diff options
author | sanine <sanine.not@pm.me> | 2022-03-01 22:49:53 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-03-01 22:49:53 -0600 |
commit | 82cf18b9163f86e4d0a1cd999d4815cc3f85a3fd (patch) | |
tree | 1bc96ae80f509ef919bb7e74500dc6b37c9e59cf /demo/FPSCamera.lua | |
parent | 10288765588673645c1cc0a6e3d2245aff3f9080 (diff) |
clear out demo/
Diffstat (limited to 'demo/FPSCamera.lua')
-rw-r--r-- | demo/FPSCamera.lua | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/demo/FPSCamera.lua b/demo/FPSCamera.lua deleted file mode 100644 index a1ab00f..0000000 --- a/demo/FPSCamera.lua +++ /dev/null @@ -1,71 +0,0 @@ -local Camera = require('Camera') - -local camera = Camera.new(nil, - honey.glm.vec3(), - honey.glm.vec3(), - honey.glm.vec3{1,1,1}, - math.rad(90), 640/480, 0.1, 1000) - -camera.pitch = 0 -camera.yaw = 0 - -camera.sensitivity = 0.1 - -camera.movement_speed = 1 - -function camera:update(dt) - movement = honey.glm.vec3() - if honey.input.key.is_down(honey.input.key.w) then - movement:add(self.basis.z, movement) - end - if honey.input.key.is_down(honey.input.key.a) then - movement:add(self.basis.x, movement) - end - if honey.input.key.is_down(honey.input.key.s) then - movement:sub(self.basis.z, movement) - end - if honey.input.key.is_down(honey.input.key.d) then - movement:sub(self.basis.x, movement) - end - - movement:set(1, 0) - movement:normalize() - - if honey.input.key.is_down(honey.input.key.left_shift) then - movement:add(honey.glm.UNIT_Y, movement) - end - if honey.input.key.is_down(honey.input.key.left_control) then - movement:sub(honey.glm.UNIT_Y, movement) - end - movement:muls(self.movement_speed*dt, movement) - self:translate(movement) - - self:updateTransform() - self:updateView() -end - -camera.mouse_pos = {} -camera.mouse_pos.x = 0 -camera.mouse_pos.y = 0 - -honey.input.mouse.bind_movement( - function(xpos, ypos) - local dx = xpos - camera.mouse_pos.x - local dy = ypos - camera.mouse_pos.y - - camera.mouse_pos = { x=xpos, y=ypos } - - camera.pitch = camera.pitch + camera.sensitivity * dy - camera.yaw = camera.yaw - camera.sensitivity * dx - - if camera.pitch > 89.9 then camera.pitch = 89.9 end - if camera.pitch < -89.9 then camera.pitch = -89.9 end - - 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.captured) - -return camera |