Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 664:c33c8e156e3e
did: update examples to use new API for scene + scene globals
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 08 May 2023 21:21:49 +0700 |
parents | 3f13de7d8ec4 |
children | d84b2e88776a |
comparison
equal
deleted
inserted
replaced
663:af9ab61aa87e | 664:c33c8e156e3e |
---|---|
23 outputs=fragOutput, | 23 outputs=fragOutput, |
24 main="color = vec4(outcolor, 1);" | 24 main="color = vec4(outcolor, 1);" |
25 ) | 25 ) |
26 | 26 |
27 var | 27 var |
28 triangle = newEntity( | 28 triangle = newScene("scene", newEntity( |
29 "triangle", | 29 "triangle", |
30 newMesh( | 30 newMesh( |
31 [newVec3f(-0.5, 0.5), newVec3f(0, -0.5), newVec3f(0.5, 0.5)], | 31 [newVec3f(-0.5, 0.5), newVec3f(0, -0.5), newVec3f(0.5, 0.5)], |
32 [X, Y, Z], | 32 [X, Y, Z], |
33 ) | 33 ) |
34 ) | 34 )) |
35 myengine = initEngine("Hello triangle") | 35 myengine = initEngine("Hello triangle") |
36 renderPass = myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode) | 36 renderPass = myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode) |
37 | 37 |
38 myengine.setRenderer(renderPass) | 38 myengine.setRenderer(renderPass) |
39 myengine.addScene(triangle, vertexInput) | 39 myengine.addScene(triangle, vertexInput) |