summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/shaders/camera_common.wgsl4
-rw-r--r--common/shaders/combined_postprocess.wgsl2
-rw-r--r--common/shaders/common_uniforms.wgsl20
-rw-r--r--common/shaders/compute/gen_blend.wgsl4
-rw-r--r--common/shaders/compute/gen_grid.wgsl2
-rw-r--r--common/shaders/compute/gen_mask.wgsl4
-rw-r--r--common/shaders/compute/gen_noise.wgsl6
-rw-r--r--common/shaders/compute/gen_perlin.wgsl6
-rw-r--r--common/shaders/gaussian_blur.wgsl6
-rw-r--r--common/shaders/heptagon.wgsl16
-rw-r--r--common/shaders/lighting.wgsl8
-rw-r--r--common/shaders/math/color.wgsl16
-rw-r--r--common/shaders/math/common_utils.wgsl18
-rw-r--r--common/shaders/math/noise.wgsl68
-rw-r--r--common/shaders/math/sdf_shapes.wgsl18
-rw-r--r--common/shaders/math/sdf_utils.wgsl32
-rw-r--r--common/shaders/math/utils.wgsl4
-rw-r--r--common/shaders/passthrough.wgsl2
-rw-r--r--common/shaders/postprocess_inline.wgsl32
-rw-r--r--common/shaders/ray_box.wgsl2
-rw-r--r--common/shaders/ray_triangle.wgsl16
-rw-r--r--common/shaders/render/fullscreen_uv_vs.wgsl4
-rw-r--r--common/shaders/render/fullscreen_vs.wgsl12
-rw-r--r--common/shaders/render/lighting_utils.wgsl4
-rw-r--r--common/shaders/render/raymarching.wgsl2
-rw-r--r--common/shaders/render/raymarching_id.wgsl2
-rw-r--r--common/shaders/render/scene_query_bvh.wgsl16
-rw-r--r--common/shaders/render/scene_query_linear.wgsl12
-rw-r--r--common/shaders/render/shadows.wgsl2
-rw-r--r--common/shaders/sequence_uniforms.wgsl2
-rw-r--r--common/shaders/skybox.wgsl4
31 files changed, 173 insertions, 173 deletions
diff --git a/common/shaders/camera_common.wgsl b/common/shaders/camera_common.wgsl
index c7daebf..846d052 100644
--- a/common/shaders/camera_common.wgsl
+++ b/common/shaders/camera_common.wgsl
@@ -1,7 +1,7 @@
// Camera parameters and helpers for SDF raymarching effects
struct CameraParams {
- inv_view: mat4x4<f32>,
+ inv_view: mat4x4f,
fov: f32,
near_plane: f32,
far_plane: f32,
@@ -14,7 +14,7 @@ struct Ray {
}
// Generate camera ray for given UV coordinates (-1 to 1)
-fn getCameraRay(cam: CameraParams, uv: vec2<f32>) -> Ray {
+fn getCameraRay(cam: CameraParams, uv: vec2f) -> Ray {
let cam_pos = vec3f(cam.inv_view[3].x, cam.inv_view[3].y, cam.inv_view[3].z);
// Compute ray direction from FOV and aspect ratio
diff --git a/common/shaders/combined_postprocess.wgsl b/common/shaders/combined_postprocess.wgsl
index bf43d6e..c0acfe7 100644
--- a/common/shaders/combined_postprocess.wgsl
+++ b/common/shaders/combined_postprocess.wgsl
@@ -9,7 +9,7 @@
@group(0) @binding(1) var input_texture: texture_2d<f32>;
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
-@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
// Sample base color
var color = textureSample(input_texture, input_sampler, in.uv);
diff --git a/common/shaders/common_uniforms.wgsl b/common/shaders/common_uniforms.wgsl
index 1ab8939..5dc0251 100644
--- a/common/shaders/common_uniforms.wgsl
+++ b/common/shaders/common_uniforms.wgsl
@@ -1,5 +1,5 @@
struct CommonUniforms {
- resolution: vec2<f32>, // Screen dimensions
+ resolution: vec2f, // Screen dimensions
aspect_ratio: f32, // Width/height ratio
time: f32, // Physical time in seconds (unaffected by tempo)
beat_time: f32, // Musical time in beats (absolute, tempo-scaled)
@@ -8,17 +8,17 @@ struct CommonUniforms {
_pad: f32, // Padding
};
struct GlobalUniforms {
- view_proj: mat4x4<f32>,
- inv_view_proj: mat4x4<f32>,
- camera_pos_time: vec4<f32>,
- params: vec4<f32>,
- resolution: vec2<f32>,
+ view_proj: mat4x4f,
+ inv_view_proj: mat4x4f,
+ camera_pos_time: vec4f,
+ params: vec4f,
+ resolution: vec2f,
};
struct ObjectData {
- model: mat4x4<f32>,
- inv_model: mat4x4<f32>,
- color: vec4<f32>,
- params: vec4<f32>,
+ model: mat4x4f,
+ inv_model: mat4x4f,
+ color: vec4f,
+ params: vec4f,
};
struct ObjectsBuffer {
objects: array<ObjectData>,
diff --git a/common/shaders/compute/gen_blend.wgsl b/common/shaders/compute/gen_blend.wgsl
index 9fc9e1e..c6be7bb 100644
--- a/common/shaders/compute/gen_blend.wgsl
+++ b/common/shaders/compute/gen_blend.wgsl
@@ -18,8 +18,8 @@ struct BlendParams {
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
if (id.x >= params.width || id.y >= params.height) { return; }
- let uv = vec2<f32>(f32(id.x) / f32(params.width),
- f32(id.y) / f32(params.height));
+ let uv = vec2f(f32(id.x) / f32(params.width),
+ f32(id.y) / f32(params.height));
let color_a = textureSampleLevel(input_a, tex_sampler, uv, 0.0);
let color_b = textureSampleLevel(input_b, tex_sampler, uv, 0.0);
diff --git a/common/shaders/compute/gen_grid.wgsl b/common/shaders/compute/gen_grid.wgsl
index cc5e189..4ce7ea3 100644
--- a/common/shaders/compute/gen_grid.wgsl
+++ b/common/shaders/compute/gen_grid.wgsl
@@ -20,5 +20,5 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
let val = select(0.0, 1.0, on_line);
- textureStore(output_tex, id.xy, vec4<f32>(val, val, val, 1.0));
+ textureStore(output_tex, id.xy, vec4f(val, val, val, 1.0));
}
diff --git a/common/shaders/compute/gen_mask.wgsl b/common/shaders/compute/gen_mask.wgsl
index 1ce9f52..39f5b50 100644
--- a/common/shaders/compute/gen_mask.wgsl
+++ b/common/shaders/compute/gen_mask.wgsl
@@ -16,8 +16,8 @@ struct MaskParams {
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
if (id.x >= params.width || id.y >= params.height) { return; }
- let uv = vec2<f32>(f32(id.x) / f32(params.width),
- f32(id.y) / f32(params.height));
+ let uv = vec2f(f32(id.x) / f32(params.width),
+ f32(id.y) / f32(params.height));
let color_a = textureSampleLevel(input_a, tex_sampler, uv, 0.0);
let mask_b = textureSampleLevel(input_b, tex_sampler, uv, 0.0);
diff --git a/common/shaders/compute/gen_noise.wgsl b/common/shaders/compute/gen_noise.wgsl
index 5c0babd..7b75f13 100644
--- a/common/shaders/compute/gen_noise.wgsl
+++ b/common/shaders/compute/gen_noise.wgsl
@@ -17,10 +17,10 @@ struct NoiseParams {
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
if (id.x >= params.width || id.y >= params.height) { return; }
- let uv = vec2<f32>(f32(id.x) / f32(params.width),
- f32(id.y) / f32(params.height));
+ let uv = vec2f(f32(id.x) / f32(params.width),
+ f32(id.y) / f32(params.height));
let p = uv * params.frequency + params.seed;
let noise = noise_2d(p);
- textureStore(output_tex, id.xy, vec4<f32>(noise, noise, noise, 1.0));
+ textureStore(output_tex, id.xy, vec4f(noise, noise, noise, 1.0));
}
diff --git a/common/shaders/compute/gen_perlin.wgsl b/common/shaders/compute/gen_perlin.wgsl
index 73816d6..2807f6d 100644
--- a/common/shaders/compute/gen_perlin.wgsl
+++ b/common/shaders/compute/gen_perlin.wgsl
@@ -21,8 +21,8 @@ struct PerlinParams {
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
if (id.x >= params.width || id.y >= params.height) { return; }
- let uv = vec2<f32>(f32(id.x) / f32(params.width),
- f32(id.y) / f32(params.height));
+ let uv = vec2f(f32(id.x) / f32(params.width),
+ f32(id.y) / f32(params.height));
var value = 0.0;
var amplitude = params.amplitude;
@@ -40,5 +40,5 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
value /= total_amp;
let clamped = clamp(value, 0.0, 1.0);
- textureStore(output_tex, id.xy, vec4<f32>(clamped, clamped, clamped, 1.0));
+ textureStore(output_tex, id.xy, vec4f(clamped, clamped, clamped, 1.0));
}
diff --git a/common/shaders/gaussian_blur.wgsl b/common/shaders/gaussian_blur.wgsl
index 551d522..7f85719 100644
--- a/common/shaders/gaussian_blur.wgsl
+++ b/common/shaders/gaussian_blur.wgsl
@@ -7,17 +7,17 @@
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
struct GaussianBlurParams {
- direction: vec2<f32>,
+ direction: vec2f,
radius: f32,
_pad: f32,
};
@group(0) @binding(3) var<uniform> params: GaussianBlurParams;
-@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
let texel_size = 1.0 / uniforms.resolution;
let offset = params.direction * texel_size;
- var color = vec4<f32>(0.0);
+ var color = vec4f(0.0);
let kernel_size = i32(params.radius);
var weight_sum = 0.0;
diff --git a/common/shaders/heptagon.wgsl b/common/shaders/heptagon.wgsl
index 519dce5..a8a450f 100644
--- a/common/shaders/heptagon.wgsl
+++ b/common/shaders/heptagon.wgsl
@@ -5,29 +5,29 @@
// Standard v2 post-process layout (bindings 0,1 unused for scene effects)
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
-fn sdf_heptagon(p: vec2<f32>, r: f32) -> f32 {
+fn sdf_heptagon(p: vec2f, r: f32) -> f32 {
let an = 3.141593 / 7.0; // PI/7 for heptagon
- let acs = vec2<f32>(cos(an), sin(an));
+ let acs = vec2f(cos(an), sin(an));
let bn = (atan2(p.x, p.y) % (2.0 * an)) - an;
- let q = length(p) * vec2<f32>(cos(bn), abs(sin(bn)));
+ let q = length(p) * vec2f(cos(bn), abs(sin(bn)));
return length(q - r * acs) * sign(q.x - r * acs.x);
}
-@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
let aspect = uniforms.aspect_ratio;
- let uv = (in.uv * 2.0 - 1.0) * vec2<f32>(aspect, 1.0);
+ let uv = (in.uv * 2.0 - 1.0) * vec2f(aspect, 1.0);
let rotation = uniforms.beat_time * 0.5;
let c = cos(rotation);
let s = sin(rotation);
- let rot_uv = vec2<f32>(
+ let rot_uv = vec2f(
uv.x * c - uv.y * s,
uv.x * s + uv.y * c
);
let dist = sdf_heptagon(rot_uv, 0.3);
- let color = mix(vec3<f32>(0.2, 0.4, 0.8), vec3<f32>(1.0, 0.8, 0.2),
+ let color = mix(vec3f(0.2, 0.4, 0.8), vec3f(1.0, 0.8, 0.2),
smoothstep(0.01, -0.01, dist));
- return vec4<f32>(color, 1.0);
+ return vec4f(color, 1.0);
}
diff --git a/common/shaders/lighting.wgsl b/common/shaders/lighting.wgsl
index ac2142b..fd92c1a 100644
--- a/common/shaders/lighting.wgsl
+++ b/common/shaders/lighting.wgsl
@@ -1,15 +1,15 @@
-fn get_normal_basic(p: vec3<f32>, obj_params: vec4<f32>) -> vec3<f32> {
+fn get_normal_basic(p: vec3f, obj_params: vec4f) -> vec3f {
let obj_type = obj_params.x;
if (obj_type == 1.0) { return normalize(p); }
- let e = vec2<f32>(0.001, 0.0);
- return normalize(vec3<f32>(
+ let e = vec2f(0.001, 0.0);
+ return normalize(vec3f(
get_dist(p + e.xyy, obj_params) - get_dist(p - e.xyy, obj_params),
get_dist(p + e.yxy, obj_params) - get_dist(p - e.yxy, obj_params),
get_dist(p + e.yyx, obj_params) - get_dist(p - e.yyx, obj_params)
));
}
-fn calc_shadow(ro: vec3<f32>, rd: vec3<f32>, tmin: f32, tmax: f32, skip_idx: u32) -> f32 {
+fn calc_shadow(ro: vec3f, rd: vec3f, tmin: f32, tmax: f32, skip_idx: u32) -> f32 {
var res = 1.0;
var t = tmin;
if (t < 0.05) { t = 0.05; }
diff --git a/common/shaders/math/color.wgsl b/common/shaders/math/color.wgsl
index b63c915..9352053 100644
--- a/common/shaders/math/color.wgsl
+++ b/common/shaders/math/color.wgsl
@@ -2,26 +2,26 @@
// sRGB to Linear approximation
// Note: Assumes input is in sRGB color space.
-fn sRGB(t: vec3<f32>) -> vec3<f32> {
- return mix(1.055 * pow(t, vec3<f32>(1.0/2.4)) - 0.055, 12.92 * t, step(t, vec3<f32>(0.0031308)));
+fn sRGB(t: vec3f) -> vec3f {
+ return mix(1.055 * pow(t, vec3f(1.0/2.4)) - 0.055, 12.92 * t, step(t, vec3f(0.0031308)));
}
// ACES Filmic Tone Mapping (Approximate)
// A common tone mapping algorithm used in games and film.
-fn aces_approx(v_in: vec3<f32>) -> vec3<f32> {
- var v = max(v_in, vec3<f32>(0.0));
+fn aces_approx(v_in: vec3f) -> vec3f {
+ var v = max(v_in, vec3f(0.0));
v *= 0.6;
let a = 2.51;
let b = 0.03;
let c = 2.43;
let d = 0.59;
let e = 0.14;
- return clamp((v * (a * v + b)) / (v * (c * v + d) + e), vec3<f32>(0.0), vec3<f32>(1.0));
+ return clamp((v * (a * v + b)) / (v * (c * v + d) + e), vec3f(0.0), vec3f(1.0));
}
// HSV to RGB conversion
-const hsv2rgb_K = vec4<f32>(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
-fn hsv2rgb(c: vec3<f32>) -> vec3<f32> {
+const hsv2rgb_K = vec4f(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+fn hsv2rgb(c: vec3f) -> vec3f {
let p = abs(fract(c.xxx + hsv2rgb_K.xyz) * 6.0 - hsv2rgb_K.www);
- return c.z * mix(hsv2rgb_K.xxx, clamp(p - hsv2rgb_K.xxx, vec3<f32>(0.0), vec3<f32>(1.0)), c.y);
+ return c.z * mix(hsv2rgb_K.xxx, clamp(p - hsv2rgb_K.xxx, vec3f(0.0), vec3f(1.0)), c.y);
}
diff --git a/common/shaders/math/common_utils.wgsl b/common/shaders/math/common_utils.wgsl
index b8446b4..6ebc25a 100644
--- a/common/shaders/math/common_utils.wgsl
+++ b/common/shaders/math/common_utils.wgsl
@@ -6,28 +6,28 @@ const PI: f32 = 3.14159265359;
const TAU: f32 = 6.28318530718;
// Transform normal from local to world space using inverse model matrix
-fn transform_normal(inv_model: mat4x4<f32>, normal_local: vec3f) -> vec3f {
- let normal_matrix = mat3x3<f32>(inv_model[0].xyz, inv_model[1].xyz, inv_model[2].xyz);
+fn transform_normal(inv_model: mat4x4f, normal_local: vec3f) -> vec3f {
+ let normal_matrix = mat3x3f(inv_model[0].xyz, inv_model[1].xyz, inv_model[2].xyz);
return normalize(normal_matrix * normal_local);
}
// Spherical UV mapping (sphere or any radial surface)
// Returns UV in [0,1] range
-fn spherical_uv(p: vec3f) -> vec2<f32> {
+fn spherical_uv(p: vec3f) -> vec2f {
let u = atan2(p.x, p.z) / TAU + 0.5;
let v = acos(clamp(p.y / length(p), -1.0, 1.0)) / PI;
- return vec2<f32>(u, v);
+ return vec2f(u, v);
}
// Spherical UV from direction vector (for skybox, etc.)
-fn spherical_uv_from_dir(dir: vec3f) -> vec2<f32> {
+fn spherical_uv_from_dir(dir: vec3f) -> vec2f {
let u = atan2(dir.z, dir.x) / TAU + 0.5;
let v = asin(clamp(dir.y, -1.0, 1.0)) / PI + 0.5;
- return vec2<f32>(u, v);
+ return vec2f(u, v);
}
// Grid pattern for procedural texturing (checkerboard-like)
-fn grid_pattern(uv: vec2<f32>) -> f32 {
+fn grid_pattern(uv: vec2f) -> f32 {
let grid = 0.5 + 0.5 * sin(uv.x * PI) * sin(uv.y * PI);
return smoothstep(0.45, 0.55, grid);
}
@@ -37,8 +37,8 @@ fn grid_pattern(uv: vec2<f32>) -> f32 {
// Calculates normalized screen coordinates from fragment position and resolution.
// Input `p` is the fragment's @builtin(position), `resolution` is the screen resolution.
-// Returns a vec2<f32> in NDC space, with X adjusted for aspect ratio.
-fn getScreenCoord(p: vec4<f32>, resolution: vec2<f32>) -> vec2<f32> {
+// Returns a vec2f in NDC space, with X adjusted for aspect ratio.
+fn getScreenCoord(p: vec4f, resolution: vec2f) -> vec2f {
let q = p.xy / resolution;
var coord = -1.0 + 2.0 * q;
coord.x *= resolution.x / resolution.y;
diff --git a/common/shaders/math/noise.wgsl b/common/shaders/math/noise.wgsl
index 9f99e4a..dd97e02 100644
--- a/common/shaders/math/noise.wgsl
+++ b/common/shaders/math/noise.wgsl
@@ -14,31 +14,31 @@ fn hash_1f(x: f32) -> f32 {
return fract(v);
}
-// Hash: vec2<f32> -> f32
+// Hash: vec2f -> f32
// 2D coordinate to single hash value
-fn hash_2f(p: vec2<f32>) -> f32 {
- var h = dot(p, vec2<f32>(127.1, 311.7));
+fn hash_2f(p: vec2f) -> f32 {
+ var h = dot(p, vec2f(127.1, 311.7));
return fract(sin(h) * 43758.5453123);
}
-// Hash: vec2<f32> -> vec2<f32>
+// Hash: vec2f -> vec2f
// 2D coordinate to 2D hash (from Shadertoy 4djSRW)
-fn hash_2f_2f(p: vec2<f32>) -> vec2<f32> {
- var p3 = fract(vec3<f32>(p.x, p.y, p.x) * vec3<f32>(0.1021, 0.1013, 0.0977));
+fn hash_2f_2f(p: vec2f) -> vec2f {
+ var p3 = fract(vec3f(p.x, p.y, p.x) * vec3f(0.1021, 0.1013, 0.0977));
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.xx + p3.yz) * p3.zy);
}
-// Hash: vec3<f32> -> f32
+// Hash: vec3f -> f32
// 3D coordinate to single hash value
-fn hash_3f(p: vec3<f32>) -> f32 {
- var h = dot(p, vec3<f32>(127.1, 311.7, 74.7));
+fn hash_3f(p: vec3f) -> f32 {
+ var h = dot(p, vec3f(127.1, 311.7, 74.7));
return fract(sin(h) * 43758.5453123);
}
-// Hash: vec3<f32> -> vec3<f32>
+// Hash: vec3f -> vec3f
// 3D coordinate to 3D hash
-fn hash_3f_3f(p: vec3<f32>) -> vec3<f32> {
+fn hash_3f_3f(p: vec3f) -> vec3f {
var v = fract(p);
v += dot(v, v.yxz + 32.41);
return fract((v.xxy + v.yzz) * v.zyx);
@@ -56,14 +56,14 @@ fn hash_1u(p: u32) -> f32 {
return bitcast<f32>((P >> 9u) | 0x3f800000u) - 1.0;
}
-// Hash: u32 -> vec2<f32>
-fn hash_1u_2f(p: u32) -> vec2<f32> {
- return vec2<f32>(hash_1u(p), hash_1u(p + 1423u));
+// Hash: u32 -> vec2f
+fn hash_1u_2f(p: u32) -> vec2f {
+ return vec2f(hash_1u(p), hash_1u(p + 1423u));
}
-// Hash: u32 -> vec3<f32>
-fn hash_1u_3f(p: u32) -> vec3<f32> {
- return vec3<f32>(hash_1u(p), hash_1u(p + 1423u), hash_1u(p + 124453u));
+// Hash: u32 -> vec3f
+fn hash_1u_3f(p: u32) -> vec3f {
+ return vec3f(hash_1u(p), hash_1u(p + 1423u), hash_1u(p + 124453u));
}
// ============================================
@@ -72,32 +72,32 @@ fn hash_1u_3f(p: u32) -> vec3<f32> {
// Value Noise: 2D
// Interpolated grid noise using smoothstep
-fn noise_2d(p: vec2<f32>) -> f32 {
+fn noise_2d(p: vec2f) -> f32 {
let i = floor(p);
let f = fract(p);
let u = f * f * (3.0 - 2.0 * f);
- let n0 = hash_2f(i + vec2<f32>(0.0, 0.0));
- let n1 = hash_2f(i + vec2<f32>(1.0, 0.0));
- let n2 = hash_2f(i + vec2<f32>(0.0, 1.0));
- let n3 = hash_2f(i + vec2<f32>(1.0, 1.0));
+ let n0 = hash_2f(i + vec2f(0.0, 0.0));
+ let n1 = hash_2f(i + vec2f(1.0, 0.0));
+ let n2 = hash_2f(i + vec2f(0.0, 1.0));
+ let n3 = hash_2f(i + vec2f(1.0, 1.0));
let ix0 = mix(n0, n1, u.x);
let ix1 = mix(n2, n3, u.x);
return mix(ix0, ix1, u.y);
}
// Value Noise: 3D
-fn noise_3d(p: vec3<f32>) -> f32 {
+fn noise_3d(p: vec3f) -> f32 {
let i = floor(p);
let f = fract(p);
let u = f * f * (3.0 - 2.0 * f);
- let n000 = hash_3f(i + vec3<f32>(0.0, 0.0, 0.0));
- let n100 = hash_3f(i + vec3<f32>(1.0, 0.0, 0.0));
- let n010 = hash_3f(i + vec3<f32>(0.0, 1.0, 0.0));
- let n110 = hash_3f(i + vec3<f32>(1.0, 1.0, 0.0));
- let n001 = hash_3f(i + vec3<f32>(0.0, 0.0, 1.0));
- let n101 = hash_3f(i + vec3<f32>(1.0, 0.0, 1.0));
- let n011 = hash_3f(i + vec3<f32>(0.0, 1.0, 1.0));
- let n111 = hash_3f(i + vec3<f32>(1.0, 1.0, 1.0));
+ let n000 = hash_3f(i + vec3f(0.0, 0.0, 0.0));
+ let n100 = hash_3f(i + vec3f(1.0, 0.0, 0.0));
+ let n010 = hash_3f(i + vec3f(0.0, 1.0, 0.0));
+ let n110 = hash_3f(i + vec3f(1.0, 1.0, 0.0));
+ let n001 = hash_3f(i + vec3f(0.0, 0.0, 1.0));
+ let n101 = hash_3f(i + vec3f(1.0, 0.0, 1.0));
+ let n011 = hash_3f(i + vec3f(0.0, 1.0, 1.0));
+ let n111 = hash_3f(i + vec3f(1.0, 1.0, 1.0));
let ix00 = mix(n000, n100, u.x);
let ix10 = mix(n010, n110, u.x);
let ix01 = mix(n001, n101, u.x);
@@ -113,13 +113,13 @@ fn noise_3d(p: vec3<f32>) -> f32 {
// Gyroid function (periodic triply-orthogonal minimal surface)
// Useful for procedural patterns and cellular structures
-fn gyroid(p: vec3<f32>) -> f32 {
+fn gyroid(p: vec3f) -> f32 {
return abs(0.04 + dot(sin(p), cos(p.zxy)));
}
// Fractional Brownian Motion (FBM) 2D
// Multi-octave noise for natural-looking variation
-fn fbm_2d(p: vec2<f32>, octaves: i32) -> f32 {
+fn fbm_2d(p: vec2f, octaves: i32) -> f32 {
var value = 0.0;
var amplitude = 0.5;
var frequency = 1.0;
@@ -133,7 +133,7 @@ fn fbm_2d(p: vec2<f32>, octaves: i32) -> f32 {
}
// Fractional Brownian Motion (FBM) 3D
-fn fbm_3d(p: vec3<f32>, octaves: i32) -> f32 {
+fn fbm_3d(p: vec3f, octaves: i32) -> f32 {
var value = 0.0;
var amplitude = 0.5;
var frequency = 1.0;
diff --git a/common/shaders/math/sdf_shapes.wgsl b/common/shaders/math/sdf_shapes.wgsl
index 4dcfdd6..2dfae3e 100644
--- a/common/shaders/math/sdf_shapes.wgsl
+++ b/common/shaders/math/sdf_shapes.wgsl
@@ -1,30 +1,30 @@
// 3D SDF primitives
-fn sdSphere(p: vec3<f32>, r: f32) -> f32 {
+fn sdSphere(p: vec3f, r: f32) -> f32 {
return length(p) - r;
}
-fn sdBox(p: vec3<f32>, b: vec3<f32>) -> f32 {
+fn sdBox(p: vec3f, b: vec3f) -> f32 {
let q = abs(p) - b;
- return length(max(q, vec3<f32>(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0);
+ return length(max(q, vec3f(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0);
}
-fn sdTorus(p: vec3<f32>, t: vec2<f32>) -> f32 {
- let q = vec2<f32>(length(p.xz) - t.x, p.y);
+fn sdTorus(p: vec3f, t: vec2f) -> f32 {
+ let q = vec2f(length(p.xz) - t.x, p.y);
return length(q) - t.y;
}
-fn sdPlane(p: vec3<f32>, n: vec3<f32>, h: f32) -> f32 {
+fn sdPlane(p: vec3f, n: vec3f, h: f32) -> f32 {
return dot(p, n) + h;
}
// 2D SDF primitives
-fn sdBox2D(p: vec2<f32>, b: vec2<f32>) -> f32 {
+fn sdBox2D(p: vec2f, b: vec2f) -> f32 {
let d = abs(p) - b;
- return length(max(d, vec2<f32>(0.0))) + min(max(d.x, d.y), 0.0);
+ return length(max(d, vec2f(0.0))) + min(max(d.x, d.y), 0.0);
}
// Approximate
-fn sdEllipse(p: vec2<f32>, ab: vec2<f32>) -> f32 {
+fn sdEllipse(p: vec2f, ab: vec2f) -> f32 {
let d = length(p / ab);
return length(p) * (1.0 - 1.0 / d);
}
diff --git a/common/shaders/math/sdf_utils.wgsl b/common/shaders/math/sdf_utils.wgsl
index 660a4ce..5a77c7e 100644
--- a/common/shaders/math/sdf_utils.wgsl
+++ b/common/shaders/math/sdf_utils.wgsl
@@ -1,8 +1,8 @@
-fn get_normal_basic(p: vec3<f32>, obj_params: vec4<f32>) -> vec3<f32> {
+fn get_normal_basic(p: vec3f, obj_params: vec4f) -> vec3f {
let obj_type = obj_params.x;
if (obj_type == 1.0) { return normalize(p); }
- let e = vec2<f32>(0.001, 0.0);
- return normalize(vec3<f32>(
+ let e = vec2f(0.001, 0.0);
+ return normalize(vec3f(
get_dist(p + e.xyy, obj_params) - get_dist(p - e.xyy, obj_params),
get_dist(p + e.yxy, obj_params) - get_dist(p - e.yxy, obj_params),
get_dist(p + e.yyx, obj_params) - get_dist(p - e.yyx, obj_params)
@@ -12,11 +12,11 @@ fn get_normal_basic(p: vec3<f32>, obj_params: vec4<f32>) -> vec3<f32> {
// Optimized normal estimation using tetrahedron pattern (4 SDF evals instead of 6).
// Slightly less accurate than central differences but faster.
// Uses tetrahedral gradient approximation with corners at (±1, ±1, ±1).
-fn get_normal_fast(p: vec3<f32>, obj_params: vec4<f32>) -> vec3<f32> {
+fn get_normal_fast(p: vec3f, obj_params: vec4f) -> vec3f {
let obj_type = obj_params.x;
if (obj_type == 1.0) { return normalize(p); }
let eps = 0.0001;
- let k = vec2<f32>(1.0, -1.0);
+ let k = vec2f(1.0, -1.0);
return normalize(
k.xyy * get_dist(p + k.xyy * eps, obj_params) +
k.yyx * get_dist(p + k.yyx * eps, obj_params) +
@@ -29,13 +29,13 @@ fn get_normal_fast(p: vec3<f32>, obj_params: vec4<f32>) -> vec3<f32> {
// High quality, suitable for detailed surfaces with displacement mapping.
// Note: Requires spherical_uv() function and get_dist() to be available in calling context.
fn get_normal_bump(
- p: vec3<f32>,
- obj_params: vec4<f32>,
+ p: vec3f,
+ obj_params: vec4f,
noise_tex: texture_2d<f32>,
noise_sampler: sampler,
disp_strength: f32
-) -> vec3<f32> {
- let e = vec2<f32>(0.005, 0.0);
+) -> vec3f {
+ let e = vec2f(0.005, 0.0);
let q_x1 = p + e.xyy;
let uv_x1 = spherical_uv(q_x1);
@@ -67,21 +67,21 @@ fn get_normal_bump(
let h_z2 = textureSample(noise_tex, noise_sampler, uv_z2).r;
let d_z2 = get_dist(q_z2, obj_params) - disp_strength * h_z2;
- return normalize(vec3<f32>(d_x1 - d_x2, d_y1 - d_y2, d_z1 - d_z2));
+ return normalize(vec3f(d_x1 - d_x2, d_y1 - d_y2, d_z1 - d_z2));
}
// Optimized bump-mapped normal using tetrahedron pattern (4 samples instead of 6).
// 33% faster than get_normal_bump(), slightly less accurate.
// Suitable for real-time rendering with displacement mapping.
fn get_normal_bump_fast(
- p: vec3<f32>,
- obj_params: vec4<f32>,
+ p: vec3f,
+ obj_params: vec4f,
noise_tex: texture_2d<f32>,
noise_sampler: sampler,
disp_strength: f32
-) -> vec3<f32> {
+) -> vec3f {
let eps = 0.0005;
- let k = vec2<f32>(1.0, -1.0);
+ let k = vec2f(1.0, -1.0);
let q1 = p + k.xyy * eps;
let uv1 = spherical_uv(q1);
@@ -107,9 +107,9 @@ fn get_normal_bump_fast(
}
// Distance to an Axis-Aligned Bounding Box
-fn aabb_sdf(p: vec3<f32>, min_p: vec3<f32>, max_p: vec3<f32>) -> f32 {
+fn aabb_sdf(p: vec3f, min_p: vec3f, max_p: vec3f) -> f32 {
let center = (min_p + max_p) * 0.5;
let extent = (max_p - min_p) * 0.5;
let q = abs(p - center) - extent;
- return length(max(q, vec3<f32>(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0);
+ return length(max(q, vec3f(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0);
}
diff --git a/common/shaders/math/utils.wgsl b/common/shaders/math/utils.wgsl
index 85f0bdf..c75cb66 100644
--- a/common/shaders/math/utils.wgsl
+++ b/common/shaders/math/utils.wgsl
@@ -1,10 +1,10 @@
// General-purpose math utility functions.
// Returns a 2x2 rotation matrix.
-fn rot(a: f32) -> mat2x2<f32> {
+fn rot(a: f32) -> mat2x2f {
let c = cos(a);
let s = sin(a);
- return mat2x2<f32>(c, s, -s, c);
+ return mat2x2f(c, s, -s, c);
}
// Fast approximation of tanh.
diff --git a/common/shaders/passthrough.wgsl b/common/shaders/passthrough.wgsl
index 265082a..bce377c 100644
--- a/common/shaders/passthrough.wgsl
+++ b/common/shaders/passthrough.wgsl
@@ -6,6 +6,6 @@
@group(0) @binding(1) var input_texture: texture_2d<f32>;
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
-@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
return textureSample(input_texture, input_sampler, in.uv);
}
diff --git a/common/shaders/postprocess_inline.wgsl b/common/shaders/postprocess_inline.wgsl
index fcc5e27..84ef3d3 100644
--- a/common/shaders/postprocess_inline.wgsl
+++ b/common/shaders/postprocess_inline.wgsl
@@ -2,29 +2,29 @@
// Use these instead of separate effect classes for v2 sequences
// Vignette: darkens edges based on distance from center
-fn apply_vignette(color: vec4<f32>, uv: vec2<f32>, radius: f32, softness: f32, intensity: f32) -> vec4<f32> {
- let d = distance(uv, vec2<f32>(0.5, 0.5));
+fn apply_vignette(color: vec4f, uv: vec2f, radius: f32, softness: f32, intensity: f32) -> vec4f {
+ let d = distance(uv, vec2f(0.5, 0.5));
let vignette = smoothstep(radius, radius - softness, d);
- return vec4<f32>(color.rgb * mix(1.0, vignette, intensity), color.a);
+ return vec4f(color.rgb * mix(1.0, vignette, intensity), color.a);
}
// Flash: additive white flash
-fn apply_flash(color: vec4<f32>, flash_intensity: f32) -> vec4<f32> {
- return color + vec4<f32>(flash_intensity, flash_intensity, flash_intensity, 0.0);
+fn apply_flash(color: vec4f, flash_intensity: f32) -> vec4f {
+ return color + vec4f(flash_intensity, flash_intensity, flash_intensity, 0.0);
}
// Fade: linear interpolation to target color
-fn apply_fade(color: vec4<f32>, fade_amount: f32, fade_color: vec3<f32>) -> vec4<f32> {
- return vec4<f32>(mix(color.rgb, fade_color, fade_amount), color.a);
+fn apply_fade(color: vec4f, fade_amount: f32, fade_color: vec3f) -> vec4f {
+ return vec4f(mix(color.rgb, fade_color, fade_amount), color.a);
}
// Theme modulation: multiply by color tint
-fn apply_theme(color: vec4<f32>, theme_color: vec3<f32>, strength: f32) -> vec4<f32> {
- return vec4<f32>(mix(color.rgb, color.rgb * theme_color, strength), color.a);
+fn apply_theme(color: vec4f, theme_color: vec3f, strength: f32) -> vec4f {
+ return vec4f(mix(color.rgb, color.rgb * theme_color, strength), color.a);
}
// Solarize: threshold-based color inversion
-fn apply_solarize(color: vec4<f32>, threshold: f32, strength: f32, time: f32) -> vec4<f32> {
+fn apply_solarize(color: vec4f, threshold: f32, strength: f32, time: f32) -> vec4f {
let pattern_num = u32(time / 2.0);
let is_even = (pattern_num % 2u) == 0u;
let thr = threshold + 0.15 * sin(time);
@@ -44,18 +44,18 @@ fn apply_solarize(color: vec4<f32>, threshold: f32, strength: f32, time: f32) ->
// Chroma aberration: RGB channel offset
fn apply_chroma_aberration(input_tex: texture_2d<f32>, input_sampler: sampler,
- uv: vec2<f32>, offset: f32, resolution: vec2<f32>) -> vec4<f32> {
+ uv: vec2f, offset: f32, resolution: vec2f) -> vec4f {
let pixel_offset = offset / resolution;
- let r = textureSample(input_tex, input_sampler, uv + vec2<f32>(pixel_offset.x, 0.0)).r;
+ let r = textureSample(input_tex, input_sampler, uv + vec2f(pixel_offset.x, 0.0)).r;
let g = textureSample(input_tex, input_sampler, uv).g;
- let b = textureSample(input_tex, input_sampler, uv - vec2<f32>(pixel_offset.x, 0.0)).b;
+ let b = textureSample(input_tex, input_sampler, uv - vec2f(pixel_offset.x, 0.0)).b;
let a = textureSample(input_tex, input_sampler, uv).a;
- return vec4<f32>(r, g, b, a);
+ return vec4f(r, g, b, a);
}
// Distort: UV distortion based on time
-fn apply_distort(uv: vec2<f32>, time: f32, strength: f32) -> vec2<f32> {
+fn apply_distort(uv: vec2f, time: f32, strength: f32) -> vec2f {
let distort_x = sin(uv.y * 10.0 + time * 2.0) * strength;
let distort_y = cos(uv.x * 10.0 + time * 2.0) * strength;
- return uv + vec2<f32>(distort_x, distort_y);
+ return uv + vec2f(distort_x, distort_y);
}
diff --git a/common/shaders/ray_box.wgsl b/common/shaders/ray_box.wgsl
index d56ea1b..37b9d6a 100644
--- a/common/shaders/ray_box.wgsl
+++ b/common/shaders/ray_box.wgsl
@@ -4,7 +4,7 @@ struct RayBounds {
hit: bool,
};
-fn ray_box_intersection(ro: vec3<f32>, rd: vec3<f32>, extent: vec3<f32>) -> RayBounds {
+fn ray_box_intersection(ro: vec3f, rd: vec3f, extent: vec3f) -> RayBounds {
let inv_rd = 1.0 / rd;
let t0 = (-extent - ro) * inv_rd;
let t1 = (extent - ro) * inv_rd;
diff --git a/common/shaders/ray_triangle.wgsl b/common/shaders/ray_triangle.wgsl
index 13341c8..ece823a 100644
--- a/common/shaders/ray_triangle.wgsl
+++ b/common/shaders/ray_triangle.wgsl
@@ -3,18 +3,18 @@
// Reference: "Fast, Minimum Storage Ray-Triangle Intersection"
struct TriangleHit {
- uv: vec2<f32>,
+ uv: vec2f,
z: f32,
- N: vec3<f32>,
+ N: vec3f,
hit: bool,
};
fn ray_triangle_intersection(
- orig: vec3<f32>,
- dir: vec3<f32>,
- p0: vec3<f32>,
- p1: vec3<f32>,
- p2: vec3<f32>
+ orig: vec3f,
+ dir: vec3f,
+ p0: vec3f,
+ p1: vec3f,
+ p2: vec3f
) -> TriangleHit {
let d10 = p1 - p0;
let d20 = p2 - p0;
@@ -23,7 +23,7 @@ fn ray_triangle_intersection(
let invdet = 1.0 / det;
let d0 = orig - p0;
let nd = cross(d0, dir);
- let uv = vec2<f32>(dot(d20, nd), -dot(d10, nd)) * invdet;
+ let uv = vec2f(dot(d20, nd), -dot(d10, nd)) * invdet;
let z = dot(d0, N) * invdet;
let hit = det > 0.0 && z >= 0.0 && uv.x >= 0.0 && uv.y >= 0.0 && (uv.x + uv.y) < 1.0;
return TriangleHit(uv, z, N, hit);
diff --git a/common/shaders/render/fullscreen_uv_vs.wgsl b/common/shaders/render/fullscreen_uv_vs.wgsl
index 42d87c3..f9ae427 100644
--- a/common/shaders/render/fullscreen_uv_vs.wgsl
+++ b/common/shaders/render/fullscreen_uv_vs.wgsl
@@ -2,8 +2,8 @@
// Draws a single triangle that covers the entire screen, with uv
// coordinates in [0..1]
struct VertexOutput {
- @builtin(position) position: vec4<f32>,
- @location(0) uv: vec2<f32>,
+ @builtin(position) position: vec4f,
+ @location(0) uv: vec2f,
};
@vertex fn vs_main(@builtin(vertex_index) i: u32) -> VertexOutput {
diff --git a/common/shaders/render/fullscreen_vs.wgsl b/common/shaders/render/fullscreen_vs.wgsl
index a68604b..507b892 100644
--- a/common/shaders/render/fullscreen_vs.wgsl
+++ b/common/shaders/render/fullscreen_vs.wgsl
@@ -1,10 +1,10 @@
// Common vertex shader for fullscreen post-processing effects.
// Draws a single triangle that covers the entire screen.
-@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> {
- var pos = array<vec2<f32>, 3>(
- vec2<f32>(-1, -1),
- vec2<f32>(3, -1),
- vec2<f32>(-1, 3)
+@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4f {
+ var pos = array<vec2f, 3>(
+ vec2f(-1, -1),
+ vec2f( 3, -1),
+ vec2f(-1, 3)
);
- return vec4<f32>(pos[i], 0.0, 1.0);
+ return vec4f(pos[i], 0.0, 1.0);
}
diff --git a/common/shaders/render/lighting_utils.wgsl b/common/shaders/render/lighting_utils.wgsl
index d2fd2e2..f805860 100644
--- a/common/shaders/render/lighting_utils.wgsl
+++ b/common/shaders/render/lighting_utils.wgsl
@@ -1,5 +1,5 @@
-fn calculate_lighting(color: vec3<f32>, normal: vec3<f32>, pos: vec3<f32>, shadow: f32) -> vec3<f32> {
- let light_dir = normalize(vec3<f32>(1.0, 1.0, 1.0));
+fn calculate_lighting(color: vec3f, normal: vec3f, pos: vec3f, shadow: f32) -> vec3f {
+ let light_dir = normalize(vec3f(1.0, 1.0, 1.0));
let diffuse = max(dot(normal, light_dir), 0.0);
let lighting = diffuse * (0.1 + 0.9 * shadow) + 0.1; // Ambient + Shadowed Diffuse
return color * lighting;
diff --git a/common/shaders/render/raymarching.wgsl b/common/shaders/render/raymarching.wgsl
index 4e0327b..2d6616d 100644
--- a/common/shaders/render/raymarching.wgsl
+++ b/common/shaders/render/raymarching.wgsl
@@ -16,7 +16,7 @@ const NORM_OFF: f32 = 0.005;
// Computes the surface normal of the distance field at a point `pos`.
fn normal(pos: vec3f) -> vec3f {
- let eps = vec2<f32>(NORM_OFF, 0.0);
+ let eps = vec2f(NORM_OFF, 0.0);
var nor: vec3f;
nor.x = df(pos + eps.xyy) - df(pos - eps.xyy);
nor.y = df(pos + eps.yxy) - df(pos - eps.yxy);
diff --git a/common/shaders/render/raymarching_id.wgsl b/common/shaders/render/raymarching_id.wgsl
index 42be02d..d9f32b2 100644
--- a/common/shaders/render/raymarching_id.wgsl
+++ b/common/shaders/render/raymarching_id.wgsl
@@ -51,7 +51,7 @@ fn reconstructPosition(ray: Ray, result: RayMarchResult) -> vec3f {
// Normal calculation using dfWithID.
fn normalWithID(pos: vec3f) -> vec3f {
- let eps = vec2<f32>(NORM_OFF, 0.0);
+ let eps = vec2f(NORM_OFF, 0.0);
var nor: vec3f;
nor.x = dfWithID(pos + eps.xyy).distance - dfWithID(pos - eps.xyy).distance;
nor.y = dfWithID(pos + eps.yxy).distance - dfWithID(pos - eps.yxy).distance;
diff --git a/common/shaders/render/scene_query_bvh.wgsl b/common/shaders/render/scene_query_bvh.wgsl
index 3e6f895..cf2136b 100644
--- a/common/shaders/render/scene_query_bvh.wgsl
+++ b/common/shaders/render/scene_query_bvh.wgsl
@@ -2,25 +2,25 @@
#include "math/sdf_utils"
struct BVHNode {
- min: vec3<f32>,
+ min: vec3f,
left_idx: i32,
- max: vec3<f32>,
+ max: vec3f,
obj_idx_or_right: i32,
};
@group(0) @binding(2) var<storage, read> bvh_nodes: array<BVHNode>;
-fn get_dist(p: vec3<f32>, obj_params: vec4<f32>) -> f32 {
+fn get_dist(p: vec3f, obj_params: vec4f) -> f32 {
let obj_type = obj_params.x;
if (obj_type == 1.0) { return length(p) - 1.0; } // Unit Sphere
- if (obj_type == 2.0) { return sdBox(p, vec3<f32>(1.0)); } // Unit Box
- if (obj_type == 3.0) { return sdTorus(p, vec2<f32>(1.0, 0.4)); } // Unit Torus
- if (obj_type == 4.0) { return sdPlane(p, vec3<f32>(0.0, 1.0, 0.0), 0.0); }
+ if (obj_type == 2.0) { return sdBox(p, vec3f(1.0)); } // Unit Box
+ if (obj_type == 3.0) { return sdTorus(p, vec2f(1.0, 0.4)); } // Unit Torus
+ if (obj_type == 4.0) { return sdPlane(p, vec3f(0.0, 1.0, 0.0), 0.0); }
if (obj_type == 5.0) { return sdBox(p, obj_params.yzw); } // MESH AABB
return 100.0;
}
-fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
+fn map_scene(p: vec3f, skip_idx: u32) -> f32 {
var d = 1000.0;
var stack: array<i32, 32>;
var stack_ptr = 0;
@@ -40,7 +40,7 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
let obj_idx = u32(node.obj_idx_or_right);
if (obj_idx == skip_idx) { continue; }
let obj = object_data.objects[obj_idx];
- let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
+ let q = (obj.inv_model * vec4f(p, 1.0)).xyz;
// Extract scale factors from the model matrix
let sx = length(obj.model[0].xyz);
diff --git a/common/shaders/render/scene_query_linear.wgsl b/common/shaders/render/scene_query_linear.wgsl
index 0497a40..5864b6f 100644
--- a/common/shaders/render/scene_query_linear.wgsl
+++ b/common/shaders/render/scene_query_linear.wgsl
@@ -1,17 +1,17 @@
#include "math/sdf_shapes"
#include "math/sdf_utils"
-fn get_dist(p: vec3<f32>, obj_params: vec4<f32>) -> f32 {
+fn get_dist(p: vec3f, obj_params: vec4f) -> f32 {
let obj_type = obj_params.x;
if (obj_type == 1.0) { return length(p) - 1.0; } // Unit Sphere
- if (obj_type == 2.0) { return sdBox(p, vec3<f32>(1.0)); } // Unit Box
- if (obj_type == 3.0) { return sdTorus(p, vec2<f32>(1.0, 0.4)); } // Unit Torus
- if (obj_type == 4.0) { return sdPlane(p, vec3<f32>(0.0, 1.0, 0.0), 0.0); }
+ if (obj_type == 2.0) { return sdBox(p, vec3f(1.0)); } // Unit Box
+ if (obj_type == 3.0) { return sdTorus(p, vec2f(1.0, 0.4)); } // Unit Torus
+ if (obj_type == 4.0) { return sdPlane(p, vec3f(0.0, 1.0, 0.0), 0.0); }
if (obj_type == 5.0) { return sdBox(p, obj_params.yzw); } // MESH AABB
return 100.0;
}
-fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
+fn map_scene(p: vec3f, skip_idx: u32) -> f32 {
var d = 1000.0;
@@ -23,7 +23,7 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
let obj = object_data.objects[i];
- let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
+ let q = (obj.inv_model * vec4f(p, 1.0)).xyz;
diff --git a/common/shaders/render/shadows.wgsl b/common/shaders/render/shadows.wgsl
index 7cba089..b71e073 100644
--- a/common/shaders/render/shadows.wgsl
+++ b/common/shaders/render/shadows.wgsl
@@ -1,4 +1,4 @@
-fn calc_shadow(ro: vec3<f32>, rd: vec3<f32>, tmin: f32, tmax: f32, skip_idx: u32) -> f32 {
+fn calc_shadow(ro: vec3f, rd: vec3f, tmin: f32, tmax: f32, skip_idx: u32) -> f32 {
var res = 1.0;
var t = tmin;
if (t < 0.05) { t = 0.05; }
diff --git a/common/shaders/sequence_uniforms.wgsl b/common/shaders/sequence_uniforms.wgsl
index 290f89b..1aef34e 100644
--- a/common/shaders/sequence_uniforms.wgsl
+++ b/common/shaders/sequence_uniforms.wgsl
@@ -2,7 +2,7 @@
// Matches UniformsSequenceParams in sequence.h
struct UniformsSequenceParams {
- resolution: vec2<f32>,
+ resolution: vec2f,
aspect_ratio: f32,
time: f32,
beat_time: f32,
diff --git a/common/shaders/skybox.wgsl b/common/shaders/skybox.wgsl
index d280390..075eeb6 100644
--- a/common/shaders/skybox.wgsl
+++ b/common/shaders/skybox.wgsl
@@ -7,14 +7,14 @@
@group(0) @binding(2) var<uniform> globals: GlobalUniforms;
@fragment
-fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+fn fs_main(in: VertexOutput) -> @location(0) vec4f {
// Convert UV to NDC
let ndc_x = in.uv.x * 2.0 - 1.0;
let ndc_y = (1.0 - in.uv.y) * 2.0 - 1.0; // Un-flip Y for NDC (Y-up)
// Unproject to find world direction
// We want the direction from camera to the far plane at this pixel
- let clip_pos = vec4<f32>(ndc_x, ndc_y, 1.0, 1.0);
+ let clip_pos = vec4f(ndc_x, ndc_y, 1.0, 1.0);
let world_pos_h = globals.inv_view_proj * clip_pos;
let world_pos = world_pos_h.xyz / world_pos_h.w;