mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
add default resource provider impls
This commit is contained in:
parent
aca17f15b7
commit
1ac33b1477
8 changed files with 15 additions and 63 deletions
|
@ -2,14 +2,21 @@ use crate::render::renderer::Renderer;
|
|||
use legion::prelude::*;
|
||||
|
||||
pub trait ResourceProvider {
|
||||
fn initialize(&mut self, renderer: &mut dyn Renderer, world: &mut World, resources: &Resources);
|
||||
fn update(&mut self, renderer: &mut dyn Renderer, world: &mut World, resources: &Resources);
|
||||
fn initialize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
) {
|
||||
}
|
||||
fn update(&mut self, _renderer: &mut dyn Renderer, _world: &mut World, _resources: &Resources) {}
|
||||
fn resize(
|
||||
&mut self,
|
||||
renderer: &mut dyn Renderer,
|
||||
world: &mut World,
|
||||
resources: &Resources,
|
||||
width: u32,
|
||||
height: u32,
|
||||
);
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
_width: u32,
|
||||
_height: u32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ impl ResourceProvider for Camera2dResourceProvider {
|
|||
self.camera_buffer = Some(buffer);
|
||||
}
|
||||
|
||||
fn update(&mut self, _renderer: &mut dyn Renderer, _world: &mut World, _resources: &Resources) {
|
||||
}
|
||||
fn resize(
|
||||
&mut self,
|
||||
renderer: &mut dyn Renderer,
|
||||
|
|
|
@ -31,8 +31,6 @@ impl ResourceProvider for CameraResourceProvider {
|
|||
self.camera_buffer = Some(buffer);
|
||||
}
|
||||
|
||||
fn update(&mut self, _renderer: &mut dyn Renderer, _world: &mut World, _resources: &Resources) {
|
||||
}
|
||||
fn resize(
|
||||
&mut self,
|
||||
renderer: &mut dyn Renderer,
|
||||
|
|
|
@ -47,9 +47,6 @@ impl ResourceProvider for FrameTextureResourceProvider {
|
|||
self.update(renderer, world, resources);
|
||||
}
|
||||
|
||||
fn update(&mut self, _renderer: &mut dyn Renderer, _world: &mut World, _resources: &Resources) {
|
||||
}
|
||||
|
||||
fn resize(
|
||||
&mut self,
|
||||
renderer: &mut dyn Renderer,
|
||||
|
|
|
@ -114,14 +114,4 @@ impl ResourceProvider for LightResourceProvider {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn resize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
_width: u32,
|
||||
_height: u32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,14 +38,6 @@ impl MeshResourceProvider {
|
|||
}
|
||||
|
||||
impl ResourceProvider for MeshResourceProvider {
|
||||
fn initialize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
) {
|
||||
}
|
||||
|
||||
fn update(&mut self, renderer: &mut dyn Renderer, world: &mut World, resources: &Resources) {
|
||||
let mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
for (mesh_handle, _renderable) in self.mesh_query.iter(world) {
|
||||
|
@ -65,14 +57,4 @@ impl ResourceProvider for MeshResourceProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn resize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
_width: u32,
|
||||
_height: u32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,14 +113,4 @@ impl ResourceProvider for UiResourceProvider {
|
|||
fn update(&mut self, renderer: &mut dyn Renderer, world: &mut World, _resources: &Resources) {
|
||||
self.update(renderer, world);
|
||||
}
|
||||
|
||||
fn resize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
_width: u32,
|
||||
_height: u32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,14 +226,4 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn resize(
|
||||
&mut self,
|
||||
_renderer: &mut dyn Renderer,
|
||||
_world: &mut World,
|
||||
_resources: &Resources,
|
||||
_width: u32,
|
||||
_height: u32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue