Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 529:eb92723db7b2
fix: API changes
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 05 Feb 2023 00:28:18 +0700 |
parents | f2c97bdbb0b3 |
children | 21c276c0a968 |
comparison
equal
deleted
inserted
replaced
528:3ec1be39e1ad | 529:eb92723db7b2 |
---|---|
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 ) |