Skip to content

Commit e190c51

Browse files
committed
Implement texture coordinate wrapping to support tiling
1 parent 00cc097 commit e190c51

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/pt/raytracer.wgsl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ struct TextureDescriptor {
478478

479479
@must_use
480480
fn textureLookup(desc: TextureDescriptor, uv: vec2f) -> vec3f {
481-
let u = clamp(uv.x, 0f, 1f);
482-
let v = clamp(uv.y, 0f, 1f);
481+
let u = fract(uv.x);
482+
let v = fract(uv.y);
483483

484484
let j = u32(u * f32(desc.width));
485485
let i = u32(v * f32(desc.height));

0 commit comments

Comments
 (0)