e2rcore/implement/render/
render_commands.rs1extern crate pretty_env_logger;
2
3use std::vec::Vec;
4use std::any::Any;
5
6use interface::i_ele;
7use interface::i_component;
8
9#[derive(Clone)]
11pub struct CmdDrawGroupClear ( pub i_component::ComponentDrawGroupClear );
12
13impl CmdDrawGroupClear {
14
15 pub fn init( group_id: usize ) -> CmdDrawGroupClear {
16 CmdDrawGroupClear( i_component::ComponentDrawGroupClear { _group_id: group_id } )
17 }
18}
19
20impl i_ele::IObjImpl for CmdDrawGroupClear {
21 fn as_any( & self ) -> & Any {
22 self
23 }
24
25 fn update_components( & mut self, components: & mut Vec< Box< i_component::IComponent > > ) -> Result< (), & 'static str > {
26 let c = self.0.clone();
27 components.push( Box::new( c ) );
28 trace!( "loaded command: draw group: clear" );
29 Ok( () )
30 }
31}
32
33#[derive(Clone)]
34pub struct CmdDrawGroupDependentObjects ( pub i_component::ComponentDrawGroupDependentObjects );
35
36impl CmdDrawGroupDependentObjects {
37
38 pub fn init( group_id: usize, obj_ids: &[ usize ] ) -> CmdDrawGroupDependentObjects {
39 CmdDrawGroupDependentObjects( i_component::ComponentDrawGroupDependentObjects { _group_id: group_id, _obj_ids: obj_ids.to_vec() } )
40 }
41}
42
43impl i_ele::IObjImpl for CmdDrawGroupDependentObjects {
44 fn as_any( & self ) -> & Any {
45 self
46 }
47
48 fn update_components( & mut self, components: & mut Vec< Box< i_component::IComponent > > ) -> Result< (), & 'static str > {
49 let c = self.0.clone();
50 components.push( Box::new( c ) );
51 trace!( "loaded command: draw group: set objects" );
52 Ok( () )
53 }
54}
55
56#[derive(Clone)]
57pub struct CmdDrawGroupBind ( pub i_component::ComponentDrawGroupBind );
58
59impl CmdDrawGroupBind {
60
61 pub fn init( group_id: usize ) -> CmdDrawGroupBind {
62 CmdDrawGroupBind( i_component::ComponentDrawGroupBind { _group_id: group_id } )
63 }
64}
65
66impl i_ele::IObjImpl for CmdDrawGroupBind {
67 fn as_any( & self ) -> & Any {
68 self
69 }
70
71 fn update_components( & mut self, components: & mut Vec< Box< i_component::IComponent > > ) -> Result< (), & 'static str > {
72 let c = self.0.clone();
73 components.push( Box::new( c ) );
74 trace!( "loaded command: draw group: set objects" );
75 Ok( () )
76 }
77}
78
79#[derive(Clone)]
80pub struct CmdDrawGroupDispatch ( pub i_component::ComponentDrawGroupDispatch );
81
82impl CmdDrawGroupDispatch {
83
84 pub fn init( group_id: usize ) -> CmdDrawGroupDispatch {
85 CmdDrawGroupDispatch( i_component::ComponentDrawGroupDispatch { _group_id: group_id } )
86 }
87}
88
89impl i_ele::IObjImpl for CmdDrawGroupDispatch {
90 fn as_any( & self ) -> & Any {
91 self
92 }
93
94 fn update_components( & mut self, components: & mut Vec< Box< i_component::IComponent > > ) -> Result< (), & 'static str > {
95 let c = self.0.clone();
96 components.push( Box::new( c ) );
97 trace!( "loaded command: draw group: set objects" );
98 Ok( () )
99 }
100}
101
102#[derive(Clone)]
103pub struct CmdDrawGroupDependentUniforms ( pub i_component::ComponentDrawGroupDependentUniforms );
104
105impl CmdDrawGroupDependentUniforms {
106
107 pub fn init( group_id: usize, uniform_ids: &[ u64 ] ) -> CmdDrawGroupDependentUniforms {
108 CmdDrawGroupDependentUniforms( i_component::ComponentDrawGroupDependentUniforms { _group_id: group_id, _uniform_ids: uniform_ids.to_vec() } )
109 }
110}
111
112impl i_ele::IObjImpl for CmdDrawGroupDependentUniforms {
113 fn as_any( & self ) -> & Any {
114 self
115 }
116
117 fn update_components( & mut self, components: & mut Vec< Box< i_component::IComponent > > ) -> Result< (), & 'static str > {
118 let c = self.0.clone();
119 components.push( Box::new( c ) );
120 trace!( "loaded command: draw group: set objects" );
121 Ok( () )
122 }
123}