pub struct Mesh3D { /* private fields */ }Expand description
A triangle mesh with solid (per-vertex or uniform) vertex colours.
Port of silx plot3d.items.Mesh (a DataItem3D wrapping a
scene.primitives.Mesh3D). Vertices carry positions, colours and optional
normals; when no normals are supplied the geometric flat face normal is used
per triangle (via flat_normal), so the headlight still shades the surface.
Strips and fans are expanded to a triangle list on the CPU since the GPU path
is TriangleList only.
Implementations§
Source§impl Mesh3D
impl Mesh3D
Sourcepub fn set_data(
&mut self,
positions: &[[f32; 3]],
colors: MeshColor,
normals: Option<&[[f32; 3]]>,
mode: MeshDrawMode,
indices: Option<&[u32]>,
) -> bool
pub fn set_data( &mut self, positions: &[[f32; 3]], colors: MeshColor, normals: Option<&[[f32; 3]]>, mode: MeshDrawMode, indices: Option<&[u32]>, ) -> bool
Set the mesh geometry (silx Mesh.setData). Returns false (leaving the
mesh unchanged) when the attributes are inconsistent: per-vertex colours or
normals not matching the vertex count, or an out-of-range index. An empty
positions clears the mesh and returns true (silx treats it as no mesh).
Sourcepub fn with_data(
self,
positions: &[[f32; 3]],
colors: MeshColor,
normals: Option<&[[f32; 3]]>,
mode: MeshDrawMode,
indices: Option<&[u32]>,
) -> Self
pub fn with_data( self, positions: &[[f32; 3]], colors: MeshColor, normals: Option<&[[f32; 3]]>, mode: MeshDrawMode, indices: Option<&[u32]>, ) -> Self
Builder form of set_data; inconsistent attributes leave
the mesh empty.
Sourcepub fn mode(&self) -> MeshDrawMode
pub fn mode(&self) -> MeshDrawMode
The drawing mode.
Sourcepub fn bounds(&self) -> Option<(Vec3, Vec3)>
pub fn bounds(&self) -> Option<(Vec3, Vec3)>
Axis-aligned data bounds (min, max), or None when empty.
Sourcepub fn append_to(&self, geometry: &mut Scene3dGeometry)
pub fn append_to(&self, geometry: &mut Scene3dGeometry)
Append this mesh’s triangles to geometry for upload via
crate::render::gpu_scene3d::set_scene3d.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mesh3D
impl RefUnwindSafe for Mesh3D
impl Send for Mesh3D
impl Sync for Mesh3D
impl Unpin for Mesh3D
impl UnsafeUnpin for Mesh3D
impl UnwindSafe for Mesh3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.