Fix bugs for pbrt bilinear patch
This commit is contained in:
parent
bb2089477e
commit
0480e041cd
6 changed files with 85 additions and 33 deletions
|
|
@ -49,16 +49,7 @@ pub(super) struct SpectrumCheckerboardTexture2d {
|
|||
impl Pbrt2dSpectrumTexture for SpectrumCheckerboardTexture2d {
|
||||
fn get(&self, u: Float, v: Float) -> Color {
|
||||
let (u, v) = self.mapping.map(u, v);
|
||||
|
||||
let even = if u >= 0.0 {
|
||||
u.fract() >= 0.5
|
||||
} else {
|
||||
u.fract() >= -0.5
|
||||
} ^ if v >= 0.0 {
|
||||
v.fract() >= 0.5
|
||||
} else {
|
||||
v.fract() >= -0.5
|
||||
};
|
||||
let even = (u.floor() as i64 + v.floor() as i64) % 2 == 0;
|
||||
|
||||
match &self.tex[even as usize] {
|
||||
Either::A(v) => *v,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue