Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::Mesh3D Struct Reference

Archetype: A 3D triangle mesh as specified by its per-mesh and per-vertex properties. More...

#include <rerun/archetypes/mesh3d.hpp>

Public Member Functions

 Mesh3D (Mesh3D &&other)=default
 
 Mesh3D (const Mesh3D &other)=default
 
Mesh3Doperator= (const Mesh3D &other)=default
 
Mesh3Doperator= (Mesh3D &&other)=default
 
 Mesh3D (Collection< rerun::components::Position3D > _vertex_positions)
 
Mesh3D with_vertex_positions (const Collection< rerun::components::Position3D > &_vertex_positions) &&
 The positions of each vertex.
 
Mesh3D with_triangle_indices (const Collection< rerun::components::TriangleIndices > &_triangle_indices) &&
 Optional indices for the triangles that make up the mesh.
 
Mesh3D with_vertex_normals (const Collection< rerun::components::Vector3D > &_vertex_normals) &&
 An optional normal for each vertex.
 
Mesh3D with_vertex_colors (const Collection< rerun::components::Color > &_vertex_colors) &&
 An optional color for each vertex.
 
Mesh3D with_vertex_texcoords (const Collection< rerun::components::Texcoord2D > &_vertex_texcoords) &&
 An optional uv texture coordinate for each vertex.
 
Mesh3D with_albedo_factor (const rerun::components::AlbedoFactor &_albedo_factor) &&
 A color multiplier applied to the whole mesh.
 
Mesh3D with_many_albedo_factor (const Collection< rerun::components::AlbedoFactor > &_albedo_factor) &&
 This method makes it possible to pack multiple albedo_factor in a single component batch.
 
Mesh3D with_face_rendering (const rerun::components::MeshFaceRendering &_face_rendering) &&
 Determines which faces of the mesh are rendered.
 
Mesh3D with_many_face_rendering (const Collection< rerun::components::MeshFaceRendering > &_face_rendering) &&
 This method makes it possible to pack multiple face_rendering in a single component batch.
 
Mesh3D with_albedo_texture_buffer (const rerun::components::ImageBuffer &_albedo_texture_buffer) &&
 Optional albedo texture.
 
Mesh3D with_many_albedo_texture_buffer (const Collection< rerun::components::ImageBuffer > &_albedo_texture_buffer) &&
 This method makes it possible to pack multiple albedo_texture_buffer in a single component batch.
 
Mesh3D with_albedo_texture_format (const rerun::components::ImageFormat &_albedo_texture_format) &&
 The format of the albedo_texture_buffer, if any.
 
Mesh3D with_many_albedo_texture_format (const Collection< rerun::components::ImageFormat > &_albedo_texture_format) &&
 This method makes it possible to pack multiple albedo_texture_format in a single component batch.
 
Mesh3D with_class_ids (const Collection< rerun::components::ClassId > &_class_ids) &&
 Optional class Ids for the vertices.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static Mesh3D update_fields ()
 Update only some specific fields of a Mesh3D.
 
static Mesh3D clear_fields ()
 Clear all the fields of a Mesh3D.
 

Public Attributes

std::optional< ComponentBatchvertex_positions
 The positions of each vertex.
 
std::optional< ComponentBatchtriangle_indices
 Optional indices for the triangles that make up the mesh.
 
std::optional< ComponentBatchvertex_normals
 An optional normal for each vertex.
 
std::optional< ComponentBatchvertex_colors
 An optional color for each vertex.
 
std::optional< ComponentBatchvertex_texcoords
 An optional uv texture coordinate for each vertex.
 
std::optional< ComponentBatchalbedo_factor
 A color multiplier applied to the whole mesh.
 
std::optional< ComponentBatchface_rendering
 Determines which faces of the mesh are rendered.
 
std::optional< ComponentBatchalbedo_texture_buffer
 Optional albedo texture.
 
std::optional< ComponentBatchalbedo_texture_format
 The format of the albedo_texture_buffer, if any.
 
