diff --git a/Cargo.toml b/Cargo.toml index 2d09567..e1dd3d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,23 +5,23 @@ authors = [ "Florian Amsallem ", "Alexandre Lamure ", ] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] cgmath = "0.18.0" -clap = { version = "4.1.4", features = ["derive", "env"] } +clap = { version = "4.5.11", features = ["derive", "env"] } derivative = "2.2.0" -easy-gltf = "1.0.0" -image = "0.24.5" +easy-gltf = "1.1.2" +image = "0.25.2" kdtree-ray = "1.2.0" once_cell = "1.17.0" pbr = "1.0.4" rand = "0.8.5" rayon = "1.6.1" -serde = { version = "1.0.152", features = ["derive"] } -serde_yaml = "0.9.17" -serde_json = "1.0.91" -sfml = "0.16.0" +serde = { version = "1.0.204", features = ["derive"] } +serde_yaml = "0.9.34+deprecated" +serde_json = "1.0.121" +sfml = "0.20.0" sha-1 = "0.10.1" diff --git a/README.md b/README.md index fb6f7bc..f32b90c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ This project is an implementation of Monte Carlo path tracing in **Rust**. ![](readme/ps5_b5_s128.png "PS5 5bounces, 128samples") +## Requirements + +- [SFML 2.5](https://www.sfml-dev.org/download.php) + ## How to use ? The renderer takes a custom Internal Scene Format (isf) as input. @@ -32,7 +36,7 @@ path-tracer render scene.isf -o my-render.png -p profile.yml # Render a scene wi ## Profile -Profile files are used to configure the renderer behaviour. +Profile files are used to configure the renderer behaviour. | Option | Description | Default | |------------|----------------|-------------------| diff --git a/flake.nix b/flake.nix index 7ececda..73517ea 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,8 @@ nativeBuildInputs = [ rustChan mold-wrapped + sfml + csfml ]; buildInputs = [ @@ -49,10 +51,6 @@ cargo-watch taplo - # Libs - sfml - csfml - # Nix formatter alejandra.defaultPackage.${system} ]; diff --git a/src/renderer/viewer.rs b/src/renderer/viewer.rs index a23ef8a..392263b 100644 --- a/src/renderer/viewer.rs +++ b/src/renderer/viewer.rs @@ -44,8 +44,9 @@ fn run(resolution: Resolution, recv: ReceiverPixel) { &Default::default(), ); let mut image = Image::new(resolution.width, resolution.height); - let mut texture = Texture::new(resolution.width, resolution.height).unwrap(); - let mut view = View::from_rect(&FloatRect::new( + let mut texture = Texture::new().unwrap(); + assert!(texture.create(resolution.width, resolution.height)); + let mut view = View::from_rect(FloatRect::new( 0., 0., resolution.width as f32, @@ -82,7 +83,7 @@ fn run(resolution: Resolution, recv: ReceiverPixel) { let start = Instant::now(); for (pos_x, pos_y, color) in recv.try_iter() { - image.set_pixel(pos_x, pos_y, color); + unsafe { image.set_pixel(pos_x, pos_y, color) }; if start.elapsed() > Duration::from_secs(1) / 60 { break; } @@ -91,7 +92,7 @@ fn run(resolution: Resolution, recv: ReceiverPixel) { // Draw the image window.clear(Color::BLACK); window.set_view(&view); - texture.update_from_image(&image, 0, 0); + unsafe { texture.update_from_image(&image, 0, 0) }; let sprite = Sprite::with_texture(&texture); window.draw(&sprite); diff --git a/src/scene/gltf.rs b/src/scene/gltf.rs index 011670f..e6ca3d7 100644 --- a/src/scene/gltf.rs +++ b/src/scene/gltf.rs @@ -216,11 +216,7 @@ impl From for Camera { impl From for Triangle { fn from(triangle: easy_gltf::model::Triangle) -> Self { - Self( - triangle[0].clone().into(), - triangle[1].clone().into(), - triangle[2].clone().into(), - ) + Self(triangle[0].into(), triangle[1].into(), triangle[2].into()) } } diff --git a/src/scene/internal/camera.rs b/src/scene/internal/camera.rs index 0ad6816..134a2f4 100644 --- a/src/scene/internal/camera.rs +++ b/src/scene/internal/camera.rs @@ -12,9 +12,11 @@ pub struct Camera { pub fov: Rad, /// The distance to the far clipping plane. + #[allow(dead_code)] pub zfar: f32, /// The distance to the near clipping plane. + #[allow(dead_code)] pub znear: f32, } diff --git a/src/scene/internal/light.rs b/src/scene/internal/light.rs index 784d1cc..aceccca 100644 --- a/src/scene/internal/light.rs +++ b/src/scene/internal/light.rs @@ -7,6 +7,7 @@ pub enum Light { Point { position: Vector3, color: Vector3, + #[allow(dead_code)] size: f32, }, Directional {