Mercurial > games > semicongine
comparison examples/hello_cube.nim @ 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 |
comparison
equal
deleted
inserted
replaced
38:c3c963e7c1a6 | 39:0cb294c5d2fd |
---|---|
51 0'f32, 0'f32, 0'f32, 1'f32, | 51 0'f32, 0'f32, 0'f32, 1'f32, |
52 ]) | 52 ]) |
53 uniforms.projection.value = perspective(float32(PI / 4), float32(engine.vulkan.frameDimension.width) / float32(engine.vulkan.frameDimension.height), 0.1'f32, 100'f32) | 53 uniforms.projection.value = perspective(float32(PI / 4), float32(engine.vulkan.frameDimension.width) / float32(engine.vulkan.frameDimension.height), 0.1'f32, 100'f32) |
54 for buffer in pipeline.uniformBuffers: | 54 for buffer in pipeline.uniformBuffers: |
55 buffer.updateData(uniforms) | 55 buffer.updateData(uniforms) |
56 echo uniforms.projection.value | |
57 | 56 |
58 const | 57 const |
59 TopLeftFront = Vec3([ -0.5'f32, -0.5'f32, -0.5'f32]) | 58 TopLeftFront = Vec3([ -0.5'f32, -0.5'f32, -0.5'f32]) |
60 TopRightFront = Vec3([ 0.5'f32, -0.5'f32, -0.5'f32]) | 59 TopRightFront = Vec3([ 0.5'f32, -0.5'f32, -0.5'f32]) |
61 BottomRightFront = Vec3([ 0.5'f32, 0.5'f32, -0.5'f32]) | 60 BottomRightFront = Vec3([ 0.5'f32, 0.5'f32, -0.5'f32]) |
81 Bf32, Bf32, Bf32, Bf32, | 80 Bf32, Bf32, Bf32, Bf32, |
82 Bf32 * 0.5'f32, Bf32 * 0.5'f32, Bf32 * 0.5'f32, Bf32 * 0.5'f32, | 81 Bf32 * 0.5'f32, Bf32 * 0.5'f32, Bf32 * 0.5'f32, Bf32 * 0.5'f32, |
83 ] | 82 ] |
84 var | 83 var |
85 tris: seq[array[3, uint16]] | 84 tris: seq[array[3, uint16]] |
86 # for i in 0'u16 ..< 6'u16: | 85 for i in 0'u16 ..< 6'u16: |
87 # let off = i * 4 | 86 let off = i * 4 |
87 tris.add [off + 0'u16, off + 1'u16, off + 2'u16] | |
88 tris.add [off + 2'u16, off + 3'u16, off + 0'u16] | |
88 var off = 0'u16 * 4 | 89 var off = 0'u16 * 4 |
89 # tris.add [off + 0'u16, off + 1'u16, off + 2'u16] | 90 # tris.add [off + 0'u16, off + 1'u16, off + 2'u16] |
90 # tris.add [off + 2'u16, off + 3'u16, off + 0'u16] | 91 # tris.add [off + 2'u16, off + 3'u16, off + 0'u16] |
91 # off = 1'u16 * 4 | 92 # off = 1'u16 * 4 |
92 # tris.add [off + 0'u16, off + 1'u16, off + 2'u16] | 93 # tris.add [off + 0'u16, off + 1'u16, off + 2'u16] |