replace the FullyGenericMaterial in spirv with an analog type from coremem_types

this represents the last spirv-specific material.
next steps are to start removing the materials from `coremem` itself
(i.e. re-exporting more from `coremem_types::mat`).
This commit is contained in:
2022-07-22 02:56:00 -07:00
parent 4cbcc46d50
commit 847b95f036
10 changed files with 196 additions and 112 deletions

View File

@@ -1,29 +1,4 @@
use crate::support::Optional;
use coremem_types::mat::{Material, MBPgram, MHPgram};
use coremem_types::vec::Vec3;
#[derive(Copy, Clone, Default, PartialEq)]
pub struct FullyGenericMaterial {
pub conductivity: Vec3<f32>,
pub m_b_curve: Optional<MBPgram<f32>>,
pub m_h_curve: Optional<MHPgram<f32>>,
}
impl Material<f32> for FullyGenericMaterial {
fn conductivity(&self) -> Vec3<f32> {
self.conductivity
}
fn move_b_vec(&self, m: Vec3<f32>, target_b: Vec3<f32>) -> Vec3<f32> {
if self.m_b_curve.is_some() {
self.m_b_curve.unwrap().move_b_vec(m, target_b)
} else if self.m_h_curve.is_some() {
self.m_h_curve.unwrap().move_b_vec(m, target_b)
} else {
Default::default()
}
}
}
// TODO: plumb the R parameter through and remove this.
pub type FullyGenericMaterial = coremem_types::mat::FullyGenericMaterial<f32>;
pub type IsoConductorOr<M> = coremem_types::mat::IsoConductorOr<f32, M>;