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

Function lib_common_trunc

src/CommonLibrary.cpp:2269–2290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2267 return bv_variable_create_float(0.0f);
2268 }
2269 bv_variable lib_common_trunc(bv_program* prog, u8 count, bv_variable* args)
2270 {
2271 /* trunc(genType) */
2272 if (count == 1) {
2273 if (args[0].type == bv_type_object) { // trunc(vec3), ...
2274 bv_object* vec = bv_variable_get_object(args[0]);
2275 glm::vec4 vecData = glm::trunc(sd::AsVector<4, float>(args[0]));
2276
2277 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
2278 bv_object* retObj = bv_variable_get_object(ret);
2279
2280 for (u16 i = 0; i < retObj->type->props.name_count; i++)
2281 retObj->prop[i] = bv_variable_create_float(vecData[i]);
2282
2283 return ret;
2284 }
2285 else // trunc(scalar)
2286 return bv_variable_create_float(glm::trunc(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
2287 }
2288
2289 return bv_variable_create_float(0.0f);
2290 }
2291
2292 /* vector */
2293 bv_variable lib_common_cross(bv_program* prog, u8 count, bv_variable* args)

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected