diff tests/test_materials.nim @ 695:d2e8b5edea7e

add: png loading with LodePNG (thanks LodePNG-author, this is a super amazing piece of code!)
author Sam <sam@basx.dev>
date Sat, 20 May 2023 16:35:23 +0700
parents 9182a5d2ea3a
children f52fccedf5ab
line wrap: on
line diff
--- a/tests/test_materials.nim	Sat May 20 01:18:45 2023 +0700
+++ b/tests/test_materials.nim	Sat May 20 16:35:23 2023 +0700
@@ -4,23 +4,16 @@
 
 proc main() =
   var scene = newScene("main", root=newEntity("rect", rect()))
-  let (R, W) = ([255'u8, 0'u8, 0'u8, 255'u8], [255'u8, 255'u8, 255'u8, 255'u8])
   let (RT, WT, PT) = (hexToColorAlpha("A51931").asPixel, hexToColorAlpha("F4F5F8").asPixel, hexToColorAlpha("2D2A4A").asPixel)
   let
-    t1 = Image(width: 5, height: 5, imagedata: @[
-      R, R, R, R, R,
-      R, R, W, R, R,
-      R, W, W, W, R,
-      R, R, W, R, R,
-      R, R, R, R, R,
-    ])
-    t2 = Image(width: 7, height: 5, imagedata: @[
+    t1 = Image(width: 7, height: 5, imagedata: @[
       RT, RT, RT, RT, RT, RT, RT,
       WT, WT, WT, WT, WT, WT, WT,
       PT, PT, PT, PT, PT, PT, PT,
       WT, WT, WT, WT, WT, WT, WT,
       RT, RT, RT, RT, RT, RT, RT,
     ])
+    t2 = loadImage("flag.png")
   scene.addTextures("my_texture", @[t1, t2], interpolation=VK_FILTER_NEAREST)
   scene.addShaderGlobalArray("test2", @[0'f32, 0'f32])