Add "stanford bunny" model to repository (for testing)

This commit is contained in:
Matthew Gordon 2020-04-03 21:18:16 -04:00
parent cf8f5e646b
commit 36a4c6f951
4 changed files with 25 additions and 12 deletions

1
.gitattributes vendored
View File

@ -1 +1,2 @@
*.png filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text
test_data/stanford_bunny.obj filter=lfs diff=lfs merge=lfs -text

View File

@ -67,6 +67,22 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
image_height as u32, 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 { let scene = Scene {
camera_location: Point3::new(-2.0, 1.0, -5.0), camera_location: Point3::new(-2.0, 1.0, -5.0),
objects: vec![ objects: vec![
@ -105,19 +121,10 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
specular_strength: 1.0, specular_strength: 1.0,
}), }),
)), )),
Box::new(BoundingVolumeHierarchy::build( model_bvh,
&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(),
)),
], ],
}; };
println!("Done.");
let mut event_pump = sdl_context.event_pump()?; let mut event_pump = sdl_context.event_pump()?;

2
test_data/Readme.md Normal file
View File

@ -0,0 +1,2 @@
Thanks to the Stanford Computer Graphics Laboratory (https://graphics.stanford.edu/data/3Dscanrep/)
for the famous Stanford Bunny model.

BIN
test_data/stanford_bunny.obj (Stored with Git LFS) Normal file

Binary file not shown.