Add "stanford bunny" model to repository (for testing)
This commit is contained in:
parent
cf8f5e646b
commit
36a4c6f951
|
|
@ -1 +1,2 @@
|
|||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
test_data/stanford_bunny.obj filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
|
|||
29
src/main.rs
29
src/main.rs
|
|
@ -67,6 +67,22 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
image_height as u32,
|
||||
)?;
|
||||
|
||||
let model_file_path =
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("test_data/stanford_bunny.obj");
|
||||
println!("Loading object...");
|
||||
let model_object = load_obj(
|
||||
&model_file_path,
|
||||
Arc::new(PhongMaterial {
|
||||
colour: ColourRgbF::from_named(NamedColour::Blue),
|
||||
diffuse_strength: 0.05,
|
||||
smoothness: 100.0,
|
||||
specular_strength: 1.0,
|
||||
}),
|
||||
)?;
|
||||
println!("Building BVH...");
|
||||
let model_bvh = Box::new(BoundingVolumeHierarchy::build(&model_object));
|
||||
println!("Constructing Scene...");
|
||||
|
||||
let scene = Scene {
|
||||
camera_location: Point3::new(-2.0, 1.0, -5.0),
|
||||
objects: vec![
|
||||
|
|
@ -105,19 +121,10 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
specular_strength: 1.0,
|
||||
}),
|
||||
)),
|
||||
Box::new(BoundingVolumeHierarchy::build(
|
||||
&load_obj(
|
||||
Path::new("/home/matthew/Downloads/bunny.obj"),
|
||||
Arc::new(ReflectiveMaterial {
|
||||
colour: ColourRgbF::from_named(NamedColour::Yellow),
|
||||
diffuse_strength: 0.05,
|
||||
reflection_strength: 0.9,
|
||||
}),
|
||||
)
|
||||
.unwrap(),
|
||||
)),
|
||||
model_bvh,
|
||||
],
|
||||
};
|
||||
println!("Done.");
|
||||
|
||||
let mut event_pump = sdl_context.event_pump()?;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Thanks to the Stanford Computer Graphics Laboratory (https://graphics.stanford.edu/data/3Dscanrep/)
|
||||
for the famous Stanford Bunny model.
|
||||
Binary file not shown.
Loading…
Reference in New Issue