pub struct Mesh3D {
pub vertex_positions: Vec<Position3D>,
pub mesh_properties: Option<MeshProperties>,
pub vertex_normals: Option<Vec<Vector3D>>,
pub vertex_colors: Option<Vec<Color>>,
pub vertex_texcoords: Option<Vec<Texcoord2D>>,
pub mesh_material: Option<Material>,
pub albedo_texture: Option<TensorData>,
pub class_ids: Option<Vec<ClassId>>,
}
Expand description
Archetype: A 3D triangle mesh as specified by its per-mesh and per-vertex properties.
See also Asset3D
.
§Example
§Simple indexed 3D mesh
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_mesh3d_indexed").spawn()?;
rec.log(
"triangle",
&rerun::Mesh3D::new([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
.with_vertex_normals([[0.0, 0.0, 1.0]])
.with_vertex_colors([0x0000FFFF, 0x00FF00FF, 0xFF0000FF])
.with_mesh_properties(rerun::MeshProperties::from_triangle_indices([[2, 1, 0]])),
)?;
Ok(())
}
Fields§
§vertex_positions: Vec<Position3D>
The positions of each vertex.
If no indices
are specified, then each triplet of positions is interpreted as a triangle.
mesh_properties: Option<MeshProperties>
Optional properties for the mesh as a whole (including indexed drawing).
vertex_normals: Option<Vec<Vector3D>>
An optional normal for each vertex.
If specified, this must have as many elements as vertex_positions
.
vertex_colors: Option<Vec<Color>>
An optional color for each vertex.
vertex_texcoords: Option<Vec<Texcoord2D>>
An optional uv texture coordinate for each vertex.
mesh_material: Option<Material>
Optional material properties for the mesh as a whole.
albedo_texture: Option<TensorData>
Optional albedo texture.
Used with vertex_texcoords
on Mesh3D
.
Currently supports only sRGB(A) textures, ignoring alpha.
(meaning that the tensor must have 3 or 4 channels and use the u8
format)
class_ids: Option<Vec<ClassId>>
Optional class Ids for the vertices.
The class ID provides colors and labels if not specified explicitly.
Implementations§
source§impl Mesh3D
impl Mesh3D
pub fn new( vertex_positions: impl IntoIterator<Item = impl Into<Position3D>> ) -> Mesh3D
pub fn with_mesh_properties( self, mesh_properties: impl Into<MeshProperties> ) -> Mesh3D
pub fn with_vertex_normals( self, vertex_normals: impl IntoIterator<Item = impl Into<Vector3D>> ) -> Mesh3D
pub fn with_vertex_colors( self, vertex_colors: impl IntoIterator<Item = impl Into<Color>> ) -> Mesh3D
pub fn with_vertex_texcoords( self, vertex_texcoords: impl IntoIterator<Item = impl Into<Texcoord2D>> ) -> Mesh3D
pub fn with_mesh_material(self, mesh_material: impl Into<Material>) -> Mesh3D
pub fn with_albedo_texture( self, albedo_texture: impl Into<TensorData> ) -> Mesh3D
pub fn with_class_ids( self, class_ids: impl IntoIterator<Item = impl Into<ClassId>> ) -> Mesh3D
source§impl Mesh3D
impl Mesh3D
pub fn sanity_check(&self) -> Result<(), Mesh3DError>
pub fn num_vertices(&self) -> usize
pub fn num_triangles(&self) -> usize
Trait Implementations§
source§impl Archetype for Mesh3D
impl Archetype for Mesh3D
§type Indicator = GenericIndicatorComponent<Mesh3D>
type Indicator = GenericIndicatorComponent<Mesh3D>
source§fn name() -> ArchetypeName
fn name() -> ArchetypeName
rerun.archetypes.Points2D
.source§fn indicator() -> MaybeOwnedComponentBatch<'static>
fn indicator() -> MaybeOwnedComponentBatch<'static>
source§fn required_components() -> Cow<'static, [ComponentName]>
fn required_components() -> Cow<'static, [ComponentName]>
source§fn recommended_components() -> Cow<'static, [ComponentName]>
fn recommended_components() -> Cow<'static, [ComponentName]>
source§fn optional_components() -> Cow<'static, [ComponentName]>
fn optional_components() -> Cow<'static, [ComponentName]>
source§fn all_components() -> Cow<'static, [ComponentName]>
fn all_components() -> Cow<'static, [ComponentName]>
source§fn from_arrow_components(
arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)>
) -> Result<Mesh3D, DeserializationError>
fn from_arrow_components( arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)> ) -> Result<Mesh3D, DeserializationError>
ComponentNames
, deserializes them
into this archetype. Read moresource§fn from_arrow(
data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> Result<Self, DeserializationError>where
Self: Sized,
fn from_arrow(
data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> Result<Self, DeserializationError>where
Self: Sized,
source§impl AsComponents for Mesh3D
impl AsComponents for Mesh3D
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatch
s. Read moresource§fn num_instances(&self) -> usize
fn num_instances(&self) -> usize
source§impl PartialEq for Mesh3D
impl PartialEq for Mesh3D
source§impl SizeBytes for Mesh3D
impl SizeBytes for Mesh3D
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl StructuralPartialEq for Mesh3D
Auto Trait Implementations§
impl Freeze for Mesh3D
impl RefUnwindSafe for Mesh3D
impl Send for Mesh3D
impl Sync for Mesh3D
impl Unpin 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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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.