comparison tests/test_mesh.nim @ 246:dcbd9f256f6a

fix: better defaults
author Sam <sam@basx.dev>
date Mon, 22 May 2023 19:27:17 +0700
parents a19c9d089f25
children beb41c93aa3f
comparison
equal deleted inserted replaced
245:a19c9d089f25 246:dcbd9f256f6a
43 engine.addScene(scene, vertexInput) 43 engine.addScene(scene, vertexInput)
44 scene.addShaderGlobal("projection", Unit4) 44 scene.addShaderGlobal("projection", Unit4)
45 scene.addShaderGlobal("view", Unit4) 45 scene.addShaderGlobal("view", Unit4)
46 scene.addShaderGlobal("model", Unit4) 46 scene.addShaderGlobal("model", Unit4)
47 var 47 var
48 size = 1'f32 48 size = 0.3'f32
49 elevation = -float32(PI) / 3'f32 49 elevation = 0'f32
50 azimut = 0'f32 50 azimut = 0'f32
51 currentScene = 0 51 currentScene = 0
52 52
53 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): 53 while engine.updateInputs() == Running and not engine.keyIsDown(Escape):
54 if engine.keyWasPressed(`1`): 54 if engine.keyWasPressed(`1`):
63 currentScene = 4 63 currentScene = 4
64 elif engine.keyWasPressed(`6`): 64 elif engine.keyWasPressed(`6`):
65 currentScene = 5 65 currentScene = 5
66 66
67 if engine.keyWasPressed(NumberRowExtra3): 67 if engine.keyWasPressed(NumberRowExtra3):
68 size = 1'f32 68 size = 0.3'f32
69 elevation = -float32(PI) / 3'f32 69 elevation = 0'f32
70 azimut = 0'f32 70 azimut = 0'f32
71 var ratio = engine.getWindow().size[0] / engine.getWindow().size[1]
72 71
72 let ratio = engine.getWindow().size[0] / engine.getWindow().size[1]
73 size *= 1'f32 + engine.mouseWheel() * 0.05 73 size *= 1'f32 + engine.mouseWheel() * 0.05
74 azimut += engine.mouseMove().x / 180'f32 74 azimut += engine.mouseMove().x / 180'f32
75 elevation -= engine.mouseMove().y / 180'f32 75 elevation -= engine.mouseMove().y / 180'f32
76 scenes[currentScene].setShaderGlobal("projection", ortho(-ratio, ratio, -1, 1, -1, 1)) 76 scenes[currentScene].setShaderGlobal("projection", ortho(-ratio, ratio, -1, 1, -1, 1))
77 scenes[currentScene].setShaderGlobal( 77 scenes[currentScene].setShaderGlobal(