| 225 | return bv_variable_create_uchar(0); |
| 226 | } |
| 227 | bv_variable lib_hlsl_fmod(bv_program* prog, u8 count, bv_variable* args) |
| 228 | { |
| 229 | /* mod(genType, genType), mod(genType, float), also for genDType */ |
| 230 | if (count == 2) { |
| 231 | if (args[0].type == bv_type_object) { |
| 232 | bv_object* vec = bv_variable_get_object(args[0]); |
| 233 | |
| 234 | // using: genType, float, genDType, double |
| 235 | glm::vec4 x = sd::AsVector<4, float>(args[0]); |
| 236 | glm::vec4 y(0.0f); |
| 237 | |
| 238 | // get y |
| 239 | if (args[1].type == bv_type_object) |
| 240 | y = sd::AsVector<4, float>(args[1]); |
| 241 | else |
| 242 | y = glm::vec4(bv_variable_get_float(bv_variable_cast(bv_type_float, args[1]))); |
| 243 | |
| 244 | glm::vec4 vecData = x - y * glm::trunc(x / y); |
| 245 | |
| 246 | bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count); |
| 247 | bv_object* retObj = bv_variable_get_object(ret); |
| 248 | |
| 249 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 250 | retObj->prop[i] = bv_variable_create_float(vecData[i]); |
| 251 | |
| 252 | return ret; |
| 253 | } |
| 254 | |
| 255 | // mod(float, float) |
| 256 | else if (args[0].type == bv_type_float) { |
| 257 | float x = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])); |
| 258 | float y = bv_variable_get_float(bv_variable_cast(bv_type_float, args[1])); |
| 259 | |
| 260 | float retVal = x - y * glm::trunc(x / y); |
| 261 | |
| 262 | return bv_variable_create_float(retVal); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | return bv_variable_create_float(0.0f); |
| 267 | } |
| 268 | |
| 269 | /* floating points */ |
| 270 | bv_variable lib_hlsl_asint(bv_program* prog, u8 count, bv_variable* args) |
nothing calls this directly
no test coverage detected