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

Function lib_common_fract

src/CommonLibrary.cpp:1469–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1467 return bv_variable_create_float(0.0f); // floor() must have 1 argument!
1468 }
1469 bv_variable lib_common_fract(bv_program* prog, u8 count, bv_variable* args)
1470 {
1471 /* fract(genType), fract(genDType) */
1472 if (count == 1) {
1473 if (args[0].type == bv_type_object) {
1474 bv_object* vec = bv_variable_get_object(args[0]);
1475
1476 glm::vec4 vecData = glm::fract(sd::AsVector<4, float>(args[0]));
1477
1478 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
1479 bv_object* retObj = bv_variable_get_object(ret);
1480
1481 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1482 retObj->prop[i] = bv_variable_create_float(vecData[i]);
1483
1484 return ret;
1485
1486 }
1487 // fract(float)
1488 else {
1489 float scalarData = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
1490 return bv_variable_create_float(glm::fract(scalarData));
1491 }
1492 }
1493
1494 return bv_variable_create_float(0.0f); // floor() must have 1 argument!
1495 }
1496 bv_variable lib_common_fwidth(bv_program* prog, u8 count, bv_variable* args)
1497 {
1498 /* TODO: requires dFdx/y */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected