Mercurial > games > semicongine
comparison tests/test_vulkan_wrapper.nim @ 1137:a4aa9f374d44
did: more renaming
author | sam <sam@basx.dev> |
---|---|
date | Tue, 04 Jun 2024 20:51:22 +0700 |
parents | 71315636ba82 |
children | 02e1d2658ff5 |
comparison
equal
deleted
inserted
replaced
1136:71315636ba82 | 1137:a4aa9f374d44 |
---|---|
21 attributes: {"baseTexture": TextureType}.toTable | 21 attributes: {"baseTexture": TextureType}.toTable |
22 ) | 22 ) |
23 mat = Mat1Type.initMaterialData( | 23 mat = Mat1Type.initMaterialData( |
24 name = "mat", | 24 name = "mat", |
25 attributes = { | 25 attributes = { |
26 "baseTexture": initDataList(@[Texture(isGrayscale: false, colorImage: Image[RGBAPixel](width: 5, height: 5, imagedata: @[ | 26 "baseTexture": InitDataList(@[Texture(isGrayscale: false, colorImage: Image[RGBAPixel](width: 5, height: 5, imagedata: @[ |
27 R, R, R, R, R, | 27 R, R, R, R, R, |
28 R, R, W, R, R, | 28 R, R, W, R, R, |
29 R, W, W, W, R, | 29 R, W, W, W, R, |
30 R, R, W, R, R, | 30 R, R, W, R, R, |
31 R, R, R, R, R, | 31 R, R, R, R, R, |
42 attributes: {"baseTexture": TextureType}.toTable | 42 attributes: {"baseTexture": TextureType}.toTable |
43 ) | 43 ) |
44 mat2 = Mat2Type.initMaterialData( | 44 mat2 = Mat2Type.initMaterialData( |
45 name = "mat2", | 45 name = "mat2", |
46 attributes = { | 46 attributes = { |
47 "baseTexture": initDataList(@[Texture(isGrayscale: false, colorImage: Image[RGBAPixel](width: 5, height: 5, imagedata: @[ | 47 "baseTexture": InitDataList(@[Texture(isGrayscale: false, colorImage: Image[RGBAPixel](width: 5, height: 5, imagedata: @[ |
48 R, W, R, W, R, | 48 R, W, R, W, R, |
49 W, R, W, R, W, | 49 W, R, W, R, W, |
50 R, W, R, W, R, | 50 R, W, R, W, R, |
51 W, R, W, R, W, | 51 W, R, W, R, W, |
52 R, W, R, W, R, | 52 R, W, R, W, R, |
54 }.toTable | 54 }.toTable |
55 ) | 55 ) |
56 mat3 = SINGLE_COLOR_MATERIAL.initMaterialData( | 56 mat3 = SINGLE_COLOR_MATERIAL.initMaterialData( |
57 name = "mat3", | 57 name = "mat3", |
58 attributes = { | 58 attributes = { |
59 "color": initDataList(@[NewVec4f(0, 1, 0, 1)]) | 59 "color": InitDataList(@[NewVec4f(0, 1, 0, 1)]) |
60 }.toTable | 60 }.toTable |
61 ) | 61 ) |
62 | 62 |
63 proc scene_different_mesh_types(): seq[Mesh] = | 63 proc scene_different_mesh_types(): seq[Mesh] = |
64 @[ | 64 @[ |
188 # INIT RENDERER: | 188 # INIT RENDERER: |
189 const | 189 const |
190 shaderConfiguration1 = createShaderConfiguration( | 190 shaderConfiguration1 = createShaderConfiguration( |
191 name = "shader1", | 191 name = "shader1", |
192 inputs = [ | 192 inputs = [ |
193 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), | 193 Attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), |
194 attr[Vec4f]("color", memoryPerformanceHint = PreferFastWrite), | 194 Attr[Vec4f]("color", memoryPerformanceHint = PreferFastWrite), |
195 attr[Mat4]("transform", perInstance = true), | 195 Attr[Mat4]("transform", perInstance = true), |
196 ], | 196 ], |
197 intermediates = [ | 197 intermediates = [ |
198 attr[Vec4f]("outcolor"), | 198 Attr[Vec4f]("outcolor"), |
199 ], | 199 ], |
200 outputs = [attr[Vec4f]("color")], | 200 outputs = [Attr[Vec4f]("color")], |
201 samplers = [attr[Texture]("baseTexture")], | 201 samplers = [Attr[Texture]("baseTexture")], |
202 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = color;""", | 202 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = color;""", |
203 fragmentCode = "color = texture(baseTexture, outcolor.xy) * 0.5 + outcolor * 0.5;", | 203 fragmentCode = "color = texture(baseTexture, outcolor.xy) * 0.5 + outcolor * 0.5;", |
204 ) | 204 ) |
205 shaderConfiguration2 = createShaderConfiguration( | 205 shaderConfiguration2 = createShaderConfiguration( |
206 name = "shader2", | 206 name = "shader2", |
207 inputs = [ | 207 inputs = [ |
208 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), | 208 Attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), |
209 attr[Mat4]("transform", perInstance = true), | 209 Attr[Mat4]("transform", perInstance = true), |
210 ], | 210 ], |
211 intermediates = [attr[Vec4f]("outcolor")], | 211 intermediates = [Attr[Vec4f]("outcolor")], |
212 outputs = [attr[Vec4f]("color")], | 212 outputs = [Attr[Vec4f]("color")], |
213 uniforms = [attr[Vec4f]("color", arrayCount = 1)], | 213 uniforms = [Attr[Vec4f]("color", arrayCount = 1)], |
214 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = Uniforms.color[0];""", | 214 vertexCode = """gl_Position = vec4(position, 1.0) * transform; outcolor = Uniforms.color[0];""", |
215 fragmentCode = "color = outcolor;", | 215 fragmentCode = "color = outcolor;", |
216 ) | 216 ) |
217 engine.initRenderer({ | 217 engine.initRenderer({ |
218 Mat1Type: shaderConfiguration1, | 218 Mat1Type: shaderConfiguration1, |