Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 336:887ddc8d45fd
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 | f05b4bef44d1 |
children | c66503386e8b |
comparison
equal
deleted
inserted
replaced
335:f05b4bef44d1 | 336:887ddc8d45fd |
---|---|
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 |