rayzor
diff src/min3d.h @ 1:a826bf0fb169
fixed line endings
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Apr 2014 09:05:26 +0300 |
parents | 2a5340a6eee4 |
children | 5fcf72837b69 |
line diff
1.1 --- a/src/min3d.h Sat Apr 05 08:46:27 2014 +0300 1.2 +++ b/src/min3d.h Sat Apr 05 09:05:26 2014 +0300 1.3 @@ -1,73 +1,73 @@ 1.4 -#ifndef MIN3D_H_ 1.5 -#define MIN3D_H_ 1.6 - 1.7 -#include "inttypes.h" 1.8 - 1.9 -/* state toggles */ 1.10 -enum { 1.11 - M3D_DEPTH_TEST, 1.12 - M3D_CULL_FACE, 1.13 - M3D_LIGHTING, 1.14 - M3D_LIGHT0, 1.15 - M3D_LIGHT1, 1.16 - M3D_LIGHT2, 1.17 - M3D_LIGHT3 1.18 -}; 1.19 - 1.20 -/* buffer bits */ 1.21 -enum { 1.22 - M3D_COLOR_BUFFER_BIT = 1, 1.23 - M3D_DEPTH_BUFFER_BIT = 2 1.24 -}; 1.25 - 1.26 -/* primitives */ 1.27 -enum { 1.28 - M3D_POINTS = 1, 1.29 - M3D_LINES = 2, 1.30 - M3D_TRIANGLES = 3, 1.31 - M3D_QUADS = 4 1.32 -}; 1.33 - 1.34 -/* matrix mode */ 1.35 -enum { 1.36 - M3D_MODELVIEW, 1.37 - M3D_PROJECTION 1.38 -}; 1.39 - 1.40 -struct m3d_image { 1.41 - int xsz, ysz; 1.42 - unsigned char *pixels; 1.43 -}; 1.44 - 1.45 -#ifdef __cplusplus 1.46 -extern "C" { 1.47 -#endif 1.48 - 1.49 -void m3d_set_buffers(struct m3d_image *cbuf, uint16_t *zbuf); 1.50 -void m3d_clear(unsigned int bmask); 1.51 - 1.52 -void m3d_enable(int bit); 1.53 -void m3d_disable(int bit); 1.54 - 1.55 -/* matrix stack */ 1.56 -void m3d_matrix_mode(int mode); 1.57 -void m3d_load_identity(void); 1.58 -void m3d_load_matrix(const float *m); 1.59 -void m3d_mult_matrix(const float *m); 1.60 -void m3d_translate(float x, float y, float z); 1.61 -void m3d_rotate(float angle, float x, float y, float z); 1.62 -void m3d_scale(float x, float y, float z); 1.63 -void m3d_frustum(float left, float right, float bottom, float top, float nr, float fr); 1.64 -void m3d_perspective(float vfov, float aspect, float znear, float zfar); 1.65 - 1.66 -/* drawing */ 1.67 -void m3d_draw(int prim, const float *varr, int vcount); 1.68 -void m3d_draw_indexed(int prim, const float *varr, const int *idxarr, int icount); 1.69 - 1.70 -/* TODO immediate mode */ 1.71 - 1.72 -#ifdef __cplusplus 1.73 -} 1.74 -#endif 1.75 - 1.76 -#endif /* MIN3D_H_ */ 1.77 +#ifndef MIN3D_H_ 1.78 +#define MIN3D_H_ 1.79 + 1.80 +#include "inttypes.h" 1.81 + 1.82 +/* state toggles */ 1.83 +enum { 1.84 + M3D_DEPTH_TEST, 1.85 + M3D_CULL_FACE, 1.86 + M3D_LIGHTING, 1.87 + M3D_LIGHT0, 1.88 + M3D_LIGHT1, 1.89 + M3D_LIGHT2, 1.90 + M3D_LIGHT3 1.91 +}; 1.92 + 1.93 +/* buffer bits */ 1.94 +enum { 1.95 + M3D_COLOR_BUFFER_BIT = 1, 1.96 + M3D_DEPTH_BUFFER_BIT = 2 1.97 +}; 1.98 + 1.99 +/* primitives */ 1.100 +enum { 1.101 + M3D_POINTS = 1, 1.102 + M3D_LINES = 2, 1.103 + M3D_TRIANGLES = 3, 1.104 + M3D_QUADS = 4 1.105 +}; 1.106 + 1.107 +/* matrix mode */ 1.108 +enum { 1.109 + M3D_MODELVIEW, 1.110 + M3D_PROJECTION 1.111 +}; 1.112 + 1.113 +struct m3d_image { 1.114 + int xsz, ysz; 1.115 + unsigned char *pixels; 1.116 +}; 1.117 + 1.118 +#ifdef __cplusplus 1.119 +extern "C" { 1.120 +#endif 1.121 + 1.122 +void m3d_set_buffers(struct m3d_image *cbuf, uint16_t *zbuf); 1.123 +void m3d_clear(unsigned int bmask); 1.124 + 1.125 +void m3d_enable(int bit); 1.126 +void m3d_disable(int bit); 1.127 + 1.128 +/* matrix stack */ 1.129 +void m3d_matrix_mode(int mode); 1.130 +void m3d_load_identity(void); 1.131 +void m3d_load_matrix(const float *m); 1.132 +void m3d_mult_matrix(const float *m); 1.133 +void m3d_translate(float x, float y, float z); 1.134 +void m3d_rotate(float angle, float x, float y, float z); 1.135 +void m3d_scale(float x, float y, float z); 1.136 +void m3d_frustum(float left, float right, float bottom, float top, float nr, float fr); 1.137 +void m3d_perspective(float vfov, float aspect, float znear, float zfar); 1.138 + 1.139 +/* drawing */ 1.140 +void m3d_draw(int prim, const float *varr, int vcount); 1.141 +void m3d_draw_indexed(int prim, const float *varr, const int *idxarr, int icount); 1.142 + 1.143 +/* TODO immediate mode */ 1.144 + 1.145 +#ifdef __cplusplus 1.146 +} 1.147 +#endif 1.148 + 1.149 +#endif /* MIN3D_H_ */