vertex.rs 507 B

12345678910111213141516171819202122232425262728293031
  1. use chair::*;
  2. use wgpu::*;
  3. #[derive(Clone, Copy, Debug, Pod, Zeroable)]
  4. #[repr(C)]
  5. pub struct TexturedVertex {
  6. pub pos: [f32; 3],
  7. pub uvs: [f32; 2]
  8. }
  9. const ATTRIBS: &[VertexAttribute] = &vertex_attr_array![
  10. 0 => Float32x3,
  11. 1 => Float32x2
  12. ];
  13. impl Vertex for TexturedVertex {
  14. fn new(pos: [f32; 3], _: [f32; 4], _: [f32; 3], uvs: [f32; 2]) -> Self {
  15. Self {
  16. pos,
  17. uvs
  18. }
  19. }
  20. fn features() -> MeshFeatures {
  21. features!(Textured)
  22. }
  23. fn attribs() -> &'static [VertexAttribute] {
  24. ATTRIBS
  25. }
  26. }