pub struct Primitive { /* private fields */ }
Expand description
A primitive consisting of a material and a subset of vertices using a particular range of indices
This might be, for example, the arm of a robot.
The Primitive depends on being in an 3D model crate::Object (or its derived crate::Instantiable, as it is the object that contains the actual materials and vertices to use
This SHOULD be optimized to fit within half a cache line (32 bytes)
Missing:
uses bones? index type (u8, u16, u32) - is this part of indices?
Implementations§
Source§impl Primitive
impl Primitive
Sourcepub fn new(
primitive_type: PrimitiveType,
vertices_index: ShortIndex,
byte_offset: u32,
index_count: u32,
material_index: ShortIndex,
) -> Self
pub fn new( primitive_type: PrimitiveType, vertices_index: ShortIndex, byte_offset: u32, index_count: u32, material_index: ShortIndex, ) -> Self
Create a new Primitive from a Vertices
use the indices’ BufferView.ele_type: BufferElementType as index size
Sourcepub fn vertices(&self) -> (Option<usize>, u32, u32)
pub fn vertices(&self) -> (Option<usize>, u32, u32)
Retrieve the data for the vertices in the primitive
This is the vertices index, the offset index, and the count
Sourcepub fn material(&self) -> ShortIndex
pub fn material(&self) -> ShortIndex
Retrieve the material for the primitive - this is the material index
Sourcepub fn primitive_type(&self) -> PrimitiveType
pub fn primitive_type(&self) -> PrimitiveType
Retrieve the PrimitiveType of the primitive
Sourcepub fn vertices_index(&self) -> ShortIndex
pub fn vertices_index(&self) -> ShortIndex
Retrieve the index into the crate::Object vertices array that this primitive uses
Sourcepub fn material_index(&self) -> ShortIndex
pub fn material_index(&self) -> ShortIndex
Retrieve the index into the crate::Object materials array that this primitive uses
Sourcepub fn index_count(&self) -> u32
pub fn index_count(&self) -> u32
Get the number of indices required to draw this primitive
Sourcepub fn byte_offset(&self) -> u32
pub fn byte_offset(&self) -> u32
Get the byte offset within the indices buffer view to the first byte used by this primitive