diff options
Diffstat (limited to 'demo/main.lua')
-rw-r--r-- | demo/main.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/demo/main.lua b/demo/main.lua index f534952..81f7354 100644 --- a/demo/main.lua +++ b/demo/main.lua @@ -27,7 +27,7 @@ out vec4 color; void main() { color = base_color; } ]] local shader = honey.shader.new(vertex_shader, fragment_shader) -local plane = honey.primitives.cube(10,10,10) +local plane = honey.mesh.load('Suzanne.obj')[1] local color1 = Vector.Vec4.new{1,0,0,1} local color2 = Vector.Vec4.new{0,0,1,1} @@ -36,15 +36,16 @@ local color = Vector.Vec4.new() local total_time = 0 function honey.update(dt) - total_time = total_time + dt - color1:lerp(color2, 0.5*(math.sin(math.pi*total_time)+1), color) + total_time = total_time + dt + color1:lerp(color2, 0.5*(math.sin(math.pi*total_time)+1), color) + FPSCamera:update(dt) end function honey.draw() - FPSCamera:update() - 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) - honey.shader.set_vec4(shader, "base_color", color.array) - honey.mesh.draw(plane, shader) + + 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) + honey.shader.set_vec4(shader, "base_color", color.array) + honey.mesh.draw(plane, shader) end |