Mercurial > games > semicongine
comparison tests/test_vulkan_wrapper.nim @ 1138:02e1d2658ff5
did: more renaming
author | sam <sam@basx.dev> |
---|---|
date | Tue, 04 Jun 2024 22:08:48 +0700 |
parents | a4aa9f374d44 |
children | 114f395b9144 |
comparison
equal
deleted
inserted
replaced
1137:a4aa9f374d44 | 1138:02e1d2658ff5 |
---|---|
181 r1.transform = Translate(NewVec3f(-0.5)) | 181 r1.transform = Translate(NewVec3f(-0.5)) |
182 r2.transform = Translate(NewVec3f(+0.5)) | 182 r2.transform = Translate(NewVec3f(+0.5)) |
183 result = @[r1, r2] | 183 result = @[r1, r2] |
184 | 184 |
185 proc main() = | 185 proc main() = |
186 var engine = initEngine("Test") | 186 var engine = InitEngine("Test") |
187 | 187 |
188 # INIT RENDERER: | 188 # INIT RENDERER: |
189 const | 189 const |
190 shaderConfiguration1 = createShaderConfiguration( | 190 shaderConfiguration1 = createShaderConfiguration( |
191 name = "shader1", | 191 name = "shader1", |
212 outputs = [Attr[Vec4f]("color")], | 212 outputs = [Attr[Vec4f]("color")], |
213 uniforms = [Attr[Vec4f]("color", arrayCount = 1)], | 213 uniforms = [Attr[Vec4f]("color", arrayCount = 1)], |
214 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = Uniforms.color[0];""", | 214 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = Uniforms.color[0];""", |
215 fragmentCode = "color = outcolor;", | 215 fragmentCode = "color = outcolor;", |
216 ) | 216 ) |
217 engine.initRenderer({ | 217 engine.InitRenderer({ |
218 Mat1Type: shaderConfiguration1, | 218 Mat1Type: shaderConfiguration1, |
219 Mat1Type: shaderConfiguration1, | 219 Mat1Type: shaderConfiguration1, |
220 Mat2Type: shaderConfiguration1, | 220 Mat2Type: shaderConfiguration1, |
221 SINGLE_COLOR_MATERIAL: shaderConfiguration2, | 221 SINGLE_COLOR_MATERIAL: shaderConfiguration2, |
222 }) | 222 }) |
229 Scene(name: "flag", meshes: scene_flag()), | 229 Scene(name: "flag", meshes: scene_flag()), |
230 Scene(name: "multimaterial", meshes: scene_multi_material()), | 230 Scene(name: "multimaterial", meshes: scene_multi_material()), |
231 ] | 231 ] |
232 | 232 |
233 for scene in scenes.mitems: | 233 for scene in scenes.mitems: |
234 engine.loadScene(scene) | 234 engine.LoadScene(scene) |
235 | 235 |
236 # MAINLOOP | 236 # MAINLOOP |
237 echo "Setup successfull, start rendering" | 237 echo "Setup successfull, start rendering" |
238 for i in 0 ..< 3: | 238 for i in 0 ..< 3: |
239 for scene in scenes.mitems: | 239 for scene in scenes.mitems: |
240 echo "rendering scene ", scene.name | 240 echo "rendering scene ", scene.name |
241 for i in 0 ..< 1000: | 241 for i in 0 ..< 1000: |
242 if not engine.UpdateInputs() or KeyIsDown(Escape): | 242 if not engine.UpdateInputs() or KeyIsDown(Escape): |
243 engine.destroy() | 243 engine.Destroy() |
244 return | 244 return |
245 engine.renderScene(scene) | 245 engine.RenderScene(scene) |
246 | 246 |
247 # cleanup | 247 # cleanup |
248 echo "Start cleanup" | 248 echo "Start cleanup" |
249 engine.destroy() | 249 engine.Destroy() |
250 | 250 |
251 when isMainModule: | 251 when isMainModule: |
252 main() | 252 main() |