summaryrefslogtreecommitdiff
path: root/demo/FPSCamera.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-12-03 02:10:32 -0600
committersanine-a <sanine.not@pm.me>2020-12-03 02:10:32 -0600
commite767e1ff9d81f8a76196caab91d9b6b4bbe0b30e (patch)
tree25a058779bcd4de00ce04ccf6cb0157cfba32611 /demo/FPSCamera.lua
parentf417d2b047369cac234c471ef37ab8281181d69f (diff)
rewrite demo
Diffstat (limited to 'demo/FPSCamera.lua')
-rw-r--r--demo/FPSCamera.lua22
1 files changed, 10 insertions, 12 deletions
diff --git a/demo/FPSCamera.lua b/demo/FPSCamera.lua
index 5a9fabf..a1ab00f 100644
--- a/demo/FPSCamera.lua
+++ b/demo/FPSCamera.lua
@@ -1,11 +1,9 @@
-local Vector = require('Vector')
-local Matrix = require('Matrix')
local Camera = require('Camera')
local camera = Camera.new(nil,
- Vector.Vec3.new(),
- Vector.Vec3.new(),
- Vector.Vec3.new{1,1,1},
+ honey.glm.vec3(),
+ honey.glm.vec3(),
+ honey.glm.vec3{1,1,1},
math.rad(90), 640/480, 0.1, 1000)
camera.pitch = 0
@@ -16,7 +14,7 @@ camera.sensitivity = 0.1
camera.movement_speed = 1
function camera:update(dt)
- movement = Vector.Vec3.new()
+ movement = honey.glm.vec3()
if honey.input.key.is_down(honey.input.key.w) then
movement:add(self.basis.z, movement)
end
@@ -30,14 +28,14 @@ function camera:update(dt)
movement:sub(self.basis.x, movement)
end
- movement:setAt(1, 0)
+ movement:set(1, 0)
movement:normalize()
if honey.input.key.is_down(honey.input.key.left_shift) then
- movement:add(Vector.Vec3.Y_UNIT, movement)
+ movement:add(honey.glm.UNIT_Y, movement)
end
if honey.input.key.is_down(honey.input.key.left_control) then
- movement:sub(Vector.Vec3.Y_UNIT, movement)
+ movement:sub(honey.glm.UNIT_Y, movement)
end
movement:muls(self.movement_speed*dt, movement)
self:translate(movement)
@@ -63,11 +61,11 @@ honey.input.mouse.bind_movement(
if camera.pitch > 89.9 then camera.pitch = 89.9 end
if camera.pitch < -89.9 then camera.pitch = -89.9 end
- camera.rotation:setAt(0, math.rad(camera.pitch))
- camera.rotation:setAt(1, math.rad(camera.yaw))
+ camera.rotation:set(0, math.rad(camera.pitch))
+ camera.rotation:set(1, math.rad(camera.yaw))
end
)
-honey.input.mouse.set_mode(honey.input.mouse.mode.disabled)
+honey.input.mouse.set_mode(honey.input.mouse.mode.captured)
return camera