summaryrefslogtreecommitdiff
path: root/honey/mat4.lua
diff options
context:
space:
mode:
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