bevy/src/render/material.rs

41 lines
803 B
Rust
Raw Normal View History

2019-12-02 18:48:08 +00:00
use crate::math;
2020-01-11 10:11:27 +00:00
use zerocopy::{AsBytes, FromBytes};
2019-12-02 18:48:08 +00:00
pub struct Material {
pub color: math::Vec4,
pub bind_group: Option<wgpu::BindGroup>,
pub uniform_buf: Option<wgpu::Buffer>,
}
2019-12-27 21:35:07 +00:00
pub struct Instanced;
2019-12-02 19:05:35 +00:00
impl Material {
pub fn new(color: math::Vec4) -> Self {
Material {
color,
bind_group: None,
2020-01-11 10:11:27 +00:00
uniform_buf: None,
2019-12-02 19:05:35 +00:00
}
}
}
2019-12-02 18:48:08 +00:00
#[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],
2019-12-27 21:35:07 +00:00
}
#[repr(C)]
#[derive(Clone, Copy, AsBytes, FromBytes)]
pub struct SimpleMaterialUniforms {
pub position: [f32; 3],
pub color: [f32; 4],
2020-01-11 10:11:27 +00:00
}