aboutsummaryrefslogtreecommitdiff
path: root/src/hittable/constant_medium.rs
diff options
context:
space:
mode:
authorlamp2024-01-21 17:03:07 +0000
committerlamp2024-01-21 17:03:07 +0000
commit45fafbcd4b41a5388ece377c4e051b5846407288 (patch)
tree2192c471ca3b47671f0906e27f6f6088f40b3d8a /src/hittable/constant_medium.rs
parent89a5c9a8a0cdf627cda0e31da454f83ca21315ce (diff)
fmt and tidy
Diffstat (limited to 'src/hittable/constant_medium.rs')
-rw-r--r--src/hittable/constant_medium.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/hittable/constant_medium.rs b/src/hittable/constant_medium.rs
index 36ac2ff..50bddc6 100644
--- a/src/hittable/constant_medium.rs
+++ b/src/hittable/constant_medium.rs
@@ -1,6 +1,12 @@
use std::sync::Arc;
-use crate::{hittable::{HitRecord, Hittable, AABB}, material::{Isotropic, Material}, ray::Ray, texture::Texture, vec3::{Vec3, Point3}};
+use crate::{
+ hittable::{HitRecord, Hittable, AABB},
+ material::{Isotropic, Material},
+ ray::Ray,
+ texture::Texture,
+ vec3::Vec3,
+};
pub struct ConstantMedium {
boundary: Arc<dyn Hittable>,
@@ -13,7 +19,7 @@ impl ConstantMedium {
Self {
boundary,
phase_function: Arc::new(Isotropic::from_texture(texture)),
- neg_inv_density: -1.0/density,
+ neg_inv_density: -1.0 / density,
}
}
}
@@ -52,10 +58,14 @@ impl Hittable for ConstantMedium {
p: ray.at(t),
t,
material: Some(self.phase_function.clone()),
- normal: Vec3 { x: 1.0, y: 0.0, z: 0.0 }, // arbitrary
+ normal: Vec3 {
+ x: 1.0,
+ y: 0.0,
+ z: 0.0,
+ }, // arbitrary
front_face: true, // arbitrary
- u: 0.0, // arbitrary
- v: 0.0, // arbitrary
+ u: 0.0, // arbitrary
+ v: 0.0, // arbitrary
})
}