Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 797:812b5e28f441
did: update examples to work with improved scenegraph/material api, notice removed complexity!
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 05 Sep 2023 00:28:35 +0700 |
parents | 8084252b807a |
children | c66503386e8b |
comparison
equal
deleted
inserted
replaced
796:8084252b807a | 797:812b5e28f441 |
---|---|
19 var | 19 var |
20 triangle = Scene(name: "scene", | 20 triangle = Scene(name: "scene", |
21 meshes: @[newMesh( | 21 meshes: @[newMesh( |
22 [newVec3f(-0.5, 0.5), newVec3f(0, -0.5), newVec3f(0.5, 0.5)], | 22 [newVec3f(-0.5, 0.5), newVec3f(0, -0.5), newVec3f(0.5, 0.5)], |
23 [newVec4f(1, 0, 0, 1), newVec4f(0, 1, 0, 1), newVec4f(0, 0, 1, 1)], | 23 [newVec4f(1, 0, 0, 1), newVec4f(0, 1, 0, 1), newVec4f(0, 0, 1, 1)], |
24 material=Material(name: "") | 24 material=Material(name: "default") |
25 )] | 25 )] |
26 ) | 26 ) |
27 myengine = initEngine("Hello triangle") | 27 myengine = initEngine("Hello triangle") |
28 | 28 |
29 myengine.initRenderer({"": shaderConfiguration}.toTable) | 29 myengine.initRenderer({"default": shaderConfiguration}.toTable) |
30 myengine.addScene(triangle) | 30 myengine.addScene(triangle) |
31 | 31 |
32 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): | 32 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): |
33 myengine.renderScene(triangle) | 33 myengine.renderScene(triangle) |
34 | 34 |