deepstone
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/mingl.h Mon Nov 21 06:14:01 2011 +0200 1.3 @@ -0,0 +1,95 @@ 1.4 +/* 1.5 +256-color 3D graphics hack for real-mode DOS. 1.6 +Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org> 1.7 + 1.8 +This program is free software: you can redistribute it and/or modify 1.9 +it under the terms of the GNU General Public License as published by 1.10 +the Free Software Foundation, either version 3 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU General Public License 1.19 +along with this program. If not, see <http://www.gnu.org/licenses/>. 1.20 +*/ 1.21 +#ifndef MINGL_H_ 1.22 +#define MINGL_H_ 1.23 + 1.24 +/* enable bitflags */ 1.25 +#define MGL_CULL_FACE 1 1.26 +#define MGL_DEPTH_TEST 2 1.27 +#define MGL_SMOOTH 4 1.28 +#define MGL_LIGHTING 8 1.29 + 1.30 +/* primitives */ 1.31 +#define MGL_POINTS 1 1.32 +#define MGL_LINES 2 1.33 +#define MGL_TRIANGLES 3 1.34 +#define MGL_QUADS 4 1.35 + 1.36 +/* matrices */ 1.37 +#define MGL_MODELVIEW 0 1.38 +#define MGL_PROJECTION 1 1.39 +#define MGL_TEXTURE 2 1.40 + 1.41 +#define MGL_FRONT 0 1.42 +#define MGL_BACK 1 1.43 + 1.44 +#define MGL_CCW 0 1.45 +#define MGL_CW 1 1.46 + 1.47 +int mgl_init(int width, int height); 1.48 +void mgl_free(void); 1.49 + 1.50 +unsigned char *mgl_framebuffer(void); 1.51 + 1.52 +void mgl_clear(int cidx); 1.53 + 1.54 +void mgl_enable(unsigned int bit); 1.55 +void mgl_disable(unsigned int bit); 1.56 + 1.57 +void mgl_front_face(int ff); 1.58 +void mgl_cull_face(int cf); 1.59 + 1.60 +void mgl_color_range(int rng); 1.61 +void mgl_light_intensity(int ltidx, float intens); 1.62 +void mgl_light_direction(int ltidx, float x, float y, float z); 1.63 + 1.64 +void mgl_begin(int prim); 1.65 +void mgl_end(void); 1.66 + 1.67 +void mgl_vertex2f(float x, float y); 1.68 +void mgl_vertex3f(float x, float y, float z); 1.69 +void mgl_vertex4f(float x, float y, float z, float w); 1.70 +void mgl_color1f(float energy); 1.71 +void mgl_index(int cidx); 1.72 +void mgl_normal(float x, float y, float z); 1.73 +void mgl_texcoord2f(float x, float y); 1.74 + 1.75 +void mgl_viewport(int x, int y, int width, int height); 1.76 + 1.77 +void mgl_matrix_mode(int mmode); 1.78 +void mgl_push_matrix(void); 1.79 +void mgl_pop_matrix(void); 1.80 +void mgl_load_matrix(float *mat); 1.81 +void mgl_mult_matrix(float *mat); 1.82 +void mgl_load_identity(void); 1.83 + 1.84 +void mgl_translate(float x, float y, float z); 1.85 +void mgl_rotate(float angle, float x, float y, float z); 1.86 +void mgl_scale(float x, float y, float z); 1.87 + 1.88 +void mgl_ortho(float left, float right, float bottom, float top, float nr, float fr); 1.89 +void mgl_frustum(float left, float right, float bottom, float top, float nr, float fr); 1.90 +void mgl_perspective(float vfov, float aspect, float nr, float fr); 1.91 + 1.92 +void mgl_cube(float sz); 1.93 +void mgl_sphere(float rad, int usub, int vsub); 1.94 +void mgl_sphere_part(float rad, int usub, int vsub, float umax, float vmax); 1.95 +void mgl_torus(float inner, float outer, int usub, int vsub); 1.96 +void mgl_torus_part(float inner, float outer, int usub, int vsub, float umax, float vmin, float vmax); 1.97 + 1.98 +#endif /* MINGL_H_ */