10 unsigned char r, g, b, a;
20 /* g3d_enable/g3d_disable bits */
22 G3D_CULL_FACE = 0x000001,
23 G3D_DEPTH_TEST = 0x000002, /* XXX not implemented */
24 G3D_LIGHTING = 0x000004,
25 G3D_LIGHT0 = 0x000008,
26 G3D_LIGHT1 = 0x000010,
27 G3D_LIGHT2 = 0x000020,
28 G3D_LIGHT3 = 0x000040,
29 G3D_TEXTURE_2D = 0x000080, /* XXX doesn't affect anything, use g3d_polygon_mode */
31 G3D_TEXTURE_GEN = 0x000200,
32 G3D_CLIP_FRUSTUM = 0x000800,/* when disabled, don't clip against the frustum */
33 G3D_CLIP_PLANE0 = 0x001000, /* user-defined 3D clipping planes XXX not impl. */
34 G3D_CLIP_PLANE1 = 0x002000,
35 G3D_CLIP_PLANE2 = 0x004000,
36 G3D_CLIP_PLANE3 = 0x008000,
38 G3D_TEXTURE_MAT = 0x010000,
43 /* arg to g3d_front_face */
44 enum { G3D_CCW, G3D_CW };
46 /* arg to g3d_polygon_mode */
63 void g3d_destroy(void);
65 void g3d_framebuffer(int width, int height, void *pixels);
66 void g3d_framebuffer_addr(void *pixels);
67 void g3d_viewport(int x, int y, int w, int h);
69 void g3d_enable(unsigned int opt);
70 void g3d_disable(unsigned int opt);
71 void g3d_setopt(unsigned int opt, unsigned int mask);
72 unsigned int g3d_getopt(unsigned int mask);
74 void g3d_front_face(unsigned int order);
75 void g3d_polygon_mode(int pmode);
77 void g3d_matrix_mode(int mmode);
79 void g3d_load_identity(void);
80 void g3d_load_matrix(const float *m);
81 void g3d_mult_matrix(const float *m);
82 void g3d_push_matrix(void);
83 void g3d_pop_matrix(void);
85 void g3d_translate(float x, float y, float z);
86 void g3d_rotate(float angle, float x, float y, float z);
87 void g3d_scale(float x, float y, float z);
88 void g3d_ortho(float left, float right, float bottom, float top, float znear, float zfar);
89 void g3d_frustum(float left, float right, float bottom, float top, float znear, float zfar);
90 void g3d_perspective(float vfov, float aspect, float znear, float zfar);
92 /* returns pointer to the *internal* matrix, and if argument m is not null,
93 * also copies the internal matrix there. */
94 const float *g3d_get_matrix(int which, float *m);
96 void g3d_light_pos(int idx, float x, float y, float z);
97 void g3d_light_color(int idx, float r, float g, float b);
99 void g3d_light_ambient(float r, float g, float b);
101 void g3d_mtl_diffuse(float r, float g, float b);
102 void g3d_mtl_specular(float r, float g, float b);
103 void g3d_mtl_shininess(float shin);
105 void g3d_set_texture(int xsz, int ysz, void *pixels);
107 void g3d_draw(int prim, const struct g3d_vertex *varr, int varr_size);
108 void g3d_draw_indexed(int prim, const struct g3d_vertex *varr, int varr_size,
109 const uint16_t *iarr, int iarr_size);
111 void g3d_begin(int prim);
113 void g3d_vertex(float x, float y, float z);
114 void g3d_normal(float x, float y, float z);
115 void g3d_color3b(unsigned char r, unsigned char g, unsigned char b);
116 void g3d_color4b(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
117 void g3d_color3f(float r, float g, float b);
118 void g3d_color4f(float r, float g, float b, float a);
119 void g3d_texcoord(float u, float v);
121 #endif /* THREEDGFX_H_ */