Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 68:bdef52f3bc0d
fix: API changes
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 05 Feb 2023 00:28:18 +0700 |
parents | 0f04ba283558 |
children | 779607656b12 |
comparison
equal
deleted
inserted
replaced
67:31ccaeee09c9 | 68:bdef52f3bc0d |
---|---|
30 | 30 |
31 when isMainModule: | 31 when isMainModule: |
32 var myengine = igniteEngine("Hello triangle") | 32 var myengine = igniteEngine("Hello triangle") |
33 | 33 |
34 # build a mesh | 34 # build a mesh |
35 var trianglemesh = new Mesh[VertexDataA] | 35 var trianglemesh = new Mesh[VertexDataA, uint16] |
36 trianglemesh.vertexData = VertexDataA( | 36 trianglemesh.vertexData = VertexDataA( |
37 position: PositionAttribute[Vec2](data: triangle_pos), | 37 position: PositionAttribute[Vec2](data: triangle_pos), |
38 color: ColorAttribute[Vec3](data: triangle_color), | 38 color: ColorAttribute[Vec3](data: triangle_color), |
39 ) | 39 ) |
40 # build a single-object scene graph | 40 # build a single-object scene graph |
41 var triangle = newThing("triangle", trianglemesh) | 41 var triangle = newThing("triangle", trianglemesh) |
42 | 42 |
43 # upload data, prepare shaders, etc | 43 # upload data, prepare shaders, etc |
44 const vertexShader = generateVertexShaderCode[VertexDataA, void]() | 44 const vertexShader = generateVertexShaderCode[VertexDataA, void]() |
45 const fragmentShader = generateFragmentShaderCode[VertexDataA]() | 45 const fragmentShader = generateFragmentShaderCode[VertexDataA]() |
46 pipeline = setupPipeline[VertexDataA, void, void]( | 46 pipeline = setupPipeline[VertexDataA, void, uint16]( |
47 myengine, | 47 myengine, |
48 triangle, | 48 triangle, |
49 vertexShader, | 49 vertexShader, |
50 fragmentShader | 50 fragmentShader |
51 ) | 51 ) |