summaryrefslogtreecommitdiff
path: root/demo/Camera.lua
diff options
context:
space:
mode:
Diffstat (limited to 'demo/Camera.lua')
-rw-r--r--demo/Camera.lua15
1 files changed, 6 insertions, 9 deletions
diff --git a/demo/Camera.lua b/demo/Camera.lua
index de14b6c..fda23f2 100644
--- a/demo/Camera.lua
+++ b/demo/Camera.lua
@@ -1,15 +1,11 @@
-local Vector = require('Vector')
-local Matrix = require('Matrix')
-local Node = require('Node')
-
local Camera = {}
Camera.prototype = {}
-setmetatable(Camera.prototype, { __index = Node.prototype })
+setmetatable(Camera.prototype, { __index = honey.nodeMetatable.__index })
Camera.prototype.updateView = function(self)
self.basis = self.transform:basis()
- Matrix.Mat4.look(self.position, self.basis.z, self.basis.y, self.view)
+ self.view:look(self.position, self.basis.z, self.basis.y)
end
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -20,12 +16,13 @@ Camera.mt.__index = Camera.prototype
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Camera.new = function(parent, position, rotation, scale, fov, aspect, near, far)
- local camera = Node.new(parent, position, rotation, scale)
+ local camera = honey.node(parent, position, rotation, scale)
setmetatable(camera, Camera.mt)
- camera.view = Matrix.Mat4.new()
+ camera.view = honey.glm.mat4()
camera:updateView()
- camera.projection = Matrix.Mat4.perspective(fov, aspect, near, far)
+ camera.projection = honey.glm.mat4()
+ camera.projection:perspective(fov, aspect, near, far)
return camera
end