mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
begin instancing work
This commit is contained in:
parent
56e79d5225
commit
63f40589e3
5 changed files with 10 additions and 8 deletions
|
@ -157,10 +157,13 @@ fn create_person(world: &mut World, mesh_handle: Handle<Mesh>, translation: Tran
|
|||
Velocity {
|
||||
value: math::vec3(0.0, 0.0, 0.0),
|
||||
},
|
||||
Instanced,
|
||||
StandardMaterial {
|
||||
albedo: (math::vec4(0.5, 0.3, 0.3, 1.0) * random::<f32>()).into(),
|
||||
},
|
||||
Renderable {
|
||||
instanced: true,
|
||||
..Default::default()
|
||||
},
|
||||
mesh_handle,
|
||||
LocalToWorld::identity(),
|
||||
translation,
|
||||
|
|
|
@ -9,8 +9,7 @@ pub use crate::{
|
|||
pipeline::PipelineDescriptor,
|
||||
render_resource::{resource_name, resource_providers::UniformResourceProvider},
|
||||
shader::{uniforms::StandardMaterial, Shader, ShaderDefSuffixProvider, ShaderStage},
|
||||
texture::{Texture, TextureType},
|
||||
ActiveCamera, ActiveCamera2d, Camera, CameraType, Color, ColorSource, Instanced, Light,
|
||||
ActiveCamera, ActiveCamera2d, Camera, CameraType, Color, ColorSource, Light,
|
||||
Renderable,
|
||||
},
|
||||
ui::{Anchors, Margins, Node},
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
pipeline::PipelineDescriptor,
|
||||
render_resource::{resource_name, ResourceInfo},
|
||||
renderer::RenderPass,
|
||||
Instanced, Renderable,
|
||||
Renderable,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl DrawTarget for MeshesDrawTarget {
|
|||
let mut current_mesh_handle = None;
|
||||
let mut current_mesh_index_len = 0;
|
||||
let mesh_query =
|
||||
<(Read<Handle<Mesh>>, Read<Renderable>)>::query().filter(!component::<Instanced>());
|
||||
<(Read<Handle<Mesh>>, Read<Renderable>)>::query();
|
||||
|
||||
for (entity, (mesh, renderable)) in mesh_query.iter_entities(world) {
|
||||
if !renderable.is_visible {
|
||||
|
|
|
@ -20,6 +20,4 @@ pub mod pipeline;
|
|||
pub mod render_resource;
|
||||
mod renderable;
|
||||
pub mod renderer;
|
||||
pub mod texture;
|
||||
|
||||
pub struct Instanced;
|
||||
pub mod texture;
|
|
@ -13,6 +13,7 @@ pub struct Renderable {
|
|||
pub is_visible: bool,
|
||||
pub pipelines: Vec<Handle<PipelineDescriptor>>,
|
||||
pub shader_defs: HashSet<String>,
|
||||
pub instanced: bool,
|
||||
}
|
||||
|
||||
impl Default for Renderable {
|
||||
|
@ -23,6 +24,7 @@ impl Default for Renderable {
|
|||
Handle::new(0), // TODO: this could be better
|
||||
],
|
||||
shader_defs: HashSet::new(),
|
||||
instanced: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue