bevy/src/render/material.rs
Carter Anderson 9f7e313dc4 rustfmt crate
2020-01-11 02:11:27 -08:00

40 lines
803 B
Rust

use crate::math;
use zerocopy::{AsBytes, FromBytes};
pub struct Material {
pub color: math::Vec4,
pub bind_group: Option<wgpu::BindGroup>,
pub uniform_buf: Option<wgpu::Buffer>,
}
pub struct Instanced;
impl Material {
pub fn new(color: math::Vec4) -> Self {
Material {
color,
bind_group: None,
uniform_buf: None,
}
}
}
#[repr(C)]
#[derive(Clone, Copy, AsBytes, FromBytes)]
pub struct RenderedUniforms {
pub transform: [[f32; 4]; 4],
}
#[repr(C)]
#[derive(Clone, Copy, AsBytes, FromBytes)]
pub struct MaterialUniforms {
pub model: [[f32; 4]; 4],
pub color: [f32; 4],
}
#[repr(C)]
#[derive(Clone, Copy, AsBytes, FromBytes)]
pub struct SimpleMaterialUniforms {
pub position: [f32; 3],
pub color: [f32; 4],
}