Rendering lto orb barely
This commit is contained in:
parent
479cf89e8d
commit
eeae057204
4 changed files with 97 additions and 64 deletions
|
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue