Mercurial > games > semicongine
comparison tests/test_materials.nim @ 705:37ef17c96bdb
did: adjust to new API
| author | Sam <sam@basx.dev> | 
|---|---|
| date | Mon, 22 May 2023 00:51:41 +0700 | 
| parents | d2e8b5edea7e | 
| children | ad078e26a1c7 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 704:782b4df0d99d | 705:37ef17c96bdb | 
|---|---|
| 4 | 4 | 
| 5 proc main() = | 5 proc main() = | 
| 6 var scene = newScene("main", root=newEntity("rect", rect())) | 6 var scene = newScene("main", root=newEntity("rect", rect())) | 
| 7 let (RT, WT, PT) = (hexToColorAlpha("A51931").asPixel, hexToColorAlpha("F4F5F8").asPixel, hexToColorAlpha("2D2A4A").asPixel) | 7 let (RT, WT, PT) = (hexToColorAlpha("A51931").asPixel, hexToColorAlpha("F4F5F8").asPixel, hexToColorAlpha("2D2A4A").asPixel) | 
| 8 let | 8 let | 
| 9 # image from memory | |
| 9 t1 = Image(width: 7, height: 5, imagedata: @[ | 10 t1 = Image(width: 7, height: 5, imagedata: @[ | 
| 10 RT, RT, RT, RT, RT, RT, RT, | 11 RT, RT, RT, RT, RT, RT, RT, | 
| 11 WT, WT, WT, WT, WT, WT, WT, | 12 WT, WT, WT, WT, WT, WT, WT, | 
| 12 PT, PT, PT, PT, PT, PT, PT, | 13 PT, PT, PT, PT, PT, PT, PT, | 
| 13 WT, WT, WT, WT, WT, WT, WT, | 14 WT, WT, WT, WT, WT, WT, WT, | 
| 14 RT, RT, RT, RT, RT, RT, RT, | 15 RT, RT, RT, RT, RT, RT, RT, | 
| 15 ]) | 16 ]) | 
| 17 # image from file | |
| 16 t2 = loadImage("flag.png") | 18 t2 = loadImage("flag.png") | 
| 17 scene.addTextures("my_texture", @[t1, t2], interpolation=VK_FILTER_NEAREST) | 19 var sampler = DefaultSampler() | 
| 20 sampler.magnification = VK_FILTER_NEAREST | |
| 21 sampler.minification = VK_FILTER_NEAREST | |
| 22 scene.addTextures("my_texture", @[Texture(image: t1, sampler: sampler), Texture(image: t2, sampler: sampler)]) | |
| 18 scene.addShaderGlobalArray("test2", @[0'f32, 0'f32]) | 23 scene.addShaderGlobalArray("test2", @[0'f32, 0'f32]) | 
| 19 | 24 | 
| 20 var engine = initEngine("Test materials") | 25 var engine = initEngine("Test materials") | 
| 21 const | 26 const | 
| 22 vertexInput = @[ | 27 vertexInput = @[ | 
