pub struct Mesh { /* private fields */ }
Expand description
A triangle mesh Geometry.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn transformation(&self) -> Mat4
pub fn transformation(&self) -> Mat4
Returns the local to world transformation applied to this mesh.
Sourcepub fn set_transformation(&mut self, transformation: Mat4)
pub fn set_transformation(&mut self, transformation: Mat4)
Set the local to world transformation applied to this mesh. If any animation method is set using Self::set_animation, the transformation from that method is applied before this transformation.
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 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 vertex_count(&self) -> u32
pub fn vertex_count(&self) -> u32
Returns the number of vertices in this mesh.
Sourcepub fn indices_mut(&mut self) -> &mut IndexBuffer
pub fn indices_mut(&mut self) -> &mut IndexBuffer
Used for editing the triangle indices. Note: Changing this will possibly ruin the mesh.
Sourcepub fn positions_mut(&mut self) -> &mut VertexBuffer<Vec3>
pub fn positions_mut(&mut self) -> &mut VertexBuffer<Vec3>
Used for editing the vertex positions. Note: Changing this will possibly ruin the mesh.
Sourcepub fn normals_mut(&mut self) -> &mut Option<VertexBuffer<Vec3>>
pub fn normals_mut(&mut self) -> &mut Option<VertexBuffer<Vec3>>
Used for editing the vertex normals. Note: Changing this will possibly ruin the mesh.
Sourcepub fn uvs_mut(&mut self) -> &mut Option<VertexBuffer<Vec2>>
pub fn uvs_mut(&mut self) -> &mut Option<VertexBuffer<Vec2>>
Used for editing the vertex uvs. Note: Changing this will possibly ruin the mesh.
Sourcepub fn tangents_mut(&mut self) -> &mut Option<VertexBuffer<Vec4>>
pub fn tangents_mut(&mut self) -> &mut Option<VertexBuffer<Vec4>>
Used for editing the vertex tangents. Note: Changing this will possibly ruin the mesh.
Sourcepub fn colors_mut(&mut self) -> &mut Option<VertexBuffer<Vec4>>
pub fn colors_mut(&mut self) -> &mut Option<VertexBuffer<Vec4>>
Used for editing the vertex colors. Note: Changing this will possibly ruin the mesh.
Sourcepub fn update_positions(&mut self, positions: &[Vector3<f32>])
👎Deprecated: use positions_mut instead
pub fn update_positions(&mut self, positions: &[Vector3<f32>])
Updates the vertex positions of the mesh.
§Panics
Panics if the number of positions does not match the number of vertices in the mesh.
Sourcepub fn update_normals(&mut self, normals: &[Vector3<f32>])
👎Deprecated: use normals_mut instead
pub fn update_normals(&mut self, normals: &[Vector3<f32>])
Updates the vertex normals of the mesh.
§Panics
Panics if the number of normals does not match the number of vertices in the mesh.
Trait Implementations§
Source§impl Geometry for Mesh
impl Geometry for Mesh
Source§fn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Source§fn animate(&mut self, time: f32)
fn animate(&mut self, time: f32)
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 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.