Compare commits
No commits in common. 'c7a56745a72c8f552af4384e5c5e0e3368501160' and '9fc7356a22b9fc264e22b32f2dfd196d3736d27f' have entirely different histories.
c7a56745a7
...
9fc7356a22
6 changed files with 15 additions and 115 deletions
@ -1,19 +1,7 @@ |
|||||||
# Zig Bloxel Game |
# Zig Bloxel Game |
||||||
|
|
||||||
This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach], [Flecs] and [zig-gamedev]. Due to Zig being a quickly evolving language, Mach and zig-gamedev, and as a result this project, target version `0.12.0-dev.2063+804cee3b9` of Zig. |
This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach] and [Flecs]. |
||||||
|
|
||||||
[Zig]: https://ziglang.org/ |
[Zig]: https://ziglang.org/ |
||||||
[Mach]: https://github.com/hexops/mach-core |
[Mach]: https://machengine.org/ |
||||||
[Flecs]: https://github.com/SanderMertens/flecs |
[Flecs]: https://flecs.dev/ |
||||||
[zig-gamedev]: https://github.com/zig-gamedev/zig-gamedev |
|
||||||
|
|
||||||
## Dependencies |
|
||||||
|
|
||||||
```sh |
|
||||||
mkdir -p libs && cd libs |
|
||||||
# Clone zig-gamedev sparsely, only grabbing top-level files. |
|
||||||
git clone --sparse --filter=blob:none https://github.com/zig-gamedev/zig-gamedev.git |
|
||||||
# However, we also care about zmath, so check that out too. |
|
||||||
cd zig-gamedev |
|
||||||
git sparse-checkout add libs/zmath |
|
||||||
``` |
|
||||||
|
@ -1 +0,0 @@ |
|||||||
Subproject commit 25e1794d608d6a1d13e84a42d98c950fd250050d |
|
@ -1,44 +1,14 @@ |
|||||||
@group(0) @binding(0) var<uniform> mvp_matrix: mat4x4<f32>; |
|
||||||
|
|
||||||
struct VertexOutput { |
|
||||||
@builtin(position) position: vec4<f32>, |
|
||||||
@location(0) color: vec4<f32>, |
|
||||||
}; |
|
||||||
|
|
||||||
struct FragmentOutput { |
|
||||||
@location(0) pixel_color: vec4<f32> |
|
||||||
}; |
|
||||||
|
|
||||||
@vertex fn vertex_main( |
@vertex fn vertex_main( |
||||||
@builtin(vertex_index) index: u32 |
@builtin(vertex_index) index: u32 |
||||||
) -> VertexOutput { |
) -> @builtin(position) vec4<f32> { |
||||||
let color = array<vec3<f32>, 3>( |
let pos = array<vec2<f32>, 3>( |
||||||
vec3<f32>(1.0, 0.0, 0.0), |
vec2<f32>( 0.0, 0.5), |
||||||
vec3<f32>(0.0, 1.0, 0.0), |
vec2<f32>(-0.5, -0.5), |
||||||
vec3<f32>(0.0, 0.0, 1.0), |
vec2<f32>( 0.5, -0.5) |
||||||
); |
); |
||||||
let pos = array<vec2<f32>, 9>( |
return vec4<f32>(pos[index], 0.0, 1.0); |
||||||
vec2<f32>(-1.0, 0.5 + 0.25), |
|
||||||
vec2<f32>(-1.5, -0.5 + 0.25), |
|
||||||
vec2<f32>(-0.5, -0.5 + 0.25), |
|
||||||
|
|
||||||
vec2<f32>( 0.0, 0.5 - 0.25), |
|
||||||
vec2<f32>(-0.5, -0.5 - 0.25), |
|
||||||
vec2<f32>( 0.5, -0.5 - 0.25), |
|
||||||
|
|
||||||
vec2<f32>( 1.0, 0.5), |
|
||||||
vec2<f32>( 0.5, -0.5), |
|
||||||
vec2<f32>( 1.5, -0.5), |
|
||||||
); |
|
||||||
|
|
||||||
var out: VertexOutput; |
|
||||||
out.position = vec4<f32>(pos[index], 0.0, 1.0) * mvp_matrix; |
|
||||||
out.color = vec4<f32>(color[index / 3], 1.0); |
|
||||||
return out; |
|
||||||
} |
} |
||||||
|
|
||||||
@fragment fn frag_main(in: VertexOutput) -> FragmentOutput { |
@fragment fn frag_main() -> @location(0) vec4<f32> { |
||||||
var out: FragmentOutput; |
return vec4<f32>(1.0, 0.0, 0.0, 1.0); |
||||||
out.pixel_color = in.color; |
|
||||||
return out; |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue