Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 203:84fd522fdf3f
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 | 25d97fa0ad5c |
children | f3912838cd69 |
comparison
equal
deleted
inserted
replaced
202:9bb3fdbecc52 | 203:84fd522fdf3f |
---|---|
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) |