Struct blender_mesh::SingleIndexedVertexAttributes[][src]

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

Implementations

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..

TODO: When we combine normals we'll end up with a lot of vertices that have the same data so we should dedupe the vertices / indices

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>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

For SingleIndexVertexData every 3 indices corresponds to one triangle.

There can not be any other faces (quads, ngons) - only triangles.

pub fn vertices(&self) -> &Vec<Vertex>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

All of the vertex data for the mesh.

You can index into this data using SingleIndexedVertexAttributes

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: for<'de> 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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,