pub struct IntersectionMaterial {
pub min_distance: Option<f32>,
pub max_distance: Option<f32>,
pub render_states: RenderStates,
pub geometry_id: u32,
}
Expand description
Used for intersection tests, see pick and ray_intersect. When rendering with this material, the output in each pixel is:
- Red channel: The depth (same as DepthMaterial).
- Green channel: The IntersectionMaterial::geometry_id.
- Blue channel: The gl_InstanceID.
Note: The geometry needs to pass the instance ID to the fragment shader, see Geometry for more information.
Fields§
§min_distance: Option<f32>
The minimum distance from the camera to any object. If None, then the near plane of the camera is used.
max_distance: Option<f32>
The maximum distance from the camera to any object. If None, then the far plane of the camera is used.
render_states: RenderStates
Render states.
geometry_id: u32
A geometry ID for the currently rendered geometry. The result is outputted in the green color channel.
Trait Implementations§
Source§impl Clone for IntersectionMaterial
impl Clone for IntersectionMaterial
Source§fn clone(&self) -> IntersectionMaterial
fn clone(&self) -> IntersectionMaterial
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for IntersectionMaterial
impl Default for IntersectionMaterial
Source§fn default() -> IntersectionMaterial
fn default() -> IntersectionMaterial
Returns the “default value” for a type. Read more
Source§impl FromCpuMaterial for IntersectionMaterial
impl FromCpuMaterial for IntersectionMaterial
Source§fn from_cpu_material(_context: &Context, _cpu_material: &CpuMaterial) -> Self
fn from_cpu_material(_context: &Context, _cpu_material: &CpuMaterial) -> Self
Creates a new material that can be used for rendering from a CpuMaterial.
Source§impl Material for IntersectionMaterial
impl Material for IntersectionMaterial
Source§fn id(&self) -> EffectMaterialId
fn id(&self) -> EffectMaterialId
Returns a unique ID for each variation of the shader source returned from Material::fragment_shader_source. Read more
Source§fn fragment_shader_source(&self, _lights: &[&dyn Light]) -> String
fn fragment_shader_source(&self, _lights: &[&dyn Light]) -> String
Returns the fragment shader source for this material.
Source§fn use_uniforms(
&self,
program: &Program,
viewer: &dyn Viewer,
_lights: &[&dyn Light],
)
fn use_uniforms( &self, program: &Program, viewer: &dyn Viewer, _lights: &[&dyn Light], )
Sends the uniform data needed for this material to the fragment shader.
Source§fn render_states(&self) -> RenderStates
fn render_states(&self) -> RenderStates
Returns the render states needed to render with this material.
Source§fn material_type(&self) -> MaterialType
fn material_type(&self) -> MaterialType
Returns the type of material.
Auto Trait Implementations§
impl Freeze for IntersectionMaterial
impl RefUnwindSafe for IntersectionMaterial
impl Send for IntersectionMaterial
impl Sync for IntersectionMaterial
impl Unpin for IntersectionMaterial
impl UnwindSafe for IntersectionMaterial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more