diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-21 10:24:24 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-21 10:24:24 +0100 |
| commit | 7d6c9bc2f10a479d9e054af56a75e535d1015b79 (patch) | |
| tree | a364cc4d16052162c48e15e9e05e491e9ba1e758 /workspaces/main/shaders/scene1.wgsl | |
| parent | 53187e2d930cf982a0bc7f99262586c6a8a0640a (diff) | |
docs: Update WGSL files to use shorter vector and matrix type aliases
Replaced `vec2<f32>`, `vec3<f32>`, `vec4<f32>`, `mat4x4<f32>`, and `mat3x3<f32>` 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.
Diffstat (limited to 'workspaces/main/shaders/scene1.wgsl')
| -rw-r--r-- | workspaces/main/shaders/scene1.wgsl | 6 |
1 files changed, 3 insertions, 3 deletions
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>) -> 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<f32>(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<f32>) -> @location(0) vec4<f32> { +@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); |
