diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -84,16 +84,27 @@ gl.DeleteShader(vertexShader) gl.DeleteShader(fragmentShader) -local mesh = honey.mesh.loadFile("assets/tetrahedron.obj")[1] ---local mesh = honey.mesh.Mesh( --- { --- 0, 0, 0, 0, 0, 1, 0, 0, --- 1, 0, 0, 0, 0, 1, 1, 0, --- 0, 1, 0, 0, 0, 1, 0, 1, --- }, --- { 0, 2, 1 } ---) - +local tetra = honey.mesh.loadFile("assets/tetrahedron.obj")[1] +local cube = honey.mesh.loadFile("assets/cube.obj")[1] +local octa = honey.mesh.loadFile("assets/octahedron.obj")[1] +local dodeca = honey.mesh.loadFile("assets/dodecahedron.obj")[1] +local icosa = honey.mesh.loadFile("assets/icosahedron.obj")[1] + +local meshes = { tetra, cube, octa, dodeca, icosa } +local meshIndex = 1 +local mesh = meshes[1] + +window:setKeyCallback(function(_, key, scancode, action, mods) + if action ~= glfw.PRESS then return end + + if key == glfw.KEY_SPACE then + meshIndex = meshIndex + 1 + if meshIndex > #meshes then meshIndex = 1 end + mesh = meshes[meshIndex] + elseif key == glfw.KEY_ESCAPE then + window:setShouldClose(true) + end +end) while not window:shouldClose() do |