# HG changeset patch # User sam # Date 1684866681 -25200 # Node ID ad078e26a1c7c9dc731c00a40e7717d4c3a07ecc # Parent f31d848ab55169df76add930b537772e46610eaa fix: API changes diff -r f31d848ab551 -r ad078e26a1c7 examples/E01_hello_triangle.nim --- a/examples/E01_hello_triangle.nim Wed May 24 01:31:02 2023 +0700 +++ b/examples/E01_hello_triangle.nim Wed May 24 01:31:21 2023 +0700 @@ -36,7 +36,7 @@ renderPass = myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode) myengine.setRenderer(renderPass) -myengine.addScene(triangle, vertexInput) +myengine.addScene(triangle, vertexInput, @[]) while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): myengine.renderScene(triangle) diff -r f31d848ab551 -r ad078e26a1c7 examples/E02_squares.nim --- a/examples/E02_squares.nim Wed May 24 01:31:02 2023 +0700 +++ b/examples/E02_squares.nim Wed May 24 01:31:21 2023 +0700 @@ -82,7 +82,7 @@ myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) var scene = newScene("scene", newEntity("scene", newEntity("squares", squaremesh))) - myengine.addScene(scene, vertexInput) + myengine.addScene(scene, vertexInput, @[]) scene.addShaderGlobal("time", 0.0'f32) while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): setShaderGlobal(scene, "time", getShaderGlobal[float32](scene, "time") + 0.0005'f) diff -r f31d848ab551 -r ad078e26a1c7 examples/E03_hello_cube.nim --- a/examples/E03_hello_cube.nim Wed May 24 01:31:02 2023 +0700 +++ b/examples/E03_hello_cube.nim Wed May 24 01:31:21 2023 +0700 @@ -82,7 +82,7 @@ cube.addShaderGlobal("projection", Unit4f32) cube.addShaderGlobal("view", Unit4f32) cube.addShaderGlobal("model", Unit4f32) - myengine.addScene(cube, vertexInput) + myengine.addScene(cube, vertexInput, @[]) var t: float32 = cpuTime() while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): diff -r f31d848ab551 -r ad078e26a1c7 examples/E04_input.nim --- a/examples/E04_input.nim Wed May 24 01:31:02 2023 +0700 +++ b/examples/E04_input.nim Wed May 24 01:31:21 2023 +0700 @@ -172,7 +172,7 @@ # set up rendering myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode, clearColor=newVec4f(0, 0, 0.5))) - myengine.addScene(scene, vertexInput, transformAttribute="transform") + myengine.addScene(scene, vertexInput, @[], transformAttribute="transform") scene.addShaderGlobal("projection", Unit4f32) # mainloop diff -r f31d848ab551 -r ad078e26a1c7 examples/E10_pong.nim --- a/examples/E10_pong.nim Wed May 24 01:31:02 2023 +0700 +++ b/examples/E10_pong.nim Wed May 24 01:31:21 2023 +0700 @@ -56,7 +56,7 @@ # set up rendering myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode, clearColor=backgroundColor)) - myengine.addScene(level, vertexInput, transformAttribute="transform") + myengine.addScene(level, vertexInput, @[], transformAttribute="transform") level.addShaderGlobal("projection", Unit4f32) var diff -r f31d848ab551 -r ad078e26a1c7 tests/test_materials.nim --- a/tests/test_materials.nim Wed May 24 01:31:02 2023 +0700 +++ b/tests/test_materials.nim Wed May 24 01:31:21 2023 +0700 @@ -14,8 +14,10 @@ WT, WT, WT, WT, WT, WT, WT, RT, RT, RT, RT, RT, RT, RT, ]) + let # image from file t2 = loadImage("flag.png") + var sampler = DefaultSampler() sampler.magnification = VK_FILTER_NEAREST sampler.minification = VK_FILTER_NEAREST @@ -23,6 +25,7 @@ scene.addShaderGlobalArray("test2", @[0'f32, 0'f32]) var engine = initEngine("Test materials") + const vertexInput = @[ attr[Vec3f]("position", memoryPerformanceHint=PreferFastRead), @@ -52,7 +55,7 @@ """ ) engine.setRenderer(engine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)) - engine.addScene(scene, vertexInput) + engine.addScene(scene, vertexInput, samplers) var t = cpuTime() while engine.updateInputs() == Running and not engine.keyIsDown(Escape): var d = float32(cpuTime() - t) diff -r f31d848ab551 -r ad078e26a1c7 tests/test_mesh.nim --- 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 diff -r f31d848ab551 -r ad078e26a1c7 tests/test_vulkan_wrapper.nim --- a/tests/test_vulkan_wrapper.nim Wed May 24 01:31:02 2023 +0700 +++ b/tests/test_vulkan_wrapper.nim Wed May 24 01:31:21 2023 +0700 @@ -131,7 +131,7 @@ R, R, W, R, R, R, R, R, R, R, ]), sampler: sampler)) - engine.addScene(scene, vertexInput) + engine.addScene(scene, vertexInput, samplers) # MAINLOOP echo "Setup successfull, start rendering"