X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2F3dgfx.h;h=ee9de632b5604c75f8fd403176b7c3084f000c4d;hb=25669bf7362645d1c0fee9d7cb07f4a6b0b34903;hp=a2fa15410b2b88e20a3407bdf0fd0fe4da17e6d0;hpb=d1a2007e191d68b104e436d1817eafcc99ae21dd;p=dosdemo diff --git a/src/3dgfx.h b/src/3dgfx.h index a2fa154..ee9de63 100644 --- a/src/3dgfx.h +++ b/src/3dgfx.h @@ -1,6 +1,8 @@ #ifndef THREEDGFX_H_ #define THREEDGFX_H_ +#include "inttypes.h" + struct g3d_vertex { float x, y, z, w; float nx, ny, nz; @@ -20,18 +22,22 @@ enum { G3D_CULL_FACE = 1, G3D_DEPTH_TEST = 2, /* XXX not implemented */ G3D_LIGHTING = 4, - G3D_TEXTURE = 8, + G3D_LIGHT0 = 8, + G3D_LIGHT1 = 16, + G3D_LIGHT2 = 32, + G3D_LIGHT3 = 64, + G3D_TEXTURE = 128, G3D_ALL = 0x7fffffff }; -/* 2nd arg to g3d_draw: which space are input verts in. skips parts of the pipeline */ +/* arg to g3d_front_face */ +enum { G3D_CCW, G3D_CW }; + +/* arg to g3d_polygon_mode */ enum { - G3D_LOCAL_SPACE, /* this being 0 makes a nice default arg. */ - G3D_VIEW_SPACE, /* ignore modelview matrix */ - G3D_CLIP_SPACE, /* ignore projection matrix */ - G3D_SCREEN_SPACE,/* 2D verts, don't divide by w */ - G3D_PIXEL_SPACE /* in pixel units, ignore viewport */ + G3D_WIRE, + G3D_FLAT }; /* matrix stacks */ @@ -42,7 +48,8 @@ enum { G3D_NUM_MATRICES }; -void g3d_init(void); +int g3d_init(void); +void g3d_destroy(void); void g3d_framebuffer(int width, int height, void *pixels); @@ -51,18 +58,37 @@ void g3d_disable(unsigned int opt); void g3d_setopt(unsigned int opt, unsigned int mask); unsigned int g3d_getopt(unsigned int mask); -void g3d_set_matrix(int which, const float *m); /* null ptr for identity */ -void g3d_mult_matrix(int which, const float *m); -void g3d_push_matrix(int which); -void g3d_pop_matrix(int which); +void g3d_front_face(unsigned int order); +void g3d_polygon_mode(int pmode); + +void g3d_matrix_mode(int mmode); + +void g3d_load_identity(void); +void g3d_load_matrix(const float *m); +void g3d_mult_matrix(const float *m); +void g3d_push_matrix(void); +void g3d_pop_matrix(void); + +void g3d_translate(float x, float y, float z); +void g3d_rotate(float angle, float x, float y, float z); +void g3d_scale(float x, float y, float z); +void g3d_ortho(float left, float right, float bottom, float top, float znear, float zfar); +void g3d_frustum(float left, float right, float bottom, float top, float znear, float zfar); +void g3d_perspective(float vfov, float aspect, float znear, float zfar); + +const float *g3d_get_matrix(int which, float *m); + +void g3d_light_pos(int idx, float x, float y, float z); +void g3d_light_color(int idx, float r, float g, float b); + +void g3d_light_ambient(float r, float g, float b); -void g3d_translate(int which, float x, float y, float z); -void g3d_rotate(int which, float angle, float x, float y, float z); -void g3d_scale(int which, float x, float y, float z); -void g3d_ortho(int which, float left, float right, float bottom, float top, float znear, float zfar); -void g3d_frustum(int which, float left, float right, float bottom, float top, float znear, float zfar); -void g3d_perspective(int which, float vfov, float aspect, float znear, float zfar); +void g3d_mtl_diffuse(float r, float g, float b); +void g3d_mtl_specular(float r, float g, float b); +void g3d_mtl_shininess(float shin); -void g3d_draw(int prim, int space, const struct g3d_vertex *varr, int varr_size); +void g3d_draw(int prim, const struct g3d_vertex *varr, int varr_size); +void g3d_draw_indexed(int prim, const struct g3d_vertex *varr, int varr_size, + const int16_t *iarr, int iarr_size); #endif /* THREEDGFX_H_ */