Mercurial > games > semicongine
comparison tests/test_collision.nim @ 371:f054b8bacab8
fix: tests, test_materials and test_mesh still needs to be done
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 22 Nov 2023 23:24:47 +0700 |
parents | 00231e014642 |
children | 73b572f82a1f |
comparison
equal
deleted
inserted
replaced
370:fad6490fb728 | 371:f054b8bacab8 |
---|---|
4 var scene = Scene(name: "main") | 4 var scene = Scene(name: "main") |
5 | 5 |
6 scene.add rect(color="f00f") | 6 scene.add rect(color="f00f") |
7 scene.add rect() | 7 scene.add rect() |
8 scene.add circle(color="0f0f") | 8 scene.add circle(color="0f0f") |
9 scene.meshes[0].material = VERTEX_COLORED_MATERIAL.initMaterialData() | |
10 scene.meshes[1].material = VERTEX_COLORED_MATERIAL.initMaterialData() | |
11 scene.meshes[2].material = VERTEX_COLORED_MATERIAL.initMaterialData() | |
9 scene.meshes[1].transform = scale(0.8, 0.8) | 12 scene.meshes[1].transform = scale(0.8, 0.8) |
10 scene.meshes[2].transform = scale(0.1, 0.1) | 13 scene.meshes[2].transform = scale(0.1, 0.1) |
11 scene.addShaderGlobal("perspective", Unit4F32) | 14 scene.addShaderGlobal("perspective", Unit4F32) |
12 | 15 |
13 const | 16 const |
24 fragmentCode="""fragcolor = colorout;""", | 27 fragmentCode="""fragcolor = colorout;""", |
25 ) | 28 ) |
26 | 29 |
27 var engine = initEngine("Test collisions") | 30 var engine = initEngine("Test collisions") |
28 | 31 |
29 engine.initRenderer({"default material": shaderConfiguration}) | 32 engine.initRenderer({VERTEX_COLORED_MATERIAL: shaderConfiguration}) |
30 engine.addScene(scene) | 33 engine.loadScene(scene) |
31 | 34 |
32 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): | 35 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): |
33 if engine.windowWasResized(): | 36 if engine.windowWasResized(): |
34 var winSize = engine.getWindow().size | 37 var winSize = engine.getWindow().size |
35 scene.setShaderGlobal("perspective", orthoWindowAspect(winSize[1] / winSize[0])) | 38 scene.setShaderGlobal("perspective", orthoWindowAspect(winSize[1] / winSize[0])) |