rayzor

annotate src/min3d.h @ 20:6b11a3f8706e

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 15 Apr 2014 01:36:03 +0300
parents 70e332156d02
children
rev   line source
nuclear@1 1 #ifndef MIN3D_H_
nuclear@1 2 #define MIN3D_H_
nuclear@1 3
nuclear@1 4 #include "inttypes.h"
nuclear@1 5
nuclear@1 6 /* state toggles */
nuclear@1 7 enum {
nuclear@1 8 M3D_DEPTH_TEST,
nuclear@1 9 M3D_CULL_FACE,
nuclear@1 10 M3D_LIGHTING,
nuclear@1 11 M3D_LIGHT0,
nuclear@1 12 M3D_LIGHT1,
nuclear@1 13 M3D_LIGHT2,
nuclear@1 14 M3D_LIGHT3
nuclear@1 15 };
nuclear@1 16
nuclear@1 17 /* buffer bits */
nuclear@1 18 enum {
nuclear@1 19 M3D_COLOR_BUFFER_BIT = 1,
nuclear@1 20 M3D_DEPTH_BUFFER_BIT = 2
nuclear@1 21 };
nuclear@1 22
nuclear@1 23 /* primitives */
nuclear@1 24 enum {
nuclear@1 25 M3D_POINTS = 1,
nuclear@1 26 M3D_LINES = 2,
nuclear@1 27 M3D_TRIANGLES = 3,
nuclear@1 28 M3D_QUADS = 4
nuclear@1 29 };
nuclear@1 30
nuclear@1 31 /* matrix mode */
nuclear@1 32 enum {
nuclear@1 33 M3D_MODELVIEW,
nuclear@1 34 M3D_PROJECTION
nuclear@1 35 };
nuclear@1 36
nuclear@1 37 struct m3d_image {
nuclear@1 38 int xsz, ysz;
nuclear@9 39 uint32_t *pixels;
nuclear@1 40 };
nuclear@1 41
nuclear@1 42 #ifdef __cplusplus
nuclear@1 43 extern "C" {
nuclear@1 44 #endif
nuclear@1 45
nuclear@6 46 int m3d_init(void);
nuclear@6 47 void m3d_shutdown(void);
nuclear@6 48
nuclear@1 49 void m3d_set_buffers(struct m3d_image *cbuf, uint16_t *zbuf);
nuclear@6 50 void m3d_clear_color(float r, float g, float b);
nuclear@1 51 void m3d_clear(unsigned int bmask);
nuclear@1 52
nuclear@1 53 void m3d_enable(int bit);
nuclear@1 54 void m3d_disable(int bit);
nuclear@1 55
nuclear@9 56 void m3d_viewport(int x, int y, int xsz, int ysz);
nuclear@9 57
nuclear@1 58 /* matrix stack */
nuclear@1 59 void m3d_matrix_mode(int mode);
nuclear@6 60 void m3d_push_matrix(void);
nuclear@6 61 void m3d_pop_matrix(void);
nuclear@1 62 void m3d_load_identity(void);
nuclear@1 63 void m3d_load_matrix(const float *m);
nuclear@17 64 void m3d_load_transpose_matrix(const float *m);
nuclear@1 65 void m3d_mult_matrix(const float *m);
nuclear@17 66 void m3d_mult_transpose_matrix(const float *m);
nuclear@1 67 void m3d_translate(float x, float y, float z);
nuclear@1 68 void m3d_rotate(float angle, float x, float y, float z);
nuclear@1 69 void m3d_scale(float x, float y, float z);
nuclear@1 70 void m3d_frustum(float left, float right, float bottom, float top, float nr, float fr);
nuclear@1 71 void m3d_perspective(float vfov, float aspect, float znear, float zfar);
nuclear@1 72
nuclear@1 73 /* drawing */
nuclear@5 74 void m3d_vertex_array(const float *varr);
nuclear@5 75 void m3d_normal_array(const float *narr);
nuclear@5 76 void m3d_color_array(const float *carr);
nuclear@5 77 void m3d_texcoord_array(const float *tcarr);
nuclear@5 78
nuclear@5 79 void m3d_draw(int prim, int vcount);
nuclear@9 80 void m3d_draw_indexed(int prim, const unsigned int *idxarr, int icount);
nuclear@1 81
nuclear@6 82 /* immediate mode interface */
nuclear@6 83 void m3d_begin(int prim);
nuclear@6 84 void m3d_end(void);
nuclear@6 85 void m3d_vertex(float x, float y, float z);
nuclear@6 86 void m3d_normal(float x, float y, float z);
nuclear@6 87 void m3d_color(float x, float y, float z);
nuclear@6 88 void m3d_texcoord(float x, float y);
nuclear@1 89
nuclear@1 90 #ifdef __cplusplus
nuclear@1 91 }
nuclear@1 92 #endif
nuclear@1 93
nuclear@1 94 #endif /* MIN3D_H_ */