add mat4.determinant(...)
This commit is contained in:
parent
2395e05a01
commit
bcbec562ac
@ -25,6 +25,13 @@ mat4.idt()
|
|||||||
mat4.idt(dst: matrix)
|
mat4.idt(dst: matrix)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Matrix determinant - *mat4.determinant(...)*
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- calculates the determinant of the matrix
|
||||||
|
mat4.determinant(m: matrix)
|
||||||
|
```
|
||||||
|
|
||||||
## Matrix multiplication - *mat4.mul(...)*
|
## Matrix multiplication - *mat4.mul(...)*
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@ -25,6 +25,13 @@ mat4.idt()
|
|||||||
mat4.idt(dst: matrix)
|
mat4.idt(dst: matrix)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Определитель матрицы - *mat4.determinant(...)*
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- вычисляет определитель матрицы
|
||||||
|
mat4.determinant(m: matrix)
|
||||||
|
```
|
||||||
|
|
||||||
## Умножение матриц - *mat4.mul(...)*
|
## Умножение матриц - *mat4.mul(...)*
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@ -22,6 +22,14 @@ static int l_idt(lua::State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// mat4.determinant(matrix: float[16]) - calculates matrix determinant
|
||||||
|
static int l_determinant(lua::State* L) {
|
||||||
|
if (lua::gettop(L) != 1) {
|
||||||
|
throw std::runtime_error("invalid arguments number (1 expected)");
|
||||||
|
}
|
||||||
|
return lua::pushnumber(L, glm::determinant(lua::tomat4(L, 1)));
|
||||||
|
}
|
||||||
|
|
||||||
/// Overloads:
|
/// Overloads:
|
||||||
/// mat4.mul(m1: float[16], m2: float[16]) -> float[16] - creates matrix of m1 and m2 multiplication result
|
/// mat4.mul(m1: float[16], m2: float[16]) -> float[16] - creates matrix of m1 and m2 multiplication result
|
||||||
/// mat4.mul(m1: float[16], m2: float[16], dst: float[16]) -> float[16] - updates dst matrix with m1 and m2 multiplication result
|
/// mat4.mul(m1: float[16], m2: float[16], dst: float[16]) -> float[16] - updates dst matrix with m1 and m2 multiplication result
|
||||||
@ -193,6 +201,7 @@ const luaL_Reg mat4lib [] = {
|
|||||||
{"translate", lua::wrap<l_transform_func<glm::translate>>},
|
{"translate", lua::wrap<l_transform_func<glm::translate>>},
|
||||||
{"inverse", lua::wrap<l_inverse>},
|
{"inverse", lua::wrap<l_inverse>},
|
||||||
{"transpose", lua::wrap<l_transpose>},
|
{"transpose", lua::wrap<l_transpose>},
|
||||||
|
{"determinant", lua::wrap<l_determinant>},
|
||||||
{"tostring", lua::wrap<l_tostring>},
|
{"tostring", lua::wrap<l_tostring>},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user