Struct re_types::archetypes::Asset3D
source · pub struct Asset3D {
pub blob: Blob,
pub media_type: Option<MediaType>,
pub transform: Option<OutOfTreeTransform3D>,
}Expand description
Archetype: A prepacked 3D asset (.gltf, .glb, .obj, etc.).
See also Mesh3D.
Example
Simple 3D asset
ⓘ
//! Log a simple 3D asset.
use rerun::external::anyhow;
fn main() -> anyhow::Result<()> {
let args = std::env::args().collect::<Vec<_>>();
let Some(path) = args.get(1) else {
anyhow::bail!("Usage: {} <path_to_asset.[gltf|glb|obj]>", args[0]);
};
let (rec, storage) =
rerun::RecordingStreamBuilder::new("rerun_example_asset3d_simple").memory()?;
rec.log_timeless("world", &rerun::ViewCoordinates::RIGHT_HAND_Z_UP)?; // Set an up-axis
rec.log("world/asset", &rerun::Asset3D::from_file(path)?)?;
rerun::native_viewer::show(storage.take())?;
Ok(())
}Fields§
§blob: BlobThe asset’s bytes.
media_type: Option<MediaType>The Media Type of the asset.
Supported values:
model/gltf-binarymodel/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: Option<OutOfTreeTransform3D>An out-of-tree transform.
Applies a transformation to the asset itself without impacting its children.
Implementations§
source§impl Asset3D
impl Asset3D
pub fn new(blob: impl Into<Blob>) -> Self
pub fn with_media_type(self, media_type: impl Into<MediaType>) -> Self
pub fn with_transform(self, transform: impl Into<OutOfTreeTransform3D>) -> Self
source§impl Asset3D
impl Asset3D
sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Creates a new Asset3D from the file contents at path.
The MediaType will first be guessed from the file extension, then from the file
contents if needed.
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.
Trait Implementations§
source§impl Archetype for Asset3D
impl Archetype for Asset3D
§type Indicator = GenericIndicatorComponent<Asset3D>
type Indicator = GenericIndicatorComponent<Asset3D>
The associated indicator component, whose presence indicates that the high-level
archetype-based APIs were used to log the data. Read more
source§fn name() -> ArchetypeName
fn name() -> ArchetypeName
The fully-qualified name of this archetype, e.g.
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]>
Returns the names of all components that must be provided by the user when constructing
this archetype.
source§fn recommended_components() -> Cow<'static, [ComponentName]>
fn recommended_components() -> Cow<'static, [ComponentName]>
Returns the names of all components that should be provided by the user when constructing
this archetype.
source§fn optional_components() -> Cow<'static, [ComponentName]>
fn optional_components() -> Cow<'static, [ComponentName]>
Returns the names of all components that may be provided by the user when constructing
this archetype.
source§fn all_components() -> Cow<'static, [ComponentName]>
fn all_components() -> Cow<'static, [ComponentName]>
Returns the names of all components that must, should and may be provided by the user when
constructing this archetype. Read more
source§fn from_arrow(
arrow_data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> DeserializationResult<Self>
fn from_arrow( arrow_data: impl IntoIterator<Item = (Field, Box<dyn Array>)> ) -> DeserializationResult<Self>
Given an iterator of Arrow arrays and their respective field metadata, deserializes them
into this archetype. Read more
source§impl AsComponents for Asset3D
impl AsComponents for Asset3D
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
Exposes the object’s contents as a set of
ComponentBatchs. Read moresource§fn num_instances(&self) -> usize
fn num_instances(&self) -> usize
The number of instances in each batch. Read more
source§impl PartialEq for Asset3D
impl PartialEq for Asset3D
impl StructuralPartialEq for Asset3D
Auto Trait Implementations§
impl RefUnwindSafe for Asset3D
impl Send for Asset3D
impl Sync for Asset3D
impl Unpin for Asset3D
impl UnwindSafe for Asset3D
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
Mutably borrows from an owned value. Read more