pub struct InstancedMesh { /* private fields */ }
Expand description
Similar to Mesh, except it is possible to render many instances of the same mesh efficiently.
Implementations§
Source§impl InstancedMesh
impl InstancedMesh
Sourcepub fn transformation(&self) -> Mat4
pub fn transformation(&self) -> Mat4
Returns the local to world transformation applied to all instances.
Sourcepub fn set_transformation(&mut self, transformation: Mat4)
pub fn set_transformation(&mut self, transformation: Mat4)
Set the local to world transformation applied to all instances. This is applied before the transform for each instance.
Sourcepub fn set_animation(
&mut self,
animation: impl Fn(f32) -> Mat4 + Send + Sync + 'static,
)
pub fn set_animation( &mut self, animation: impl Fn(f32) -> Mat4 + Send + Sync + 'static, )
Specifies a function which takes a time parameter as input and returns a transformation that should be applied to this mesh at the given time. To actually animate this instanced mesh, call Geometry::animate at each frame which in turn evaluates the animation function defined by this method. This transformation is applied first, then the local to world transformation defined by Self::set_transformation.
Sourcepub fn instance_count(&self) -> u32
pub fn instance_count(&self) -> u32
Returns the number of instances that is rendered.
Sourcepub fn set_instances(&mut self, instances: &Instances)
pub fn set_instances(&mut self, instances: &Instances)
Update the instances.
Trait Implementations§
Source§impl Geometry for InstancedMesh
impl Geometry for InstancedMesh
Source§fn draw(
&self,
viewer: &dyn Viewer,
program: &Program,
render_states: RenderStates,
)
fn draw( &self, viewer: &dyn Viewer, program: &Program, render_states: RenderStates, )
Source§fn vertex_shader_source(&self) -> String
fn vertex_shader_source(&self) -> String
Source§fn id(&self) -> GeometryId
fn id(&self) -> GeometryId
Geometry::vertex_shader_source
. Read moreSource§fn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Source§fn animate(&mut self, time: f32)
fn animate(&mut self, time: f32)
Source§fn render_with_material(
&self,
material: &dyn Material,
viewer: &dyn Viewer,
lights: &[&dyn Light],
)
fn render_with_material( &self, material: &dyn Material, viewer: &dyn Viewer, lights: &[&dyn Light], )
lights
argument, if the material does not require lights to be rendered.Source§fn render_with_effect(
&self,
material: &dyn Effect,
viewer: &dyn Viewer,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>,
)
fn render_with_effect( &self, material: &dyn Effect, viewer: &dyn Viewer, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>>, )
lights
argument, if the material does not require lights to be rendered.