[][src]Struct blender_mesh::SingleIndexedVertexAttributes

pub struct SingleIndexedVertexAttributes { /* fields omitted */ }

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]

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]

impl PartialEq<SingleIndexedVertexAttributes> for SingleIndexedVertexAttributes[src]

impl Serialize for SingleIndexedVertexAttributes[src]

impl StructuralPartialEq for SingleIndexedVertexAttributes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.