deepstone

view src/mingl.h @ 0:f04884489bad

dos3d initial import
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 Nov 2011 06:14:01 +0200
parents
children 0e781cc43178
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
27 /* primitives */
28 #define MGL_POINTS 1
29 #define MGL_LINES 2
30 #define MGL_TRIANGLES 3
31 #define MGL_QUADS 4
33 /* matrices */
34 #define MGL_MODELVIEW 0
35 #define MGL_PROJECTION 1
36 #define MGL_TEXTURE 2
38 #define MGL_FRONT 0
39 #define MGL_BACK 1
41 #define MGL_CCW 0
42 #define MGL_CW 1
44 int mgl_init(int width, int height);
45 void mgl_free(void);
47 unsigned char *mgl_framebuffer(void);
49 void mgl_clear(int cidx);
51 void mgl_enable(unsigned int bit);
52 void mgl_disable(unsigned int bit);
54 void mgl_front_face(int ff);
55 void mgl_cull_face(int cf);
57 void mgl_color_range(int rng);
58 void mgl_light_intensity(int ltidx, float intens);
59 void mgl_light_direction(int ltidx, float x, float y, float z);
61 void mgl_begin(int prim);
62 void mgl_end(void);
64 void mgl_vertex2f(float x, float y);
65 void mgl_vertex3f(float x, float y, float z);
66 void mgl_vertex4f(float x, float y, float z, float w);
67 void mgl_color1f(float energy);
68 void mgl_index(int cidx);
69 void mgl_normal(float x, float y, float z);
70 void mgl_texcoord2f(float x, float y);
72 void mgl_viewport(int x, int y, int width, int height);
74 void mgl_matrix_mode(int mmode);
75 void mgl_push_matrix(void);
76 void mgl_pop_matrix(void);
77 void mgl_load_matrix(float *mat);
78 void mgl_mult_matrix(float *mat);
79 void mgl_load_identity(void);
81 void mgl_translate(float x, float y, float z);
82 void mgl_rotate(float angle, float x, float y, float z);
83 void mgl_scale(float x, float y, float z);
85 void mgl_ortho(float left, float right, float bottom, float top, float nr, float fr);
86 void mgl_frustum(float left, float right, float bottom, float top, float nr, float fr);
87 void mgl_perspective(float vfov, float aspect, float nr, float fr);
89 void mgl_cube(float sz);
90 void mgl_sphere(float rad, int usub, int vsub);
91 void mgl_sphere_part(float rad, int usub, int vsub, float umax, float vmax);
92 void mgl_torus(float inner, float outer, int usub, int vsub);
93 void mgl_torus_part(float inner, float outer, int usub, int vsub, float umax, float vmin, float vmax);
95 #endif /* MINGL_H_ */