# HG changeset patch # User Sam # Date 1684691501 -25200 # Node ID f52fccedf5ab3f7b31b3f341f0e35650850f6fbd # Parent 3b388986c7fd391b45049af0d8c383e496410f4f did: adjust to new API diff -r 3b388986c7fd -r f52fccedf5ab tests/test_materials.nim --- 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") diff -r 3b388986c7fd -r f52fccedf5ab tests/test_mesh.nim --- 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,