summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-10-31 18:48:20 -0500
committersanine-a <sanine.not@pm.me>2020-10-31 18:48:20 -0500
commitad75604ec79d70d328595f114e65bac80db9999f (patch)
treec0eefa1a3795db995283418b54b558a8a33ceaec /demo
parent3dca6a336c9fd54b0847249b5771d39141daa3ae (diff)
add additional texture types and refactor texture setup and loading
Diffstat (limited to 'demo')
-rw-r--r--demo/FPSCamera.lua7
-rw-r--r--demo/main.lua10
2 files changed, 15 insertions, 2 deletions
diff --git a/demo/FPSCamera.lua b/demo/FPSCamera.lua
index 7ee3cf8..7c33242 100644
--- a/demo/FPSCamera.lua
+++ b/demo/FPSCamera.lua
@@ -42,6 +42,13 @@ function camera:update(dt)
movement:setAt(1, 0)
movement:normalize()
+
+ if honey.input.key.is_down(honey.input.key.left_shift) then
+ movement:add(Vector.Vec3.Y_UNIT, movement)
+ end
+ if honey.input.key.is_down(honey.input.key.left_control) then
+ movement:sub(Vector.Vec3.Y_UNIT, movement)
+ end
movement:muls(self.movement_speed*dt, movement)
self.position:add(movement, self.position)
diff --git a/demo/main.lua b/demo/main.lua
index 9ca08be..3c32b6f 100644
--- a/demo/main.lua
+++ b/demo/main.lua
@@ -49,7 +49,7 @@ uniform sampler2D tex;
out vec4 color;
void main() {
- vec2 texture_coords = UV + (0.01 * time * vec2(1,1));
+ vec2 texture_coords = UV + (time * vec2(100,100));
color = vec4(texture(tex, texture_coords).xyz, 1);
} ]]
@@ -60,15 +60,21 @@ local color1 = Vector.Vec4.new{1,0,0,1}
local color2 = Vector.Vec4.new{0,0,1,1}
local color = Vector.Vec4.new()
+local total_frames = 0
local total_time = 0
function honey.update(dt)
total_time = total_time + dt
FPSCamera:update(dt)
+ if total_time > 1 then
+ print('FPS: '..tostring(total_frames/total_time))
+ total_time = 0
+ total_frames = 0
+ end
end
function honey.draw()
-
+ total_frames = total_frames + 1
honey.shader.set_mat4(shader, 'model', model.array)
honey.shader.set_mat4(shader, 'view', FPSCamera.view.array)
honey.shader.set_mat4(shader, 'projection', FPSCamera.projection.array)