@DATABASE "graphics3D.h"
@MASTER   "ram:graphics3D.h"
@REMARK   This file was created by ADtoHT 2.1 on 26-Feb-98 23:28:25
@REMARK   Do not edit
@REMARK   ADtoHT is © 1993-1995 Christian Stieber

@NODE MAIN "graphics3D.h"

@{"graphics3D.h" LINK File}


@{b}Structures@{ub}

@{"ambient3d" LINK "graphics3D.h/File" 186}  @{"dir3d" LINK "graphics3D.h/File" 110}    @{"grafica" LINK "graphics3D.h/File" 249}   @{"line" LINK "graphics3D.h/File" 103}     @{"matrix1x4" LINK "graphics3D.h/File" 75}  @{"matrix4x4" LINK "graphics3D.h/File" 53}  @{"objectnode" LINK "graphics3D.h/File" 134}
@{"pixel" LINK "graphics3D.h/File" 95}      @{"polygon" LINK "graphics3D.h/File" 118}  @{"polytemp" LINK "graphics3D.h/File" 161}  @{"rgbtype" LINK "graphics3D.h/File" 36}  @{"vector" LINK "graphics3D.h/File" 85}     @{"vertex" LINK "graphics3D.h/File" 28}     


@{b}Typedefs@{ub}

@{"Sambient3d" LINK "graphics3D.h/File" 245}  @{"SAreaInfo" LINK "graphics3D.h/File" 236}  @{"Sdir3d" LINK "graphics3D.h/File" 243}   @{"Sgrafica" LINK "graphics3D.h/File" 235}  @{"Smatrix4x4" LINK "graphics3D.h/File" 244}  @{"Sobjectnode" LINK "graphics3D.h/File" 238}
@{"Spolygon" LINK "graphics3D.h/File" 240}    @{"Spolytemp" LINK "graphics3D.h/File" 242}  @{"STmpRas" LINK "graphics3D.h/File" 237}  @{"Svector" LINK "graphics3D.h/File" 241}   @{"Svertex" LINK "graphics3D.h/File" 239}     


@{b}#defines@{ub}

@{"COMPLEMENT" LINK "graphics3D.h/File" 15}  @{"FIXV" LINK "graphics3D.h/File" 23}   @{"FIXVM" LINK "graphics3D.h/File" 24}      @{"FLAT" LINK "graphics3D.h/File" 19}       @{"FRUSTUM" LINK "graphics3D.h/File" 21}   @{"INVERSVID" LINK "graphics3D.h/File" 16}
@{"JAM1" LINK "graphics3D.h/File" 13}        @{"JAM2" LINK "graphics3D.h/File" 14}   @{"MAXOBJECT" LINK "graphics3D.h/File" 47}  @{"MAXPLFRAM" LINK "graphics3D.h/File" 48}  @{"MAXPOINT" LINK "graphics3D.h/File" 46}  @{"MAXVER()" LINK "graphics3D.h/File" 230}
@{"MAXVERT" LINK "graphics3D.h/File" 49}     @{"SFIXV" LINK "graphics3D.h/File" 22}  @{"SOLID" LINK "graphics3D.h/File" 18}      @{"WIREF" LINK "graphics3D.h/File" 17}      @{"ZPLANE" LINK "graphics3D.h/File" 20}    

@ENDNODE
@NODE File "graphics3D.h"
/*
**      $VER: graphics3d.h 10.01 (01.11.97)
**
**      main include file for @{"graphics3d.library" LINK "graphics3d_E/MAIN"}
**
**      (C) Copyright 1997 Patrizio Biancalani
**      All Rights Reserved.
*/

#ifndef GRAPHICS3D_GRAPHICS3D_H
#define GRAPHICS3D_GRAPHICS3D_H

#define JAM1 0
#define JAM2 1
#define COMPLEMENT 2
#define INVERSVID 4
#define WIREF   0       /* modo visualizzazione in wire frame */
#define SOLID   2       /* modo visualizzazione in solid */
#define FLAT    1       /* modo visualizzazione i flat shading */
#define ZPLANE  0       /* #1 modo clippaggio oggetti */
#define FRUSTUM 1       /* #2 modo clippaggio oggetti */
#define SFIXV   8       /* n# di shift per cal. num. virgola fissa */
#define FIXV    256     /* fattore moltipl. per num. virgola fissa */
#define FIXVM   128     /* meta' di @{"FIXV" LINK File 23} , per effettuare appros.  */

