Rendering lto orb barely

This commit is contained in:
hal8174 2025-09-14 22:41:52 +02:00
parent 479cf89e8d
commit eeae057204
Signed by: hal8174
SSH key fingerprint: SHA256:NN98ZYwnrreQLSOV/g+amY7C3yL/mS1heD7bi5t6PPw
4 changed files with 97 additions and 64 deletions

View file

@ -121,8 +121,29 @@ impl Pbrt2dSpectrumTexture for SpectrumImageMapTexture {
let (w, h) = self.image.dimensions();
dbg!(u, v, w, h);
todo!()
let (u, v) = match self.wrap {
ImageMapWrap::Repeat => (
if u < 0.0 { 1.0 + u.fract() } else { u.fract() },
if v < 0.0 { 1.0 + v.fract() } else { v.fract() },
),
ImageMapWrap::Black => {
if !(0.0..=1.0).contains(&u) || !(0.0..=1.0).contains(&v) {
return Color::black();
}
(u, v)
}
ImageMapWrap::Clamp => (u.clamp(0.0, 1.0), v.clamp(0.0, 1.0)),
};
let x = u * w as Float;
let y = v * h as Float;
let c = self
.image
.get_pixel((x as u32).clamp(0, w - 1), (y as u32).clamp(0, h - 1));
Color::new(c.0[0], c.0[1], c.0[2])
}
}