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

Function lib_common_cos

src/CommonLibrary.cpp:920–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918 return bv_variable_create_float(0.0f);
919 }
920 bv_variable lib_common_cos(bv_program* prog, u8 count, bv_variable* args)
921 {
922 /* cos(genType) */
923 if (count == 1) {
924 if (args[0].type == bv_type_object) { // cos(vec3), ...
925 bv_object* vec = bv_variable_get_object(args[0]);
926 glm::vec4 vecData = glm::cos(sd::AsVector<4, float>(args[0]));
927
928 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
929 bv_object* retObj = bv_variable_get_object(ret);
930
931 for (u16 i = 0; i < retObj->type->props.name_count; i++)
932 retObj->prop[i] = bv_variable_create_float(vecData[i]);
933
934 return ret;
935 }
936 else // cos(scalar)
937 return bv_variable_create_float(glm::cos(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
938 }
939
940 return bv_variable_create_float(0.0f);
941 }
942 bv_variable lib_common_cosh(bv_program* prog, u8 count, bv_variable* args)
943 {
944 /* cosh(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected