[][src]Struct duku::Mesh

pub struct Mesh {
    pub vertices: Vec<Vector3>,
    pub uvs: Vec<Vector2>,
    pub normals: Vec<Vector3>,
    pub tangents: Vec<Vector3>,
    pub colors: Vec<Color>,
    pub textures: Vec<u32>,
    pub indices: Vec<u32>,
    // some fields omitted
}

Shape collection for rendering

Example

This example is not tested
// setup a triangle
let mut mesh = duku.create_mesh();
mesh.vertices = vec![
    Vector3::new(-1.0, -1.0),
    Vector3::new(0.0, 1.0),
    Vector3::new(1.0, -1.0),
];
mesh.indices = vec![0, 1, 2];

// render a triangle
target.draw_mesh(&mesh);

Fields

vertices: Vec<Vector3>

vertex positions

uvs: Vec<Vector2>

vertex UV coordinates

normals: Vec<Vector3>

vertex normal directions

tangents: Vec<Vector3>

vertex tangent directions

colors: Vec<Color>

vertex colors

textures: Vec<u32>

vertex texture indices

indices: Vec<u32>

vertex indices

Implementations

impl Mesh[src]

pub fn calculate_normals(&mut self)[src]

Calculate vertex normals automatically smoothing the values to achieve smooth shading.

Note: calls calculate_tangents automatically

pub fn calculate_tangents(&mut self)[src]

Calculate vertex tangents automatically smoothing the values to achieve smooth shading.

Auto Trait Implementations

impl RefUnwindSafe for Mesh

impl !Send for Mesh

impl !Sync for Mesh

impl Unpin for Mesh

impl UnwindSafe for Mesh

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> From<T> for T[src]

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

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.