e2rcore/interface/
i_renderobj.rs

1extern crate mazth;
2
3use std::collections::HashMap;
4
5use self::mazth::mat::{ Mat4, Mat3x1 };
6use implement::render::renderdevice_gl::RenderUniformCollection;
7
8pub trait Xform {
9    fn get_xform() -> Mat4< f32 >;
10}
11
12pub trait ObjPos {
13    fn get_pos( & self ) -> Mat3x1< f32 >;
14}
15
16#[derive(Debug)]
17#[derive(Clone)]
18#[derive(Copy)]
19pub enum RenderObjType {
20    TRI,
21    //todo
22    QUAD,
23    POINT,
24    LINE,
25}
26
27#[derive(Debug)]
28#[derive(Clone)]
29#[derive(Copy)]
30#[derive(Eq)]
31#[derive(Hash)]
32#[derive(PartialEq)]
33pub enum BuffDataType {
34    POS,
35    NORMAL,
36    TC,
37}
38
39pub trait RenderDevice {
40    fn bind_buffer( & mut self ) -> Result< (), & 'static str >;
41    fn draw_buffer_all( & mut self ) -> Result< (), & 'static str >;
42    fn draw_buffer_range( & mut self ) -> Result< (), & 'static str >;
43    fn store_buff_data( & mut self, data: & HashMap< BuffDataType, Vec< f32 > > ) -> Result< (), & 'static str >;
44    fn clear_buff_data( & mut self );
45}
46
47pub trait IRenderBuffer {
48    fn load_into_buffer( & mut self, rd: & mut RenderDevice ) -> Result< (), & 'static str >;
49}
50
51pub enum RenderMethod {
52    ADS,
53    PBR,
54    NONE,
55}
56pub trait IRenderable : IRenderBuffer {
57    fn get_render_method( & self ) -> RenderMethod;
58}
59
60pub trait IRenderUniform {
61    fn load_into_uniform( & mut self, uniforms: & mut RenderUniformCollection ) -> Result< (), & 'static str >;
62}