/** STRUTTURE DATI DI USO ESTERNO ED INTERNO **/
/* vertice, usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 23}) */
struct vertex
{
long int x;
long int y;
long int z;
};

/* struttura per definizione colore */
struct rgbtype
{
short int r;
short int g;
short int b;
};

/* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */

/** COSTANTI DI USO SOLO INTERNO **/
#define MAXPOINT  4     /* massimo numero di punti per poligono */
#define MAXOBJECT 100   /* massimo numero oggetti per mondo 3D (max. 65535)*/
#define MAXPLFRAM 10000 /* massimo numero poligoni in una frame (16*12) */
#define MAXVERT   1000  /* massimo numero vertici per un oggetto */

/* matrice di trasformazione (4x4) */
/* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 23}) */
struct matrix4x4
{
long int r0c0;
long int r0c1;
long int r0c2;
long int r0c3;
long int r1c0;
long int r1c1;
long int r1c2;
long int r1c3;
long int r2c0;
long int r2c1;
long int r2c2;
long int r2c3;
long int r3c0;
long int r3c1;
long int r3c2;
long int r3c3;
};

/* matrice di trasformazione (1x4) */
/* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 23}) */
struct matrix1x4
{
long int r0c0;
long int r0c1;
long int r0c2;
long int r0c3;
};

/* vettore */
/* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 23}) */
struct vector
{
long int x;
long int y;
long int z;
long int w;
};

/* pixel */
/* usa formato intero a 2 bytes */
struct pixel
{
short int x;
short int y;
};

/* struttura per definire una linea */
/* usa due riferimenti a strutture vertice */
struct line
{
@{"struct vertex" LINK File 28} *a;               /* puntatore a st. vertex di partenza */
@{"struct vertex" LINK File 28} *b;               /* puntatore a st. vertex d'arrivo */
};

/* struttura per definire direzione in spazio 3d */
struct dir3d
{
long int angx;
long int angy;
long int angz;
};

/* struttura per definizione di un poligono */
struct polygon
{
char numpoints;
short int color;
short int shade;
char twosided;
char visible;
char clipped;
char active;
long int vertexlist0;   /* puntatore a #1 indice vertici */
long int vertexlist1;   /* puntatore a #2 indice vertici */
long int vertexlist2;   /* puntatore a #3 indice vertici */
long int vertexlist3;   /* puntatore a #4 indice vertici */
};

/* struttura di descrizione di un oggetto */
struct objectnode
{
long int id;            /* identificativo univoco per oggetto */
long int dummy;         /* pad per poter usare name con StringF */
char name[22];
long int numverts;
@{"struct vertex" LINK File 28} *vorig;   /* puntatore a elenco vertici loc. orig. */
@{"struct vertex" LINK File 28} *vlocal;  /* puntatore a elenco vertici locali */
@{"struct vertex" LINK File 28} *vcamera; /* puntatore a elenco vertici camera */
long int numpolys;
@{"struct polygon" LINK File 118} *polys;  /* puntatore a elenco poligoni */
char shade;             /* metodo di visualiz. (WIRE,@{"SOLID" LINK File 18},@{"FLAT" LINK File 19}) */
char state;             /* segnala se oggetto da visualizzare */
char clipped;           /* segnala se oggetto clippato interamente*/
char trasf;             /* flag per segnalare eventuale trasf. avv.*/
long int worldposx;     /* coord. x punto d'inserzione oggetto */
long int worldposy;     /* coord. y  "        "          "     */
long int worldposz;     /* coord. z  "        "          "     */
long int xmax;          /* vertici bounding box oggetto */
long int ymax;          /*              "               */
long int zmax;          /*              "               */
long int xmin;          /*              "               */
long int ymin;          /*              "               */
long int zmin;          /*              "               */
};

/* struttura per definizione di un poligono da visualizzare */
struct polytemp
{
short int       x1;
short int       y1;
short int       x2;
short int       y2;
short int       x3;
short int       y3;
short int       x4;
short int       y4;
short int       x5;
short int       y5;
short int numpoints;
short int     shade;
short int       obj;
long  int      npol;
long  int    svalue;
char          vmode;
};

