| 470 | return ret; |
| 471 | } |
| 472 | bv_variable lib_common_vec_operator_multiply(bv_program* prog, bv_object* me, u8 count, bv_variable* args) |
| 473 | { |
| 474 | bv_variable ret = bv_variable_create_void(); |
| 475 | |
| 476 | if (count == 1) { |
| 477 | if (args[0].type == bv_type_object) { |
| 478 | bv_object* vec = bv_variable_get_object(args[0]); |
| 479 | |
| 480 | // vec * vec |
| 481 | if (vec->type->props.name_count) { |
| 482 | bv_type mtype = merge_type(me->prop[0].type, vec->prop[0].type); |
| 483 | |
| 484 | ret = create_vec(prog, mtype, me->type->props.name_count); |
| 485 | bv_object* retObj = bv_variable_get_object(ret); |
| 486 | |
| 487 | for (u16 i = 0; i < me->type->props.name_count; i++) { |
| 488 | bv_variable_deinitialize(&retObj->prop[i]); |
| 489 | retObj->prop[i] = bv_variable_cast(mtype, bv_variable_op_multiply(prog, me->prop[i], vec->prop[i])); |
| 490 | } |
| 491 | } |
| 492 | // vec * mat |
| 493 | else { |
| 494 | sd::Matrix* matData = (sd::Matrix*)vec->user_data; |
| 495 | glm::vec4 retVec = multiply_mat_vec(*matData, me, 1); |
| 496 | ret = create_vec(prog, matData->Type, me->type->props.name_count); |
| 497 | bv_object* retObj = bv_variable_get_object(ret); |
| 498 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 499 | retObj->prop[i] = bv_variable_cast(matData->Type, bv_variable_create_float(retVec[i])); |
| 500 | } |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | return ret; |
| 505 | } |
| 506 | bv_variable lib_common_vec_operator_increment(bv_program* prog, bv_object* me, u8 count, bv_variable* args) |
| 507 | { |
| 508 | if (count == 0) { |
nothing calls this directly
no test coverage detected