comparison examples/E03_hello_cube.nim @ 253:ad078e26a1c7

fix: API changes
author sam <sam@basx.dev>
date Wed, 24 May 2023 01:31:21 +0700
parents f3912838cd69
children 95281f2db400
comparison
equal deleted inserted replaced
252:f31d848ab551 253:ad078e26a1c7
80 myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) 80 myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode))
81 var cube = newScene("scene", newEntity("cube", newMesh(positions=cube_pos, indices=tris, colors=cube_color))) 81 var cube = newScene("scene", newEntity("cube", newMesh(positions=cube_pos, indices=tris, colors=cube_color)))
82 cube.addShaderGlobal("projection", Unit4f32) 82 cube.addShaderGlobal("projection", Unit4f32)
83 cube.addShaderGlobal("view", Unit4f32) 83 cube.addShaderGlobal("view", Unit4f32)
84 cube.addShaderGlobal("model", Unit4f32) 84 cube.addShaderGlobal("model", Unit4f32)
85 myengine.addScene(cube, vertexInput) 85 myengine.addScene(cube, vertexInput, @[])
86 86
87 var t: float32 = cpuTime() 87 var t: float32 = cpuTime()
88 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): 88 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape):
89 setShaderGlobal(cube, "model", translate3d(0'f32, 0'f32, 10'f32) * rotate3d(t, Yf32)) 89 setShaderGlobal(cube, "model", translate3d(0'f32, 0'f32, 10'f32) * rotate3d(t, Yf32))
90 setShaderGlobal(cube, "projection", 90 setShaderGlobal(cube, "projection",