std::optional< ComponentBatchclass_ids
 Optional class Ids for the vertices.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.Mesh3D"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_vertex_positions
 ComponentDescriptor for the vertex_positions field.
 
static constexpr auto Descriptor_triangle_indices
 ComponentDescriptor for the triangle_indices field.
 
static constexpr auto Descriptor_vertex_normals
 ComponentDescriptor for the vertex_normals field.
 
static constexpr auto Descriptor_vertex_colors
 ComponentDescriptor for the vertex_colors field.
 
static constexpr auto Descriptor_vertex_texcoords
 ComponentDescriptor for the vertex_texcoords field.
 
static constexpr auto Descriptor_albedo_factor
 ComponentDescriptor for the albedo_factor field.
 
static constexpr auto Descriptor_face_rendering
 ComponentDescriptor for the face_rendering field.
 
static constexpr auto Descriptor_albedo_texture_buffer
 ComponentDescriptor for the albedo_texture_buffer field.
 
static constexpr auto Descriptor_albedo_texture_format
 ComponentDescriptor for the albedo_texture_format field.
 
static constexpr auto Descriptor_class_ids
 ComponentDescriptor for the class_ids field.
 

Detailed Description

Archetype: A 3D triangle mesh as specified by its per-mesh and per-vertex properties.

See also archetypes::Asset3D.

If there are multiple archetypes::InstancePoses3D instances logged to the same entity as a mesh, an instance of the mesh will be drawn for each transform.

For transparency ordering, as well as back face culling (disabled by default), front faces are assumed to be those with counter clockwise triangle winding order (this is the same as in the GLTF specification).

Examples

Simple indexed 3D mesh

image

#include <rerun.hpp>
#include <vector>
int main(int argc, char* argv[]) {
const auto rec = rerun::RecordingStream("rerun_example_mesh3d_indexed");
rec.spawn().exit_on_failure();
{0.0f, 1.0f, 0.0f},
{1.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.0f},
};
{0, 0, 255},
{0, 255, 0},
{255, 0, 0},
};
rec.log(
"triangle",
.with_vertex_normals({{0.0, 0.0, 1.0}})
.with_triangle_indices({{2, 1, 0}})
);
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:73
Archetype: A 3D triangle mesh as specified by its per-mesh and per-vertex properties.
Definition mesh3d.hpp:114
Mesh3D with_triangle_indices(const Collection< rerun::components::TriangleIndices > &_triangle_indices) &&
Optional indices for the triangles that make up the mesh.
Definition mesh3d.hpp:249
Mesh3D with_vertex_normals(const Collection< rerun::components::Vector3D > &_vertex_normals) &&
An optional normal for each vertex.
Definition mesh3d.hpp:259
std::optional< ComponentBatch > vertex_positions
The positions of each vertex.
Definition mesh3d.hpp:118
std::optional< ComponentBatch > vertex_colors
An optional color for each vertex.
Definition mesh3d.hpp:129
Mesh3D with_vertex_colors(const Collection< rerun::components::Color > &_vertex_colors) &&
An optional color for each vertex.
Definition mesh3d.hpp:270
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Component: A position in 3D space.
Definition position3d.hpp:15

3D mesh with instancing

image

#include <rerun.hpp>
int main(int argc, char* argv[]) {
const auto rec = rerun::RecordingStream("rerun_example_mesh3d_instancing");
rec.spawn().exit_on_failure();
rec.set_time_sequence("frame", 0);
rec.log(
"shape",
{{1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {-1.0f, 1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}}
)
.with_triangle_indices({{0, 2, 1}, {0, 3, 1}, {0, 3, 2}, {1, 3, 2}})
.with_vertex_colors({0xFF0000FF, 0x00FF00FF, 0x00000FFFF, 0xFFFF00FF})
);
// This box will not be affected by its parent's instance poses!
rec.log("shape/box", rerun::Boxes3D::from_half_sizes({{5.0f, 5.0f, 5.0f}}));
for (int i = 0; i <100; ++i) {
rec.set_time_sequence("frame", i);
rec.log(
"shape",
.with_translations(
{{2.0f, 0.0f, 0.0f},
{0.0f, 2.0f, 0.0f},
{0.0f, -2.0f, 0.0f},
{-2.0f, 0.0f, 0.0f}}
)
.with_rotation_axis_angles({rerun::RotationAxisAngle(
{0.0f, 0.0f, 1.0f},
rerun::Angle::degrees(static_cast<float>(i) * 2.0f)
)})
);
}
}
Archetype: One or more transforms applied on the current entity's transform frame.
Definition instance_poses3d.hpp:84
static Angle degrees(float degrees_)
New angle in degrees.
Definition angle.hpp:39
Datatype: 3D rotation represented by a rotation around a given axis.
Definition rotation_axis_angle.hpp:21

Member Function Documentation

◆ with_vertex_positions()

Mesh3D rerun::archetypes::Mesh3D::with_vertex_positions ( const Collection< rerun::components::Position3D > &  _vertex_positions) &&
inline

The positions of each vertex.

If no triangle_indices are specified, then each triplet of positions is interpreted as a triangle.

◆ with_vertex_colors()

Mesh3D rerun::archetypes::Mesh3D::with_vertex_colors ( const Collection< rerun::components::Color > &  _vertex_colors) &&
inline

An optional color for each vertex.

The alpha channel is ignored.

◆ with_albedo_factor()

Mesh3D rerun::archetypes::Mesh3D::with_albedo_factor ( const rerun::components::AlbedoFactor _albedo_factor) &&
inline

A color multiplier applied to the whole mesh.

Alpha channel governs the overall mesh transparency.

◆ with_many_albedo_factor()

Mesh3D rerun::archetypes::Mesh3D::with_many_albedo_factor ( const Collection< rerun::components::AlbedoFactor > &  _albedo_factor) &&
inline

This method makes it possible to pack multiple albedo_factor in a single component batch.

This only makes sense when used in conjunction with columns. with_albedo_factor should be used when logging a single row's worth of data.

◆ with_face_rendering()

Mesh3D rerun::archetypes::Mesh3D::with_face_rendering ( const rerun::components::MeshFaceRendering _face_rendering) &&
inline

Determines which faces of the mesh are rendered.

The default is components::MeshFaceRendering::DoubleSided, meaning both front and back faces are shown.

◆ with_many_face_rendering()

Mesh3D rerun::archetypes::Mesh3D::with_many_face_rendering ( const Collection< rerun::components::MeshFaceRendering > &  _face_rendering) &&
inline

This method makes it possible to pack multiple face_rendering in a single component batch.

This only makes sense when used in conjunction with columns. with_face_rendering should be used when logging a single row's worth of data.

◆ with_albedo_texture_buffer()

Mesh3D rerun::archetypes::Mesh3D::with_albedo_texture_buffer ( const rerun::components::ImageBuffer _albedo_texture_buffer) &&
inline

Optional albedo texture.

Used with the components::Texcoord2D of the mesh.

Currently supports only sRGB(A) textures, ignoring alpha. (meaning that the tensor must have 3 or 4 channels and use the u8 format)

The alpha channel is ignored.

◆ with_many_albedo_texture_buffer()

Mesh3D rerun::archetypes::Mesh3D::with_many_albedo_texture_buffer ( const Collection< rerun::components::ImageBuffer > &  _albedo_texture_buffer) &&
inline

This method makes it possible to pack multiple albedo_texture_buffer in a single component batch.

This only makes sense when used in conjunction with columns. with_albedo_texture_buffer should be used when logging a single row's worth of data.

◆ with_many_albedo_texture_format()

Mesh3D rerun::archetypes::Mesh3D::with_many_albedo_texture_format ( const Collection< rerun::components::ImageFormat > &  _albedo_texture_format) &&
inline

This method makes it possible to pack multiple albedo_texture_format in a single component batch.

This only makes sense when used in conjunction with columns. with_albedo_texture_format should be used when logging a single row's worth of data.

◆ with_class_ids()

Mesh3D rerun::archetypes::Mesh3D::with_class_ids ( const Collection< rerun::components::ClassId > &  _class_ids) &&
inline

