6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/albedo_factor.hpp"
11#include "../components/blob.hpp"
12#include "../components/media_type.hpp"
13#include "../result.hpp"
65 std::optional<ComponentBatch>
blob;
88 static constexpr const char ArchetypeName[] =
"rerun.archetypes.Asset3D";
114 const std::filesystem::path& path
132 std::optional<rerun::components::MediaType>
media_type = {}
143 std::optional<rerun::components::MediaType>
media_type = {}
148 return std::move(asset).with_media_type(
media_type.value());
157 Asset3D(Asset3D&& other) =
default;
158 Asset3D(
const Asset3D& other) =
default;
159 Asset3D& operator=(
const Asset3D& other) =
default;
160 Asset3D& operator=(Asset3D&& other) =
default;
177 return std::move(*
this);
186 return std::move(*
this);
203 return std::move(*
this);
214 return std::move(*
this);
224 return std::move(*
this);
236 return std::move(*
this);
266 template <
typename T>
271 struct AsComponents<archetypes::Asset3D> {
273 static Result<Collection<ComponentBatch>> as_batches(
const archetypes::Asset3D& archetype) {
274 return detail::collect_batches(
275 {&archetype.blob, &archetype.media_type, &archetype.albedo_factor}
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:90
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: A prepacked 3D asset (.gltf, .glb, .obj, .stl, etc.).
Definition asset3d.hpp:63
static Asset3D from_bytes(rerun::Collection< uint8_t > bytes, std::optional< rerun::components::MediaType > media_type={})
Creates a new Asset3D from the given bytes.
Definition asset3d.hpp:130
static Asset3D update_fields()
Update only some specific fields of a Asset3D.
Definition asset3d.hpp:167
static Asset3D clear_fields()
Clear all the fields of a Asset3D.
static constexpr auto Descriptor_media_type
ComponentDescriptor for the media_type field.
Definition asset3d.hpp:95
static Result< Asset3D > from_file(const std::filesystem::path &path)
Creates a new Asset3D from the file contents at path.
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition asset3d.hpp:256
static constexpr auto Descriptor_albedo_factor
ComponentDescriptor for the albedo_factor field.
Definition asset3d.hpp:100
static constexpr auto Descriptor_blob
ComponentDescriptor for the blob field.
Definition asset3d.hpp:91
Asset3D with_many_media_type(const Collection< rerun::components::MediaType > &_media_type) &&
This method makes it possible to pack multiple media_type in a single component batch.
Definition asset3d.hpp:210
Asset3D with_many_blob(const Collection< rerun::components::Blob > &_blob) &&
This method makes it possible to pack multiple blob in a single component batch.
Definition asset3d.hpp:184
static Result< Asset3D > from_file_path(const std::filesystem::path &path)
Creates a new Asset3D from the file contents at path.
static Asset3D from_file_contents(rerun::Collection< uint8_t > bytes, std::optional< rerun::components::MediaType > media_type={})
Creates a new Asset3D from the given bytes.
Definition asset3d.hpp:141
std::optional< ComponentBatch > blob
The asset's bytes.
Definition asset3d.hpp:65
std::optional< ComponentBatch > media_type
The Media Type of the asset.
Definition asset3d.hpp:78
Asset3D 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.
Definition asset3d.hpp:231
Asset3D with_media_type(const rerun::components::MediaType &_media_type) &&
The Media Type of the asset.
Definition asset3d.hpp:200
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition asset3d.hpp:247
Asset3D with_blob(const rerun::components::Blob &_blob) &&
The asset's bytes.
Definition asset3d.hpp:175
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition asset3d.hpp:88
std::optional< ComponentBatch > albedo_factor
A color multiplier applied to the whole asset.
Definition asset3d.hpp:84
Asset3D with_albedo_factor(const rerun::components::AlbedoFactor &_albedo_factor) &&
A color multiplier applied to the whole asset.
Definition asset3d.hpp:221
Component: A color multiplier, usually applied to a whole entity, e.g. a mesh.
Definition albedo_factor.hpp:14
Component: A binary blob of data.
Definition blob.hpp:16