fix: mat4.decompose (-Wmaybe-uninitialized)
This commit is contained in:
@@ -111,7 +111,7 @@ mat4.decompose(m: matrix)
|
|||||||
translation=vec3,
|
translation=vec3,
|
||||||
skew=vec3,
|
skew=vec3,
|
||||||
perspective=vec4
|
perspective=vec4
|
||||||
}
|
} or nil
|
||||||
```
|
```
|
||||||
|
|
||||||
## Look at point - *mat4.look_at(...)*
|
## Look at point - *mat4.look_at(...)*
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ mat4.decompose(m: matrix)
|
|||||||
translation=vec3,
|
translation=vec3,
|
||||||
skew=vec3,
|
skew=vec3,
|
||||||
perspective=vec4
|
perspective=vec4
|
||||||
}
|
} или nil
|
||||||
```
|
```
|
||||||
|
|
||||||
## Отслеживание точки *mat4.look_at(...)*
|
## Отслеживание точки *mat4.look_at(...)*
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ static int l_transpose(lua::State* L) {
|
|||||||
/// translation=float[3],
|
/// translation=float[3],
|
||||||
/// skew=float[3],
|
/// skew=float[3],
|
||||||
/// perspective=float[4]
|
/// perspective=float[4]
|
||||||
/// }
|
/// } or nil
|
||||||
static int l_decompose(lua::State* L) {
|
static int l_decompose(lua::State* L) {
|
||||||
auto matrix = lua::tomat4(L, 1);
|
auto matrix = lua::tomat4(L, 1);
|
||||||
glm::vec3 scale;
|
glm::vec3 scale;
|
||||||
@@ -173,35 +173,36 @@ static int l_decompose(lua::State* L) {
|
|||||||
glm::vec3 translation;
|
glm::vec3 translation;
|
||||||
glm::vec3 skew;
|
glm::vec3 skew;
|
||||||
glm::vec4 perspective;
|
glm::vec4 perspective;
|
||||||
glm::decompose(
|
if (glm::decompose(
|
||||||
matrix,
|
matrix,
|
||||||
scale,
|
scale,
|
||||||
rotation,
|
rotation,
|
||||||
translation,
|
translation,
|
||||||
skew,
|
skew,
|
||||||
perspective
|
perspective
|
||||||
);
|
)) {
|
||||||
|
lua::createtable(L, 0, 6);
|
||||||
|
|
||||||
lua::createtable(L, 0, 6);
|
lua::pushvec3(L, scale);
|
||||||
|
lua::setfield(L, "scale");
|
||||||
|
|
||||||
lua::pushvec3(L, scale);
|
lua::pushmat4(L, glm::toMat4(rotation));
|
||||||
lua::setfield(L, "scale");
|
lua::setfield(L, "rotation");
|
||||||
|
|
||||||
lua::pushmat4(L, glm::toMat4(rotation));
|
lua::pushquat(L, rotation);
|
||||||
lua::setfield(L, "rotation");
|
lua::setfield(L, "quaternion");
|
||||||
|
|
||||||
lua::pushquat(L, rotation);
|
lua::pushvec3(L, translation);
|
||||||
lua::setfield(L, "quaternion");
|
lua::setfield(L, "translation");
|
||||||
|
|
||||||
lua::pushvec3(L, translation);
|
lua::pushvec3(L, skew);
|
||||||
lua::setfield(L, "translation");
|
lua::setfield(L, "skew");
|
||||||
|
|
||||||
lua::pushvec3(L, skew);
|
lua::pushvec4(L, perspective);
|
||||||
lua::setfield(L, "skew");
|
lua::setfield(L, "perspective");
|
||||||
|
return 1;
|
||||||
lua::pushvec4(L, perspective);
|
}
|
||||||
lua::setfield(L, "perspective");
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_look_at(lua::State* L) {
|
static int l_look_at(lua::State* L) {
|
||||||
|
|||||||
Reference in New Issue
Block a user