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

Archetype: A prepacked 3D asset (.gltf, .glb, .obj, etc.). More...

#include <rerun/archetypes/asset3d.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

 Asset3D (Asset3D &&other)=default
 
 Asset3D (rerun::components::Blob _blob)
 
Asset3D with_media_type (rerun::components::MediaType _media_type) &&
 The Media Type of the asset.
 
Asset3D with_transform (rerun::components::OutOfTreeTransform3D _transform) &&
 An out-of-tree transform.
 
size_t num_instances () const
 Returns the number of primary instances of this archetype.
 

Static Public Member Functions

static std::optional< rerun::components::MediaTypeguess_media_type (const std::filesystem::path &path)
 
static Result< Asset3Dfrom_file (const std::filesystem::path &path)
 Creates a new Asset3D from the file contents at path.
 
static Asset3D from_bytes (rerun::Collection< uint8_t > bytes, std::optional< rerun::components::MediaType > media_type)
 Creates a new Asset3D from the given bytes.
 

Public Attributes

rerun::components::Blob blob
 The asset's bytes.
 
std::optional< rerun::components::MediaTypemedia_type
 The Media Type of the asset.
 
std::optional< rerun::components::OutOfTreeTransform3Dtransform
 An out-of-tree transform.
 

Static Public Attributes

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

Detailed Description

Archetype: A prepacked 3D asset (.gltf, .glb, .obj, etc.).

Example

Simple 3D asset

image

#include <rerun.hpp>
#include <filesystem>
#include <iostream>
#include <string>
int main(int argc, char* argv[]) {
if (argc <2) {
std::cerr <<"Usage: " <<argv[0] <<" <path_to_asset.[gltf|glb|obj]>" <<std::endl;
return 1;
}
const auto path = argv[1];
const auto rec = rerun::RecordingStream("rerun_example_asset3d");
rec.spawn().exit_on_failure();
rec.log_timeless("world", rerun::ViewCoordinates::RIGHT_HAND_Z_UP); // Set an up-axis
rec.log("world/asset", rerun::Asset3D::from_file(path).value_or_throw());
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:57

Member Function Documentation

◆ from_file()

static Result< Asset3D > rerun::archetypes::Asset3D::from_file ( const std::filesystem::path &  path)
static

Creates a new Asset3D from the file contents at path.

The MediaType will be guessed from the file extension.

If no MediaType can be guessed at the moment, the Rerun Viewer will try to guess one from the data at render-time. If it can't, rendering will fail with an error.

◆ from_bytes()

static Asset3D rerun::archetypes::Asset3D::from_bytes ( rerun::Collection< uint8_t >  bytes,
std::optional< rerun::components::MediaType media_type 
)
inlinestatic

Creates a new Asset3D from the given bytes.

If no MediaType is specified, the Rerun Viewer will try to guess one from the data at render-time. If it can't, rendering will fail with an error.

◆ with_media_type()

Asset3D rerun::archetypes::Asset3D::with_media_type ( rerun::components::MediaType  _media_type) &&
inline

The Media Type of the asset.

Supported values:

  • model/gltf-binary
  • model/obj (.mtl material files are not supported yet, references are silently ignored)

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ with_transform()

Asset3D rerun::archetypes::Asset3D::with_transform ( rerun::components::OutOfTreeTransform3D  _transform) &&
inline

An out-of-tree transform.

Applies a transformation to the asset itself without impacting its children.

Member Data Documentation

◆ media_type

std::optional<rerun::components::MediaType> rerun::archetypes::Asset3D::media_type

The Media Type of the asset.

Supported values:

  • model/gltf-binary
  • model/obj (.mtl material files are not supported yet, references are silently ignored)

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ transform

std::optional<rerun::components::OutOfTreeTransform3D> rerun::archetypes::Asset3D::transform

An out-of-tree transform.

Applies a transformation to the asset itself without impacting its children.


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