| 2426 | return bv_variable_create_float(0.0f); |
| 2427 | } |
| 2428 | bv_variable lib_common_refract(bv_program* prog, u8 count, bv_variable* args) |
| 2429 | { |
| 2430 | /* genType refract(genType,genType,genType) */ |
| 2431 | if (args[0].type == bv_type_object) { |
| 2432 | u16 vecSize = bv_variable_get_object(args[0])->type->props.name_count; |
| 2433 | |
| 2434 | glm::vec4 i = sd::AsVector<4, float>(args[0]); |
| 2435 | glm::vec4 n = sd::AsVector<4, float>(args[1]); |
| 2436 | float eta = bv_variable_get_float(bv_variable_cast(bv_type_float, args[2])); |
| 2437 | |
| 2438 | glm::vec4 retData = glm::refract(i, n, eta); |
| 2439 | |
| 2440 | bv_variable ret = Common::create_vec(prog, bv_type_float, vecSize); |
| 2441 | bv_object* retObj = bv_variable_get_object(ret); |
| 2442 | for (u16 i = 0; i < vecSize; i++) |
| 2443 | retObj->prop[i] = bv_variable_create_float(retData[i]); |
| 2444 | |
| 2445 | return ret; |
| 2446 | } |
| 2447 | else { |
| 2448 | float i = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])); |
| 2449 | float n = bv_variable_get_float(bv_variable_cast(bv_type_float, args[1])); |
| 2450 | float eta = bv_variable_get_float(bv_variable_cast(bv_type_float, args[2])); |
| 2451 | |
| 2452 | return bv_variable_create_float(glm::refract(i, n, eta)); |
| 2453 | } |
| 2454 | |
| 2455 | return bv_variable_create_float(0.0f); |
| 2456 | } |
| 2457 | |
| 2458 | /* component comparison */ |
| 2459 | bv_variable lib_common_all(bv_program* prog, u8 count, bv_variable* args) |
nothing calls this directly
no test coverage detected