Struct IntersectionMaterial

Source
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:

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

Source§

fn clone(&self) -> IntersectionMaterial

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for IntersectionMaterial

Source§

fn default() -> IntersectionMaterial

Returns the “default value” for a type. Read more
Source§

impl FromCpuMaterial for IntersectionMaterial

Source§

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

Source§

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

Returns the fragment shader source for this material.
Source§

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

Returns the render states needed to render with this material.
Source§

fn material_type(&self) -> MaterialType

Returns the type of material.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,