diff --git a/assignment-1b/Cargo.toml b/assignment-1b/Cargo.toml index 84f1c5b..1be1358 100644 --- a/assignment-1b/Cargo.toml +++ b/assignment-1b/Cargo.toml @@ -8,6 +8,12 @@ edition = "2021" [profile.release] debug = true +# Optimize for size when creating handin +[profile.release-handin] +inherits = "release" +strip = true +lto = true + [[bin]] name = "raytracer1b" path = "src/main.rs" diff --git a/assignment-1b/Makefile b/assignment-1b/Makefile index 676d843..2ee7944 100644 --- a/assignment-1b/Makefile +++ b/assignment-1b/Makefile @@ -10,7 +10,7 @@ CONVERT := convert HANDIN := hw1b.michael.zhang.zip BINARY := ./raytracer1b WRITEUP := writeup.pdf -SOURCES := $(shell find -name "*.rs") +SOURCES := Cargo.toml $(shell find -name "*.rs") EXAMPLES := $(shell find examples -name "*.txt") EXAMPLES_PPM := $(patsubst %.txt,%.ppm,$(EXAMPLES)) @@ -28,8 +28,8 @@ $(BINARY): $(SOURCES) -w /usr/src/myapp \ -e CARGO_TARGET_DIR=/usr/src/myapp/target/docker \ rust \ - cargo build --release - mv target/release/raytracer1b $@ + cargo build --profile release-handin + mv target/docker/release-handin/raytracer1b $@ $(HANDIN): $(BINARY) $(WRITEUP) Makefile Cargo.toml Cargo.lock README.md $(EXAMPLES_PNG) $(EXAMPLES_PPM) $(ZIP) -r $@ src examples $^ diff --git a/assignment-1b/README.md b/assignment-1b/README.md index 9d6e0ac..396c03e 100644 --- a/assignment-1b/README.md +++ b/assignment-1b/README.md @@ -4,7 +4,7 @@ Writeup is located at `/writeup.pdf`. -The binary can be found at `/assignment-1`. Run `./assignment-1 --help` to see +The binary can be found at `/raytracer1b`. Run `./raytracer1b --help` to see how to use it. The binary has been built using the Rust Docker image, which should have an environment similar to CSELabs. If there is trouble running the binary, try building from source, as documented below. diff --git a/assignment-1b/src/lib.rs b/assignment-1b/src/lib.rs index 8fe737c..aa6a64d 100644 --- a/assignment-1b/src/lib.rs +++ b/assignment-1b/src/lib.rs @@ -1,4 +1,4 @@ -#![doc = include_str!("../writeup.md")] +#![doc = include_str!("../README.md")] #[macro_use] extern crate anyhow; diff --git a/assignment-1b/src/main.rs b/assignment-1b/src/main.rs index 486cfcf..87e22b2 100644 --- a/assignment-1b/src/main.rs +++ b/assignment-1b/src/main.rs @@ -1,16 +1,13 @@ use std::fs::File; use std::path::PathBuf; -use anyhow::{ensure, Result}; +use anyhow::{Result}; use assignment_1b::image::Image; use assignment_1b::ray::Ray; use assignment_1b::scene::Scene; -use base64::{engine::general_purpose::STANDARD as BASE64, Engine}; + use clap::Parser; -use rand::{ - rngs::{StdRng, ThreadRng}, - thread_rng, Rng, RngCore, SeedableRng, -}; + use rayon::prelude::{IntoParallelIterator, ParallelIterator}; /// Simple raycaster. diff --git a/assignment-1b/src/scene/cylinder.rs b/assignment-1b/src/scene/cylinder.rs index 5e1b6ea..18a52fb 100644 --- a/assignment-1b/src/scene/cylinder.rs +++ b/assignment-1b/src/scene/cylinder.rs @@ -5,7 +5,7 @@ use ordered_float::NotNan; use crate::ray::Ray; use crate::utils::compute_rotation_matrix; -use super::{data::ObjectKind, illumination::IntersectionContext}; +use super::{illumination::IntersectionContext}; #[derive(Debug)] pub struct Cylinder { @@ -181,7 +181,7 @@ impl Cylinder { mod tests { use nalgebra::Vector3; - use crate::{ray::Ray, scene::data::ObjectKind}; + use crate::{ray::Ray}; use super::Cylinder; diff --git a/assignment-1b/src/scene/sphere.rs b/assignment-1b/src/scene/sphere.rs index f064b0d..3eda3c0 100644 --- a/assignment-1b/src/scene/sphere.rs +++ b/assignment-1b/src/scene/sphere.rs @@ -4,7 +4,7 @@ use ordered_float::NotNan; use crate::{ray::Ray, utils::min_f64}; -use super::{data::ObjectKind, illumination::IntersectionContext}; +use super::{illumination::IntersectionContext}; #[derive(Debug)] pub struct Sphere {