48 lines
1.3 KiB
Rust
48 lines
1.3 KiB
Rust
use crate::core::texture::{
|
|
FloatTextureTrait, SpectrumTextureTrait, TextureEvalContext, TextureMapping2D,
|
|
};
|
|
use crate::spectra::{SampledSpectrum, SampledWavelengths};
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct FloatBilerpTexture {
|
|
mapping: TextureMapping2D,
|
|
v00: Float,
|
|
v01: Float,
|
|
v10: Float,
|
|
v11: Float,
|
|
}
|
|
|
|
impl FloatBilerpTexture {
|
|
pub fn new(mapping: TextureMapping2D, v00: Float, v01: Float, v10: Float, v11: Float) -> Self {
|
|
Self {
|
|
mapping,
|
|
v00,
|
|
v01,
|
|
v10,
|
|
v11,
|
|
}
|
|
}
|
|
|
|
pub fn create(
|
|
render_from_texture: &Transform,
|
|
params: &TextureParameterDictionary,
|
|
loc: &FileLoc,
|
|
) -> Self {
|
|
let mapping = TextureMapping2D::create(params, render_from_texture, loc);
|
|
let v00 = params.get_one_float("v00", 0.);
|
|
let v01 = params.get_one_float("v01", 1.);
|
|
let v10 = params.get_one_float("v10", 0.);
|
|
let v11 = params.get_one_float("v11", 1.);
|
|
Self::new(mapping, v00, v01, v10, v11)
|
|
}
|
|
}
|
|
|
|
impl FloatTextureTrait for FloatBilerpTexture {}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct SpectrumBilerpTexture;
|
|
impl SpectrumTextureTrait for SpectrumBilerpTexture {
|
|
fn evaluate(&self, _ctx: &TextureEvalContext, _lambda: &SampledWavelengths) -> SampledSpectrum {
|
|
todo!()
|
|
}
|
|
}
|