summaryrefslogtreecommitdiff
path: root/client/src/shader.wgsl
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-06 22:36:03 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-06 22:36:03 +0100
commit45282d3a54cc50306383c41e4c7e3d982cac69d1 (patch)
treed9b9046dae519f1e48716a7497c1dc8505d5e4d8 /client/src/shader.wgsl
parent44ef37bca0aa633f8c59d849946faf2319c5446b (diff)
downloadweareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar
weareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar.bz2
weareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar.zst
mesh not visible
Diffstat (limited to 'client/src/shader.wgsl')
-rw-r--r--client/src/shader.wgsl33
1 files changed, 26 insertions, 7 deletions
diff --git a/client/src/shader.wgsl b/client/src/shader.wgsl
index 41c21d9..68bd93d 100644
--- a/client/src/shader.wgsl
+++ b/client/src/shader.wgsl
@@ -1,11 +1,30 @@
-@vertex
-fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
- let x = f32(i32(in_vertex_index) % 2);
- let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
- return vec4<f32>(x, y, 0.0, 1.0);
+
+struct VertexIn {
+ @location(0) x: f32,
+ @location(1) y: f32,
+ @location(2) z: f32,
+ @location(3) nx: f32,
+ @location(4) ny: f32,
+ @location(5) nz: f32,
+ @location(6) u: f32,
+ @location(7) v: f32,
+}
+struct VertexOut {
+ @builtin(position) clip: vec4<f32>,
+ @location(0) normal: vec3<f32>,
+ @location(1) uv: vec2<f32>,
}
+@vertex
+fn vs_main(vi: VertexIn) -> VertexOut {
+ let vo = VertexOut(
+ vec4(vi.x * 0.1, vi.y * 0.1, 0., 1.),
+ vec3(vi.nx, vi.ny, vi.nz),
+ vec2(vi.u, vi.v),
+ );
+ return vo;
+}
@fragment
-fn fs_main() -> @location(0) vec4<f32> {
- return vec4<f32>(1.0, 0.0, 0.0, 1.0);
+fn fs_main(vo: VertexOut) -> @location(0) vec4<f32> {
+ return vec4<f32>(vo.normal, 1.0);
}