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

Function lib_common_reflect

src/CommonLibrary.cpp:2401–2427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2399 return bv_variable_create_float(0.0f);
2400 }
2401 bv_variable lib_common_reflect(bv_program* prog, u8 count, bv_variable* args)
2402 {
2403 /* genType reflect(genType,genType,genType) */
2404 if (args[0].type == bv_type_object) {
2405 u16 vecSize = bv_variable_get_object(args[0])->type->props.name_count;
2406
2407 glm::vec4 i = sd::AsVector<4, float>(args[0]);
2408 glm::vec4 n = sd::AsVector<4, float>(args[1]);
2409
2410 glm::vec4 retData = glm::reflect(i, n);
2411
2412 bv_variable ret = Common::create_vec(prog, bv_type_float, vecSize);
2413 bv_object* retObj = bv_variable_get_object(ret);
2414 for (u16 i = 0; i < vecSize; i++)
2415 retObj->prop[i] = bv_variable_create_float(retData[i]);
2416
2417 return ret;
2418 }
2419 else {
2420 float i = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
2421 float n = bv_variable_get_float(bv_variable_cast(bv_type_float, args[1]));
2422
2423 return bv_variable_create_float(glm::reflect(i, n));
2424 }
2425
2426 return bv_variable_create_float(0.0f);
2427 }
2428 bv_variable lib_common_refract(bv_program* prog, u8 count, bv_variable* args)
2429 {
2430 /* genType refract(genType,genType,genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected