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 Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 Mesh3D (Mesh3D &&other)=default
 
 Mesh3D (Collection< rerun::components::Position3D > _vertex_positions)
 
Mesh3D with_triangle_indices (Collection< rerun::components::TriangleIndices > _triangle_indices) &&
 Optional indices for the triangles that make up the mesh.
 
Mesh3D with_vertex_normals (Collection< rerun::components::Vector3D > _vertex_normals) &&
 An optional normal for each vertex.
 
Mesh3D with_vertex_colors (Collection< rerun::components::Color > _vertex_colors) &&
 An optional color for each vertex.
 
Mesh3D with_vertex_texcoords (Collection< rerun::components::Texcoord2D > _vertex_texcoords) &&
 An optional uv texture coordinate for each vertex.
 
Mesh3D with_albedo_factor (rerun::components::AlbedoFactor _albedo_factor) &&
 A color multiplier applied to the whole mesh.
 
Mesh3D with_albedo_texture_buffer (rerun::components::ImageBuffer _albedo_texture_buffer) &&
 Optional albedo texture.
 
Mesh3D with_albedo_texture_format (rerun::components::ImageFormat _albedo_texture_format) &&
 The format of the albedo_texture_buffer, if any.
 
Mesh3D with_class_ids (Collection< rerun::components::ClassId > _class_ids) &&
 Optional class Ids for the vertices.
 

Public Attributes

Collection< rerun::components::Position3Dvertex_positions
 The positions of each vertex.
 
std::optional< Collection< rerun::components::TriangleIndices > > triangle_indices
 Optional indices for the triangles that make up the mesh.
 
std::optional< Collection< rerun::components::Vector3D > > vertex_normals
 An optional normal for each vertex.
 
std::optional< Collection< rerun::components::Color > > vertex_colors
 An optional color for each vertex.
 
std::optional< Collection< rerun::components::Texcoord2D > > vertex_texcoords
 An optional uv texture coordinate for each vertex.
 
std::optional< rerun::components::AlbedoFactoralbedo_factor
 A color multiplier applied to the whole mesh.
 
std::optional< rerun::components::ImageBufferalbedo_texture_buffer
 Optional albedo texture.
 
std::optional< rerun::components::ImageFormatalbedo_texture_format
 The format of the albedo_texture_buffer, if any.
 
std::optional< Collection< rerun::components::ClassId > > class_ids
 Optional class Ids for the vertices.
 

Static Public Attributes

static constexpr const char IndicatorComponentName [] = "rerun.components.Mesh3DIndicator"
 

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.

Examples

Simple indexed 3D mesh

image

#include <rerun.hpp>
#include <vector>
int main() {
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:60
Archetype: A 3D triangle mesh as specified by its per-mesh and per-vertex properties.
Definition mesh3d.hpp:110
Collection< rerun::components::Position3D > vertex_positions
The positions of each vertex.
Definition mesh3d.hpp:114
Mesh3D with_vertex_colors(Collection< rerun::components::Color > _vertex_colors) &&
An optional color for each vertex.
Definition mesh3d.hpp:177
std::optional< Collection< rerun::components::Color > > vertex_colors
An optional color for each vertex.
Definition mesh3d.hpp:123
Mesh3D with_triangle_indices(Collection< rerun::components::TriangleIndices > _triangle_indices) &&
Optional indices for the triangles that make up the mesh.
Definition mesh3d.hpp:161
Mesh3D with_vertex_normals(Collection< rerun::components::Vector3D > _vertex_normals) &&
An optional normal for each vertex.
Definition mesh3d.hpp:170
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:18
Component: A position in 3D space.
Definition position3d.hpp:16

3D mesh with instancing

image

#include <rerun.hpp>
int main() {
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, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}})
.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 between the current entity and its parent.
Definition instance_poses3d.hpp:79
static Angle degrees(float degrees_)
New angle in degrees.
Definition angle.hpp:40
Datatype: 3D rotation represented by a rotation around a given axis.
Definition rotation_axis_angle.hpp:22

Member Function Documentation

◆ with_albedo_texture_buffer()

Mesh3D rerun::archetypes::Mesh3D::with_albedo_texture_buffer ( 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)

◆ with_class_ids()

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

Optional class Ids for the vertices.

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

Member Data Documentation

◆ vertex_positions

Collection<rerun::components::Position3D> 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.

◆ albedo_texture_buffer

std::optional<rerun::components::ImageBuffer> 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)

◆ class_ids

std::optional<Collection<rerun::components::ClassId> > rerun::archetypes::Mesh3D::class_ids

Optional class Ids for the vertices.

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


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