Some more stuff with cat.obj

This commit is contained in:
Jonathan Flueren 2022-07-19 17:51:59 +02:00
parent ee49ce9ecb
commit ff6b6191a4
2 changed files with 8 additions and 21 deletions

16
Cargo.lock generated
View file

@ -152,15 +152,14 @@ dependencies = [
[[package]] [[package]]
name = "image" name = "image"
version = "0.24.2" version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
"color_quant", "color_quant",
"jpeg-decoder", "jpeg-decoder",
"num-iter",
"num-rational", "num-rational",
"num-traits", "num-traits",
"png", "png",
@ -206,17 +205,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "num-iter"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-rational" name = "num-rational"
version = "0.4.1" version = "0.4.1"

View file

@ -173,7 +173,7 @@ fn random_world() -> HittableList {
fn from_obj(path: &str) -> HittableList { fn from_obj(path: &str) -> HittableList {
let mut world = HittableList::new(); let mut world = HittableList::new();
let material_ground = Arc::new(Lambertian::new(&Color::new(0.05, 0.05, 0.05))); let material_ground = Arc::new(Lambertian::new(&Color::new(0.2, 0.2, 0.2)));
world.add(Box::<Sphere>::new(Sphere::new( world.add(Box::<Sphere>::new(Sphere::new(
Point3::new(0.0, -50000.0, 0.0), Point3::new(0.0, -50000.0, 0.0),
50000.0, 50000.0,
@ -189,10 +189,9 @@ fn from_obj(path: &str) -> HittableList {
} }
}*/ }*/
//let material = Arc::new(Lambertian::new(&Color::new(0.4, 0.2, 0.3))); let material = Arc::new(Lambertian::new(&Color::new(0.4, 0.2, 0.3)));
//let material = Arc::new(Dielectric::new(2.0)); //let material = Arc::new(Dielectric::new(2.0));
let material = Arc::new(Metal::new(&Color::new(0.9, 0.9, 0.7), 0.0)); //let material = Arc::new(Metal::new(&Color::new(0.9, 0.9, 0.7), 0.0));
let cornell_box = tobj::load_obj(path, &tobj::GPU_LOAD_OPTIONS); let cornell_box = tobj::load_obj(path, &tobj::GPU_LOAD_OPTIONS);
let (models, materials) = cornell_box.expect("Failed to load OBJ file"); let (models, materials) = cornell_box.expect("Failed to load OBJ file");
@ -267,9 +266,9 @@ fn main() {
// Image // Image
let aspect_ratio = 16.0 / 9.0; let aspect_ratio = 16.0 / 9.0;
let image_width = 1000; let image_width = 700;
let image_height = (image_width as f64 / aspect_ratio) as u32; let image_height = (image_width as f64 / aspect_ratio) as u32;
let samples_per_pixel = 25_u32; let samples_per_pixel = 1_u32;
let max_depth = 25; let max_depth = 25;
let vfov = 60.0; let vfov = 60.0;