Skip to main content

Payload

Enum Payload 

Source
#[non_exhaustive]
pub enum Payload { None, Mesh(Mesh), InstancedMesh(InstancedMesh), SkinnedMesh(Box<SkinnedMesh>), BatchedMesh(Box<BatchedMesh>), Line(Line), Points(Points), Sprite(Sprite), Light(LightObject), ClippingGroup(ClippingGroup), }
Expand description

The subclass state of one crate::core::Object3D.

None is a plain Object3D, a Group, a Bone — anything the renderer walks through without drawing.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

A plain Object3D, a Group or a Bone: nothing to draw.

§

Mesh(Mesh)

Mesh.geometry / Mesh.material.

§

InstancedMesh(InstancedMesh)

InstancedMesh extends Mesh.

§

SkinnedMesh(Box<SkinnedMesh>)

SkinnedMesh extends Mesh — the skeleton and the two bind matrices on top of the Mesh. is_mesh() is true for it, as isMesh is in three.js. Boxed because the two bind matrices and the bounding volumes make it half again the size of the next-largest variant, and every Object3D in the tree carries a Payload.

§

BatchedMesh(Box<BatchedMesh>)

BatchedMesh extends Mesh — boxed because it is much the largest variant (three data textures and two draw-list arrays).

§

Line(Line)

Line extends Object3D — and LineSegments extends Line, which is the is_line_segments flag inside. Not a Mesh: the renderer reads the object to pick line-strip / line-list over triangle-list.

§

Points(Points)

Points extends Object3D — like Line, not a Mesh: the renderer reads the object to pick point-list over triangle-list.

§

Sprite(Sprite)

Sprite extends Object3D — not a Mesh either: _projectObject() gives it an arm of its own, culled by Frustum.intersectsSprite() and sorted by its origin rather than by a geometry bounding sphere.

§

Light(LightObject)

Light extends Object3D, one variant per subclass. The renderer reaches it through RenderList.lights, which _projectObject() fills from object.is_light — set alongside this variant.

§

ClippingGroup(ClippingGroup)

ClippingGroup extends Group — the planes _projectObject() folds into the clipping context of everything below it.

Implementations§

Source§

impl Payload

Source

pub fn is_mesh(&self) -> bool

object.isMesh — true for InstancedMesh too, exactly as in three.js where InstancedMesh extends Mesh.

Source

pub fn is_skinned_mesh(&self) -> bool

object.isSkinnedMesh.

Source

pub fn skinned_mesh(&self) -> Option<&SkinnedMesh>

The SkinnedMesh this node is, if it is one.

Source

pub fn skinned_mesh_mut(&mut self) -> Option<&mut SkinnedMesh>

The SkinnedMesh this node is, mutably, if it is one.

Source

pub fn is_instanced_mesh(&self) -> bool

object.isInstancedMesh.

Source

pub fn is_line(&self) -> bool

object.isLine — true for a LineSegments too, exactly as in three.js where LineSegments extends Line.

Source

pub fn is_line_segments(&self) -> bool

object.isLineSegments.

Source

pub fn is_points(&self) -> bool

object.isPoints.

Source

pub fn is_sprite(&self) -> bool

object.isSprite.

Source

pub fn is_clipping_group(&self) -> bool

object.isClippingGroup.

Source

pub fn clipping_group(&self) -> Option<&ClippingGroup>

The ClippingGroup this node is, if it is one.

Source

pub fn clipping_group_mut(&mut self) -> Option<&mut ClippingGroup>

The ClippingGroup this node is, mutably, if it is one.

Source

pub fn sprite(&self) -> Option<&Sprite>

The Sprite this node is, if it is one.

Source

pub fn sprite_mut(&mut self) -> Option<&mut Sprite>

The Sprite this node is, mutably, if it is one.

Source

pub fn points(&self) -> Option<&Points>

The Points this node is, if it is one.

Source

pub fn points_mut(&mut self) -> Option<&mut Points>

The Points this node is, mutably, if it is one.

Source

pub fn line(&self) -> Option<&Line>

The Line this node is, if it is one.

Source

pub fn line_mut(&mut self) -> Option<&mut Line>

The Line this node is, mutably, if it is one.

Source

pub fn geometry(&self) -> Option<&Rc<BufferGeometry>>

object.geometry for anything _projectObject()’s isMesh || isLine || isPoints arm draws, and for its isSprite arm.

Source

pub fn material(&self) -> Option<&MeshBasicNodeMaterial>

object.material for the same set. None is three.js’ “no material of its own”, which scene.overrideMaterial (or MeshBasicNodeMaterial’s defaults) stands in for.

Source

pub fn material_mut(&mut self) -> Option<&mut MeshBasicNodeMaterial>

object.material for writing — what ReflectorNode.updateBefore() needs to set material.visible = false around its own render.

Source

pub fn morph_target_influences(&self) -> Vec<f64>

Mesh.morphTargetInfluences. A Line has the field in three.js too, but nothing on the ladder morphs one, so it is always empty here. A SkinnedMesh keeps its influences behind an Rc<RefCell<…>> — the animation binding writes into them from outside — so this returns a value rather than a borrow.

Source

pub fn mesh(&self) -> Option<&Mesh>

The Mesh half of whichever mesh-ish payload this is.

Source

pub fn mesh_mut(&mut self) -> Option<&mut Mesh>

The Mesh half, mutably, of whichever mesh-ish payload this is.

Source

pub fn light(&self) -> Option<&LightObject>

The light this node is, if it is one.

Source

pub fn light_mut(&mut self) -> Option<&mut LightObject>

The light this node is, mutably, if it is one.

Source

pub fn is_batched_mesh(&self) -> bool

object.isBatchedMesh.

Source

pub fn batched_mesh(&self) -> Option<&BatchedMesh>

The BatchedMesh this node is, if it is one.

Source

pub fn batched_mesh_mut(&mut self) -> Option<&mut BatchedMesh>

The BatchedMesh this node is, mutably, if it is one.

Source

pub fn instanced_mesh(&self) -> Option<&InstancedMesh>

The InstancedMesh this node is, if it is one.

Source

pub fn instanced_mesh_mut(&mut self) -> Option<&mut InstancedMesh>

The InstancedMesh this node is, mutably, if it is one.

Source

pub fn instance_matrix(&self) -> Option<&InstancedBufferAttribute>

InstancedMesh.instanceMatrix, None for a plain mesh.

Source

pub fn instance_color(&self) -> Option<&InstancedBufferAttribute>

InstancedMesh.instanceColor — None until setColorAt() is called, and None for a plain mesh.

Trait Implementations§

Source§

impl Clone for Payload

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Payload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Object3D derives Debug; geometries, materials and node graphs do not, so a payload prints as its variant.

Source§

impl Default for Payload

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.