Mercurial > games > semicongine
comparison tests/test_mesh.nim @ 420:91e018270832
fix: all tests (once more)
| author | Sam <sam@basx.dev> |
|---|---|
| date | Mon, 29 Jan 2024 00:19:35 +0700 |
| parents | f4f1474dc70a |
| children | 6406766a222d |
comparison
equal
deleted
inserted
replaced
| 419:18e5443e4f83 | 420:91e018270832 |
|---|---|
| 6 ] | 6 ] |
| 7 | 7 |
| 8 var engine = initEngine("Test meshes") | 8 var engine = initEngine("Test meshes") |
| 9 const | 9 const |
| 10 shaderConfiguration = createShaderConfiguration( | 10 shaderConfiguration = createShaderConfiguration( |
| 11 inputs=[ | 11 inputs = [ |
| 12 attr[Vec3f]("position", memoryPerformanceHint=PreferFastRead), | 12 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), |
| 13 attr[uint16]("materialIndex", memoryPerformanceHint=PreferFastRead, perInstance=true), | 13 attr[uint16](MATERIALINDEX_ATTRIBUTE, memoryPerformanceHint = PreferFastRead, perInstance = true), |
| 14 attr[Vec2f]("texcoord_0", memoryPerformanceHint=PreferFastRead), | 14 attr[Vec2f]("texcoord_0", memoryPerformanceHint = PreferFastRead), |
| 15 attr[Mat4]("transform", memoryPerformanceHint=PreferFastWrite, perInstance=true), | 15 attr[Mat4]("transform", memoryPerformanceHint = PreferFastWrite, perInstance = true), |
| 16 ], | 16 ], |
| 17 intermediates=[ | 17 intermediates = [ |
| 18 attr[Vec4f]("vertexColor"), | 18 attr[Vec4f]("vertexColor"), |
| 19 attr[Vec2f]("colorTexCoord"), | 19 attr[Vec2f]("colorTexCoord"), |
| 20 attr[uint16]("materialIndexOut", noInterpolation=true) | 20 attr[uint16]("materialIndexOut", noInterpolation = true) |
| 21 ], | 21 ], |
| 22 outputs=[attr[Vec4f]("color")], | 22 outputs = [attr[Vec4f]("color")], |
| 23 uniforms=[ | 23 uniforms = [ |
| 24 attr[Mat4]("projection"), | 24 attr[Mat4]("projection"), |
| 25 attr[Mat4]("view"), | 25 attr[Mat4]("view"), |
| 26 attr[Vec4f]("color", arrayCount=4), | 26 attr[Vec4f]("color", arrayCount = 4), |
| 27 ], | 27 ], |
| 28 samplers=[attr[Texture]("baseTexture", arrayCount=4)], | 28 samplers = [attr[Texture]("baseTexture", arrayCount = 4)], |
| 29 vertexCode=""" | 29 vertexCode = &""" |
| 30 gl_Position = vec4(position, 1.0) * (transform * Uniforms.view * Uniforms.projection); | 30 gl_Position = vec4(position, 1.0) * (transform * Uniforms.view * Uniforms.projection); |
| 31 vertexColor = Uniforms.color[materialIndex]; | 31 vertexColor = Uniforms.color[{MATERIALINDEX_ATTRIBUTE}]; |
| 32 colorTexCoord = texcoord_0; | 32 colorTexCoord = texcoord_0; |
| 33 materialIndexOut = materialIndex; | 33 materialIndexOut = {MATERIALINDEX_ATTRIBUTE}; |
| 34 """, | 34 """, |
| 35 fragmentCode="color = texture(baseTexture[materialIndexOut], colorTexCoord) * vertexColor;" | 35 fragmentCode = "color = texture(baseTexture[materialIndexOut], colorTexCoord) * vertexColor;" |
| 36 ) | 36 ) |
| 37 engine.initRenderer({COLORED_SINGLE_TEXTURE_MATERIAL: shaderConfiguration}) | 37 engine.initRenderer({COLORED_SINGLE_TEXTURE_MATERIAL: shaderConfiguration}) |
| 38 | 38 |
| 39 for scene in scenes.mitems: | 39 for scene in scenes.mitems: |
| 40 scene.addShaderGlobal("projection", Unit4F32) | 40 scene.addShaderGlobal("projection", Unit4F32) |
