MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / lib_common_faceforward

Function lib_common_faceforward

src/CommonLibrary.cpp:2335–2363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2333 return ret;
2334 }
2335 bv_variable lib_common_faceforward(bv_program* prog, u8 count, bv_variable* args)
2336 {
2337 /* genType faceforward(genType,genType,genType) */
2338 if (args[0].type == bv_type_object) {
2339 u16 vecSize = bv_variable_get_object(args[0])->type->props.name_count;
2340
2341 glm::vec4 n = sd::AsVector<4, float>(args[0]);
2342 glm::vec4 i = sd::AsVector<4, float>(args[1]);
2343 glm::vec4 nref = sd::AsVector<4, float>(args[2]);
2344
2345 glm::vec4 retData = glm::faceforward(n, i, nref);
2346
2347 bv_variable ret = Common::create_vec(prog, bv_type_float, vecSize);
2348 bv_object* retObj = bv_variable_get_object(ret);
2349 for (u16 i = 0; i < vecSize; i++)
2350 retObj->prop[i] = bv_variable_create_float(retData[i]);
2351
2352 return ret;
2353 }
2354 else {
2355 float n = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
2356 float i = bv_variable_get_float(bv_variable_cast(bv_type_float, args[1]));
2357 float nref = bv_variable_get_float(bv_variable_cast(bv_type_float, args[2]));
2358
2359 return bv_variable_create_float(glm::faceforward(n, i, nref));
2360 }
2361
2362 return bv_variable_create_float(0.0f);
2363 }
2364 bv_variable lib_common_length(bv_program* prog, u8 count, bv_variable* args)
2365 {
2366 /* float length(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected