deepstone

view src/mingl.h @ 28:11d14f688485

added clipping
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Sep 2013 06:38:08 +0300
parents 0909996838ff
children
line source
1 #ifndef MINGL_H_
2 #define MINGL_H_
4 /* enable bitflags */
5 #define MGL_CULL_FACE 0
6 #define MGL_DEPTH_TEST 1
7 #define MGL_SMOOTH 2
8 #define MGL_LIGHTING 3
9 #define MGL_TEXTURE_2D 4
10 #define MGL_CLIP_PLANE0 5
11 #define MGL_CLIP_PLANE1 6
12 #define MGL_CLIP_PLANE2 7
13 #define MGL_CLIP_PLANE3 8
14 #define MGL_CLIP_PLANE4 9
15 #define MGL_CLIP_PLANE5 10
17 /* primitives */
18 #define MGL_POINTS 1
19 #define MGL_LINES 2
20 #define MGL_TRIANGLES 3
21 #define MGL_QUADS 4
23 /* matrices */
24 #define MGL_MODELVIEW 0
25 #define MGL_PROJECTION 1
26 #define MGL_TEXTURE 2
28 #define MGL_FRONT 0
29 #define MGL_BACK 1
31 #define MGL_CCW 0
32 #define MGL_CW 1
34 int mgl_init(int width, int height);
35 void mgl_free(void);
37 unsigned char *mgl_framebuffer(void);
39 void mgl_clear(int cidx);
40 void mgl_clear_depth(void);
42 void mgl_enable(unsigned int bit);
43 void mgl_disable(unsigned int bit);
44 int mgl_isenabled(unsigned int bit);
46 void mgl_front_face(int ff);
47 void mgl_cull_face(int cf);
49 void mgl_set_ambient(float amb);
50 float mgl_get_ambient(void);
52 void mgl_color_range(int rng);
53 void mgl_light_intensity(int ltidx, float intens);
54 void mgl_light_position(int ltidx, float x, float y, float z, float w);
56 void mgl_begin(int prim);
57 void mgl_end(void);
59 void mgl_vertex2f(float x, float y);
60 void mgl_vertex3f(float x, float y, float z);
61 void mgl_vertex4f(float x, float y, float z, float w);
62 void mgl_color1f(float energy);
63 void mgl_index(int cidx);
64 void mgl_normal(float x, float y, float z);
65 void mgl_texcoord2f(float x, float y);
67 void mgl_viewport(int x, int y, int width, int height);
69 void mgl_matrix_mode(int mmode);
70 void mgl_push_matrix(void);
71 void mgl_pop_matrix(void);
72 void mgl_load_matrix(float *mat);
73 void mgl_mult_matrix(float *mat);
74 void mgl_load_identity(void);
76 void mgl_translate(float x, float y, float z);
77 void mgl_rotate(float angle, float x, float y, float z);
78 void mgl_scale(float x, float y, float z);
80 void mgl_ortho(float left, float right, float bottom, float top, float nr, float fr);
81 void mgl_frustum(float left, float right, float bottom, float top, float nr, float fr);
82 void mgl_perspective(float vfov, float aspect, float nr, float fr);
84 void mgl_teximage(int width, int height, unsigned char *pixels);
86 void mgl_clip_plane(int id, float nx, float ny, float nz, float dist);
88 void mgl_cube(float sz);
89 void mgl_sphere(float rad, int usub, int vsub);
90 void mgl_sphere_part(float rad, int usub, int vsub, float umax, float vmax);
91 void mgl_torus(float inner, float outer, int usub, int vsub);
92 void mgl_torus_part(float inner, float outer, int usub, int vsub, float umax, float vmin, float vmax);
94 #endif /* MINGL_H_ */