Fixed compiler warnings.

This commit is contained in:
Nathan Vegdahl 2018-12-28 11:09:17 -08:00
parent 1cd5d28767
commit 8e109efed5
6 changed files with 14 additions and 33 deletions

View File

@ -397,14 +397,6 @@ impl XYZ {
XYZ { x: x, y: y, z: z } XYZ { x: x, y: y, z: z }
} }
pub fn from_tuple(xyz: (f32, f32, f32)) -> XYZ {
XYZ {
x: xyz.0,
y: xyz.1,
z: xyz.2,
}
}
pub fn from_wavelength(wavelength: f32, intensity: f32) -> XYZ { pub fn from_wavelength(wavelength: f32, intensity: f32) -> XYZ {
XYZ { XYZ {
x: x_1931(wavelength) * intensity, x: x_1931(wavelength) * intensity,

View File

@ -7,7 +7,6 @@ use nom::{call, closure, tuple, tuple_parser, IResult};
use mem_arena::MemArena; use mem_arena::MemArena;
use crate::{ use crate::{
color::{rec709_e_to_xyz, Color},
light::{DistantDiskLight, RectangleLight, SphereLight}, light::{DistantDiskLight, RectangleLight, SphereLight},
math::Vector, math::Vector,
}; };

View File

@ -2,14 +2,11 @@
use std::result::Result; use std::result::Result;
use nom::{call, closure, tuple, tuple_parser, IResult}; use nom::IResult;
use mem_arena::MemArena; use mem_arena::MemArena;
use crate::{ use crate::shading::{SimpleSurfaceShader, SurfaceShader};
color::{rec709_e_to_xyz, Color},
shading::{SimpleSurfaceShader, SurfaceShader},
};
use super::{ use super::{
basics::ws_f32, basics::ws_f32,

View File

@ -10,7 +10,7 @@ use self::surface_closure::SurfaceClosure;
pub trait SurfaceShader: Debug + Sync { pub trait SurfaceShader: Debug + Sync {
/// Takes the result of a surface intersection and returns the surface /// Takes the result of a surface intersection and returns the surface
/// closure to be evaluated at that intersection point. /// closure to be evaluated at that intersection point.
fn shade(&self, data: &SurfaceIntersectionData, time: f32, wavelength: f32) -> SurfaceClosure; fn shade(&self, data: &SurfaceIntersectionData, time: f32) -> SurfaceClosure;
} }
/// Clearly we must eat this brownie before the world ends, lest it /// Clearly we must eat this brownie before the world ends, lest it
@ -40,7 +40,7 @@ pub enum SimpleSurfaceShader {
} }
impl SurfaceShader for SimpleSurfaceShader { impl SurfaceShader for SimpleSurfaceShader {
fn shade(&self, data: &SurfaceIntersectionData, time: f32, wavelength: f32) -> SurfaceClosure { fn shade(&self, data: &SurfaceIntersectionData, time: f32) -> SurfaceClosure {
let _ = (data, time); // Silence "unused" compiler warning let _ = (data, time); // Silence "unused" compiler warning
match *self { match *self {

View File

@ -210,7 +210,7 @@ mod lambert_closure {
} }
pub fn estimate_eval_over_sphere_light( pub fn estimate_eval_over_sphere_light(
color: Color, _color: Color,
inc: Vector, inc: Vector,
to_light_center: Vector, to_light_center: Vector,
light_radius_squared: f32, light_radius_squared: f32,
@ -411,9 +411,9 @@ mod ggx_closure {
} }
pub fn estimate_eval_over_sphere_light( pub fn estimate_eval_over_sphere_light(
col: Color, _col: Color,
roughness: f32, roughness: f32,
fresnel: f32, _fresnel: f32,
inc: Vector, inc: Vector,
to_light_center: Vector, to_light_center: Vector,
light_radius_squared: f32, light_radius_squared: f32,
@ -548,16 +548,13 @@ mod emit_closure {
} }
pub fn estimate_eval_over_sphere_light( pub fn estimate_eval_over_sphere_light(
color: Color, _color: Color,
inc: Vector, _inc: Vector,
to_light_center: Vector, _to_light_center: Vector,
light_radius_squared: f32, _light_radius_squared: f32,
nor: Normal, _nor: Normal,
nor_g: Normal, _nor_g: Normal,
) -> f32 { ) -> f32 {
// Not using these, silence warning
let _ = (inc, to_light_center, light_radius_squared, nor, nor_g);
// TODO: what to do here? // TODO: what to do here?
unimplemented!() unimplemented!()
} }

View File

@ -263,11 +263,7 @@ impl<'a> Surface for TriangleMesh<'a> {
// Fill in intersection data // Fill in intersection data
isects[r.id as usize] = SurfaceIntersection::Hit { isects[r.id as usize] = SurfaceIntersection::Hit {
intersection_data: intersection_data, intersection_data: intersection_data,
closure: shader.shade( closure: shader.shade(&intersection_data, wr.time),
&intersection_data,
wr.time,
wr.wavelength,
),
}; };
r.max_t = t; r.max_t = t;
} }