[−][src]Struct blender_mesh::SingleIndexedVertexAttributes
Most 3D model file formats export vertex data with multiple indices.
There might be indices for the positions, normals and uvs.
The SingleIndexVertexData
is vertex data that only has one index.
When we've run BlenderMesh.combine_vertex_indices
we'll end up generating
SingleIndexVertexData
Methods
impl SingleIndexedVertexAttributes
[src]
pub fn face_weight_normals(&mut self) -> Result<(), WeightedNormalsError>
[src]
Alter normals to be both surface weighted (connected triangle size) and angle weighted (angle of connected triangle corner)
@see http://www.bytehazard.com/articles/vertnorm.html
TODO: We could also implement this for multi-indexed - but we should wait until we refactor / replace the combine_indices function because, for example, if we weight normals before we calculate face tangents our face tangents will be incorrect. In general this entire crate needs to be heavily TDD"d and refactored into something clean..
impl SingleIndexedVertexAttributes
[src]
pub fn interleave<T: Copy>(
attribs: &[&VertexAttribute<T>]
) -> Result<Vec<T>, InterleaveError>
[src]
attribs: &[&VertexAttribute<T>]
) -> Result<Vec<T>, InterleaveError>
Combine anu number of vertex attributes into a single buffer of vertex data.
Say you have positions: [0., 1., 2., 10., 11., 12.] with attribute size 3 uvs : [0., 1., 1., 1.]
This would get stitched together as [0., 1., 2., 0., 1., 10., 11., 12., 1., 1.]
More generally, say you have attributes P with size 3, U with size 2, N with size 3.
They'll get interleaved as [ P0, P0, P0, U0, U0, N0, N0, P1, P1, P1, U1, U1, N1, N1, ... ],
impl SingleIndexedVertexAttributes
[src]
pub fn indices(&self) -> &Vec<u16>
[src]
For SingleIndexVertexData
every 3 indices corresponds to one triangle.
There can not be any other faces (quads, ngons) - only triangles.
pub fn positions(&self) -> &VertexAttribute<f32>
[src]
Every 3 floats corresponds to one vertex's position
pub fn normals(&self) -> Option<&VertexAttribute<f32>>
[src]
Every 3 floats corresponds to one vertex's normal.
pub fn face_tangents(&self) -> Option<&VertexAttribute<f32>>
[src]
Every 3 floats corresponds to one tangent vector - useful for normal mapping.
pub fn uvs(&self) -> Option<&VertexAttribute<f32>>
[src]
Every 2 floats corresponds to one vertex's uv.
pub fn bones_influencers(&self) -> Option<&VertexAttribute<u8>>
[src]
The indices of the joints that influence each bone.
The number of floats per vertex can vary and can be found using
VertexAttribute.attribute_size()
.
pub fn bone_influencer_weights(&self) -> Option<&VertexAttribute<f32>>
[src]
The weights of each bone influencer.
The number of floats per vertex can vary and can be found using
VertexAttribute.attribute_size()
.
Trait Implementations
impl Debug for SingleIndexedVertexAttributes
[src]
impl Default for SingleIndexedVertexAttributes
[src]
impl<'de> Deserialize<'de> for SingleIndexedVertexAttributes
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<SingleIndexedVertexAttributes> for SingleIndexedVertexAttributes
[src]
fn eq(&self, other: &SingleIndexedVertexAttributes) -> bool
[src]
fn ne(&self, other: &SingleIndexedVertexAttributes) -> bool
[src]
impl Serialize for SingleIndexedVertexAttributes
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for SingleIndexedVertexAttributes
[src]
Auto Trait Implementations
impl RefUnwindSafe for SingleIndexedVertexAttributes
impl Send for SingleIndexedVertexAttributes
impl Sync for SingleIndexedVertexAttributes
impl Unpin for SingleIndexedVertexAttributes
impl UnwindSafe for SingleIndexedVertexAttributes
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,