| 2692 | return bv_variable_create_float(0.0f); |
| 2693 | } |
| 2694 | bv_variable lib_common_ldexp(bv_program* prog, u8 count, bv_variable* args) |
| 2695 | { |
| 2696 | /* ldexp(genType, genIType), ldexp(float, int), also for genDType */ |
| 2697 | if (count == 2) { |
| 2698 | if (args[0].type == bv_type_object) { |
| 2699 | bv_object* vec = bv_variable_get_object(args[0]); |
| 2700 | |
| 2701 | // using: genType, float, genDType, double |
| 2702 | glm::vec4 x = sd::AsVector<4, float>(args[0]); |
| 2703 | glm::ivec4 exp = sd::AsVector<4, int>(args[1]); |
| 2704 | |
| 2705 | glm::vec4 resData = glm::ldexp(x, exp); |
| 2706 | |
| 2707 | // return value |
| 2708 | bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count); |
| 2709 | bv_object* retObj = bv_variable_get_object(ret); |
| 2710 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 2711 | retObj->prop[i] = bv_variable_create_float(resData[i]); |
| 2712 | |
| 2713 | return ret; |
| 2714 | } |
| 2715 | |
| 2716 | // ldexp(float, int) |
| 2717 | else { |
| 2718 | float x = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])); |
| 2719 | int exp = bv_variable_get_int(bv_variable_cast(bv_type_int, args[1])); |
| 2720 | |
| 2721 | float res = glm::ldexp(x, exp); |
| 2722 | |
| 2723 | return bv_variable_create_float(res); |
| 2724 | } |
| 2725 | } |
| 2726 | |
| 2727 | return bv_variable_create_float(0.0f); |
| 2728 | } |
| 2729 | |
| 2730 | /* helper functions to create vector & matrix definitions */ |
| 2731 | bv_object_info* lib_add_vec(bv_library* lib, const char* name, u8 comp, u8 logNot) |
nothing calls this directly
no test coverage detected