Resolve all warnings.

This commit is contained in:
hal8174 2025-05-28 19:27:55 +02:00
parent 86d009fb4c
commit 96e7085e37
Signed by: hal8174
SSH key fingerprint: SHA256:JwuqS+eVfISfKr+DkDQ6NWAbGd1jFAHkPpCM1yCnlTs
10 changed files with 92 additions and 86 deletions

View file

@ -23,6 +23,7 @@ use vulkano::{
type DynRenderer =
dyn ClassicalRenderer<SmallRng, Box<dyn Scene<SmallRng> + Sync>, BasicCamera> + Sync;
#[allow(clippy::type_complexity)]
pub const RENDERER: [(&str, fn(u32, u32) -> Box<DynRenderer>); 5] = [
("Depth", |w, h| {
Box::new(DepthRenderer::new(w, h)) as Box<DynRenderer>

View file

@ -98,13 +98,11 @@ impl Iridescent {
if local_c_squred.is_infinite() {
1.0
} else {
if local_cos_k_delta.abs() < 1.0 {
} else if local_cos_k_delta.abs() < 1.0 {
let k_delta = f32::acos(local_cos_k_delta);
let u = f32::sin(k_delta) / f32::sin(self.n * k_delta);
let r = local_c_squred / (local_c_squred + u * u);
// if k_delta.is_nan() || u.is_nan() || r.is_nan() {
// dbg!((
// l,
@ -119,7 +117,7 @@ impl Iridescent {
// ));
// }
r
local_c_squred / (local_c_squred + u * u)
} else if local_cos_k_delta.abs() > 1.0 {
let imk_delta = -f32::ln(f32::abs(
local_cos_k_delta - f32::sqrt(local_cos_k_delta * local_cos_k_delta - 1.0),
@ -127,7 +125,6 @@ impl Iridescent {
let u = f32::sinh(imk_delta) / f32::sinh(self.n * imk_delta);
let r = local_c_squred / (local_c_squred + u * u);
// if imk_delta.is_nan() || u.is_nan() || r.is_nan() {
// dbg!((
// l,
@ -142,11 +139,10 @@ impl Iridescent {
// ));
// }
r
local_c_squred / (local_c_squred + u * u)
} else {
let u = 1.0 / self.n;
let r = local_c_squred / (local_c_squred + u * u);
// if u.is_nan() || r.is_nan() {
// dbg!((
// l,
@ -160,8 +156,7 @@ impl Iridescent {
// ));
// }
r
}
local_c_squred / (local_c_squred + u * u)
}
}

View file

@ -83,7 +83,7 @@ impl<A: AccelerationStructure<u32>, R: Rng> Scene<R> for AccelerationStructureSc
let material = &self.materials[i as usize];
let light_pdf = if let Some(l) = &material.light {
let light_pdf = if let Some(_l) = &material.light {
0.0
} else {
0.0

View file

@ -19,6 +19,12 @@ impl<R: Rng> BasicCornell<R> {
}
}
impl<R: Rng> Default for BasicCornell<R> {
fn default() -> Self {
Self::new()
}
}
impl<R: Rng + 'static> ExampleScene<R> for BasicCornell<R> {
fn get_scene(&self) -> Box<dyn Scene<R> + Sync> {
let s = self.scene.get_or_init(|| {

View file

@ -22,6 +22,12 @@ impl<R: Rng> Cornell2<R> {
}
}
impl<R: Rng> Default for Cornell2<R> {
fn default() -> Self {
Self::new()
}
}
impl<R: Rng + 'static> ExampleScene<R> for Cornell2<R> {
fn get_scene(&self) -> Box<dyn Scene<R> + Sync> {
let s = self.scene.get_or_init(|| {

View file

@ -1,15 +1,11 @@
use std::cell::OnceCell;
use crate::triangle_bvh::{BVHMaterial, Triangle, TriangleBVH};
use super::ExampleScene;
use crate::triangle_bvh::{BVHMaterial, Triangle, TriangleBVH};
use ray_tracing_core::{light::AreaLight, prelude::*, scene::Scene};
use ray_tracing_material::{
diffuse::DiffuseMaterial,
microfacet::{BeckmannDistribution, Microfacet},
mirror::Mirror,
};
use std::cell::OnceCell;
pub struct MISTest<R: Rng> {
scene: OnceCell<TriangleBVH<R>>,
@ -67,6 +63,12 @@ impl<R: Rng> MISTest<R> {
}
}
impl<R: Rng> Default for MISTest<R> {
fn default() -> Self {
Self::new()
}
}
impl<R: Rng + 'static> ExampleScene<R> for MISTest<R> {
fn get_scene(&self) -> Box<dyn Scene<R> + Sync> {
let s = self.scene.get_or_init(move || {

View file

@ -49,7 +49,7 @@ pub fn example_scenes<R: Rng + Debug + 'static>() -> HashMap<&'static str, Box<d
);
map.insert("mis_test", Box::new(mis_test::MISTest::new()));
let material = Iridescent::new(250.0, 250.0, 1.0, 1.3, 20);
// let material = Iridescent::new(250.0, 250.0, 1.0, 1.3, 20);
let material = Iridescent::new(0.9 * 988.0, 0.1 * 988.0, 1.0, 1.5, 20);
map.insert("sphere", Box::new(sphere::SphereScene::new(material)));
map

View file

@ -1,13 +1,7 @@
use std::{
cell::{Cell, OnceCell},
marker::PhantomData,
};
use ray_tracing_core::prelude::*;
use crate::basic_scene::BasicScene;
use super::ExampleScene;
use crate::basic_scene::BasicScene;
use ray_tracing_core::prelude::*;
use std::cell::{Cell, OnceCell};
pub struct SphereScene<M> {
scene: OnceCell<BasicScene<M>>,

View file

@ -1,15 +1,11 @@
use rand::Rng;
use ray_tracing_core::{light::AreaLight, prelude::*, scene::Scene};
use ray_tracing_material::{
microfacet::{BeckmannDistribution, Microfacet},
oren_nayar::OrenNayar,
};
use std::cell::{Cell, OnceCell};
use crate::{
parse_obj::ObjData,
triangle_bvh::{BVHMaterial, Triangle, TriangleBVH},
};
use rand::Rng;
use ray_tracing_core::{light::AreaLight, prelude::*, scene::Scene};
use ray_tracing_material::oren_nayar::OrenNayar;
use std::cell::{Cell, OnceCell};
use super::ExampleScene;

View file

@ -28,6 +28,12 @@ impl<R: Rng> StanfordDragon<R> {
}
}
impl<R: Rng> Default for StanfordDragon<R> {
fn default() -> Self {
Self::new()
}
}
impl<R: Rng + 'static> ExampleScene<R> for StanfordDragon<R> {
fn get_scene(&self) -> Box<dyn Scene<R> + Sync> {
let s = self.scene.get_or_init(|| {