Fix all warnings

This commit is contained in:
hal8174 2025-08-23 13:36:07 +02:00
parent 2bc5ec93fe
commit ae4dc2c21a
Signed by: hal8174
SSH key fingerprint: SHA256:NN98ZYwnrreQLSOV/g+amY7C3yL/mS1heD7bi5t6PPw
26 changed files with 249 additions and 185 deletions

View file

@ -3,10 +3,10 @@ use super::*;
#[derive(Debug)]
pub(super) struct FloatCheckerboardTexture2d {
pub(super) mapping: UVMapping,
pub(super) tex: [Either<Float, Arc<dyn Pbrt_2d_float_texture>>; 2],
pub(super) tex: [Either<Float, Arc<dyn Pbrt2dFloatTexture>>; 2],
}
impl Pbrt_2d_float_texture for FloatCheckerboardTexture2d {
impl Pbrt2dFloatTexture for FloatCheckerboardTexture2d {
fn get(&self, u: Float, v: Float) -> Float {
let (u, v) = self.mapping.map(u, v);
@ -28,11 +28,11 @@ impl Pbrt_2d_float_texture for FloatCheckerboardTexture2d {
}
impl PbrtTexture for FloatCheckerboardTexture2d {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_float_texture>> {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dFloatTexture>> {
Ok(self)
}
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_spectrum_texture>> {
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dSpectrumTexture>> {
Err(miette!("Unable to use this texture as a spectrum texture"))
}
@ -43,10 +43,10 @@ impl PbrtTexture for FloatCheckerboardTexture2d {
#[derive(Debug)]
pub(super) struct SpectrumCheckerboardTexture2d {
pub(super) mapping: UVMapping,
pub(super) tex: [Either<Color, Arc<dyn Pbrt_2d_spectrum_texture>>; 2],
pub(super) tex: [Either<Color, Arc<dyn Pbrt2dSpectrumTexture>>; 2],
}
impl Pbrt_2d_spectrum_texture for SpectrumCheckerboardTexture2d {
impl Pbrt2dSpectrumTexture for SpectrumCheckerboardTexture2d {
fn get(&self, u: Float, v: Float) -> Color {
let (u, v) = self.mapping.map(u, v);
@ -68,11 +68,11 @@ impl Pbrt_2d_spectrum_texture for SpectrumCheckerboardTexture2d {
}
impl PbrtTexture for SpectrumCheckerboardTexture2d {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_float_texture>> {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dFloatTexture>> {
Err(miette!("Unable to use this texture as a float texture"))
}
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_spectrum_texture>> {
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dSpectrumTexture>> {
Ok(self)
}

View file

@ -24,6 +24,7 @@ impl ImageMapWrap {
#[derive(Debug)]
pub(super) enum ImageMapEncoding {
#[allow(clippy::upper_case_acronyms)]
SRGB,
Linear,
Gamma(Float),
@ -118,22 +119,23 @@ impl SpectrumImageMapTexture {
}
}
impl Pbrt_2d_spectrum_texture for SpectrumImageMapTexture {
impl Pbrt2dSpectrumTexture for SpectrumImageMapTexture {
fn get(&self, u: Float, v: Float) -> Color {
let (u, v) = self.mapping.map(u, v);
let (w, h) = self.image.dimensions();
dbg!(u, v, w, h);
todo!()
}
}
impl PbrtTexture for SpectrumImageMapTexture {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_float_texture>> {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dFloatTexture>> {
Err(miette!("Unable to use this texture as a float texture"))
}
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_spectrum_texture>> {
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dSpectrumTexture>> {
Ok(self)
}

View file

@ -2,8 +2,8 @@ use super::*;
#[derive(Debug)]
pub(super) struct SpectrumScaleTexture2d {
pub(super) tex: Either<Color, Arc<dyn Pbrt_2d_spectrum_texture>>,
pub(super) scale: Either<Float, Arc<dyn Pbrt_2d_float_texture>>,
pub(super) tex: Either<Color, Arc<dyn Pbrt2dSpectrumTexture>>,
pub(super) scale: Either<Float, Arc<dyn Pbrt2dFloatTexture>>,
}
impl PbrtTexture for SpectrumScaleTexture2d {
@ -11,16 +11,16 @@ impl PbrtTexture for SpectrumScaleTexture2d {
TextureDimension::D2
}
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_float_texture>> {
fn get_2d_float_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dFloatTexture>> {
Err(miette!("Unable to convert to float texture"))
}
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt_2d_spectrum_texture>> {
fn get_2d_spectrum_texture(self: Arc<Self>) -> Result<Arc<dyn Pbrt2dSpectrumTexture>> {
Ok(self)
}
}
impl Pbrt_2d_spectrum_texture for SpectrumScaleTexture2d {
impl Pbrt2dSpectrumTexture for SpectrumScaleTexture2d {
fn get(&self, u: Float, v: Float) -> Color {
let x = match &self.tex {
Either::A(x) => *x,