| 1736 | return bv_variable_create_float(0.0f); |
| 1737 | } |
| 1738 | bv_variable lib_common_min(bv_program* prog, u8 count, bv_variable* args) |
| 1739 | { |
| 1740 | /* min(genType, genType), min(genType, float), also for genIType and genUType */ |
| 1741 | if (count == 2) { |
| 1742 | if (args[0].type == bv_type_object) { |
| 1743 | bv_object* vec = bv_variable_get_object(args[0]); |
| 1744 | |
| 1745 | // using: genType, float, genDType, double |
| 1746 | if (vec->prop[0].type == bv_type_float) |
| 1747 | { |
| 1748 | glm::vec4 x = sd::AsVector<4, float>(args[0]); |
| 1749 | glm::vec4 y(0.0f); |
| 1750 | |
| 1751 | // get y |
| 1752 | if (args[1].type == bv_type_object) |
| 1753 | y = sd::AsVector<4, float>(args[1]); |
| 1754 | else |
| 1755 | y = glm::vec4(bv_variable_get_float(bv_variable_cast(bv_type_float, args[1]))); |
| 1756 | |
| 1757 | glm::vec4 vecData = glm::min(x, y); |
| 1758 | |
| 1759 | bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count); |
| 1760 | bv_object* retObj = bv_variable_get_object(ret); |
| 1761 | |
| 1762 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 1763 | retObj->prop[i] = bv_variable_create_float(vecData[i]); |
| 1764 | |
| 1765 | return ret; |
| 1766 | } |
| 1767 | // using: genUType, uint |
| 1768 | else if (vec->prop[0].type == bv_type_uint) |
| 1769 | { |
| 1770 | glm::uvec4 x = sd::AsVector<4, unsigned int>(args[0]); |
| 1771 | glm::uvec4 y(0u); |
| 1772 | |
| 1773 | // get y |
| 1774 | if (args[1].type == bv_type_object) |
| 1775 | y = sd::AsVector<4, unsigned int>(args[1]); |
| 1776 | else |
| 1777 | y = glm::uvec4(bv_variable_get_uint(bv_variable_cast(bv_type_uint, args[1]))); |
| 1778 | |
| 1779 | glm::uvec4 vecData = glm::min(x, y); |
| 1780 | |
| 1781 | bv_variable ret = Common::create_vec(prog, bv_type_uint, vec->type->props.name_count); |
| 1782 | bv_object* retObj = bv_variable_get_object(ret); |
| 1783 | |
| 1784 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 1785 | retObj->prop[i] = bv_variable_create_uint(vecData[i]); |
| 1786 | |
| 1787 | return ret; |
| 1788 | } |
| 1789 | // using: genIType, int |
| 1790 | else if (vec->prop[0].type == bv_type_int) |
| 1791 | { |
| 1792 | glm::ivec4 x = sd::AsVector<4, int>(args[0]); |
| 1793 | glm::ivec4 y(0); |
| 1794 | |
| 1795 | // get y |
nothing calls this directly
no test coverage detected