Mercurial > games > semicongine
comparison examples/E01_hello_triangle.nim @ 597:fdae5f50fa00
did: rewrite example 02 with new engine approach
| author | Sam <sam@basx.dev> |
|---|---|
| date | Thu, 20 Apr 2023 23:46:22 +0700 |
| parents | 512d33d314c4 |
| children | f41c1b78cf5b |
comparison
equal
deleted
inserted
replaced
| 596:a89cd90af3cc | 597:fdae5f50fa00 |
|---|---|
| 1 import std/strutils | |
| 2 import std/enumerate | |
| 3 | |
| 4 import semicongine | 1 import semicongine |
| 5 | 2 |
| 6 | 3 |
| 7 const | 4 const |
| 8 vertexInput = @[ | 5 vertexInput = @[ |
| 13 fragOutput = @[attr[Vec4f]("color")] | 10 fragOutput = @[attr[Vec4f]("color")] |
| 14 vertexCode = compileGlslShader( | 11 vertexCode = compileGlslShader( |
| 15 stage=VK_SHADER_STAGE_VERTEX_BIT, | 12 stage=VK_SHADER_STAGE_VERTEX_BIT, |
| 16 inputs=vertexInput, | 13 inputs=vertexInput, |
| 17 outputs=vertexOutput, | 14 outputs=vertexOutput, |
| 18 main="""gl_Position = vec4(position, 1.0); outcolor = color;""" | 15 main=""" |
| 16 gl_Position = vec4(position, 1.0); | |
| 17 outcolor = color; | |
| 18 """ | |
| 19 ) | 19 ) |
| 20 fragmentCode = compileGlslShader( | 20 fragmentCode = compileGlslShader( |
| 21 stage=VK_SHADER_STAGE_FRAGMENT_BIT, | 21 stage=VK_SHADER_STAGE_FRAGMENT_BIT, |
| 22 inputs=vertexOutput, | 22 inputs=vertexOutput, |
| 23 outputs=fragOutput, | 23 outputs=fragOutput, |
