summaryrefslogtreecommitdiff
path: root/honey/mat4.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-03-22 12:12:31 -0500
committersanine-a <sanine.not@pm.me>2023-03-22 12:12:31 -0500
commit16bcc6daab84373cac0f4125c1580d3cb1261baf (patch)
tree7a6156e204579264ce867c4771c35265f680e84b /honey/mat4.lua
parenta45f73c7388b3f5a5901bfcc66fd2d1df58d3001 (diff)
move ecs systems into separate module
Diffstat (limited to 'honey/mat4.lua')
-rw-r--r--honey/mat4.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/honey/mat4.lua b/honey/mat4.lua
index 8ea73d4..6ea17fd 100644
--- a/honey/mat4.lua
+++ b/honey/mat4.lua
@@ -57,13 +57,6 @@ end
setmetatable(Mat4, {__call=Mat4.new})
-function Mat4.Identity()
- local m = Mat4()
- m:identity()
- return m
-end
-
-
function Mat4.__index(self, key)
if type(key) == "number" then
return RowLookup(key, self.data)
@@ -111,40 +104,49 @@ end
function Mat4.identity(self)
glm.mat4_identity(self.data)
+ return self
end
function Mat4.zero(self)
glm.mat4_zero(self.data)
+ return self
end
function Mat4.translate(self, vec)
glm.translate(self.data, vec.data)
+ return self
end
function Mat4.rotateX(self, angle)
glm.rotate_x(self.data, angle, self.data)
+ return self
end
function Mat4.rotateY(self, angle)
glm.rotate_y(self.data, angle, self.data)
+ return self
end
function Mat4.rotateZ(self, angle)
glm.rotate_z(self.data, angle, self.data)
+ return self
end
function Mat4.scale(self, vec)
glm.scale(self.data, vec.data)
+ return self
end
function Mat4.perspective(self, fovy, aspect, near, far)
glm.perspective(fovy, aspect, near, far, self.data)
+ return self
end
function Mat4.perspectiveResize(self, aspect)
glm.perspective_resize(aspect, self.data)
+ return self
end