mirror of
https://github.com/bevyengine/bevy
synced 2025-01-10 12:18:58 +00:00
40 lines
803 B
Rust
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],
|
|
}
|