ft: moved random scene code to function; cleaned up tri/quad/cube hit logic; made camera attributes private
This commit is contained in:
19
src/vec3.rs
19
src/vec3.rs
@@ -33,7 +33,7 @@ impl Vec3 {
|
||||
Self {
|
||||
x: r as f32 / 255.,
|
||||
y: g as f32 / 255.,
|
||||
z: b as f32/ 255.,
|
||||
z: b as f32 / 255.,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,16 +444,20 @@ impl Div<Vec3> for Vec3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<u32> for Vec3 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, u: u32) -> Self::Output {
|
||||
self / u as f32
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<i32> for Vec3 {
|
||||
type Output = Self;
|
||||
|
||||
fn div(self, i: i32) -> Self::Output {
|
||||
let f: f32 = i as f32;
|
||||
Self {
|
||||
x: self.x / f,
|
||||
y: self.y / f,
|
||||
z: self.z / f,
|
||||
}
|
||||
self / i as f32
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,4 +504,3 @@ impl Display for Vec3 {
|
||||
write!(f, "({}, {}, {})", self.x, self.y, self.z)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user