1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::any::Any;
use crate::render;
#[derive(Clone, PartialEq)]
struct EmptyRenderPipeline;
impl render::PipelineTrait for EmptyRenderPipeline {
fn box_eq(&self, other: &dyn Any) -> bool {
other.downcast_ref::<Self>().map_or(false, |a| self == a)
}
fn as_any(&self) -> &dyn Any {
self
}
fn clone_box(&self) -> Box<dyn render::PipelineTrait> {
Box::new(self.clone())
}
}
impl render::RenderPipeline for EmptyRenderPipeline {
fn draw(&self, _: &mut render::RenderTarget) {}
}
#[derive(Clone, Debug)]
pub struct DefaultRenderPipeline(pub Box<dyn render::PipelineTrait>);
impl PartialEq for DefaultRenderPipeline {
fn eq(&self, _other: &Self) -> bool {
false
}
}
impl Default for DefaultRenderPipeline {
fn default() -> Self {
DefaultRenderPipeline(Box::new(EmptyRenderPipeline))
}
}