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

Function lib_common_acos

src/CommonLibrary.cpp:829–850  ·  view source on GitHub ↗

trigonometry */

Source from the content-addressed store, hash-verified

827
828 /* trigonometry */
829 bv_variable lib_common_acos(bv_program* prog, u8 count, bv_variable* args)
830 {
831 /* acos(genType) */
832 if (count == 1) {
833 if (args[0].type == bv_type_object) { // acos(vec3), ...
834 bv_object* vec = bv_variable_get_object(args[0]);
835 glm::vec4 vecData = glm::acos(sd::AsVector<4, float>(args[0])); // acos takes only float vectors
836
837 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
838 bv_object* retObj = bv_variable_get_object(ret);
839
840 for (u16 i = 0; i < retObj->type->props.name_count; i++)
841 retObj->prop[i] = bv_variable_create_float(vecData[i]);
842
843 return ret;
844 }
845 else // acos(scalar)
846 return bv_variable_create_float(glm::acos(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
847 }
848
849 return bv_variable_create_float(0.0f); // acos() must have 1 argument!
850 }
851 bv_variable lib_common_asin(bv_program* prog, u8 count, bv_variable* args)
852 {
853 /* asin(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected