Show 3d.h syntax highlighted
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D al_draw_polygon drawing routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_3D_H
#define ALLEGRO_3D_H
#ifdef __cplusplus
extern "C" {
#endif
#include "base.h"
#include "fixed.h"
struct AL_BITMAP;
typedef struct AL_V3D /* a 3d point (fixed point version) */
{
fixed x, y, z; /* position */
fixed u, v; /* texture map coordinates */
int c; /* color */
} AL_V3D;
typedef struct AL_V3D_F /* a 3d point (floating point version) */
{
float x, y, z; /* position */
float u, v; /* texture map coordinates */
int c; /* color */
} AL_V3D_F;
#define POLYTYPE_FLAT 0
#define POLYTYPE_GCOL 1
#define POLYTYPE_GRGB 2
#define POLYTYPE_ATEX 3
#define POLYTYPE_PTEX 4
#define POLYTYPE_ATEX_MASK 5
#define POLYTYPE_PTEX_MASK 6
#define POLYTYPE_ATEX_LIT 7
#define POLYTYPE_PTEX_LIT 8
#define POLYTYPE_ATEX_MASK_LIT 9
#define POLYTYPE_PTEX_MASK_LIT 10
#define POLYTYPE_ATEX_TRANS 11
#define POLYTYPE_PTEX_TRANS 12
#define POLYTYPE_ATEX_MASK_TRANS 13
#define POLYTYPE_PTEX_MASK_TRANS 14
#define POLYTYPE_MAX 15
#define POLYTYPE_ZBUF 16
AL_VAR(float, al_scene_gap);
AL_FUNC(void, al_draw_polygon_3d, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, int vc, AL_V3D *vtx[]));
AL_FUNC(void, al_draw_polygon_3d_f, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, int vc, AL_V3D_F *vtx[]));
AL_FUNC(void, al_draw_triangle_3d, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, AL_V3D *v1, AL_V3D *v2, AL_V3D *v3));
AL_FUNC(void, al_draw_triangle_3d_f, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, AL_V3D_F *v1, AL_V3D_F *v2, AL_V3D_F *v3));
AL_FUNC(void, al_quad_3d, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, AL_V3D *v1, AL_V3D *v2, AL_V3D *v3, AL_V3D *v4));
AL_FUNC(void, al_quad_3d_f, (struct AL_BITMAP *bmp, int type, struct AL_BITMAP *texture, AL_V3D_F *v1, AL_V3D_F *v2, AL_V3D_F *v3, AL_V3D_F *v4));
AL_FUNC(int, al_clip_3d, (int type, fixed min_z, fixed max_z, int vc, AL_CONST AL_V3D *vtx[], AL_V3D *vout[], AL_V3D *vtmp[], int out[]));
AL_FUNC(int, al_clip_3d_f, (int type, float min_z, float max_z, int vc, AL_CONST AL_V3D_F *vtx[], AL_V3D_F *vout[], AL_V3D_F *vtmp[], int out[]));
AL_FUNC(fixed, polygon_z_normal, (AL_CONST AL_V3D *v1, AL_CONST AL_V3D *v2, AL_CONST AL_V3D *v3));
AL_FUNC(float, al_polygon_z_normal_f, (AL_CONST AL_V3D_F *v1, AL_CONST AL_V3D_F *v2, AL_CONST AL_V3D_F *v3));
/* Note: You are not supposed to mix AL_ZBUFFER with AL_BITMAP even though it is
* currently possible. This is just the internal representation, and it may
* change in the future.
*/
typedef struct AL_BITMAP AL_ZBUFFER;
AL_FUNC(AL_ZBUFFER *, al_create_zbuffer, (struct AL_BITMAP *bmp));
AL_FUNC(AL_ZBUFFER *, al_create_sub_zbuffer, (AL_ZBUFFER *parent, int x, int y, int width, int height));
AL_FUNC(void, al_set_zbuffer, (AL_ZBUFFER *zbuf));
AL_FUNC(void, al_clear_zbuffer, (AL_ZBUFFER *zbuf, float z));
AL_FUNC(void, al_destroy_zbuffer, (AL_ZBUFFER *zbuf));
AL_FUNC(int, al_create_scene, (int nedge, int npoly));
AL_FUNC(void, al_clear_scene, (struct AL_BITMAP* bmp));
AL_FUNC(void, al_destroy_scene, (void));
AL_FUNC(int, al_scene_polygon_3d, (int type, struct AL_BITMAP *texture, int vx, AL_V3D *vtx[]));
AL_FUNC(int, al_scene_polygon_3d_f, (int type, struct AL_BITMAP *texture, int vx, AL_V3D_F *vtx[]));
AL_FUNC(void, al_render_scene, (void));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_3D_H */
See more files for this project here