Struct three_d::core::InstancedMesh [−][src]
pub struct InstancedMesh { /* fields omitted */ }
Use InstancedModel instead
Expand description
Similar to Mesh, except it is possible to render many instances of the same triangle mesh efficiently.
Implementations
Constructs a new InstancedMesh from the given CPUMesh. The mesh is rendered in as many instances as there are transformation matrices in the transformations parameter. Each instance is transformed with the given transformation before it is rendered. The transformations can be updated by the update_transformations function.
pub fn render(
&self,
render_states: RenderStates,
program: &Program,
camera_buffer: &UniformBuffer,
viewport: Viewport
) -> ThreeDResult<()>
pub fn render(
&self,
render_states: RenderStates,
program: &Program,
camera_buffer: &UniformBuffer,
viewport: Viewport
) -> ThreeDResult<()>
Render the instanced mesh with the given Program. Must be called in a render target render function, for example in the callback function of Screen::write.
Errors
Will return an error if the program requires a certain attribute and the instanced mesh does not have that attribute. For example if the program needs the normal to calculate lighting, but the mesh does not have per vertex normals, this function will return an error.
Updates the transformations applied to each mesh instance before they are rendered. The mesh is rendered in as many instances as there are transformation matrices.
Methods from Deref<Target = Mesh>
👎 Deprecated: Use Model instead
Use Model instead
Returns the local to world transformation of this mesh.
👎 Deprecated: Use Model instead
Use Model instead
Set the local to world transformation of this mesh.
pub fn render(
&self,
render_states: RenderStates,
program: &Program,
camera_buffer: &UniformBuffer,
viewport: Viewport
) -> ThreeDResult<()>
👎 Deprecated: Instead, use render_forward in Model or use Program and send attributes and uniforms self
pub fn render(
&self,
render_states: RenderStates,
program: &Program,
camera_buffer: &UniformBuffer,
viewport: Viewport
) -> ThreeDResult<()>
Instead, use render_forward in Model or use Program and send attributes and uniforms self
Render the mesh with the given Program. Must be called in a render target render function, for example in the callback function of Screen::write.
Errors
Will return an error if the program requires a certain attribute and the mesh does not have that attribute data. For example if the program needs the normal to calculate lighting, but the mesh does not have per vertex normals, this function will return an error.
👎 Deprecated: Use Model instead
Use Model instead
Computes the axis aligned bounding box for this mesh.
Trait Implementations
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
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more