-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.h
72 lines (56 loc) · 1.47 KB
/
render.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* render.h
*/
typedef struct _device
{
int global_data;
} device;
typedef struct _mesh
{
void* vertex_data;
void* index_data;
unsigned int vertex_count;
unsigned int index_count;
unsigned int mesh_id;
} mesh;
typedef struct _texture
{
void* texture_data;
unsigned int texture_id;
} texture;
typedef struct _transform
{
float4x4 m;
} transform;
typedef struct _render_target
{
unsigned int width;
unsigned int height;
unsigned int render_target_id;
} render_target;
/* C */
#ifdef __cplusplus
extern "C" {
#endif
void render_init( device* device );
void render_draw_mesh( device* device, render_target* target, mesh* mesh, transform m );
render_target* render_create_target( device* device, unsigned int width, unsigned int height );
mesh* render_create_mesh( device* device, void* mesh_data );
texture* render_create_texture( device* device, void* texture_data );
shader* render_create_vertex_shader( device* device, const char* shader_source );
shader* render_create_pixel_shader( device* device, const char* shader_source );
#ifdef __cplusplus
}
#endif
/* C++ */
class render {
public:
render( void );
~render( void );
void draw_mesh( render_target* target, mesh* mesh, transform m );
render_target* create_target( unsigned int width, unsigned int height );
mesh* create_mesh( void* mesh_data );
texture* create_texture( void* texture_data );
shader* create_vertex_shader( const char* shader_source );
shader* create_pixel_shader( const char* shader_source );
};