Skip to main content

RenderPrimitiveBuilder

Struct RenderPrimitiveBuilder 

Source
pub struct RenderPrimitiveBuilder { /* private fields */ }
Expand description

Builds one renderer-ready primitive from programmatic vertex data.

Required asset references use typed identifiers. Missing optional vertex attributes receive the same safe defaults as loaded glTF primitives, and triangle normals are generated when they are omitted.

Implementations§

Source§

impl RenderPrimitiveBuilder

Source

pub fn new(node_id: NodeId, positions: Vec<[f32; 3]>, indices: Vec<u32>) -> Self

Creates a triangle primitive attached to node_id.

Use Self::with_topology for point or line geometry. Indices are always explicit; use 0..positions.len() for non-indexed input.

Source

pub const fn with_world_transform(self, transform: Transform) -> Self

Sets the accumulated rest-pose transform for an unskinned primitive.

Skinned primitives use the identity transform, matching loaded VRM assets whose skinning palette already places the surface in world space.

Source

pub fn with_normals(self, normals: Vec<[f32; 3]>) -> Self

Supplies one normal per position instead of generating defaults.

Source

pub fn with_skinning( self, joints: Vec<[u16; 4]>, weights: Vec<[f32; 4]>, ) -> Self

Supplies joint indices and weights, one pair per position.

Source

pub fn with_skinning_sets(self, skinning_sets: Vec<SkinningSet>) -> Self

Replaces every consecutive skinning attribute set.

Source

pub const fn with_skin(self, skin_id: SkinId) -> Self

Attaches the primitive to a skin in the completed asset.

Source

pub fn with_morph_target( self, position_deltas: Vec<[f32; 3]>, normal_deltas: Option<Vec<[f32; 3]>>, tangent_deltas: Option<Vec<[f32; 3]>>, ) -> Self

Appends a morph target without requiring direct access to its storage.

Source

pub fn with_morph_targets(self, morph_targets: Vec<MorphTarget>) -> Self

Replaces the complete morph-target list.

Source

pub fn with_morph_weights(self, morph_weights: Vec<f32>) -> Self

Sets the base weights, one value per morph target.

Source

pub fn with_texcoords(self, texcoords: Vec<[f32; 2]>) -> Self

Supplies UV set 0, one coordinate per position.

Source

pub fn with_secondary_texcoords(self, texcoords: Vec<[f32; 2]>) -> Self

Supplies UV set 1, one coordinate per position.

Source

pub fn with_texcoord_sets(self, texcoord_sets: Vec<Vec<[f32; 2]>>) -> Self

Replaces every consecutive texture coordinate set.

Source

pub fn with_tangents(self, tangents: Vec<[f32; 4]>) -> Self

Supplies tangent vectors, one per position.

Source

pub fn with_colors(self, colors: Vec<[f32; 4]>) -> Self

Supplies vertex colors, one per position.

Source

pub const fn with_material(self, material_id: MaterialId) -> Self

Associates the primitive with a material in the completed asset.

Source

pub const fn with_base_color_texture( self, texture_id: TextureId, tex_coord: u32, ) -> Self

Sets the legacy base-color texture shortcut retained by RenderPrimitive.

Renderers should normally resolve all texture slots from the material. This value is kept for consumers of RenderPrimitive::texture_id.

Source

pub const fn with_topology(self, topology: PrimitiveTopology) -> Self

Selects how the index buffer is interpreted.

Source

pub fn build(self) -> Result<RenderPrimitive, BuildError>

Validates local vertex invariants and creates an immutable primitive.

Cross-object identifiers are validated later by crate::AvatarAssetBuilder::build.

Trait Implementations§

Source§

impl Clone for RenderPrimitiveBuilder

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 RenderPrimitiveBuilder

Source§

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

Formats the value using the given formatter. 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<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> 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.