Model_lwo.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __LWO2_H__
  21. #define __LWO2_H__
  22. /*
  23. ======================================================================
  24. LWO2 loader. (LightWave Object)
  25. Ernie Wright 17 Sep 00
  26. ======================================================================
  27. */
  28. /* chunk and subchunk IDs */
  29. #define LWID_(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
  30. #define ID_FORM LWID_('F','O','R','M')
  31. #define ID_LWO2 LWID_('L','W','O','2')
  32. #define ID_LWOB LWID_('L','W','O','B')
  33. /* top-level chunks */
  34. #define ID_LAYR LWID_('L','A','Y','R')
  35. #define ID_TAGS LWID_('T','A','G','S')
  36. #define ID_PNTS LWID_('P','N','T','S')
  37. #define ID_BBOX LWID_('B','B','O','X')
  38. #define ID_VMAP LWID_('V','M','A','P')
  39. #define ID_VMAD LWID_('V','M','A','D')
  40. #define ID_POLS LWID_('P','O','L','S')
  41. #define ID_PTAG LWID_('P','T','A','G')
  42. #define ID_ENVL LWID_('E','N','V','L')
  43. #define ID_CLIP LWID_('C','L','I','P')
  44. #define ID_SURF LWID_('S','U','R','F')
  45. #define ID_DESC LWID_('D','E','S','C')
  46. #define ID_TEXT LWID_('T','E','X','T')
  47. #define ID_ICON LWID_('I','C','O','N')
  48. /* polygon types */
  49. #define ID_FACE LWID_('F','A','C','E')
  50. #define ID_CURV LWID_('C','U','R','V')
  51. #define ID_PTCH LWID_('P','T','C','H')
  52. #define ID_MBAL LWID_('M','B','A','L')
  53. #define ID_BONE LWID_('B','O','N','E')
  54. /* polygon tags */
  55. #define ID_SURF LWID_('S','U','R','F')
  56. #define ID_PART LWID_('P','A','R','T')
  57. #define ID_SMGP LWID_('S','M','G','P')
  58. /* envelopes */
  59. #define ID_PRE LWID_('P','R','E',' ')
  60. #define ID_POST LWID_('P','O','S','T')
  61. #define ID_KEY LWID_('K','E','Y',' ')
  62. #define ID_SPAN LWID_('S','P','A','N')
  63. #define ID_TCB LWID_('T','C','B',' ')
  64. #define ID_HERM LWID_('H','E','R','M')
  65. #define ID_BEZI LWID_('B','E','Z','I')
  66. #define ID_BEZ2 LWID_('B','E','Z','2')
  67. #define ID_LINE LWID_('L','I','N','E')
  68. #define ID_STEP LWID_('S','T','E','P')
  69. /* clips */
  70. #define ID_STIL LWID_('S','T','I','L')
  71. #define ID_ISEQ LWID_('I','S','E','Q')
  72. #define ID_ANIM LWID_('A','N','I','M')
  73. #define ID_XREF LWID_('X','R','E','F')
  74. #define ID_STCC LWID_('S','T','C','C')
  75. #define ID_TIME LWID_('T','I','M','E')
  76. #define ID_CONT LWID_('C','O','N','T')
  77. #define ID_BRIT LWID_('B','R','I','T')
  78. #define ID_SATR LWID_('S','A','T','R')
  79. #define ID_HUE LWID_('H','U','E',' ')
  80. #define ID_GAMM LWID_('G','A','M','M')
  81. #define ID_NEGA LWID_('N','E','G','A')
  82. #define ID_IFLT LWID_('I','F','L','T')
  83. #define ID_PFLT LWID_('P','F','L','T')
  84. /* surfaces */
  85. #define ID_COLR LWID_('C','O','L','R')
  86. #define ID_LUMI LWID_('L','U','M','I')
  87. #define ID_DIFF LWID_('D','I','F','F')
  88. #define ID_SPEC LWID_('S','P','E','C')
  89. #define ID_GLOS LWID_('G','L','O','S')
  90. #define ID_REFL LWID_('R','E','F','L')
  91. #define ID_RFOP LWID_('R','F','O','P')
  92. #define ID_RIMG LWID_('R','I','M','G')
  93. #define ID_RSAN LWID_('R','S','A','N')
  94. #define ID_TRAN LWID_('T','R','A','N')
  95. #define ID_TROP LWID_('T','R','O','P')
  96. #define ID_TIMG LWID_('T','I','M','G')
  97. #define ID_RIND LWID_('R','I','N','D')
  98. #define ID_TRNL LWID_('T','R','N','L')
  99. #define ID_BUMP LWID_('B','U','M','P')
  100. #define ID_SMAN LWID_('S','M','A','N')
  101. #define ID_SIDE LWID_('S','I','D','E')
  102. #define ID_CLRH LWID_('C','L','R','H')
  103. #define ID_CLRF LWID_('C','L','R','F')
  104. #define ID_ADTR LWID_('A','D','T','R')
  105. #define ID_SHRP LWID_('S','H','R','P')
  106. #define ID_LINE LWID_('L','I','N','E')
  107. #define ID_LSIZ LWID_('L','S','I','Z')
  108. #define ID_ALPH LWID_('A','L','P','H')
  109. #define ID_AVAL LWID_('A','V','A','L')
  110. #define ID_GVAL LWID_('G','V','A','L')
  111. #define ID_BLOK LWID_('B','L','O','K')
  112. /* texture layer */
  113. #define ID_TYPE LWID_('T','Y','P','E')
  114. #define ID_CHAN LWID_('C','H','A','N')
  115. #define ID_NAME LWID_('N','A','M','E')
  116. #define ID_ENAB LWID_('E','N','A','B')
  117. #define ID_OPAC LWID_('O','P','A','C')
  118. #define ID_FLAG LWID_('F','L','A','G')
  119. #define ID_PROJ LWID_('P','R','O','J')
  120. #define ID_STCK LWID_('S','T','C','K')
  121. #define ID_TAMP LWID_('T','A','M','P')
  122. /* texture coordinates */
  123. #define ID_TMAP LWID_('T','M','A','P')
  124. #define ID_AXIS LWID_('A','X','I','S')
  125. #define ID_CNTR LWID_('C','N','T','R')
  126. #define ID_SIZE LWID_('S','I','Z','E')
  127. #define ID_ROTA LWID_('R','O','T','A')
  128. #define ID_OREF LWID_('O','R','E','F')
  129. #define ID_FALL LWID_('F','A','L','L')
  130. #define ID_CSYS LWID_('C','S','Y','S')
  131. /* image map */
  132. #define ID_IMAP LWID_('I','M','A','P')
  133. #define ID_IMAG LWID_('I','M','A','G')
  134. #define ID_WRAP LWID_('W','R','A','P')
  135. #define ID_WRPW LWID_('W','R','P','W')
  136. #define ID_WRPH LWID_('W','R','P','H')
  137. #define ID_VMAP LWID_('V','M','A','P')
  138. #define ID_AAST LWID_('A','A','S','T')
  139. #define ID_PIXB LWID_('P','I','X','B')
  140. /* procedural */
  141. #define ID_PROC LWID_('P','R','O','C')
  142. #define ID_COLR LWID_('C','O','L','R')
  143. #define ID_VALU LWID_('V','A','L','U')
  144. #define ID_FUNC LWID_('F','U','N','C')
  145. #define ID_FTPS LWID_('F','T','P','S')
  146. #define ID_ITPS LWID_('I','T','P','S')
  147. #define ID_ETPS LWID_('E','T','P','S')
  148. /* gradient */
  149. #define ID_GRAD LWID_('G','R','A','D')
  150. #define ID_GRST LWID_('G','R','S','T')
  151. #define ID_GREN LWID_('G','R','E','N')
  152. #define ID_PNAM LWID_('P','N','A','M')
  153. #define ID_INAM LWID_('I','N','A','M')
  154. #define ID_GRPT LWID_('G','R','P','T')
  155. #define ID_FKEY LWID_('F','K','E','Y')
  156. #define ID_IKEY LWID_('I','K','E','Y')
  157. /* shader */
  158. #define ID_SHDR LWID_('S','H','D','R')
  159. #define ID_DATA LWID_('D','A','T','A')
  160. /* generic linked list */
  161. typedef struct st_lwNode {
  162. struct st_lwNode *next, *prev;
  163. void *data;
  164. } lwNode;
  165. /* plug-in reference */
  166. typedef struct st_lwPlugin {
  167. struct st_lwPlugin *next, *prev;
  168. char *ord;
  169. char *name;
  170. int flags;
  171. void *data;
  172. } lwPlugin;
  173. /* envelopes */
  174. typedef struct st_lwKey {
  175. struct st_lwKey *next, *prev;
  176. float value;
  177. float time;
  178. unsigned int shape; /* ID_TCB, ID_BEZ2, etc. */
  179. float tension;
  180. float continuity;
  181. float bias;
  182. float param[ 4 ];
  183. } lwKey;
  184. typedef struct st_lwEnvelope {
  185. struct st_lwEnvelope *next, *prev;
  186. int index;
  187. int type;
  188. char *name;
  189. lwKey *key; /* linked list of keys */
  190. int nkeys;
  191. int behavior[ 2 ]; /* pre and post (extrapolation) */
  192. lwPlugin *cfilter; /* linked list of channel filters */
  193. int ncfilters;
  194. } lwEnvelope;
  195. #define BEH_RESET 0
  196. #define BEH_CONSTANT 1
  197. #define BEH_REPEAT 2
  198. #define BEH_OSCILLATE 3
  199. #define BEH_OFFSET 4
  200. #define BEH_LINEAR 5
  201. /* values that can be enveloped */
  202. typedef struct st_lwEParam {
  203. float val;
  204. int eindex;
  205. } lwEParam;
  206. typedef struct st_lwVParam {
  207. float val[ 3 ];
  208. int eindex;
  209. } lwVParam;
  210. /* clips */
  211. typedef struct st_lwClipStill {
  212. char *name;
  213. } lwClipStill;
  214. typedef struct st_lwClipSeq {
  215. char *prefix; /* filename before sequence digits */
  216. char *suffix; /* after digits, e.g. extensions */
  217. int digits;
  218. int flags;
  219. int offset;
  220. int start;
  221. int end;
  222. } lwClipSeq;
  223. typedef struct st_lwClipAnim {
  224. char *name;
  225. char *server; /* anim loader plug-in */
  226. void *data;
  227. } lwClipAnim;
  228. typedef struct st_lwClipXRef {
  229. char *string;
  230. int index;
  231. struct st_lwClip *clip;
  232. } lwClipXRef;
  233. typedef struct st_lwClipCycle {
  234. char *name;
  235. int lo;
  236. int hi;
  237. } lwClipCycle;
  238. typedef struct st_lwClip {
  239. struct st_lwClip *next, *prev;
  240. int index;
  241. unsigned int type; /* ID_STIL, ID_ISEQ, etc. */
  242. union {
  243. lwClipStill still;
  244. lwClipSeq seq;
  245. lwClipAnim anim;
  246. lwClipXRef xref;
  247. lwClipCycle cycle;
  248. } source;
  249. float start_time;
  250. float duration;
  251. float frame_rate;
  252. lwEParam contrast;
  253. lwEParam brightness;
  254. lwEParam saturation;
  255. lwEParam hue;
  256. lwEParam gamma;
  257. int negative;
  258. lwPlugin *ifilter; /* linked list of image filters */
  259. int nifilters;
  260. lwPlugin *pfilter; /* linked list of pixel filters */
  261. int npfilters;
  262. } lwClip;
  263. /* textures */
  264. typedef struct st_lwTMap {
  265. lwVParam size;
  266. lwVParam center;
  267. lwVParam rotate;
  268. lwVParam falloff;
  269. int fall_type;
  270. char *ref_object;
  271. int coord_sys;
  272. } lwTMap;
  273. typedef struct st_lwImageMap {
  274. int cindex;
  275. int projection;
  276. char *vmap_name;
  277. int axis;
  278. int wrapw_type;
  279. int wraph_type;
  280. lwEParam wrapw;
  281. lwEParam wraph;
  282. float aa_strength;
  283. int aas_flags;
  284. int pblend;
  285. lwEParam stck;
  286. lwEParam amplitude;
  287. } lwImageMap;
  288. #define PROJ_PLANAR 0
  289. #define PROJ_CYLINDRICAL 1
  290. #define PROJ_SPHERICAL 2
  291. #define PROJ_CUBIC 3
  292. #define PROJ_FRONT 4
  293. #define WRAP_NONE 0
  294. #define WRAP_EDGE 1
  295. #define WRAP_REPEAT 2
  296. #define WRAP_MIRROR 3
  297. typedef struct st_lwProcedural {
  298. int axis;
  299. float value[ 3 ];
  300. char *name;
  301. void *data;
  302. } lwProcedural;
  303. typedef struct st_lwGradKey {
  304. struct st_lwGradKey *next, *prev;
  305. float value;
  306. float rgba[ 4 ];
  307. } lwGradKey;
  308. typedef struct st_lwGradient {
  309. char *paramname;
  310. char *itemname;
  311. float start;
  312. float end;
  313. int repeat;
  314. lwGradKey *key; /* array of gradient keys */
  315. short *ikey; /* array of interpolation codes */
  316. } lwGradient;
  317. typedef struct st_lwTexture {
  318. struct st_lwTexture *next, *prev;
  319. char *ord;
  320. unsigned int type;
  321. unsigned int chan;
  322. lwEParam opacity;
  323. short opac_type;
  324. short enabled;
  325. short negative;
  326. short axis;
  327. union {
  328. lwImageMap imap;
  329. lwProcedural proc;
  330. lwGradient grad;
  331. } param;
  332. lwTMap tmap;
  333. } lwTexture;
  334. /* values that can be textured */
  335. typedef struct st_lwTParam {
  336. float val;
  337. int eindex;
  338. lwTexture *tex; /* linked list of texture layers */
  339. } lwTParam;
  340. typedef struct st_lwCParam {
  341. float rgb[ 3 ];
  342. int eindex;
  343. lwTexture *tex; /* linked list of texture layers */
  344. } lwCParam;
  345. /* surfaces */
  346. typedef struct st_lwGlow {
  347. short enabled;
  348. short type;
  349. lwEParam intensity;
  350. lwEParam size;
  351. } Glow;
  352. typedef struct st_lwRMap {
  353. lwTParam val;
  354. int options;
  355. int cindex;
  356. float seam_angle;
  357. } lwRMap;
  358. typedef struct st_lwLine {
  359. short enabled;
  360. unsigned short flags;
  361. lwEParam size;
  362. } lwLine;
  363. typedef struct st_lwSurface {
  364. struct st_lwSurface *next, *prev;
  365. char *name;
  366. char *srcname;
  367. lwCParam color;
  368. lwTParam luminosity;
  369. lwTParam diffuse;
  370. lwTParam specularity;
  371. lwTParam glossiness;
  372. lwRMap reflection;
  373. lwRMap transparency;
  374. lwTParam eta;
  375. lwTParam translucency;
  376. lwTParam bump;
  377. float smooth;
  378. int sideflags;
  379. float alpha;
  380. int alpha_mode;
  381. lwEParam color_hilite;
  382. lwEParam color_filter;
  383. lwEParam add_trans;
  384. lwEParam dif_sharp;
  385. lwEParam glow;
  386. lwLine line;
  387. lwPlugin *shader; /* linked list of shaders */
  388. int nshaders;
  389. } lwSurface;
  390. /* vertex maps */
  391. typedef struct st_lwVMap {
  392. struct st_lwVMap *next, *prev;
  393. char *name;
  394. unsigned int type;
  395. int dim;
  396. int nverts;
  397. int perpoly;
  398. int *vindex; /* array of point indexes */
  399. int *pindex; /* array of polygon indexes */
  400. float **val;
  401. // added by duffy
  402. int offset;
  403. } lwVMap;
  404. typedef struct st_lwVMapPt {
  405. lwVMap *vmap;
  406. int index; /* vindex or pindex element */
  407. } lwVMapPt;
  408. /* points and polygons */
  409. typedef struct st_lwPoint {
  410. float pos[ 3 ];
  411. int npols; /* number of polygons sharing the point */
  412. int *pol; /* array of polygon indexes */
  413. int nvmaps;
  414. lwVMapPt *vm; /* array of vmap references */
  415. } lwPoint;
  416. typedef struct st_lwPolVert {
  417. int index; /* index into the point array */
  418. float norm[ 3 ];
  419. int nvmaps;
  420. lwVMapPt *vm; /* array of vmap references */
  421. } lwPolVert;
  422. typedef struct st_lwPolygon {
  423. lwSurface *surf;
  424. int part; /* part index */
  425. int smoothgrp; /* smoothing group */
  426. int flags;
  427. unsigned int type;
  428. float norm[ 3 ];
  429. int nverts;
  430. lwPolVert *v; /* array of vertex records */
  431. } lwPolygon;
  432. typedef struct st_lwPointList {
  433. int count;
  434. int offset; /* only used during reading */
  435. lwPoint *pt; /* array of points */
  436. } lwPointList;
  437. typedef struct st_lwPolygonList {
  438. int count;
  439. int offset; /* only used during reading */
  440. int vcount; /* total number of vertices */
  441. int voffset; /* only used during reading */
  442. lwPolygon *pol; /* array of polygons */
  443. } lwPolygonList;
  444. /* geometry layers */
  445. typedef struct st_lwLayer {
  446. struct st_lwLayer *next, *prev;
  447. char *name;
  448. int index;
  449. int parent;
  450. int flags;
  451. float pivot[ 3 ];
  452. float bbox[ 6 ];
  453. lwPointList point;
  454. lwPolygonList polygon;
  455. int nvmaps;
  456. lwVMap *vmap; /* linked list of vmaps */
  457. } lwLayer;
  458. /* tag strings */
  459. typedef struct st_lwTagList {
  460. int count;
  461. int offset; /* only used during reading */
  462. char **tag; /* array of strings */
  463. } lwTagList;
  464. /* an object */
  465. typedef struct st_lwObject {
  466. ID_TIME_T timeStamp;
  467. lwLayer * layer; /* linked list of layers */
  468. lwEnvelope * env; /* linked list of envelopes */
  469. lwClip * clip; /* linked list of clips */
  470. lwSurface * surf; /* linked list of surfaces */
  471. lwTagList taglist;
  472. int nlayers;
  473. int nenvs;
  474. int nclips;
  475. int nsurfs;
  476. } lwObject;
  477. /* lwo2.c */
  478. lwObject *lwGetObject( const char *filename, unsigned int *failID, int *failpos );
  479. void lwFreeObject( lwObject *object );
  480. void lwFreeLayer( lwLayer *layer );
  481. /* pntspols.c */
  482. void lwFreePoints( lwPointList *point );
  483. void lwFreePolygons( lwPolygonList *plist );
  484. int lwGetPoints( idFile *fp, int cksize, lwPointList *point );
  485. void lwGetBoundingBox( lwPointList *point, float bbox[] );
  486. int lwAllocPolygons( lwPolygonList *plist, int npols, int nverts );
  487. int lwGetPolygons( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset );
  488. void lwGetPolyNormals( lwPointList *point, lwPolygonList *polygon );
  489. int lwGetPointPolygons( lwPointList *point, lwPolygonList *polygon );
  490. int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
  491. lwSurface **surf, int *nsurfs );
  492. void lwGetVertNormals( lwPointList *point, lwPolygonList *polygon );
  493. void lwFreeTags( lwTagList *tlist );
  494. int lwGetTags( idFile *fp, int cksize, lwTagList *tlist );
  495. int lwGetPolygonTags( idFile *fp, int cksize, lwTagList *tlist,
  496. lwPolygonList *plist );
  497. /* vmap.c */
  498. void lwFreeVMap( lwVMap *vmap );
  499. lwVMap *lwGetVMap( idFile *fp, int cksize, int ptoffset, int poloffset,
  500. int perpoly );
  501. int lwGetPointVMaps( lwPointList *point, lwVMap *vmap );
  502. int lwGetPolyVMaps( lwPolygonList *polygon, lwVMap *vmap );
  503. /* clip.c */
  504. void lwFreeClip( lwClip *clip );
  505. lwClip *lwGetClip( idFile *fp, int cksize );
  506. lwClip *lwFindClip( lwClip *list, int index );
  507. /* envelope.c */
  508. void lwFreeEnvelope( lwEnvelope *env );
  509. lwEnvelope *lwGetEnvelope( idFile *fp, int cksize );
  510. lwEnvelope *lwFindEnvelope( lwEnvelope *list, int index );
  511. float lwEvalEnvelope( lwEnvelope *env, float time );
  512. /* surface.c */
  513. void lwFreePlugin( lwPlugin *p );
  514. void lwFreeTexture( lwTexture *t );
  515. void lwFreeSurface( lwSurface *surf );
  516. int lwGetTHeader( idFile *fp, int hsz, lwTexture *tex );
  517. int lwGetTMap( idFile *fp, int tmapsz, lwTMap *tmap );
  518. int lwGetImageMap( idFile *fp, int rsz, lwTexture *tex );
  519. int lwGetProcedural( idFile *fp, int rsz, lwTexture *tex );
  520. int lwGetGradient( idFile *fp, int rsz, lwTexture *tex );
  521. lwTexture *lwGetTexture( idFile *fp, int bloksz, unsigned int type );
  522. lwPlugin *lwGetShader( idFile *fp, int bloksz );
  523. lwSurface *lwGetSurface( idFile *fp, int cksize );
  524. lwSurface *lwDefaultSurface( void );
  525. /* lwob.c */
  526. lwSurface *lwGetSurface5( idFile *fp, int cksize, lwObject *obj );
  527. int lwGetPolygons5( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset );
  528. lwObject *lwGetObject5( const char *filename, unsigned int *failID, int *failpos );
  529. /* list.c */
  530. void lwListFree( void *list, void ( *freeNode )( void * ));
  531. void lwListAdd( void **list, void *node );
  532. void lwListInsert( void **vlist, void *vitem,
  533. int ( *compare )( void *, void * ));
  534. /* vecmath.c */
  535. float dot( float a[], float b[] );
  536. void cross( float a[], float b[], float c[] );
  537. void normalize( float v[] );
  538. #define vecangle( a, b ) ( float ) idMath::ACos( dot( a, b ) )
  539. /* lwio.c */
  540. void set_flen( int i );
  541. int get_flen( void );
  542. void *getbytes( idFile *fp, int size );
  543. void skipbytes( idFile *fp, int n );
  544. int getI1( idFile *fp );
  545. short getI2( idFile *fp );
  546. int getI4( idFile *fp );
  547. unsigned char getU1( idFile *fp );
  548. unsigned short getU2( idFile *fp );
  549. unsigned int getU4( idFile *fp );
  550. int getVX( idFile *fp );
  551. float getF4( idFile *fp );
  552. char *getS0( idFile *fp );
  553. int sgetI1( unsigned char **bp );
  554. short sgetI2( unsigned char **bp );
  555. int sgetI4( unsigned char **bp );
  556. unsigned char sgetU1( unsigned char **bp );
  557. unsigned short sgetU2( unsigned char **bp );
  558. unsigned int sgetU4( unsigned char **bp );
  559. int sgetVX( unsigned char **bp );
  560. float sgetF4( unsigned char **bp );
  561. char *sgetS0( unsigned char **bp );
  562. #endif /* !__LWO2_H__ */