From 7d6c9bc2f10a479d9e054af56a75e535d1015b79 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 21 Feb 2026 10:24:24 +0100 Subject: docs: Update WGSL files to use shorter vector and matrix type aliases Replaced `vec2`, `vec3`, `vec4`, `mat4x4`, and `mat3x3` with their shorter aliases `vec2f`, `vec3f`, `vec4f`, `mat4x4f`, and `mat3x3f` across all WGSL shader files in `workspaces/main/shaders/`. This improves readability and aligns with modern WGSL conventions. --- workspaces/main/shaders/scene1.wgsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'workspaces/main/shaders/scene1.wgsl') diff --git a/workspaces/main/shaders/scene1.wgsl b/workspaces/main/shaders/scene1.wgsl index 8cc36cd..035f2e9 100644 --- a/workspaces/main/shaders/scene1.wgsl +++ b/workspaces/main/shaders/scene1.wgsl @@ -23,7 +23,7 @@ const sunDir1 = vec3f(0.0, 0.04997, -0.99875); // normalize(0, 0.05, -1) const lightPos1 = vec3f(10.0, 10.0, 10.0); const lightPos2 = vec3f(-10.0, 10.0, -10.0); -fn rayPlane(ray: Ray, plane: vec4) -> f32 { +fn rayPlane(ray: Ray, plane: vec4f) -> f32 { return (dot(ray.origin, plane.xyz) - plane.w) / dot(ray.direction, plane.xyz); } @@ -40,7 +40,7 @@ fn render0(ray: Ray) -> vec3f { if (tp1 > 0.0) { let pos = ray.origin + tp1 * ray.direction; let pp = pos.xz; - let db = sdBox2D(pp, vec2(5.0, 9.0)) - 3.0; + let db = sdBox2D(pp, vec2f(5.0, 9.0)) - 3.0; col += vec3f(4.0) * skyCol * y * y * smoothstep(0.25, 0.0, db); col += vec3f(0.8) * skyCol * exp(-0.5 * max(db, 0.0)); } @@ -155,7 +155,7 @@ fn render1(ray: Ray) -> vec3f { #include "render/fullscreen_vs" -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let coord = getScreenCoord(p, uniforms.resolution); let ray = getCameraRay(camera, coord); var col = render1(ray); -- cgit v1.2.3