/**
        struttura di descrizione generale ambiente, il puntatore ad essa
        va dato come primo parametro al richiamo di ogni funzione
        dall'esterno
**/
struct ambient3d
{
@{"struct grafica" LINK File 249} *graf;           /* valore ritornato da PE_ini_g */
struct Window *win;             /* punt. a finestra superbitmap usata */
long int half_screen_width;
long int half_screen_height;
long int viewing_distance;
short int gl_triangle_color;
short int minx;
short int miny;
short int maxx;
short int maxy;
short int maxintensity;
long int near_z;
long int far_z;
long int aspect_ratio;          /* num. reale a virgola fissa (val*@{"FIXV" LINK File 23}) */
long int ambient_light;         /* num. reale a virgola fissa (val*@{"FIXV" LINK File 23}) */
long int inv_aspect_ratio;      /* num. reale a virgola fissa (val*@{"FIXV" LINK File 23}) */
long int bord_col;              /* colore bordo poligoni (se <0 no bordo)*/
char view_mode;                 /* modo vis. (1=flat 0=wire 2=solid) */
char clip_mode;
char agg_all;                   /* flag per forzare aggiornamento scena */
long int dummy;
@{"struct vector" LINK File 85} *light_source;    /* puntatore a struttura vector */
long int dummy1;
@{"struct vector" LINK File 85} *view_point;      /* puntatore a struttura vector */
@{"struct dir3d" LINK File 110} *view_angle;       /* puntatore a struttura dir3d */
@{"struct matrix4x4" LINK File 53} *global_view;  /* puntatore a struttura matrix4x4 */
char *temp;                     /* puntatore ad area per uso temporaneo */
long int *iobjects;             /* punt. ad array con indici su objects */
@{"struct objectnode" LINK File 134} *objects;     /* punt. ad array di strutture objectnode */
long int *iwpolys;              /* punt. ad array puntatori su worldpolys */
@{"struct polytemp" LINK File 161} *worldpolys;    /* punt. ad array di strutture polytemp */
long int *sintable;             /* punt. ad array di reali a virg. fissa */
long int *costable;             /* punt. ad array di reali a virg. fissa */
long int total_polys;           /* n# totale poligoni da tracciare */
short int total_objects;        /* n# totale oggetti presenti */
long int attuale;               /* oggetto attualmente selezionato */
long int numero;                /* numero inc. alla creazione di un oggetto*/
long int iterazioni;            /* n# iterazioni per sorting */
};

/* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */

#define MAXVER(vert) (vert*5+30)

/**** dichiarazioni per poter usare sizeof con queste strutture  ****/
/**** probabilmente utile solo se si usa VBCC v0.5 ****/

typedef @{"struct grafica" LINK File 249} Sgrafica;
typedef struct AreaInfo SAreaInfo;
typedef struct TmpRas STmpRas;
typedef @{"struct objectnode" LINK File 134} Sobjectnode;
typedef @{"struct vertex" LINK File 28} Svertex;
typedef @{"struct polygon" LINK File 118} Spolygon;
typedef @{"struct vector" LINK File 85} Svector;
typedef @{"struct polytemp" LINK File 161} Spolytemp;
typedef @{"struct dir3d" LINK File 110} Sdir3d;
typedef @{"struct matrix4x4" LINK File 53} Smatrix4x4;
typedef @{"struct ambient3d" LINK File 186} Sambient3d;

/********************************************************************/

struct grafica
{
 struct AreaInfo *o_ai; /* valore originale puntatore ad areainfo */
 struct TmpRas *o_tr;   /* valore originale puntatore ad tmprast */
 struct AreaInfo n_ai;  /* nuova areainfo */
 struct TmpRas n_tr;    /* nuova tmpras */
 char *pras;            /* puntatore a area di memoria grafica */
 char *b_af;            /* puntatore a buffer vettori per areafill */
 long int lb_af;        /* dimensioni area precedente */
 struct ViewPort *vpor; /* puntatore a viewport dello schermo della fin.*/
 struct RastPort *rast; /* puntatore a rastport usato dalle routin */
 struct Window *wind;   /* puntatore a finestra su cui agire */
 long int larg;         /* larghezza box in cui lavorera' areafill */
 long int alte;         /* altezza box in cui lavorera' areafill */
 long int clipx;        /* origine x clip box */
 long int clipy;        /* origine y clip box */
 long int clipdx;       /* larghezza clip box */
 long int clipdy;       /* altezza clip box */
/** estensioni per double buffering **/
 char   fdouble;        /* flag per attivare double buffer (0=off 1=on)*/
 struct RastPort *rast1;/* puntatore a rastport della finestra*/
 struct RastPort *rast2;/* puntatore a rastport nascosto */
 struct RasInfo    *NB_rinfo;
 struct BitMap     *NB_bmap;
 struct Layer_Info *NB_layerinfo;
 struct Layer      *NB_layer;

};


#endif /* GRAPHICS3D_GRAPHICS3D_H */
@ENDNODE
