deepstone

view src/mingl.h @ 3:0e781cc43178

adding textures
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 Nov 2011 10:16:09 +0200
parents f04884489bad
children bce78aaafc68
line source
1 /*
2 256-color 3D graphics hack for real-mode DOS.
3 Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef MINGL_H_
19 #define MINGL_H_
21 /* enable bitflags */
22 #define MGL_CULL_FACE 1
23 #define MGL_DEPTH_TEST 2
24 #define MGL_SMOOTH 4
25 #define MGL_LIGHTING 8
26 #define MGL_TEXTURE_2D 16
28 /* primitives */
29 #define MGL_POINTS 1
30 #define MGL_LINES 2
31 #define MGL_TRIANGLES 3
32 #define MGL_QUADS 4
34 /* matrices */
35 #define MGL_MODELVIEW 0
36 #define MGL_PROJECTION 1
37 #define MGL_TEXTURE 2
39 #define MGL_FRONT 0
40 #define MGL_BACK 1
42 #define MGL_CCW 0
43 #define MGL_CW 1
45 int mgl_init(int width, int height);
46 void mgl_free(void);
48 unsigned char *mgl_framebuffer(void);
50 void mgl_clear(int cidx);
52 void mgl_enable(unsigned int bit);
53 void mgl_disable(unsigned int bit);
54 int mgl_isenabled(unsigned int bit);
56 void mgl_front_face(int ff);
57 void mgl_cull_face(int cf);
59 void mgl_color_range(int rng);
60 void mgl_light_intensity(int ltidx, float intens);
61 void mgl_light_direction(int ltidx, float x, float y, float z);
63 void mgl_begin(int prim);
64 void mgl_end(void);
66 void mgl_vertex2f(float x, float y);
67 void mgl_vertex3f(float x, float y, float z);
68 void mgl_vertex4f(float x, float y, float z, float w);
69 void mgl_color1f(float energy);
70 void mgl_index(int cidx);
71 void mgl_normal(float x, float y, float z);
72 void mgl_texcoord2f(float x, float y);
74 void mgl_viewport(int x, int y, int width, int height);
76 void mgl_matrix_mode(int mmode);
77 void mgl_push_matrix(void);
78 void mgl_pop_matrix(void);
79 void mgl_load_matrix(float *mat);
80 void mgl_mult_matrix(float *mat);
81 void mgl_load_identity(void);
83 void mgl_translate(float x, float y, float z);
84 void mgl_rotate(float angle, float x, float y, float z);
85 void mgl_scale(float x, float y, float z);
87 void mgl_ortho(float left, float right, float bottom, float top, float nr, float fr);
88 void mgl_frustum(float left, float right, float bottom, float top, float nr, float fr);
89 void mgl_perspective(float vfov, float aspect, float nr, float fr);
91 void mgl_teximage(int width, int height, unsigned char *pixels);
93 void mgl_cube(float sz);
94 void mgl_sphere(float rad, int usub, int vsub);
95 void mgl_sphere_part(float rad, int usub, int vsub, float umax, float vmax);
96 void mgl_torus(float inner, float outer, int usub, int vsub);
97 void mgl_torus_part(float inner, float outer, int usub, int vsub, float umax, float vmin, float vmax);
99 #endif /* MINGL_H_ */