Skip to content

Commit

Permalink
Initial Commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleeok committed Jan 26, 2016
0 parents commit 429df34
Show file tree
Hide file tree
Showing 687 changed files with 300,341 additions and 0 deletions.
82 changes: 82 additions & 0 deletions allegro/allegro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Main header file for the entire Allegro library.
* (separate modules can be included from the allegro/ directory)
*
* By Shawn Hargreaves.
*
* Vincent Penquerc'h split the original allegro.h into separate headers.
*
* See readme.txt for copyright information.
*/


#ifndef ALLEGRO_H
#define ALLEGRO_H

#include "allegro/base.h"

#include "allegro/system.h"
#include "allegro/debug.h"

#include "allegro/unicode.h"

#include "allegro/mouse.h"
#include "allegro/timer.h"
#include "allegro/keyboard.h"
#include "allegro/joystick.h"

#include "allegro/palette.h"
#include "allegro/gfx.h"
#include "allegro/color.h"
#include "allegro/draw.h"
#include "allegro/rle.h"
#include "allegro/compiled.h"
#include "allegro/text.h"
#include "allegro/font.h"

#include "allegro/fli.h"
#include "allegro/config.h"
#include "allegro/gui.h"

#include "allegro/sound.h"

#include "allegro/file.h"
#include "allegro/lzss.h"
#include "allegro/datafile.h"

#include "allegro/fixed.h"
#include "allegro/fmaths.h"
#include "allegro/matrix.h"
#include "allegro/quat.h"

#include "allegro/3d.h"
#include "allegro/3dmaths.h"


#ifndef ALLEGRO_NO_COMPATIBILITY
#include "allegro/alcompat.h"
#endif

#ifndef ALLEGRO_NO_FIX_CLASS
#ifdef __cplusplus
#include "allegro/fix.h"
#endif
#endif


#ifdef ALLEGRO_EXTRA_HEADER
#include ALLEGRO_EXTRA_HEADER
#endif

#endif /* ifndef ALLEGRO_H */


104 changes: 104 additions & 0 deletions allegro/allegro/3d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D polygon drawing routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/


#ifndef ALLEGRO_3D_H
#define ALLEGRO_3D_H

#include "base.h"
#include "fixed.h"

#ifdef __cplusplus
extern "C" {
#endif

struct BITMAP;

typedef struct V3D /* a 3d point (fixed point version) */
{
fixed x, y, z; /* position */
fixed u, v; /* texture map coordinates */
int c; /* color */
} V3D;


typedef struct V3D_f /* a 3d point (floating point version) */
{
float x, y, z; /* position */
float u, v; /* texture map coordinates */
int c; /* color */
} 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, scene_gap);

AL_FUNC(void, _soft_polygon3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D *vtx[]));
AL_FUNC(void, _soft_polygon3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D_f *vtx[]));
AL_FUNC(void, _soft_triangle3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3));
AL_FUNC(void, _soft_triangle3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3));
AL_FUNC(void, _soft_quad3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4));
AL_FUNC(void, _soft_quad3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3, V3D_f *v4));
AL_FUNC(int, clip3d, (int type, fixed min_z, fixed max_z, int vc, AL_CONST V3D *vtx[], V3D *vout[], V3D *vtmp[], int out[]));
AL_FUNC(int, clip3d_f, (int type, float min_z, float max_z, int vc, AL_CONST V3D_f *vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]));

AL_FUNC(fixed, polygon_z_normal, (AL_CONST V3D *v1, AL_CONST V3D *v2, AL_CONST V3D *v3));
AL_FUNC(float, polygon_z_normal_f, (AL_CONST V3D_f *v1, AL_CONST V3D_f *v2, AL_CONST V3D_f *v3));

/* Note: You are not supposed to mix ZBUFFER with BITMAP even though it is
* currently possible. This is just the internal representation, and it may
* change in the future.
*/
typedef struct BITMAP ZBUFFER;

AL_FUNC(ZBUFFER *, create_zbuffer, (struct BITMAP *bmp));
AL_FUNC(ZBUFFER *, create_sub_zbuffer, (ZBUFFER *parent, int x, int y, int width, int height));
AL_FUNC(void, set_zbuffer, (ZBUFFER *zbuf));
AL_FUNC(void, clear_zbuffer, (ZBUFFER *zbuf, float z));
AL_FUNC(void, destroy_zbuffer, (ZBUFFER *zbuf));

AL_FUNC(int, create_scene, (int nedge, int npoly));
AL_FUNC(void, clear_scene, (struct BITMAP* bmp));
AL_FUNC(void, destroy_scene, (void));
AL_FUNC(int, scene_polygon3d, (int type, struct BITMAP *texture, int vx, V3D *vtx[]));
AL_FUNC(int, scene_polygon3d_f, (int type, struct BITMAP *texture, int vx, V3D_f *vtx[]));
AL_FUNC(void, render_scene, (void));

#ifdef __cplusplus
}
#endif

#endif /* ifndef ALLEGRO_3D_H */


64 changes: 64 additions & 0 deletions allegro/allegro/3dmaths.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D oriented math routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/


#ifndef ALLEGRO_3DMATHS_H
#define ALLEGRO_3DMATHS_H

#include "base.h"
#include "fixed.h"

#ifdef __cplusplus
extern "C" {
#endif

struct QUAT;
struct MATRIX_f;

AL_FUNC(fixed, vector_length, (fixed x, fixed y, fixed z));
AL_FUNC(float, vector_length_f, (float x, float y, float z));

AL_FUNC(void, normalize_vector, (fixed *x, fixed *y, fixed *z));
AL_FUNC(void, normalize_vector_f, (float *x, float *y, float *z));

AL_FUNC(void, cross_product, (fixed x1, fixed y_1, fixed z1, fixed x2, fixed y2, fixed z2, fixed *xout, fixed *yout, fixed *zout));
AL_FUNC(void, cross_product_f, (float x1, float y_1, float z1, float x2, float y2, float z2, float *xout, float *yout, float *zout));

AL_VAR(fixed, _persp_xscale);
AL_VAR(fixed, _persp_yscale);
AL_VAR(fixed, _persp_xoffset);
AL_VAR(fixed, _persp_yoffset);

AL_VAR(float, _persp_xscale_f);
AL_VAR(float, _persp_yscale_f);
AL_VAR(float, _persp_xoffset_f);
AL_VAR(float, _persp_yoffset_f);

AL_FUNC(void, set_projection_viewport, (int x, int y, int w, int h));

AL_FUNC(void, quat_to_matrix, (AL_CONST struct QUAT *q, struct MATRIX_f *m));
AL_FUNC(void, matrix_to_quat, (AL_CONST struct MATRIX_f *m, struct QUAT *q));

#ifdef __cplusplus
}
#endif

#include "inline/3dmaths.inl"

#endif /* ifndef ALLEGRO_3DMATHS_H */


Loading

0 comments on commit 429df34

Please sign in to comment.