home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / libs / graphics3d / doc / graphics3d.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-21  |  13.3 KB  |  342 lines

  1. @DATABASE "graphics3D.h"
  2. @MASTER   "Ram Disk:graphics3D.h"
  3. @REMARK   This file was created by ADtoHT 2.1 on 21-Apr-98 20:16:26
  4. @REMARK   Do not edit
  5. @REMARK   ADtoHT is © 1993-1995 Christian Stieber
  6.  
  7. @NODE MAIN "graphics3D.h"
  8.  
  9. @{"graphics3D.h" LINK File}
  10.  
  11.  
  12. @{b}Structures@{ub}
  13.  
  14. @{"ambient3d" LINK "graphics3D.h/File" 211}   @{"dir3d" LINK "graphics3D.h/File" 135}   @{"grafica" LINK "graphics3D.h/File" 276}  @{"line" LINK "graphics3D.h/File" 128}      @{"matrix1x4" LINK "graphics3D.h/File" 100}  @{"matrix4x4" LINK "graphics3D.h/File" 78}
  15. @{"objectnode" LINK "graphics3D.h/File" 159}  @{"pixel" LINK "graphics3D.h/File" 120}   @{"polygon" LINK "graphics3D.h/File" 143}  @{"polytemp" LINK "graphics3D.h/File" 186}  @{"rgbtype" LINK "graphics3D.h/File" 52}    @{"tag3d" LINK "graphics3D.h/File" 61}
  16. @{"vector" LINK "graphics3D.h/File" 110}      @{"vertex" LINK "graphics3D.h/File" 44}  
  17.  
  18.  
  19. @{b}Typedefs@{ub}
  20.  
  21. @{"Sambient3d" LINK "graphics3D.h/File" 272}  @{"SAreaInfo" LINK "graphics3D.h/File" 263}  @{"Sdir3d" LINK "graphics3D.h/File" 270}   @{"Sgrafica" LINK "graphics3D.h/File" 262}  @{"Smatrix4x4" LINK "graphics3D.h/File" 271}  @{"Sobjectnode" LINK "graphics3D.h/File" 265}
  22. @{"Spolygon" LINK "graphics3D.h/File" 267}    @{"Spolytemp" LINK "graphics3D.h/File" 269}  @{"STmpRas" LINK "graphics3D.h/File" 264}  @{"Svector" LINK "graphics3D.h/File" 268}   @{"Svertex" LINK "graphics3D.h/File" 266}     
  23.  
  24.  
  25. @{b}#defines@{ub}
  26.  
  27. @{"COMPLEMENT" LINK "graphics3D.h/File" 15}  @{"CS_GCOLOR" LINK "graphics3D.h/File" 37}  @{"CS_NPX0" LINK "graphics3D.h/File" 39}  @{"CS_NPY0" LINK "graphics3D.h/File" 40}    @{"CS_PROJET" LINK "graphics3D.h/File" 35}  @{"CS_SBUFF" LINK "graphics3D.h/File" 36}
  28. @{"CS_VDIST" LINK "graphics3D.h/File" 38}    @{"END_T" LINK "graphics3D.h/File" 29}      @{"FIXV" LINK "graphics3D.h/File" 25}     @{"FIXVM" LINK "graphics3D.h/File" 26}      @{"FLAT" LINK "graphics3D.h/File" 21}       @{"FRUSTUM" LINK "graphics3D.h/File" 23}
  29. @{"INVERSVID" LINK "graphics3D.h/File" 16}   @{"JAM1" LINK "graphics3D.h/File" 13}       @{"JAM2" LINK "graphics3D.h/File" 14}     @{"MAXOBJECT" LINK "graphics3D.h/File" 72}  @{"MAXPLFRAM" LINK "graphics3D.h/File" 73}  @{"MAXPOINT" LINK "graphics3D.h/File" 71}
  30. @{"MAXVER()" LINK "graphics3D.h/File" 257}    @{"MAXVERT" LINK "graphics3D.h/File" 74}    @{"MFRAC" LINK "graphics3D.h/File" 27}    @{"MINT" LINK "graphics3D.h/File" 28}       @{"PARAL_P" LINK "graphics3D.h/File" 18}    @{"PROSP_P" LINK "graphics3D.h/File" 17}
  31. @{"SFIXV" LINK "graphics3D.h/File" 24}       @{"SOLID" LINK "graphics3D.h/File" 20}      @{"WIREF" LINK "graphics3D.h/File" 19}    @{"ZPLANE" LINK "graphics3D.h/File" 22}     
  32.  
  33. @ENDNODE
  34. @NODE File "graphics3D.h"
  35. /*
  36. **      $VER: graphics3d.h 10.02 (02.03.98)
  37. **
  38. **      main include file for @{"graphics3d.library" LINK "graphics3d_I/MAIN"}
  39. **
  40. **      (C) Copyright 1997 Patrizio Biancalani
  41. **      All Rights Reserved.
  42. */
  43.  
  44. #ifndef GRAPHICS3D_GRAPHICS3D_H
  45. #define GRAPHICS3D_GRAPHICS3D_H
  46.  
  47. #define JAM1 0
  48. #define JAM2 1
  49. #define COMPLEMENT 2
  50. #define INVERSVID 4
  51. #define PROSP_P 0       /* tipo proiezione prospettica */
  52. #define PARAL_P 1       /* tipo proiezione parallela */
  53. #define WIREF   0       /* modo visualizzazione in wire frame */
  54. #define SOLID   2       /* modo visualizzazione in solid */
  55. #define FLAT    1       /* modo visualizzazione i flat shading */
  56. #define ZPLANE  0       /* #1 modo clippaggio oggetti */
  57. #define FRUSTUM 1       /* #2 modo clippaggio oggetti */
  58. #define SFIXV   8       /* n# di shift per cal. num. virgola fissa */
  59. #define FIXV    256     /* fattore moltipl. per num. virgola fissa */
  60. #define FIXVM   128     /* meta' di @{"FIXV" LINK File 25} , per effettuare appros.  */
  61. #define MFRAC   @{"FIXV" LINK File 25}    /* maschera per estrarre parte frazionaria */
  62. #define MINT 0xFFFFFFFF /* maschera per estrarre parte intera */
  63. #define END_T  0        /* fine array tag3d di dati */
  64.  
  65. /*
  66.   tipi dati per tag3d.tipo riconosciuti attualmente per
  67.   funzione cascene()
  68. */
  69. #define CS_PROJET 1     /* tipo di proiezione */
  70. #define CS_SBUFF  2     /* attivazione o meno single buffering */
  71. #define CS_GCOLOR 3     /* nuovo colore sfondo box di visualizzazione */
  72. #define CS_VDIST  4     /* nuovo valore distanza da piano di proiezione */
  73. #define CS_NPX0   5     /* nuova posizione X per box di visualizzazione */
  74. #define CS_NPY0   6     /* nuova posizione Y per box di visualizzazione */
  75.  
  76. /** STRUTTURE DATI DI USO ESTERNO ED INTERNO **/
  77. /* vertice, usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  78. struct vertex
  79. {
  80. long int x;
  81. long int y;
  82. long int z;
  83. };
  84.  
  85. /* struttura per definizione colore */
  86. struct rgbtype
  87. {
  88. short int r;
  89. short int g;
  90. short int b;
  91. };
  92.  
  93. /* struttura tag3d per definire un array di valori estendibile */
  94. /* analogo alla struttura TagItem dell' Amiga O.S.             */
  95. struct tag3d
  96. {
  97. short unsigned int tipo;        /* flag che identifica valore
  98.                                                 (se=0 fine array) */
  99. long int val;                   /* valore effettivo */
  100. };
  101.  
  102. /* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */
  103.  
  104. /** COSTANTI DI USO SOLO INTERNO **/
  105. #define MAXPOINT  4     /* massimo numero di punti per poligono */
  106. #define MAXOBJECT 100   /* massimo numero oggetti per mondo 3D (max. 65535)*/
  107. #define MAXPLFRAM 10000 /* massimo numero poligoni in una frame (16*12) */
  108. #define MAXVERT   1000  /* massimo numero vertici in un poligono */
  109.  
  110. /* matrice di trasformazione (4x4) */
  111. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  112. struct matrix4x4
  113. {
  114. long int r0c0;
  115. long int r0c1;
  116. long int r0c2;
  117. long int r0c3;
  118. long int r1c0;
  119. long int r1c1;
  120. long int r1c2;
  121. long int r1c3;
  122. long int r2c0;
  123. long int r2c1;
  124. long int r2c2;
  125. long int r2c3;
  126. long int r3c0;
  127. long int r3c1;
  128. long int r3c2;
  129. long int r3c3;
  130. };
  131.  
  132. /* matrice di trasformazione (1x4) */
  133. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  134. struct matrix1x4
  135. {
  136. long int r0c0;
  137. long int r0c1;
  138. long int r0c2;
  139. long int r0c3;
  140. };
  141.  
  142. /* vettore */
  143. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  144. struct vector
  145. {
  146. long int x;
  147. long int y;
  148. long int z;
  149. long int w;
  150. };
  151.  
  152. /* pixel */
  153. /* usa formato intero a 2 bytes */
  154. struct pixel
  155. {
  156. short int x;
  157. short int y;
  158. };
  159.  
  160. /* struttura per definire una linea */
  161. /* usa due riferimenti a strutture vertice */
  162. struct line
  163. {
  164. @{"struct vertex" LINK File 44} *a;               /* puntatore a st. vertex di partenza */
  165. @{"struct vertex" LINK File 44} *b;               /* puntatore a st. vertex d'arrivo */
  166. };
  167.  
  168. /* struttura per definire direzione in spazio 3d */
  169. struct dir3d
  170. {
  171. long int angx;
  172. long int angy;
  173. long int angz;
  174. };
  175.  
  176. /* struttura per definizione di un poligono */
  177. struct polygon
  178. {
  179. char numpoints;
  180. short int color;
  181. short int shade;
  182. char twosided;
  183. char visible;
  184. char clipped;
  185. char active;
  186. long int vertexlist0;   /* puntatore a #1 indice vertici */
  187. long int vertexlist1;   /* puntatore a #2 indice vertici */
  188. long int vertexlist2;   /* puntatore a #3 indice vertici */
  189. long int vertexlist3;   /* puntatore a #4 indice vertici */
  190. };
  191.  
  192. /* struttura di descrizione di un oggetto */
  193. struct objectnode
  194. {
  195. long int id;            /* identificativo univoco per oggetto */
  196. long int dummy;         /* pad per poter usare name con StringF */
  197. char name[22];
  198. long int numverts;
  199. @{"struct vertex" LINK File 44} *vorig;   /* puntatore a elenco vertici loc. orig. */
  200. @{"struct vertex" LINK File 44} *vlocal;  /* puntatore a elenco vertici locali */
  201. @{"struct vertex" LINK File 44} *vcamera; /* puntatore a elenco vertici camera */
  202. long int numpolys;
  203. @{"struct polygon" LINK File 143} *polys;  /* puntatore a elenco poligoni */
  204. char shade;             /* metodo di visualiz. (WIRE,@{"SOLID" LINK File 20},@{"FLAT" LINK File 21}) */
  205. char state;             /* segnala se oggetto da visualizzare */
  206. char clipped;           /* segnala se oggetto clippato interamente*/
  207. char trasf;             /* flag per segnalare eventuale trasf. avv.*/
  208. long int worldposx;     /* coord. x punto d'inserzione oggetto */
  209. long int worldposy;     /* coord. y  "        "          "     */
  210. long int worldposz;     /* coord. z  "        "          "     */
  211. long int xmax;          /* vertici bounding box oggetto */
  212. long int ymax;          /*              "               */
  213. long int zmax;          /*              "               */
  214. long int xmin;          /*              "               */
  215. long int ymin;          /*              "               */
  216. long int zmin;          /*              "               */
  217. };
  218.  
  219. /* struttura per definizione di un poligono da visualizzare */
  220. struct polytemp
  221. {
  222. short int       x1;
  223. short int       y1;
  224. short int       x2;
  225. short int       y2;
  226. short int       x3;
  227. short int       y3;
  228. short int       x4;
  229. short int       y4;
  230. short int       x5;
  231. short int       y5;
  232. short int numpoints;
  233. short int     shade;
  234. short int       obj;
  235. long  int      npol;
  236. long  int    svalue;
  237. char          vmode;
  238. };
  239.  
  240. /**
  241.         struttura di descrizione generale ambiente, il puntatore ad essa
  242.         va dato come primo parametro al richiamo di ogni funzione
  243.         dall'esterno
  244. **/
  245. struct ambient3d
  246. {
  247. @{"struct grafica" LINK File 276} *graf;           /* valore ritornato da PE_ini_g */
  248. struct Window *win;             /* punt. a finestra usata */
  249. long int half_screen_width;
  250. long int half_screen_height;
  251. long int viewing_distance;
  252. short int gl_triangle_color;
  253. short int minx;
  254. short int miny;
  255. short int maxx;
  256. short int maxy;
  257. short int maxintensity;
  258. long int near_z;
  259. long int far_z;
  260. long int aspect_ratio;          /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  261. long int ambient_light;         /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  262. long int inv_aspect_ratio;      /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  263. long int bord_col;              /* colore bordo poligoni (se <0 no bordo)*/
  264. long int gcolor;                /* colore sfondo scena */
  265. char projection_type;           /* tipo di proiezione (0=pros. 1=paral.) */
  266. char view_mode;                 /* modo vis. (1=flat 0=wire 2=solid) */
  267. char clip_mode;
  268. char agg_all;                   /* flag per forzare aggiornamento scena */
  269. long int dummy;
  270. @{"struct vector" LINK File 110} light_source;     /* puntatore a struttura vector */
  271. long int dummy1;
  272. @{"struct vector" LINK File 110} view_point;       /* puntatore a struttura vector */
  273. @{"struct dir3d" LINK File 135} view_angle;        /* puntatore a struttura dir3d */
  274. @{"struct matrix4x4" LINK File 78} global_view;   /* puntatore a struttura matrix4x4 */
  275. char *temp;                     /* puntatore ad area per uso temporaneo */
  276. long int *iobjects;             /* punt. ad array con indici su objects */
  277. @{"struct objectnode" LINK File 159} *objects;     /* punt. ad array di strutture objectnode */
  278. long int *iwpolys;              /* punt. ad array puntatori su worldpolys */
  279. @{"struct polytemp" LINK File 186} *worldpolys;    /* punt. ad array di strutture polytemp */
  280. long int *sintable;             /* punt. ad array di reali a virg. fissa */
  281. long int *costable;             /* punt. ad array di reali a virg. fissa */
  282. long int total_polys;           /* n# totale poligoni da tracciare */
  283. short int total_objects;        /* n# totale oggetti presenti */
  284. long int attuale;               /* oggetto attualmente selezionato */
  285. long int numero;                /* numero inc. alla creazione di un oggetto*/
  286. long int iterazioni;            /* n# iterazioni per sorting */
  287. };
  288.  
  289. /* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */
  290.  
  291. #define MAXVER(vert) (vert*5+30)
  292.  
  293. /**** dichiarazioni per poter usare sizeof con queste strutture  ****/
  294. /**** probabilmente utile solo se si usa VBCC v0.5 ****/
  295.  
  296. typedef @{"struct grafica" LINK File 276} Sgrafica;
  297. typedef struct AreaInfo SAreaInfo;
  298. typedef struct TmpRas STmpRas;
  299. typedef @{"struct objectnode" LINK File 159} Sobjectnode;
  300. typedef @{"struct vertex" LINK File 44} Svertex;
  301. typedef @{"struct polygon" LINK File 143} Spolygon;
  302. typedef @{"struct vector" LINK File 110} Svector;
  303. typedef @{"struct polytemp" LINK File 186} Spolytemp;
  304. typedef @{"struct dir3d" LINK File 135} Sdir3d;
  305. typedef @{"struct matrix4x4" LINK File 78} Smatrix4x4;
  306. typedef @{"struct ambient3d" LINK File 211} Sambient3d;
  307.  
  308. /********************************************************************/
  309.  
  310. struct grafica
  311. {
  312.  struct AreaInfo *o_ai; /* valore originale puntatore ad areainfo */
  313.  struct TmpRas *o_tr;   /* valore originale puntatore ad tmprast */
  314.  struct AreaInfo n_ai;  /* nuova areainfo */
  315.  struct TmpRas n_tr;    /* nuova tmpras */
  316.  char *pras;            /* puntatore a area di memoria grafica */
  317.  char *b_af;            /* puntatore a buffer vettori per areafill */
  318.  long int lb_af;        /* dimensioni area precedente */
  319.  struct ViewPort *vpor; /* puntatore a viewport dello schermo della fin.*/
  320.  struct RastPort *rast; /* puntatore a rastport usato dalle routin */
  321.  struct Window *wind;   /* puntatore a finestra su cui agire */
  322.  long int larg;         /* larghezza box in cui lavorera' areafill */
  323.  long int alte;         /* altezza box in cui lavorera' areafill */
  324.  long int clipx;        /* origine x clip box */
  325.  long int clipy;        /* origine y clip box */
  326.  long int clipdx;       /* larghezza clip box */
  327.  long int clipdy;       /* altezza clip box */
  328. /** estensioni per double buffering **/
  329.  char   fdouble;        /* flag per attivare double buffer (0=off 1=on)*/
  330.  struct RastPort *rast1;/* puntatore a rastport della finestra*/
  331.  struct RastPort *rast2;/* puntatore a rastport nascosto */
  332.  struct RasInfo    *NB_rinfo;
  333.  struct BitMap     *NB_bmap;
  334.  struct Layer_Info *NB_layerinfo;
  335.  struct Layer      *NB_layer;
  336.  
  337. };
  338.  
  339.  
  340. #endif /* GRAPHICS3D_GRAPHICS3D_H */
  341. @ENDNODE
  342.