changeset 705:37ef17c96bdb

did: adjust to new API
author Sam <sam@basx.dev>
date Mon, 22 May 2023 00:51:41 +0700
parents 782b4df0d99d
children 0936ae49f0c4
files tests/test_materials.nim tests/test_mesh.nim
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_materials.nim	Mon May 22 00:50:41 2023 +0700
+++ b/tests/test_materials.nim	Mon May 22 00:51:41 2023 +0700
@@ -6,6 +6,7 @@
   var scene = newScene("main", root=newEntity("rect", rect()))
   let (RT, WT, PT) = (hexToColorAlpha("A51931").asPixel, hexToColorAlpha("F4F5F8").asPixel, hexToColorAlpha("2D2A4A").asPixel)
   let
+    # image from memory
     t1 = Image(width: 7, height: 5, imagedata: @[
       RT, RT, RT, RT, RT, RT, RT,
       WT, WT, WT, WT, WT, WT, WT,
@@ -13,8 +14,12 @@
       WT, WT, WT, WT, WT, WT, WT,
       RT, RT, RT, RT, RT, RT, RT,
     ])
+    # image from file
     t2 = loadImage("flag.png")
-  scene.addTextures("my_texture", @[t1, t2], interpolation=VK_FILTER_NEAREST)
+  var sampler = DefaultSampler()
+  sampler.magnification = VK_FILTER_NEAREST
+  sampler.minification = VK_FILTER_NEAREST
+  scene.addTextures("my_texture", @[Texture(image: t1, sampler: sampler), Texture(image: t2, sampler: sampler)])
   scene.addShaderGlobalArray("test2", @[0'f32, 0'f32])
 
   var engine = initEngine("Test materials")
--- a/tests/test_mesh.nim	Mon May 22 00:50:41 2023 +0700
+++ b/tests/test_mesh.nim	Mon May 22 00:51:41 2023 +0700
@@ -18,13 +18,13 @@
     ]
     vertexOutput = @[attr[Vec4f]("vertexColor")]
     fragOutput = @[attr[Vec4f]("color")]
-    uniforms = @[attr[Mat4]("transform"), attr[Vec4f]("material_colors", arrayCount=16), ]
+    uniforms = @[attr[Mat4]("transform"), attr[Vec4f]("material_color", arrayCount=16), ]
     vertexCode = compileGlslShader(
       stage=VK_SHADER_STAGE_VERTEX_BIT,
       inputs=vertexInput,
       outputs=vertexOutput,
       uniforms=uniforms,
-      main="""gl_Position = vec4(position, 1.0) * Uniforms.transform; vertexColor = Uniforms.material_colors[material];"""
+      main="""gl_Position = vec4(position, 1.0) * Uniforms.transform; vertexColor = Uniforms.material_color[material];"""
     )
     fragmentCode = compileGlslShader(
       stage=VK_SHADER_STAGE_FRAGMENT_BIT,