pub trait VertexDescriptor: Copy {
    const INSTANCING: VertexInstancing;
    const ATTRIBUTES: &'static [VertexAttribute];
    const DRAW_MODE: DrawMode;
}
Expand description

A trait to describe vertices that will be consumed by a shader. The INSTANCING field describes if vertices with this VertexDescriptor will be drawn instanced or non instanced. The ATTRIBUTES field describes the fields contained in your vertex struct.

Example

// This is an example for how to implement VertexDescriptor for a simple type.
use storm::cgmath::*;
use storm::graphics::*;

#[repr(C)]
#[derive(Copy, Clone)]
struct Demo {
    pos: Vector3<f32>,
    size: Vector2<u16>,
}

impl VertexDescriptor for Demo {
    // Don't apply any instancing to this vertex type.
    const INSTANCING: VertexInstancing = VertexInstancing::none();
    // These are the attributes that describe the fields contained in this vertex.
    const ATTRIBUTES: &'static [VertexAttribute] = &[
        // This value represents the three f32s in pos's Vector3<f32>. When invoked in the
        // shader, the values will be read as f32s.
        VertexAttribute::new(3, VertexInputType::F32, VertexOutputType::F32),
        // This value represents the two u16s in size's Vector3<u16>. When invoked in the
        // shader, the values will be read as f32s.
        VertexAttribute::new(2, VertexInputType::U16, VertexOutputType::F32),
    ];
}

Required Associated Constants

Implementors