Compare commits
1 commit
cf1549a45b
...
7d312c19b7
Author | SHA1 | Date | |
---|---|---|---|
7d312c19b7 |
5 changed files with 44 additions and 65 deletions
|
@ -22,7 +22,6 @@ pub trait RenderingFrontEnd {
|
||||||
// scene rendering
|
// scene rendering
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
changed: bool,
|
|
||||||
content: Vec<&EntityObject>,
|
content: Vec<&EntityObject>,
|
||||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||||
images: &TargetMode<Vec<Arc<Image>>>,
|
images: &TargetMode<Vec<Arc<Image>>>,
|
||||||
|
|
|
@ -406,7 +406,6 @@ impl RenderingFrontEnd for Rasterizer {
|
||||||
|
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
_changed: bool,
|
|
||||||
content: Vec<&EntityObject>,
|
content: Vec<&EntityObject>,
|
||||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||||
_images: &TargetMode<Vec<Arc<Image>>>,
|
_images: &TargetMode<Vec<Arc<Image>>>,
|
||||||
|
|
|
@ -680,7 +680,6 @@ impl RenderingFrontEnd for TraditionalRasterizer {
|
||||||
|
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
_changed: bool,
|
|
||||||
content: Vec<&EntityObject>,
|
content: Vec<&EntityObject>,
|
||||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||||
_images: &TargetMode<Vec<Arc<Image>>>,
|
_images: &TargetMode<Vec<Arc<Image>>>,
|
||||||
|
|
|
@ -65,8 +65,6 @@ where
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
|
|
||||||
vertex_count: u64,
|
|
||||||
|
|
||||||
renderer: T,
|
renderer: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +147,6 @@ where
|
||||||
|
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
|
||||||
vertex_count: 0,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +601,6 @@ where
|
||||||
// scene rendering
|
// scene rendering
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
changed: bool,
|
|
||||||
content: Vec<&EntityObject>,
|
content: Vec<&EntityObject>,
|
||||||
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
buffer_recorder: &mut CommandBufferRecorder<'_>,
|
||||||
images: &TargetMode<Vec<Arc<Image>>>,
|
images: &TargetMode<Vec<Arc<Image>>>,
|
||||||
|
@ -619,12 +614,10 @@ where
|
||||||
self.renderer.invalidate();
|
self.renderer.invalidate();
|
||||||
self.animator.invalidate();
|
self.animator.invalidate();
|
||||||
|
|
||||||
if changed {
|
|
||||||
let mut recompile = false;
|
|
||||||
|
|
||||||
// gather textures and materials from all objects
|
// gather textures and materials from all objects
|
||||||
let (textures, materials, vertex_count) = Self::gather_descriptor_buffers(&content)?;
|
let (textures, materials, vertex_count) = Self::gather_descriptor_buffers(&content)?;
|
||||||
self.vertex_count = vertex_count;
|
|
||||||
|
let mut recompile = false;
|
||||||
|
|
||||||
// update material descriptor
|
// update material descriptor
|
||||||
if !materials.is_empty() {
|
if !materials.is_empty() {
|
||||||
|
@ -635,10 +628,8 @@ where
|
||||||
self.max_material_count *= 2;
|
self.max_material_count *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.material_desc_set = Self::create_material_descriptor_set(
|
self.material_desc_set =
|
||||||
&self.device,
|
Self::create_material_descriptor_set(&self.device, self.max_material_count)?;
|
||||||
self.max_material_count,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
recompile = true;
|
recompile = true;
|
||||||
}
|
}
|
||||||
|
@ -675,17 +666,13 @@ where
|
||||||
&self.light_info_desc_set,
|
&self.light_info_desc_set,
|
||||||
])?;
|
])?;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let index = *indices.mono();
|
let index = *indices.mono();
|
||||||
|
|
||||||
if let Some(scene_buffer) = self.animator.animate(
|
if let Some(scene_buffer) =
|
||||||
&content,
|
self.animator
|
||||||
self.vertex_count,
|
.animate(&content, vertex_count, buffer_recorder, index, &self.view)?
|
||||||
buffer_recorder,
|
{
|
||||||
index,
|
|
||||||
&self.view,
|
|
||||||
)? {
|
|
||||||
self.scene_desc_set
|
self.scene_desc_set
|
||||||
.update(&[DescriptorWrite::storage_buffers(0, &[scene_buffer])])?;
|
.update(&[DescriptorWrite::storage_buffers(0, &[scene_buffer])])?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -463,13 +463,8 @@ impl TScene for Scene {
|
||||||
#[cfg(feature = "timings")]
|
#[cfg(feature = "timings")]
|
||||||
let before = Instant::now();
|
let before = Instant::now();
|
||||||
|
|
||||||
self.renderer.process(
|
self.renderer
|
||||||
world.had_entity_changes(),
|
.process(content, buffer_recorder, images, indices)?;
|
||||||
content,
|
|
||||||
buffer_recorder,
|
|
||||||
images,
|
|
||||||
indices,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
#[cfg(feature = "timings")]
|
#[cfg(feature = "timings")]
|
||||||
self.timings
|
self.timings
|
||||||
|
|
Loading…
Reference in a new issue