Compare commits
No commits in common. "d43cf2feeb4845db59d1ab14096d3126ba107283" and "c1a79e78937a43f08627039b674158618abd3f79" have entirely different histories.
d43cf2feeb
...
c1a79e7893
|
|
@ -56,7 +56,7 @@ impl AccumulationBuffer {
|
|||
let colour_sum_t = buffer_colour_sum.values + colour_sum_y;
|
||||
buffer_colour_bias.values = (colour_sum_t - buffer_colour_sum.values) - colour_sum_y;
|
||||
buffer_colour_sum.values = colour_sum_t;
|
||||
buffer_colour.values = buffer_colour_sum.values / *buffer_weight;
|
||||
buffer_colour.values = buffer_colour_sum.values * (1.0 / *buffer_weight);
|
||||
}
|
||||
|
||||
pub fn merge_tile(&mut self, tile: &Tile, src: &AccumulationBuffer) {
|
||||
|
|
|
|||
|
|
@ -175,10 +175,10 @@ mod tests {
|
|||
};
|
||||
let expected_x: f64 =
|
||||
ImageSampler::scale(200, 800, target.film_width) - target.film_width * 0.5;
|
||||
assert!((point_on_film_plane.x() - expected_x).abs() < 0.5 / 800.0);
|
||||
assert!((point_on_film_plane.x() - expected_x).abs() < 0.5 / 200.0);
|
||||
let expected_y =
|
||||
-ImageSampler::scale(100, 600, target.film_height) + target.film_height * 0.5;
|
||||
assert!((point_on_film_plane.y() - expected_y).abs() < 0.5 / 600.0);
|
||||
assert!((point_on_film_plane.y() - expected_y).abs() < 0.5 / 800.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::Mat3;
|
|||
|
||||
use itertools::izip;
|
||||
|
||||
use std::ops::{Add, AddAssign, Div, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign};
|
||||
use std::ops::{Add, AddAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Debug, Default)]
|
||||
pub struct Vec3 {
|
||||
|
|
@ -316,30 +316,6 @@ impl Mul<&Vec3> for f64 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Div<f64> for &Vec3 {
|
||||
type Output = Vec3;
|
||||
|
||||
fn div(self, rhs: f64) -> Vec3 {
|
||||
let mut coords = [0.0; 3];
|
||||
for (r, a) in coords.iter_mut().zip(self.coords.iter()) {
|
||||
*r = a / rhs;
|
||||
}
|
||||
Vec3 { coords }
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<f64> for Vec3 {
|
||||
type Output = Vec3;
|
||||
|
||||
fn div(self, rhs: f64) -> Vec3 {
|
||||
let mut coords = [0.0; 3];
|
||||
for (r, a) in coords.iter_mut().zip(self.coords.iter()) {
|
||||
*r = a / rhs;
|
||||
}
|
||||
Vec3 { coords }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
@ -483,14 +459,6 @@ mod tests {
|
|||
assert!(a * b == c);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn div_by_scalar_returns_correct_result() {
|
||||
let a = Vec3::new(1.0, 2.0, 3.0);
|
||||
let b = 2.0;
|
||||
let c = Vec3::new(0.5, 1.0, 1.5);
|
||||
assert!(dbg!(a / b) == dbg!(c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mul_assign_by_scalar_returns_correct_result() {
|
||||
let mut a = Vec3::new(1.0, 2.0, 3.0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue