add default resource provider impls

This commit is contained in:
Carter Anderson 2020-03-10 01:51:06 -07:00
parent aca17f15b7
commit 1ac33b1477
8 changed files with 15 additions and 63 deletions

View file

@ -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,
) {
}
}

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,
) {
}
}

View file

@ -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,
) {
}
}

View file

@ -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,
) {
}
}

View file

@ -226,14 +226,4 @@ where
}
}
}
fn resize(
&mut self,
_renderer: &mut dyn Renderer,
_world: &mut World,
_resources: &Resources,
_width: u32,
_height: u32,
) {
}
}