# HG changeset patch # User Sam # Date 1674024552 -25200 # Node ID 8025ab67d931ee6904d43cfe4ff95d0071ca8563 # Parent 3f1111f3b9f8c2407eba033de1be179b28f6fab7 fix: hello cube, add: run_all command diff -r 3f1111f3b9f8 -r 8025ab67d931 config.nims --- a/config.nims Wed Jan 18 09:52:03 2023 +0700 +++ b/config.nims Wed Jan 18 13:49:12 2023 +0700 @@ -122,3 +122,13 @@ if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]: compilerFlags() + +task run_all , "Run all binaries": + for file in listFiles("build/debug/linux"): + exec file + for file in listFiles("build/release/linux"): + exec file + for file in listFiles("build/debug/windows"): + exec &"wine {file}" + for file in listFiles("build/release/windows"): + exec &"wine {file}" diff -r 3f1111f3b9f8 -r 8025ab67d931 examples/hello_cube.nim --- a/examples/hello_cube.nim Wed Jan 18 09:52:03 2023 +0700 +++ b/examples/hello_cube.nim Wed Jan 18 13:49:12 2023 +0700 @@ -53,7 +53,6 @@ uniforms.projection.value = perspective(float32(PI / 4), float32(engine.vulkan.frameDimension.width) / float32(engine.vulkan.frameDimension.height), 0.1'f32, 100'f32) for buffer in pipeline.uniformBuffers: buffer.updateData(uniforms) - echo uniforms.projection.value const TopLeftFront = Vec3([ -0.5'f32, -0.5'f32, -0.5'f32]) @@ -83,8 +82,10 @@ ] var tris: seq[array[3, uint16]] -# for i in 0'u16 ..< 6'u16: - # let off = i * 4 +for i in 0'u16 ..< 6'u16: + let off = i * 4 + tris.add [off + 0'u16, off + 1'u16, off + 2'u16] + tris.add [off + 2'u16, off + 3'u16, off + 0'u16] var off = 0'u16 * 4 # tris.add [off + 0'u16, off + 1'u16, off + 2'u16] # tris.add [off + 2'u16, off + 3'u16, off + 0'u16] diff -r 3f1111f3b9f8 -r 8025ab67d931 examples/squares.nim --- a/examples/squares.nim Wed Jan 18 09:52:03 2023 +0700 +++ b/examples/squares.nim Wed Jan 18 13:49:12 2023 +0700 @@ -68,7 +68,6 @@ indices[squareIndex * 2 + 0] = [uint16(vertIndex + 0), uint16(vertIndex + 1), uint16(vertIndex + 2)] indices[squareIndex * 2 + 1] = [uint16(vertIndex + 2), uint16(vertIndex + 3), uint16(vertIndex + 0)] - var scene = new Thing type PIndexedMesh = ref IndexedMesh[VertexDataA, uint16] # required so we can use ctor with ref/on heap var squaremesh = PIndexedMesh( @@ -79,6 +78,7 @@ ), indices: @indices ) + var scene = new Thing var childthing = new Thing childthing.parts.add squaremesh scene.children.add childthing @@ -93,11 +93,6 @@ """ ) const fragmentShader = generateFragmentShaderCode[VertexDataA]() - static: - echo "--------------" - for (i, line) in enumerate(vertexShader.splitLines()): - echo $(i + 1) & " " & line - echo "--------------" pipeline = setupPipeline[VertexDataA, Uniforms, uint16]( myengine, scene, diff -r 3f1111f3b9f8 -r 8025ab67d931 src/zamikongine/engine.nim --- a/src/zamikongine/engine.nim Wed Jan 18 09:52:03 2023 +0700 +++ b/src/zamikongine/engine.nim Wed Jan 18 13:49:12 2023 +0700 @@ -528,7 +528,7 @@ var ubermesh = createUberMesh(allmeshes) result.vertexBuffers.add createVertexBuffers(ubermesh, result.device, engine.vulkan.device.physicalDevice.device, engine.vulkan.commandPool, engine.vulkan.device.graphicsQueue) - when not IndexType is void: + when not (IndexType is void): # vertex buffers with indexes var allindexedmeshes: seq[IndexedMesh[VertexType, IndexType]] for mesh in partsOfType[ref IndexedMesh[VertexType, IndexType]](engine.currentscenedata):