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

Function lib_common_normalize

src/CommonLibrary.cpp:2379–2400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2377 return ret;
2378 }
2379 bv_variable lib_common_normalize(bv_program* prog, u8 count, bv_variable* args)
2380 {
2381 /* genType normalize(genType) */
2382 if (args[0].type == bv_type_object) {
2383 glm::vec4 x = sd::AsVector<4, float>(args[0]);
2384 glm::vec4 retData = glm::normalize(x);
2385
2386 u16 vecSize = bv_variable_get_object(args[0])->type->props.name_count;
2387 bv_variable ret = Common::create_vec(prog, bv_type_float, vecSize);
2388 bv_object* retObj = bv_variable_get_object(ret);
2389 for (u16 i = 0; i < vecSize; i++)
2390 retObj->prop[i] = bv_variable_create_float(retData[i]);
2391
2392 return ret;
2393 }
2394 else {
2395 float x = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
2396 return bv_variable_create_float(x);
2397 }
2398
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) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected