forked from smcameron/space-nerds-in-space
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_dev.h
90 lines (72 loc) · 3.57 KB
/
graph_dev.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
Copyright (C) 2013 Jeremy Van Grinsven
Author: Jeremy Van Grinsven
This file is part of Spacenerds In Space.
Spacenerds in Space is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Spacenerds in Space is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Spacenerds in Space; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef INCLUDE_graph_device_H
#define INCLUDE_graph_device_H
struct mesh;
struct entity_context;
struct entity;
struct entity_transform;
union vec3;
struct mat44;
struct mat33;
extern int graph_dev_setup(const char *shader_dir);
extern void graph_dev_start_frame();
extern void graph_dev_end_frame();
extern void graph_dev_set_context(void *gdk_drawable, void *gdk_gc);
extern void graph_dev_set_color(void *gdk_color, float a);
extern void graph_dev_set_screen_size(int width, int height);
extern void graph_dev_set_extent_scale(float x_scale, float y_scale);
extern void graph_dev_set_3d_viewport(int x_offset, int y_offset, int width, int height);
extern void graph_dev_clear_depth_bit();
#define GRAPH_DEV_RENDER_FAR_TO_NEAR 0
#define GRAPH_DEV_RENDER_NEAR_TO_FAR 1
extern int graph_dev_entity_render_order(struct entity_context *cx, struct entity *e);
extern void graph_dev_draw_entity(struct entity_context *cx, struct entity *e, union vec3 *eye_light_pos,
const struct entity_transform *transform);
extern void graph_dev_draw_3d_line(struct entity_context *cx, const struct mat44 *mat_vp, const struct mat44 *mat_v,
float x1, float y1, float z1, float x2, float y2, float z2);
extern void graph_dev_draw_line(float x1, float y1, float x2, float y2);
extern void graph_dev_draw_rectangle(int filled, float x, float y, float width, float height);
extern void graph_dev_draw_point(float x, float y);
extern void graph_dev_draw_arc(int filled, float x, float y, float width, float height,
float angle1, float angle2);
extern void graph_dev_load_skybox_texture(
const char *texture_filename_pos_x,
const char *texture_filename_neg_x,
const char *texture_filename_pos_y,
const char *texture_filename_neg_y,
const char *texture_filename_pos_z,
const char *texture_filename_neg_z);
extern unsigned int graph_dev_load_cubemap_texture(
int is_inside,
const char *texture_filename_pos_x,
const char *texture_filename_neg_x,
const char *texture_filename_pos_y,
const char *texture_filename_neg_y,
const char *texture_filename_pos_z,
const char *texture_filename_neg_z);
extern unsigned int graph_dev_load_texture(const char *filename);
extern const char *graph_dev_get_texture_filename(unsigned int);
extern void graph_dev_draw_skybox(struct entity_context *cx, const struct mat44 *mat_vp);
extern void graph_dev_reload_changed_textures();
extern void graph_dev_reload_changed_cubemap_textures();
extern void graph_dev_display_debug_menu_show();
extern int graph_dev_graph_dev_debug_menu_click(int x, int y);
extern void graph_dev_setup_colors(void *gtk_widget, void *gdk_color_huex, int nhuex);
/* graph_dev_grab_framebuffer only implemented for opengl backend */
extern void graph_dev_grab_framebuffer(unsigned char **buffer, int *width, int *height);
#endif