1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
use rin_material::{OutlineMaterial, AlphaType}; use rin_gl as gl; use super::{ MaterialTransparency, Shader, PropertyChanged }; pub static PRIORITY: i32 = 100; impl super::Material for OutlineMaterial { fn properties(&self) -> PropertyChanged<Vec<glin::Property>>{ if self.alpha_type.has_changed() { let properties = vec![ glin::Property::CullFace(Some(gl::FRONT)), glin::Property::DepthMask(true), glin::Property::DepthFunc(gl::LEQUAL), glin::Property::ColorMask([true, true, true, true]), ]; PropertyChanged::New(properties) }else{ PropertyChanged::Old } } fn transparency(&self) -> PropertyChanged<MaterialTransparency>{ if self.alpha_type.has_changed() { PropertyChanged::New(MaterialTransparency{ alpha_type: *self.alpha_type, is_translucent: *self.alpha_type != AlphaType::None, is_visible: true, priority: Some(PRIORITY), }) }else{ PropertyChanged::Old } } fn shaders(&self) -> PropertyChanged<Vec<Shader>>{ PropertyChanged::Always(vec![ gl::vertex_shader!("shaders/outline_material.vs.glsl"), gl::fragment_shader!("shaders/outline_material.fs.glsl") ]) } }