pub struct InstancedMesh { /* private fields */ }Expand description
Similar to Mesh, except it is possible to render many instances of the same mesh efficiently.
Implementations
sourceimpl InstancedMesh
impl InstancedMesh
sourcepub fn new(
context: &Context,
instances: &Instances,
cpu_mesh: &CpuMesh
) -> ThreeDResult<Self>
pub fn new(
context: &Context,
instances: &Instances,
cpu_mesh: &CpuMesh
) -> ThreeDResult<Self>
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 texture_transform(&self) -> &Mat3
pub fn texture_transform(&self) -> &Mat3
Get the texture transform applied to the uv coordinates of all of the instances.
sourcepub fn set_texture_transform(&mut self, texture_transform: Mat3)
pub fn set_texture_transform(&mut self, texture_transform: Mat3)
Set the texture transform applied to the uv coordinates of all of the model instances. This is applied before the texture transform for each instance.
sourcepub fn instance_count(&self) -> u32
pub fn instance_count(&self) -> u32
Returns the number of instances that is rendered.
sourcepub fn set_instance_count(&mut self, instance_count: u32)
pub fn set_instance_count(&mut self, instance_count: u32)
Use this if you only want to render instance 0 through to instance instance_count.
This is the same as changing the instances using set_instances, except that it is faster since it doesn’t update any buffers.
instance_count will be set to the number of instances when they are defined by set_instances, so all instanced are rendered by default.
sourcepub fn set_instances(&mut self, instances: &Instances) -> ThreeDResult<()>
pub fn set_instances(&mut self, instances: &Instances) -> ThreeDResult<()>
Update the instances.
Trait Implementations
sourceimpl Geometry for InstancedMesh
impl Geometry for InstancedMesh
sourcefn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Returns the AxisAlignedBoundingBox for this geometry in the global coordinate system. Read more
sourcefn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> ThreeDResult<()>
Render the geometry with the given material.
Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.
Use an empty array for the lights argument, if the objects does not require lights to be rendered. Read more
Auto Trait Implementations
impl !RefUnwindSafe for InstancedMesh
impl !Send for InstancedMesh
impl !Sync for InstancedMesh
impl Unpin for InstancedMesh
impl !UnwindSafe for InstancedMesh
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more