diff tests/test_mesh.nim @ 253:ad078e26a1c7

fix: API changes
author sam <sam@basx.dev>
date Wed, 24 May 2023 01:31:21 +0700
parents beb41c93aa3f
children d16fd73959c1
line wrap: on
line diff
--- a/tests/test_mesh.nim	Wed May 24 01:31:02 2023 +0700
+++ b/tests/test_mesh.nim	Wed May 24 01:31:21 2023 +0700
@@ -7,11 +7,11 @@
   myScene.root.transform = translate3d(0.2'f32, 0'f32, 0'f32)
   myScene.root.children[0].transform = translate3d(0'f32, 0.2'f32, 0'f32)
   var scenes = [
-    # loadScene("default_cube.glb", "1"),
+    loadScene("default_cube.glb", "1"),
     # loadScene("default_cube1.glb", "3"),
     # loadScene("default_cube2.glb", "4"),
     # loadScene("flat.glb", "5"),
-    loadScene("tutorialk-donat.glb", "6"),
+    # loadScene("tutorialk-donat.glb", "6"),
     # myScene,
     # loadScene("personv3.glb", "2"),
   ]
@@ -24,7 +24,7 @@
       attr[Vec2f]("texcoord_0", memoryPerformanceHint=PreferFastRead),
       attr[Mat4]("transform", memoryPerformanceHint=PreferFastWrite, perInstance=true),
     ]
-    vertexOutput = @[attr[Vec4f]("vertexColor"), attr[Vec2f]("colorTexCoord")]
+    vertexOutput = @[attr[Vec4f]("vertexColor"),  #[ attr[Vec2f]("colorTexCoord")]#]
     fragOutput = @[attr[Vec4f]("color")]
     uniforms = @[
       attr[Mat4]("projection"),
@@ -32,7 +32,7 @@
       attr[Vec4f]("material_color", arrayCount=16),
     ]
     samplers = @[
-      attr[Sampler2DType]("material_color_texture", arrayCount=1),
+      # attr[Sampler2DType]("material_color_texture", arrayCount=1),
     ]
     vertexCode = compileGlslShader(
       stage=VK_SHADER_STAGE_VERTEX_BIT,
@@ -43,7 +43,7 @@
       main="""
 gl_Position =  vec4(position, 1.0) * (transform * Uniforms.view * Uniforms.projection);
 vertexColor = Uniforms.material_color[material];
-colorTexCoord = texcoord_0;
+// colorTexCoord = texcoord_0;
 """
     )
     fragmentCode = compileGlslShader(
@@ -52,11 +52,12 @@
       outputs=fragOutput,
       uniforms=uniforms,
       samplers=samplers,
-      main="""color = texture(material_color_texture[0], colorTexCoord) * vertexColor;"""
+      # main="""color = texture(material_color_texture[0], colorTexCoord) * vertexColor;"""
+      main="""color = vertexColor;"""
     )
   engine.setRenderer(engine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode, clearColor=newVec4f(0, 0, 0, 1)))
   for scene in scenes.mitems:
-    engine.addScene(scene, vertexInput, transformAttribute="transform")
+    engine.addScene(scene, vertexInput, samplers, transformAttribute="transform")
     scene.addShaderGlobal("projection", Unit4)
     scene.addShaderGlobal("view", Unit4)
   var