Mercurial > games > semicongine
diff examples/E02_squares.nim @ 137:ac2b6777c5db
add: some cleanup, discovered bug
author | Sam <sam@basx.dev> |
---|---|
date | Fri, 21 Apr 2023 00:29:09 +0700 |
parents | fc5db4f1f94e |
children | 34112bf5abf8 |
line wrap: on
line diff
--- a/examples/E02_squares.nim Thu Apr 20 23:46:22 2023 +0700 +++ b/examples/E02_squares.nim Fri Apr 21 00:29:09 2023 +0700 @@ -47,7 +47,7 @@ const vertexInput = @[ attr[Vec3f]("position", memoryLocation=VRAM), - attr[Vec3f]("color", memoryLocation=VRAM), # TODO: VRAMVisible + attr[Vec3f]("color", memoryLocation=VRAM), attr[uint32]("index", memoryLocation=VRAM), ] vertexOutput = @[attr[Vec3f]("outcolor")] @@ -80,6 +80,11 @@ colors=colors, ) setMeshData[uint32](squaremesh, "index", iValues.toSeq) + var i = 0'u64 + var (p, l) = squaremesh.getRawData("color") + while i < uint64(l): + echo (cast[ptr float32]((cast[uint64](p) + i)))[] + inc i var myengine = initEngine("Squares") myengine.setRenderer(myengine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode))