Mercurial > games > semicongine
changeset 39:0cb294c5d2fd
fix: hello cube, add: run_all command
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 18 Jan 2023 13:49:12 +0700 |
parents | c3c963e7c1a6 |
children | 2771db8d4276 |
files | config.nims examples/hello_cube.nim examples/squares.nim src/zamikongine/engine.nim |
diffstat | 4 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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}"
--- 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]
--- 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,
--- 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):