deepstone

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