Optional class Ids for the vertices.

The components::ClassId provides colors and labels if not specified explicitly.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::Mesh3D::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::Mesh3D::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ vertex_positions

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::vertex_positions

The positions of each vertex.

If no triangle_indices are specified, then each triplet of positions is interpreted as a triangle.

◆ vertex_colors

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::vertex_colors

An optional color for each vertex.

The alpha channel is ignored.

◆ albedo_factor

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::albedo_factor

A color multiplier applied to the whole mesh.

Alpha channel governs the overall mesh transparency.

◆ face_rendering

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::face_rendering

Determines which faces of the mesh are rendered.

The default is components::MeshFaceRendering::DoubleSided, meaning both front and back faces are shown.

◆ albedo_texture_buffer

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::albedo_texture_buffer

Optional albedo texture.

Used with the components::Texcoord2D of the mesh.

Currently supports only sRGB(A) textures, ignoring alpha. (meaning that the tensor must have 3 or 4 channels and use the u8 format)

The alpha channel is ignored.

◆ class_ids

std::optional<ComponentBatch> rerun::archetypes::Mesh3D::class_ids

Optional class Ids for the vertices.

The components::ClassId provides colors and labels if not specified explicitly.

◆ Descriptor_vertex_positions

constexpr auto rerun::archetypes::Mesh3D::Descriptor_vertex_positions
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:vertex_positions",
Loggable<rerun::components::Position3D>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition mesh3d.hpp:164

ComponentDescriptor for the vertex_positions field.

◆ Descriptor_triangle_indices

constexpr auto rerun::archetypes::Mesh3D::Descriptor_triangle_indices
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:triangle_indices",
Loggable<rerun::components::TriangleIndices>::ComponentType
)

ComponentDescriptor for the triangle_indices field.

◆ Descriptor_vertex_normals

constexpr auto rerun::archetypes::Mesh3D::Descriptor_vertex_normals
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:vertex_normals",
Loggable<rerun::components::Vector3D>::ComponentType
)

ComponentDescriptor for the vertex_normals field.

◆ Descriptor_vertex_colors

constexpr auto rerun::archetypes::Mesh3D::Descriptor_vertex_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:vertex_colors", Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the vertex_colors field.

◆ Descriptor_vertex_texcoords

constexpr auto rerun::archetypes::Mesh3D::Descriptor_vertex_texcoords
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:vertex_texcoords",
Loggable<rerun::components::Texcoord2D>::ComponentType
)

ComponentDescriptor for the vertex_texcoords field.

◆ Descriptor_albedo_factor

constexpr auto rerun::archetypes::Mesh3D::Descriptor_albedo_factor
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:albedo_factor",
Loggable<rerun::components::AlbedoFactor>::ComponentType
)

ComponentDescriptor for the albedo_factor field.

◆ Descriptor_face_rendering

constexpr auto rerun::archetypes::Mesh3D::Descriptor_face_rendering
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:face_rendering",
Loggable<rerun::components::MeshFaceRendering>::ComponentType
)

ComponentDescriptor for the face_rendering field.

◆ Descriptor_albedo_texture_buffer

constexpr auto rerun::archetypes::Mesh3D::Descriptor_albedo_texture_buffer
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:albedo_texture_buffer",
Loggable<rerun::components::ImageBuffer>::ComponentType
)

ComponentDescriptor for the albedo_texture_buffer field.

◆ Descriptor_albedo_texture_format

constexpr auto rerun::archetypes::Mesh3D::Descriptor_albedo_texture_format
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:albedo_texture_format",
Loggable<rerun::components::ImageFormat>::ComponentType
)

ComponentDescriptor for the albedo_texture_format field.

◆ Descriptor_class_ids

constexpr auto rerun::archetypes::Mesh3D::Descriptor_class_ids
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Mesh3D:class_ids", Loggable<rerun::components::ClassId>::ComponentType
)

ComponentDescriptor for the class_ids field.


The documentation for this struct was generated from the following file: