mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add mat4.scale mutating overload
This commit is contained in:
parent
c7a843bc63
commit
8f046b86b9
2 changed files with 19 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ static int l_idt(lua::State* L) {
|
|||
return lua::pushmat4(L, glm::mat4(1.0f));
|
||||
}
|
||||
|
||||
/// @brief mat4.scale(matrix=idt: array[16], scale: array[3]) -> array[16]
|
||||
/// Modifies matrix
|
||||
static int l_scale(lua::State* L) {
|
||||
uint argc = lua::gettop(L);
|
||||
switch (argc) {
|
||||
|
|
@ -19,6 +21,11 @@ static int l_scale(lua::State* L) {
|
|||
auto scale = lua::tovec3(L, 2);
|
||||
return lua::pushmat4(L, glm::scale(matrix, scale));
|
||||
}
|
||||
case 3: {
|
||||
auto matrix = lua::tomat4(L, 1);
|
||||
auto scale = lua::tovec3(L, 2);
|
||||
return lua::setmat4(L, 3, glm::scale(matrix, scale));
|
||||
}
|
||||
default: {
|
||||
throw std::runtime_error("invalid number of arguments (1 or 2 expected)");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue