| 1840 | return bv_variable_create_float(0.0f); |
| 1841 | } |
| 1842 | bv_variable lib_common_mix(bv_program* prog, u8 count, bv_variable* args) |
| 1843 | { |
| 1844 | /* mix(genType, genType, genType), mix(genType, genType, float), mix(genI/U/B/Type, genI/U/BType, genBType) */ |
| 1845 | if (count == 3) { |
| 1846 | if (args[0].type == bv_type_object) { |
| 1847 | bv_object* vec = bv_variable_get_object(args[0]); |
| 1848 | |
| 1849 | // using: genType, float, genDType, double, genBType |
| 1850 | if (vec->prop[0].type == bv_type_float) |
| 1851 | { |
| 1852 | glm::vec4 x = sd::AsVector<4, float>(args[0]); |
| 1853 | glm::vec4 y = sd::AsVector<4, float>(args[1]); |
| 1854 | glm::vec4 a(0.0f); |
| 1855 | |
| 1856 | // get a |
| 1857 | if (args[2].type == bv_type_object) |
| 1858 | a = sd::AsVector<4, float>(args[2]); |
| 1859 | else |
| 1860 | a = glm::vec4(bv_variable_get_float(bv_variable_cast(bv_type_float, args[2]))); |
| 1861 | |
| 1862 | glm::vec4 vecData = glm::mix(x, y, a); |
| 1863 | |
| 1864 | bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count); |
| 1865 | bv_object* retObj = bv_variable_get_object(ret); |
| 1866 | |
| 1867 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 1868 | retObj->prop[i] = bv_variable_create_float(vecData[i]); |
| 1869 | |
| 1870 | return ret; |
| 1871 | } |
| 1872 | // using: genUType, genBType |
| 1873 | else if (vec->prop[0].type == bv_type_uint) |
| 1874 | { |
| 1875 | glm::uvec4 x = sd::AsVector<4, unsigned int>(args[0]); |
| 1876 | glm::uvec4 y = sd::AsVector<4, unsigned int>(args[1]); |
| 1877 | glm::vec4 a = sd::AsVector<4, float>(args[2]); |
| 1878 | |
| 1879 | glm::uvec4 vecData = glm::mix(x, y, a); |
| 1880 | |
| 1881 | bv_variable ret = Common::create_vec(prog, bv_type_uint, vec->type->props.name_count); |
| 1882 | bv_object* retObj = bv_variable_get_object(ret); |
| 1883 | |
| 1884 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 1885 | retObj->prop[i] = bv_variable_create_uint(vecData[i]); |
| 1886 | |
| 1887 | return ret; |
| 1888 | } |
| 1889 | // using: genIType, genBType |
| 1890 | else if (vec->prop[0].type == bv_type_int) |
| 1891 | { |
| 1892 | glm::ivec4 x = sd::AsVector<4, int>(args[0]); |
| 1893 | glm::ivec4 y = sd::AsVector<4, int>(args[1]); |
| 1894 | glm::vec4 a = sd::AsVector<4, float>(args[2]); |
| 1895 | |
| 1896 | glm::ivec4 vecData = glm::mix(x, y, a); |
| 1897 | |
| 1898 | bv_variable ret = Common::create_vec(prog, bv_type_int, vec->type->props.name_count); |
| 1899 | bv_object* retObj = bv_variable_get_object(ret); |
nothing calls this directly
no test coverage detected