Mercurial > games > semicongine
comparison tests/test_materials.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 |
---|---|
3 | 3 |
4 import semicongine | 4 import semicongine |
5 | 5 |
6 let | 6 let |
7 sampler = Sampler(magnification: VK_FILTER_NEAREST, minification: VK_FILTER_NEAREST) | 7 sampler = Sampler(magnification: VK_FILTER_NEAREST, minification: VK_FILTER_NEAREST) |
8 (RT, WT, PT) = (toRGBA("A51931").asPixel, toRGBA("F4F5F8").asPixel, toRGBA("2D2A4A").asPixel) | 8 (RT, WT, PT) = (ToRGBA("A51931").AsPixel, ToRGBA("F4F5F8").AsPixel, ToRGBA("2D2A4A").AsPixel) |
9 thai = Image[RGBAPixel](width: 7, height: 5, imagedata: @[ | 9 thai = Image[RGBAPixel](width: 7, height: 5, imagedata: @[ |
10 RT, RT, RT, RT, RT, RT, RT, | 10 RT, RT, RT, RT, RT, RT, RT, |
11 WT, WT, WT, WT, WT, WT, WT, | 11 WT, WT, WT, WT, WT, WT, WT, |
12 PT, PT, PT, PT, PT, PT, PT, | 12 PT, PT, PT, PT, PT, PT, PT, |
13 WT, WT, WT, WT, WT, WT, WT, | 13 WT, WT, WT, WT, WT, WT, WT, |
24 ) | 24 ) |
25 material = initMaterialData( | 25 material = initMaterialData( |
26 theType = doubleTextureMaterial, | 26 theType = doubleTextureMaterial, |
27 name = "swiss-thai", | 27 name = "swiss-thai", |
28 attributes = { | 28 attributes = { |
29 "tex1": initDataList(@[Texture(colorImage: thai, sampler: sampler, isGrayscale: false)]), | 29 "tex1": InitDataList(@[Texture(colorImage: thai, sampler: sampler, isGrayscale: false)]), |
30 "tex2": initDataList(@[Texture(colorImage: swiss, sampler: sampler, isGrayscale: false)]), | 30 "tex2": InitDataList(@[Texture(colorImage: swiss, sampler: sampler, isGrayscale: false)]), |
31 } | 31 } |
32 ) | 32 ) |
33 | 33 |
34 proc main() = | 34 proc main() = |
35 var flag = rect() | 35 var flag = rect() |
41 | 41 |
42 const | 42 const |
43 shaderConfiguration1 = createShaderConfiguration( | 43 shaderConfiguration1 = createShaderConfiguration( |
44 name = "shader 1", | 44 name = "shader 1", |
45 inputs = [ | 45 inputs = [ |
46 attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), | 46 Attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), |
47 attr[Vec2f]("uv", memoryPerformanceHint = PreferFastRead), | 47 Attr[Vec2f]("uv", memoryPerformanceHint = PreferFastRead), |
48 ], | 48 ], |
49 intermediates = [ | 49 intermediates = [ |
50 attr[Vec2f]("uvout"), | 50 Attr[Vec2f]("uvout"), |
51 ], | 51 ], |
52 uniforms = [attr[Vec4f]("test2", arrayCount = 2)], | 52 uniforms = [Attr[Vec4f]("test2", arrayCount = 2)], |
53 samplers = @[ | 53 samplers = @[ |
54 attr[Texture]("tex1"), | 54 Attr[Texture]("tex1"), |
55 attr[Texture]("tex2"), | 55 Attr[Texture]("tex2"), |
56 ], | 56 ], |
57 outputs = [attr[Vec4f]("color")], | 57 outputs = [Attr[Vec4f]("color")], |
58 vertexCode = """ | 58 vertexCode = """ |
59 gl_Position = vec4(position.x, position.y + sin(Uniforms.test2[1].x) / Uniforms.test2[1].x * 0.5, position.z, 1.0); | 59 gl_Position = vec4(position.x, position.y + sin(Uniforms.test2[1].x) / Uniforms.test2[1].x * 0.5, position.z, 1.0); |
60 uvout = uv;""", | 60 uvout = uv;""", |
61 fragmentCode = """ | 61 fragmentCode = """ |
62 float d = sin(Uniforms.test2[0].x) * 0.5 + 0.5; | 62 float d = sin(Uniforms.test2[0].x) * 0.5 + 0.5; |