mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
material constructor
This commit is contained in:
parent
6b937d5df4
commit
df5c74a0ea
2 changed files with 13 additions and 3 deletions
|
@ -17,19 +17,19 @@ fn main() {
|
||||||
|
|
||||||
world.insert((), vec![
|
world.insert((), vec![
|
||||||
(
|
(
|
||||||
Material { color: math::vec4(0.1, 0.2, 0.1, 1.0), bind_group: None, uniform_buf: None },
|
Material::new(math::vec4(0.1, 0.2, 0.1, 1.0)),
|
||||||
plane_handle.clone(),
|
plane_handle.clone(),
|
||||||
LocalToWorld(math::translation(&math::vec3(0.0, 0.0, 0.0))),
|
LocalToWorld(math::translation(&math::vec3(0.0, 0.0, 0.0))),
|
||||||
Translation::new(0.0, 0.0, 0.0)
|
Translation::new(0.0, 0.0, 0.0)
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Material { color: math::vec4(0.1, 0.1, 0.6, 1.0), bind_group: None, uniform_buf: None },
|
Material::new(math::vec4(0.1, 0.1, 0.6, 1.0)),
|
||||||
mesh_handle.clone(),
|
mesh_handle.clone(),
|
||||||
LocalToWorld(math::translation(&math::vec3(1.5, 0.0, 1.0))),
|
LocalToWorld(math::translation(&math::vec3(1.5, 0.0, 1.0))),
|
||||||
Translation::new(0.0, 0.0, 0.0)
|
Translation::new(0.0, 0.0, 0.0)
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Material { color: math::vec4(0.6, 0.1, 0.1, 1.0), bind_group: None, uniform_buf: None },
|
Material::new(math::vec4(0.6, 0.1, 0.1, 1.0)),
|
||||||
mesh_handle,
|
mesh_handle,
|
||||||
LocalToWorld(math::translation(&math::vec3(-1.5, 0.0, 1.0))),
|
LocalToWorld(math::translation(&math::vec3(-1.5, 0.0, 1.0))),
|
||||||
Translation::new(0.0, 0.0, 0.0)
|
Translation::new(0.0, 0.0, 0.0)
|
||||||
|
|
|
@ -7,6 +7,16 @@ pub struct Material {
|
||||||
pub uniform_buf: Option<wgpu::Buffer>,
|
pub uniform_buf: Option<wgpu::Buffer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Material {
|
||||||
|
pub fn new(color: math::Vec4) -> Self {
|
||||||
|
Material {
|
||||||
|
color,
|
||||||
|
bind_group: None,
|
||||||
|
uniform_buf: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy, AsBytes, FromBytes)]
|
#[derive(Clone, Copy, AsBytes, FromBytes)]
|
||||||
pub struct RenderedUniforms {
|
pub struct RenderedUniforms {
|
||||||
|
|
Loading…
Reference in a new issue