Struct mod3d_base::Primitive
source · 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)