Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1602 lines
35 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef STUDIOMDL_H
  9. #define STUDIOMDL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <stdio.h>
  14. #include "basetypes.h"
  15. #include "tier1/utlvector.h"
  16. #include "tier1/utlsymbol.h"
  17. #include "tier1/utlstring.h"
  18. #include "mathlib/vector.h"
  19. #include "studio.h"
  20. #include "datamodel/dmelementhandle.h"
  21. #include "checkuv.h"
  22. struct LodScriptData_t;
  23. struct s_flexkey_t;
  24. struct s_flexcontroller_t;
  25. struct s_flexcontrollerremap_t;
  26. struct s_combinationrule_t;
  27. struct s_combinationcontrol_t;
  28. class CDmeVertexDeltaData;
  29. class CDmeCombinationOperator;
  30. #define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I')
  31. // little-endian "IDST"
  32. #define IDSTUDIOANIMGROUPHEADER (('G'<<24)+('A'<<16)+('D'<<8)+'I')
  33. // little-endian "IDAG"
  34. #define STUDIO_QUADRATIC_MOTION 0x00002000
  35. #define MAXSTUDIOANIMFRAMES 5000 // max frames per animation
  36. #define MAXSTUDIOANIMS 2000 // total animations
  37. #define MAXSTUDIOSEQUENCES 1524 // total sequences
  38. #define MAXSTUDIOSRCBONES 512 // bones allowed at source movement
  39. #define MAXSTUDIOMODELS 32 // sub-models per model
  40. #define MAXSTUDIOBODYPARTS 32
  41. #define MAXSTUDIOMESHES 256
  42. #define MAXSTUDIOEVENTS 1024
  43. #define MAXSTUDIOFLEXKEYS 512
  44. #define MAXSTUDIOFLEXRULES 1024
  45. #define MAXSTUDIOBONEWEIGHTS 3
  46. #define MAXSTUDIOCMDS 64
  47. #define MAXSTUDIOMOVEKEYS 64
  48. #define MAXSTUDIOIKRULES 64
  49. #define MAXSTUDIONAME 128
  50. #ifndef EXTERN
  51. #define EXTERN extern
  52. #endif
  53. EXTERN char outname[MAX_PATH];
  54. //EXTERN char g_pPlatformName[1024];
  55. EXTERN qboolean cdset;
  56. EXTERN int numdirs;
  57. EXTERN char cddir[32][MAX_PATH];
  58. EXTERN int numcdtextures;
  59. EXTERN char * cdtextures[16];
  60. EXTERN char fullpath[1024];
  61. EXTERN char rootname[MAXSTUDIONAME]; // name of the root bone
  62. EXTERN float g_defaultscale;
  63. EXTERN float g_currentscale;
  64. EXTERN RadianEuler g_defaultrotation;
  65. EXTERN char defaulttexture[16][MAX_PATH];
  66. EXTERN char sourcetexture[16][MAX_PATH];
  67. EXTERN int numrep;
  68. EXTERN int tag_reversed;
  69. EXTERN int tag_normals;
  70. EXTERN float normal_blend;
  71. EXTERN int dump_hboxes;
  72. EXTERN int ignore_warnings;
  73. EXTERN Vector eyeposition;
  74. EXTERN float g_flMaxEyeDeflection;
  75. EXTERN int g_illumpositionattachment;
  76. EXTERN Vector illumposition;
  77. EXTERN int illumpositionset;
  78. EXTERN int gflags;
  79. EXTERN Vector bbox[2];
  80. EXTERN Vector cbox[2];
  81. EXTERN bool g_wrotebbox;
  82. EXTERN bool g_wrotecbox;
  83. EXTERN int clip_texcoords;
  84. EXTERN bool g_staticprop;
  85. EXTERN bool g_centerstaticprop;
  86. EXTERN bool g_realignbones;
  87. EXTERN bool g_definebones;
  88. EXTERN byte g_constdirectionalightdot;
  89. // Methods associated with the key value text block
  90. extern CUtlVector< char > g_KeyValueText;
  91. int KeyValueTextSize( CUtlVector< char > *pKeyValue );
  92. const char *KeyValueText( CUtlVector< char > *pKeyValue );
  93. extern vec_t Q_rint (vec_t in);
  94. extern void WriteModelFiles(void);
  95. void *kalloc( int num, int size );
  96. // --------------------------------------------------------------------
  97. template< class T >
  98. class CUtlVectorAuto : public CUtlVector< T >
  99. {
  100. // typedef CUtlVectorAuto< T, CUtlVector<T > > BaseClass;
  101. public:
  102. T& operator[]( int i );
  103. };
  104. template< typename T >
  105. inline T& CUtlVectorAuto<T>::operator[]( int i )
  106. {
  107. EnsureCount( i + 1 );
  108. Assert( IsValidIndex(i) );
  109. return Base()[i];
  110. }
  111. // --------------------------------------------------------------------
  112. struct s_trianglevert_t
  113. {
  114. int vertindex;
  115. int normindex; // index into normal array
  116. int s,t;
  117. float u,v;
  118. };
  119. struct s_boneweight_t
  120. {
  121. int numbones;
  122. int bone[MAXSTUDIOBONEWEIGHTS];
  123. float weight[MAXSTUDIOBONEWEIGHTS];
  124. };
  125. struct s_tmpface_t
  126. {
  127. int material;
  128. unsigned long a, b, c;
  129. unsigned long ta, tb, tc;
  130. unsigned long na, nb, nc;
  131. };
  132. struct s_face_t
  133. {
  134. unsigned long a, b, c;
  135. };
  136. struct s_vertexinfo_t
  137. {
  138. int material;
  139. int mesh;
  140. Vector position;
  141. Vector normal;
  142. Vector4D tangentS;
  143. Vector2D texcoord;
  144. s_boneweight_t boneweight;
  145. };
  146. //============================================================================
  147. // dstudiobone_t bone[MAXSTUDIOBONES];
  148. struct s_bonefixup_t
  149. {
  150. matrix3x4_t m;
  151. };
  152. EXTERN int g_numbones;
  153. struct s_bonetable_t
  154. {
  155. char name[MAXSTUDIONAME]; // bone name for symbolic links
  156. int parent; // parent bone
  157. bool split;
  158. int bonecontroller; // -1 == 0
  159. Vector pos; // default pos
  160. Vector posscale; // pos values scale
  161. RadianEuler rot; // default pos
  162. Vector rotscale; // rotation values scale
  163. int group; // hitgroup
  164. Vector bmin, bmax; // bounding box
  165. bool bPreDefined;
  166. matrix3x4_t rawLocalOriginal; // original transform of preDefined bone
  167. matrix3x4_t rawLocal;
  168. matrix3x4_t srcRealign;
  169. bool bPreAligned;
  170. matrix3x4_t boneToPose;
  171. int flags;
  172. int proceduralindex;
  173. int physicsBoneIndex;
  174. int surfacePropIndex;
  175. Quaternion qAlignment;
  176. bool bDontCollapse;
  177. Vector posrange;
  178. };
  179. EXTERN s_bonetable_t g_bonetable[MAXSTUDIOSRCBONES];
  180. extern int findGlobalBone( const char *name ); // finds a named bone in the global bone table
  181. EXTERN int g_numrenamedbones;
  182. struct s_renamebone_t
  183. {
  184. char from[MAXSTUDIONAME];
  185. char to[MAXSTUDIONAME];
  186. };
  187. EXTERN s_renamebone_t g_renamedbone[MAXSTUDIOSRCBONES];
  188. const char *RenameBone( const char *pName ); // returns new name if available, else return pName.
  189. EXTERN int g_numimportbones;
  190. struct s_importbone_t
  191. {
  192. char name[MAXSTUDIONAME];
  193. char parent[MAXSTUDIONAME];
  194. matrix3x4_t rawLocal;
  195. bool bPreAligned;
  196. matrix3x4_t srcRealign;
  197. };
  198. EXTERN s_importbone_t g_importbone[MAXSTUDIOSRCBONES];
  199. EXTERN int g_numincludemodels;
  200. struct s_includemodel_t
  201. {
  202. char name[MAXSTUDIONAME];
  203. };
  204. EXTERN s_includemodel_t g_includemodel[128];
  205. struct s_bbox_t
  206. {
  207. char name[MAXSTUDIONAME]; // bone name
  208. char hitboxname[MAXSTUDIONAME]; // hitbox name
  209. int bone;
  210. int group; // hitgroup
  211. int model;
  212. Vector bmin, bmax; // bounding box
  213. };
  214. #define MAXSTUDIOHITBOXSETNAME 64
  215. struct s_hitboxset
  216. {
  217. char hitboxsetname[ MAXSTUDIOHITBOXSETNAME ];
  218. int numhitboxes;
  219. s_bbox_t hitbox[MAXSTUDIOSRCBONES];
  220. };
  221. extern CUtlVector< s_hitboxset > g_hitboxsets;
  222. EXTERN int g_numhitgroups;
  223. struct s_hitgroup_t
  224. {
  225. int models;
  226. int group;
  227. char name[MAXSTUDIONAME]; // bone name
  228. };
  229. EXTERN s_hitgroup_t g_hitgroup[MAXSTUDIOSRCBONES];
  230. struct s_bonecontroller_t
  231. {
  232. char name[MAXSTUDIONAME];
  233. int bone;
  234. int type;
  235. int inputfield;
  236. float start;
  237. float end;
  238. };
  239. EXTERN s_bonecontroller_t g_bonecontroller[MAXSTUDIOSRCBONES];
  240. EXTERN int g_numbonecontrollers;
  241. struct s_screenalignedbone_t
  242. {
  243. char name[MAXSTUDIONAME];
  244. int flags;
  245. };
  246. EXTERN s_screenalignedbone_t g_screenalignedbone[MAXSTUDIOSRCBONES];
  247. EXTERN int g_numscreenalignedbones;
  248. struct s_attachment_t
  249. {
  250. char name[MAXSTUDIONAME];
  251. char bonename[MAXSTUDIONAME];
  252. int bone;
  253. int type;
  254. int flags;
  255. matrix3x4_t local;
  256. int found; // a owning bone has been flagged
  257. bool operator==( const s_attachment_t &rhs ) const;
  258. };
  259. #define IS_ABSOLUTE 0x0001
  260. #define IS_RIGID 0x0002
  261. EXTERN s_attachment_t g_attachment[MAXSTUDIOSRCBONES];
  262. EXTERN int g_numattachments;
  263. struct s_bonemerge_t
  264. {
  265. char bonename[MAXSTUDIONAME];
  266. };
  267. EXTERN CUtlVector< s_bonemerge_t > g_BoneMerge;
  268. struct s_mouth_t
  269. {
  270. char bonename[MAXSTUDIONAME];
  271. int bone;
  272. Vector forward;
  273. int flexdesc;
  274. };
  275. EXTERN s_mouth_t g_mouth[MAXSTUDIOSRCBONES]; // ?? skins?
  276. EXTERN int g_nummouths;
  277. struct s_node_t
  278. {
  279. char name[MAXSTUDIONAME];
  280. int parent;
  281. };
  282. struct s_bone_t
  283. {
  284. Vector pos;
  285. RadianEuler rot;
  286. };
  287. struct s_linearmove_t
  288. {
  289. int endframe; // frame when pos, rot is valid.
  290. int flags; // type of motion. Only linear, linear accel, and linear decel is allowed
  291. float v0;
  292. float v1;
  293. Vector vector; // movement vector
  294. Vector pos; // final position
  295. RadianEuler rot; // final rotation
  296. };
  297. #define CMD_WEIGHTS 1
  298. #define CMD_SUBTRACT 2
  299. #define CMD_AO 3
  300. #define CMD_MATCH 4
  301. #define CMD_FIXUP 5
  302. #define CMD_ANGLE 6
  303. #define CMD_IKFIXUP 7
  304. #define CMD_IKRULE 8
  305. #define CMD_MOTION 9
  306. #define CMD_REFMOTION 10
  307. #define CMD_DERIVATIVE 11
  308. #define CMD_NOANIMATION 12
  309. #define CMD_LINEARDELTA 13
  310. #define CMD_SPLINEDELTA 14
  311. #define CMD_COMPRESS 15
  312. #define CMD_NUMFRAMES 16
  313. #define CMD_COUNTERROTATE 17
  314. #define CMD_SETBONE 18
  315. #define CMD_WORLDSPACEBLEND 19
  316. #define CMD_MATCHBLEND 20
  317. #define CMD_LOCALHIERARCHY 21
  318. struct s_animation_t;
  319. struct s_ikrule_t;
  320. struct s_motion_t
  321. {
  322. int motiontype;
  323. int iStartFrame;// starting frame to apply motion over
  324. int iEndFrame; // end frame to apply motion over
  325. int iSrcFrame; // frame that matches the "reference" animation
  326. s_animation_t *pRefAnim; // animation to match
  327. int iRefFrame; // reference animation's frame to match
  328. };
  329. struct s_animcmd_t
  330. {
  331. int cmd;
  332. union
  333. {
  334. struct
  335. {
  336. int index;
  337. } weightlist;
  338. struct
  339. {
  340. s_animation_t *ref;
  341. int frame;
  342. int flags;
  343. } subtract;
  344. struct
  345. {
  346. s_animation_t *ref;
  347. int motiontype;
  348. int srcframe;
  349. int destframe;
  350. char *pBonename;
  351. } ao;
  352. struct
  353. {
  354. s_animation_t *ref;
  355. int srcframe;
  356. int destframe;
  357. int destpre;
  358. int destpost;
  359. } match;
  360. struct
  361. {
  362. s_animation_t *ref;
  363. int startframe;
  364. int loops;
  365. } world;
  366. struct
  367. {
  368. int start;
  369. int end;
  370. } fixuploop;
  371. struct
  372. {
  373. float angle;
  374. } angle;
  375. struct
  376. {
  377. s_ikrule_t *pRule;
  378. } ikfixup;
  379. struct
  380. {
  381. s_ikrule_t *pRule;
  382. } ikrule;
  383. struct
  384. {
  385. float scale;
  386. } derivative;
  387. struct
  388. {
  389. int flags;
  390. } linear;
  391. struct
  392. {
  393. int frames;
  394. } compress;
  395. struct
  396. {
  397. int frames;
  398. } numframes;
  399. struct
  400. {
  401. char *pBonename;
  402. bool bHasTarget;
  403. float targetAngle[3];
  404. } counterrotate;
  405. struct
  406. {
  407. char *pBonename;
  408. char *pParentname;
  409. int start;
  410. int peak;
  411. int tail;
  412. int end;
  413. } localhierarchy;
  414. struct s_motion_t motion;
  415. } u;
  416. };
  417. struct s_streamdata_t
  418. {
  419. Vector pos;
  420. Quaternion q;
  421. };
  422. struct s_animationstream_t
  423. {
  424. // source animations
  425. int numerror;
  426. s_streamdata_t *pError;
  427. // compressed animations
  428. float scale[6];
  429. int numanim[6];
  430. mstudioanimvalue_t *anim[6];
  431. };
  432. struct s_ikrule_t
  433. {
  434. int chain;
  435. int index;
  436. int type;
  437. int slot;
  438. char bonename[MAXSTUDIONAME];
  439. char attachment[MAXSTUDIONAME];
  440. int bone;
  441. Vector pos;
  442. Quaternion q;
  443. float height;
  444. float floor;
  445. float radius;
  446. int start;
  447. int peak;
  448. int tail;
  449. int end;
  450. int contact;
  451. bool usesequence;
  452. bool usesource;
  453. int flags;
  454. s_animationstream_t errorData;
  455. };
  456. struct s_localhierarchy_t
  457. {
  458. int bone;
  459. int newparent;
  460. int start;
  461. int peak;
  462. int tail;
  463. int end;
  464. s_animationstream_t localData;
  465. };
  466. struct s_source_t;
  467. EXTERN int g_numani;
  468. struct s_compressed_t
  469. {
  470. int num[6];
  471. mstudioanimvalue_t *data[6];
  472. };
  473. struct s_animation_t
  474. {
  475. bool isImplied;
  476. bool isOverride;
  477. bool doesOverride;
  478. int index;
  479. char name[MAXSTUDIONAME];
  480. char filename[MAX_PATH];
  481. /*
  482. int animsubindex;
  483. // For sharing outside of current .mdl file
  484. bool shared_group_checkvalidity;
  485. bool shared_group_valid;
  486. char shared_animgroup_file[ MAX_PATH ]; // share file name
  487. char shared_animgroup_name[ MAXSTUDIONAME ]; // group name in share file
  488. int shared_group_subindex;
  489. studioanimhdr_t *shared_group_header;
  490. */
  491. float fps;
  492. int startframe;
  493. int endframe;
  494. int flags;
  495. // animations processed (time shifted, linearized, and bone adjusted ) from source animations
  496. CUtlVectorAuto< s_bone_t * > sanim; // [MAXSTUDIOANIMFRAMES]; // [frame][bones];
  497. int motiontype;
  498. int fudgeloop;
  499. int looprestart; // new starting frame for looping animations
  500. // piecewise linear motion
  501. int numpiecewisekeys;
  502. s_linearmove_t piecewisemove[MAXSTUDIOMOVEKEYS];
  503. // default adjustments
  504. Vector adjust;
  505. float scale; // ????
  506. RadianEuler rotation;
  507. s_source_t *source;
  508. char animationname[MAX_PATH];
  509. Vector bmin;
  510. Vector bmax;
  511. int numframes;
  512. // compressed animation data
  513. int numsections;
  514. int sectionframes;
  515. CUtlVectorAuto< CUtlVectorAuto< s_compressed_t > > anim;
  516. // int weightlist;
  517. float weight[MAXSTUDIOSRCBONES];
  518. float posweight[MAXSTUDIOSRCBONES];
  519. int numcmds;
  520. s_animcmd_t cmds[MAXSTUDIOCMDS];
  521. int numikrules;
  522. s_ikrule_t ikrule[MAXSTUDIOIKRULES];
  523. bool noAutoIK;
  524. int numlocalhierarchy;
  525. s_localhierarchy_t localhierarchy[MAXSTUDIOIKRULES];
  526. float motionrollback;
  527. bool disableAnimblocks; // no demand loading
  528. bool isFirstSectionLocal; // first block of a section isn't demand loaded
  529. };
  530. EXTERN s_animation_t *g_panimation[MAXSTUDIOANIMS];
  531. EXTERN int g_numcmdlists;
  532. struct s_cmdlist_t
  533. {
  534. char name[MAXSTUDIONAME];
  535. int numcmds;
  536. s_animcmd_t cmds[MAXSTUDIOCMDS];
  537. };
  538. EXTERN s_cmdlist_t g_cmdlist[MAXSTUDIOANIMS];
  539. struct s_iklock_t
  540. {
  541. char name[MAXSTUDIONAME];
  542. int chain;
  543. float flPosWeight;
  544. float flLocalQWeight;
  545. };
  546. EXTERN int g_numikautoplaylocks;
  547. EXTERN s_iklock_t g_ikautoplaylock[16];
  548. struct s_event_t
  549. {
  550. int event;
  551. int frame;
  552. char options[64];
  553. char eventname[MAXSTUDIONAME];
  554. };
  555. struct s_autolayer_t
  556. {
  557. char name[MAXSTUDIONAME];
  558. int sequence;
  559. int flags;
  560. int pose;
  561. float start;
  562. float peak;
  563. float tail;
  564. float end;
  565. };
  566. class s_sequence_t
  567. {
  568. public:
  569. char name[MAXSTUDIONAME];
  570. char activityname[MAXSTUDIONAME]; // index into the string table, the name of this activity.
  571. int flags;
  572. // float fps;
  573. // int numframes;
  574. int activity;
  575. int actweight;
  576. int numevents;
  577. s_event_t event[MAXSTUDIOEVENTS];
  578. int numblends;
  579. int groupsize[2];
  580. CUtlVectorAuto< CUtlVectorAuto< s_animation_t * > > panim; // [MAXSTUDIOBLENDS][MAXSTUDIOBLENDS];
  581. int paramindex[2];
  582. float paramstart[2];
  583. float paramend[2];
  584. int paramattachment[2];
  585. int paramcontrol[2];
  586. CUtlVectorAuto< float >param0; // [MAXSTUDIOBLENDS];
  587. CUtlVectorAuto< float >param1; // [MAXSTUDIOBLENDS];
  588. s_animation_t *paramanim;
  589. s_animation_t *paramcompanim;
  590. s_animation_t *paramcenter;
  591. // Vector automovepos[MAXSTUDIOANIMATIONS];
  592. // Vector automoveangle[MAXSTUDIOANIMATIONS];
  593. int animindex;
  594. Vector bmin;
  595. Vector bmax;
  596. float fadeintime;
  597. float fadeouttime;
  598. int entrynode;
  599. int exitnode;
  600. int nodeflags;
  601. float entryphase;
  602. float exitphase;
  603. int numikrules;
  604. int numautolayers;
  605. s_autolayer_t autolayer[64];
  606. float weight[MAXSTUDIOSRCBONES];
  607. s_iklock_t iklock[64];
  608. int numiklocks;
  609. int cycleposeindex;
  610. CUtlVector< char > KeyValue;
  611. };
  612. EXTERN CUtlVector< s_sequence_t > g_sequence;
  613. //EXTERN int g_numseq;
  614. EXTERN int g_numanimblocks;
  615. struct s_animblock_t
  616. {
  617. int iStartAnim;
  618. int iEndAnim;
  619. byte *start;
  620. byte *end;
  621. };
  622. EXTERN s_animblock_t g_animblock[MAXSTUDIOANIMBLOCKS];
  623. EXTERN int g_animblocksize;
  624. EXTERN char g_animblockname[260];
  625. EXTERN int g_numposeparameters;
  626. struct s_poseparameter_t
  627. {
  628. char name[MAXSTUDIONAME];
  629. float min;
  630. float max;
  631. int flags;
  632. float loop;
  633. };
  634. EXTERN s_poseparameter_t g_pose[32]; // FIXME: this shouldn't be hard coded
  635. EXTERN int g_numxnodes;
  636. EXTERN char *g_xnodename[100];
  637. EXTERN int g_xnode[100][100];
  638. EXTERN int g_numxnodeskips;
  639. EXTERN int g_xnodeskip[10000][2];
  640. struct rgb_t
  641. {
  642. byte r, g, b;
  643. };
  644. struct rgb2_t
  645. {
  646. float r, g, b, a;
  647. };
  648. // FIXME: what about texture overrides inline with loading models
  649. enum TextureFlags_t
  650. {
  651. RELATIVE_TEXTURE_PATH_SPECIFIED = 0x1
  652. };
  653. struct s_texture_t
  654. {
  655. char name[MAX_PATH];
  656. int flags;
  657. int parent;
  658. int material;
  659. float width;
  660. float height;
  661. float dPdu;
  662. float dPdv;
  663. };
  664. EXTERN s_texture_t g_texture[MAXSTUDIOSKINS];
  665. EXTERN int g_numtextures;
  666. EXTERN int g_material[MAXSTUDIOSKINS]; // link into texture array
  667. EXTERN int g_nummaterials;
  668. EXTERN float g_gamma;
  669. EXTERN int g_numskinref;
  670. EXTERN int g_numskinfamilies;
  671. EXTERN int g_skinref[256][MAXSTUDIOSKINS]; // [skin][skinref], returns texture index
  672. EXTERN int g_numtexturegroups;
  673. EXTERN int g_numtexturelayers[32];
  674. EXTERN int g_numtexturereps[32];
  675. EXTERN int g_texturegroup[32][32][32];
  676. struct s_mesh_t
  677. {
  678. int numvertices;
  679. int vertexoffset;
  680. int numfaces;
  681. int faceoffset;
  682. };
  683. struct s_vertanim_t
  684. {
  685. int vertex;
  686. float speed;
  687. float side;
  688. Vector pos;
  689. Vector normal;
  690. float wrinkle;
  691. };
  692. struct s_lodvertexinfo_t : public s_vertexinfo_t
  693. {
  694. int lodFlag;
  695. };
  696. // processed aggregate lod pools
  697. struct s_loddata_t
  698. {
  699. int numvertices;
  700. s_lodvertexinfo_t *vertex;
  701. int numfaces;
  702. s_face_t *face;
  703. s_mesh_t mesh[MAXSTUDIOSKINS];
  704. // remaps verts from an lod's source mesh to this all-lod processed aggregate pool
  705. int *pMeshVertIndexMaps[MAX_NUM_LODS];
  706. };
  707. // Animations stored in raw off-disk source files. Raw data should be not processed.
  708. class s_sourceanim_t
  709. {
  710. public:
  711. char animationname[MAX_PATH];
  712. int numframes;
  713. int startframe;
  714. int endframe;
  715. CUtlVectorAuto< s_bone_t * >rawanim;
  716. // vertex animation
  717. bool newStyleVertexAnimations; // new style doesn't store a base pose in vertex anim[0]
  718. int *vanim_mapcount; // local verts map to N target verts
  719. int **vanim_map; // local vertices to target vertices mapping list
  720. int *vanim_flag; // local vert does animate
  721. int numvanims[MAXSTUDIOANIMFRAMES];
  722. s_vertanim_t *vanim[MAXSTUDIOANIMFRAMES]; // [frame][vertex]
  723. };
  724. // raw off-disk source files. Raw data should be not processed.
  725. struct s_source_t
  726. {
  727. char filename[MAX_PATH];
  728. int time; // time stamp
  729. bool isActiveModel;
  730. // local skeleton hierarchy
  731. int numbones;
  732. s_node_t localBone[MAXSTUDIOSRCBONES];
  733. matrix3x4_t boneToPose[MAXSTUDIOSRCBONES]; // converts bone local data into initial pose data
  734. // bone remapping
  735. int boneflags[MAXSTUDIOSRCBONES]; // attachment, vertex, etc flags for this bone
  736. int boneref[MAXSTUDIOSRCBONES]; // flags for this and child bones
  737. int boneLocalToGlobal[MAXSTUDIOSRCBONES]; // bonemap : local bone to world bone mapping
  738. int boneGlobalToLocal[MAXSTUDIOSRCBONES]; // boneimap : world bone to local bone mapping
  739. int texmap[MAXSTUDIOSKINS*4]; // map local MAX materials to unique textures
  740. // per material mesh
  741. int nummeshes;
  742. int meshindex[MAXSTUDIOSKINS]; // mesh to skin index
  743. s_mesh_t mesh[MAXSTUDIOSKINS];
  744. // vertices defined in "local" space (not remapped to global bones)
  745. int numvertices;
  746. s_vertexinfo_t *vertex;
  747. // vertices defined in "global" space (remapped to global bones)
  748. CUtlVector< s_vertexinfo_t > m_GlobalVertices;
  749. int numfaces;
  750. s_face_t *face; // vertex indexs per face
  751. // raw skeletal animation
  752. CUtlVector< s_sourceanim_t > m_Animations;
  753. // default adjustments
  754. Vector adjust;
  755. float scale; // ????
  756. RadianEuler rotation;
  757. // Flex keys stored in the source data
  758. CUtlVector< s_flexkey_t > m_FlexKeys;
  759. // Combination controls stored in the source data
  760. CUtlVector< s_combinationcontrol_t > m_CombinationControls;
  761. // Combination rules stored in the source data
  762. CUtlVector< s_combinationrule_t > m_CombinationRules;
  763. // Flexcontroller remaps
  764. CUtlVector< s_flexcontrollerremap_t > m_FlexControllerRemaps;
  765. // Attachment points stored in the SMD/DMX/etc. file
  766. CUtlVector< s_attachment_t > m_Attachments;
  767. // Information about how flex controller remaps map into flex rules
  768. int m_nKeyStartIndex; // The index at which the flex keys for this model start in the global list
  769. CUtlVector< int > m_rawIndexToRemapSourceIndex;
  770. CUtlVector< int > m_rawIndexToRemapLocalIndex;
  771. CUtlVector< int > m_leftRemapIndexToGlobalFlexControllIndex;
  772. CUtlVector< int > m_rightRemapIndexToGlobalFlexControllIndex;
  773. };
  774. EXTERN int g_numsources;
  775. EXTERN s_source_t *g_source[MAXSTUDIOSEQUENCES];
  776. struct s_eyeball_t
  777. {
  778. char name[MAXSTUDIONAME];
  779. int index;
  780. int bone;
  781. Vector org;
  782. float zoffset;
  783. float radius;
  784. Vector up;
  785. Vector forward;
  786. int mesh;
  787. float iris_scale;
  788. int upperlidflexdesc;
  789. int upperflexdesc[3];
  790. float uppertarget[3];
  791. int lowerlidflexdesc;
  792. int lowerflexdesc[3];
  793. float lowertarget[3];
  794. int m_flags;
  795. enum StudioMdlEyeBallFlags
  796. {
  797. STUDIOMDL_EYELID_DME = 1 << 0
  798. };
  799. };
  800. struct s_model_t
  801. {
  802. char name[MAXSTUDIONAME];
  803. char filename[MAX_PATH];
  804. // needs local scaling and rotation paramaters
  805. s_source_t *source; // index into source table
  806. float scale; // UNUSED
  807. float boundingradius;
  808. Vector boundingbox[MAXSTUDIOSRCBONES][2];
  809. int numattachments;
  810. s_attachment_t attachment[32];
  811. int numeyeballs;
  812. s_eyeball_t eyeball[4];
  813. int numflexes;
  814. int flexoffset;
  815. // References to sources which are the LODs for this model
  816. CUtlVector< s_source_t* > m_LodSources;
  817. // processed aggregate lod data
  818. s_loddata_t *m_pLodData;
  819. };
  820. EXTERN int g_nummodels;
  821. EXTERN int g_nummodelsbeforeLOD;
  822. EXTERN s_model_t *g_model[MAXSTUDIOMODELS];
  823. struct s_flexdesc_t
  824. {
  825. char FACS[MAXSTUDIONAME]; // FACS identifier
  826. };
  827. EXTERN int g_numflexdesc;
  828. EXTERN s_flexdesc_t g_flexdesc[MAXSTUDIOFLEXDESC];
  829. int Add_Flexdesc( const char *name );
  830. struct s_flexcontroller_t
  831. {
  832. char name[MAXSTUDIONAME];
  833. char type[MAXSTUDIONAME];
  834. float min;
  835. float max;
  836. };
  837. EXTERN int g_numflexcontrollers;
  838. EXTERN s_flexcontroller_t g_flexcontroller[MAXSTUDIOFLEXCTRL];
  839. struct s_flexcontrollerremap_t
  840. {
  841. CUtlString m_Name;
  842. FlexControllerRemapType_t m_RemapType;
  843. bool m_bIsStereo;
  844. CUtlVector< CUtlString > m_RawControls;
  845. int m_Index; ///< The model relative index of the slider control for value for this if it's not split, -1 otherwise
  846. int m_LeftIndex; ///< The model relative index of the left slider control for this if it's split, -1 otherwise
  847. int m_RightIndex; ///< The model relative index of the right slider control for this if it's split, -1 otherwise
  848. int m_MultiIndex; ///< The model relative index of the value slider control for this if it's multi, -1 otherwise
  849. CUtlString m_EyesUpDownFlexName; // The name of the eyes up/down flex controller
  850. int m_EyesUpDownFlexController; // The global index of the Eyes Up/Down Flex Controller
  851. int m_BlinkController; // The global index of the Blink Up/Down Flex Controller
  852. };
  853. extern CUtlVector<s_flexcontrollerremap_t> g_FlexControllerRemap;
  854. struct s_flexkey_t
  855. {
  856. int flexdesc;
  857. int flexpair;
  858. s_source_t *source; // index into source table
  859. char animationname[MAX_PATH];
  860. int imodel;
  861. int frame;
  862. float target0;
  863. float target1;
  864. float target2;
  865. float target3;
  866. int original;
  867. float split;
  868. float decay;
  869. // extracted and remapped vertex animations
  870. int numvanims;
  871. s_vertanim_t *vanim;
  872. int vanimtype;
  873. int weighttable;
  874. };
  875. EXTERN int g_numflexkeys;
  876. EXTERN s_flexkey_t g_flexkey[MAXSTUDIOFLEXKEYS];
  877. EXTERN s_flexkey_t *g_defaultflexkey;
  878. #define MAX_OPS 512
  879. struct s_flexop_t
  880. {
  881. int op;
  882. union
  883. {
  884. int index;
  885. float value;
  886. } d;
  887. };
  888. struct s_flexrule_t
  889. {
  890. int flex;
  891. int numops;
  892. s_flexop_t op[MAX_OPS];
  893. };
  894. EXTERN int g_numflexrules;
  895. EXTERN s_flexrule_t g_flexrule[MAXSTUDIOFLEXRULES];
  896. struct s_combinationcontrol_t
  897. {
  898. char name[MAX_PATH];
  899. };
  900. struct s_combinationrule_t
  901. {
  902. // The 'ints' here are indices into the m_Controls array
  903. CUtlVector< int > m_Combination;
  904. CUtlVector< CUtlVector< int > > m_Dominators;
  905. // The index into the flexkeys to put the result in
  906. // (should affect both left + right if the key is sided)
  907. int m_nFlex;
  908. };
  909. EXTERN Vector g_defaultadjust;
  910. struct s_bodypart_t
  911. {
  912. char name[MAXSTUDIONAME];
  913. int nummodels;
  914. int base;
  915. s_model_t *pmodel[MAXSTUDIOMODELS];
  916. };
  917. EXTERN int g_numbodyparts;
  918. EXTERN s_bodypart_t g_bodypart[MAXSTUDIOBODYPARTS];
  919. #define MAXWEIGHTLISTS 128
  920. #define MAXWEIGHTSPERLIST (MAXSTUDIOBONES)
  921. struct s_weightlist_t
  922. {
  923. // weights, indexed by numbones per weightlist
  924. char name[MAXSTUDIONAME];
  925. int numbones;
  926. char *bonename[MAXWEIGHTSPERLIST];
  927. float boneweight[MAXWEIGHTSPERLIST];
  928. float boneposweight[MAXWEIGHTSPERLIST];
  929. // weights, indexed by global bone index
  930. float weight[MAXSTUDIOBONES];
  931. float posweight[MAXSTUDIOBONES];
  932. };
  933. EXTERN int g_numweightlist;
  934. EXTERN s_weightlist_t g_weightlist[MAXWEIGHTLISTS];
  935. struct s_iklink_t
  936. {
  937. int bone;
  938. Vector kneeDir;
  939. };
  940. struct s_ikchain_t
  941. {
  942. char name[MAXSTUDIONAME];
  943. char bonename[MAXSTUDIONAME];
  944. int axis;
  945. float value;
  946. int numlinks;
  947. s_iklink_t link[10]; // hip, knee, ankle, toes...
  948. float height;
  949. float radius;
  950. float floor;
  951. Vector center;
  952. };
  953. EXTERN int g_numikchains;
  954. EXTERN s_ikchain_t g_ikchain[16];
  955. struct s_jigglebone_t
  956. {
  957. int flags;
  958. char bonename[MAXSTUDIONAME];
  959. int bone;
  960. mstudiojigglebone_t data; // the actual jiggle properties
  961. };
  962. EXTERN int g_numjigglebones;
  963. EXTERN s_jigglebone_t g_jigglebones[MAXSTUDIOBONES];
  964. EXTERN int g_jigglebonemap[MAXSTUDIOBONES]; // map used jigglebone's to source jigglebonebone's
  965. struct s_axisinterpbone_t
  966. {
  967. int flags;
  968. char bonename[MAXSTUDIONAME];
  969. int bone;
  970. char controlname[MAXSTUDIONAME];
  971. int control;
  972. int axis;
  973. Vector pos[6];
  974. Quaternion quat[6];
  975. };
  976. EXTERN int g_numaxisinterpbones;
  977. EXTERN s_axisinterpbone_t g_axisinterpbones[MAXSTUDIOBONES];
  978. EXTERN int g_axisinterpbonemap[MAXSTUDIOBONES]; // map used axisinterpbone's to source axisinterpbone's
  979. struct s_quatinterpbone_t
  980. {
  981. int flags;
  982. char bonename[MAXSTUDIONAME];
  983. int bone;
  984. char parentname[MAXSTUDIONAME];
  985. // int parent;
  986. char controlparentname[MAXSTUDIONAME];
  987. // int controlparent;
  988. char controlname[MAXSTUDIONAME];
  989. int control;
  990. int numtriggers;
  991. Vector size;
  992. Vector basepos;
  993. float percentage;
  994. float tolerance[32];
  995. Quaternion trigger[32];
  996. Vector pos[32];
  997. Quaternion quat[32];
  998. };
  999. EXTERN int g_numquatinterpbones;
  1000. EXTERN s_quatinterpbone_t g_quatinterpbones[MAXSTUDIOBONES];
  1001. EXTERN int g_quatinterpbonemap[MAXSTUDIOBONES]; // map used quatinterpbone's to source axisinterpbone's
  1002. struct s_aimatbone_t
  1003. {
  1004. char bonename[MAXSTUDIONAME];
  1005. int bone;
  1006. char parentname[MAXSTUDIONAME];
  1007. int parent;
  1008. char aimname[MAXSTUDIONAME];
  1009. int aimAttach;
  1010. int aimBone;
  1011. Vector aimvector;
  1012. Vector upvector;
  1013. Vector basepos;
  1014. };
  1015. EXTERN int g_numaimatbones;
  1016. EXTERN s_aimatbone_t g_aimatbones[MAXSTUDIOBONES];
  1017. EXTERN int g_aimatbonemap[MAXSTUDIOBONES]; // map used aimatpbone's to source aimatpbone's (may be optimized out)
  1018. struct s_forcedhierarchy_t
  1019. {
  1020. char parentname[MAXSTUDIONAME];
  1021. char childname[MAXSTUDIONAME];
  1022. char subparentname[MAXSTUDIONAME];
  1023. };
  1024. EXTERN int g_numforcedhierarchy;
  1025. EXTERN s_forcedhierarchy_t g_forcedhierarchy[MAXSTUDIOBONES];
  1026. struct s_forcedrealign_t
  1027. {
  1028. char name[MAXSTUDIONAME];
  1029. RadianEuler rot;
  1030. };
  1031. EXTERN int g_numforcedrealign;
  1032. EXTERN s_forcedrealign_t g_forcedrealign[MAXSTUDIOBONES];
  1033. struct s_limitrotation_t
  1034. {
  1035. char name[MAXSTUDIONAME];
  1036. int numseq;
  1037. char *sequencename[64];
  1038. };
  1039. EXTERN int g_numlimitrotation;
  1040. EXTERN s_limitrotation_t g_limitrotation[MAXSTUDIOBONES];
  1041. extern int BuildTris (s_trianglevert_t (*x)[3], s_mesh_t *y, byte **ppdata );
  1042. struct s_bonesaveframe_t
  1043. {
  1044. char name[ MAXSTUDIOHITBOXSETNAME ];
  1045. bool bSavePos;
  1046. bool bSaveRot;
  1047. };
  1048. EXTERN CUtlVector< s_bonesaveframe_t > g_bonesaveframe;
  1049. int OpenGlobalFile( char *src );
  1050. bool GetGlobalFilePath( const char *pSrc, char *pFullPath, int nMaxLen );
  1051. s_source_t *Load_Source( char const *filename, const char *ext, bool reverse = false, bool isActiveModel = false );
  1052. int Load_VRM( s_source_t *psource );
  1053. int Load_SMD( s_source_t *psource );
  1054. int Load_VTA( s_source_t *psource );
  1055. int Load_OBJ( s_source_t *psource );
  1056. int Load_DMX( s_source_t *psource );
  1057. int AppendVTAtoOBJ( s_source_t *psource, char *filename, int frame );
  1058. void Build_Reference( s_source_t *psource, const char *pAnimName );
  1059. int Grab_Nodes( s_node_t *pnodes );
  1060. void Grab_Animation( s_source_t *psource, const char *pAnimName );
  1061. // Processes source comment line and extracts information about the data file
  1062. void ProcessSourceComment( s_source_t *psource, const char *pCommentString );
  1063. // Processes original content file "szOriginalContentFile" that was used to generate
  1064. // data file "szDataFile"
  1065. void ProcessOriginalContentFile( const char *szDataFile, const char *szOriginalContentFile );
  1066. //-----------------------------------------------------------------------------
  1067. // Utility methods to get or add animation data from sources
  1068. //-----------------------------------------------------------------------------
  1069. s_sourceanim_t *FindSourceAnim( s_source_t *pSource, const char *pAnimName );
  1070. const s_sourceanim_t *FindSourceAnim( const s_source_t *pSource, const char *pAnimName );
  1071. s_sourceanim_t *FindOrAddSourceAnim( s_source_t *pSource, const char *pAnimName );
  1072. // Adds flexkey data to a particular source
  1073. void AddFlexKey( s_source_t *pSource, CDmeCombinationOperator *pComboOp, const char *pFlexKeyName );
  1074. // Adds combination data to the source
  1075. void AddCombination( s_source_t *pSource, CDmeCombinationOperator *pCombination );
  1076. int LookupTexture( const char *pTextureName, bool bRelativePath = false );
  1077. int UseTextureAsMaterial( int textureindex );
  1078. int MaterialToTexture( int material );
  1079. int LookupAttachment( char *name );
  1080. void ClearModel (void);
  1081. void SimplifyModel (void);
  1082. void CollapseBones (void);
  1083. void adjust_vertex( float *org );
  1084. void scale_vertex( Vector &org );
  1085. void clip_rotations( RadianEuler& rot );
  1086. void clip_rotations( Vector& rot );
  1087. void *kalloc( int num, int size );
  1088. void kmemset( void *ptr, int value, int size );
  1089. char *stristr( const char *string, const char *string2 );
  1090. void CalcBoneTransforms( s_animation_t *panimation, int frame, matrix3x4_t* pBoneToWorld );
  1091. void CalcBoneTransforms( s_animation_t *panimation, s_animation_t *pbaseanimation, int frame, matrix3x4_t* pBoneToWorld );
  1092. void CalcBoneTransformsCycle( s_animation_t *panimation, s_animation_t *pbaseanimation, float flCycle, matrix3x4_t* pBoneToWorld );
  1093. void BuildRawTransforms( const s_source_t *psource, const char *pAnimationName, int frame, float scale, Vector const &shift, RadianEuler const &rotate, int flags, matrix3x4_t* boneToWorld );
  1094. void BuildRawTransforms( const s_source_t *psource, const char *pAnimationName, int frame, matrix3x4_t* boneToWorld );
  1095. void TranslateAnimations( const s_source_t *pSource, const matrix3x4_t *pSrcBoneToWorld, matrix3x4_t *pDestBoneToWorld );
  1096. // Returns surface property for a given joint
  1097. char* GetSurfaceProp ( char const* pJointName );
  1098. int GetContents ( char const* pJointName );
  1099. char* GetDefaultSurfaceProp ( );
  1100. int GetDefaultContents( );
  1101. // Did we read 'end'
  1102. bool IsEnd( char const* pLine );
  1103. // Parses an LOD command
  1104. void Cmd_LOD( char const *cmdname );
  1105. void Cmd_ShadowLOD( void );
  1106. // Fixes up the LOD source files
  1107. void FixupLODSources();
  1108. // Get model LOD source
  1109. s_source_t* GetModelLODSource( const char *pModelName,
  1110. const LodScriptData_t& scriptLOD, bool* pFound );
  1111. void LoadLODSources( void );
  1112. void ConvertBoneTreeCollapsesToReplaceBones( void );
  1113. void FixupReplacedBones( void );
  1114. void UnifyLODs( void );
  1115. void SpewBoneUsageStats( void );
  1116. void MarkParentBoneLODs( void );
  1117. //void CheckAutoShareAnimationGroup( char const *animation_name );
  1118. /*
  1119. =================
  1120. =================
  1121. */
  1122. extern bool GetLineInput(void);
  1123. extern char g_szFilename[1024];
  1124. extern FILE *g_fpInput;
  1125. extern char g_szLine[4096];
  1126. extern int g_iLinecount;
  1127. extern int g_min_faces, g_max_faces;
  1128. extern float g_min_resolution, g_max_resolution;
  1129. EXTERN int g_numverts;
  1130. EXTERN Vector g_vertex[MAXSTUDIOVERTS];
  1131. EXTERN s_boneweight_t g_bone[MAXSTUDIOVERTS];
  1132. EXTERN int g_numnormals;
  1133. EXTERN Vector g_normal[MAXSTUDIOVERTS];
  1134. EXTERN int g_numtexcoords;
  1135. EXTERN Vector2D g_texcoord[MAXSTUDIOVERTS];
  1136. EXTERN int g_numfaces;
  1137. EXTERN s_tmpface_t g_face[MAXSTUDIOTRIANGLES];
  1138. EXTERN s_face_t g_src_uface[MAXSTUDIOTRIANGLES]; // max res unified faces
  1139. struct v_unify_t
  1140. {
  1141. int refcount;
  1142. int lastref;
  1143. int firstref;
  1144. int v;
  1145. int m;
  1146. int n;
  1147. int t;
  1148. v_unify_t *next;
  1149. };
  1150. EXTERN v_unify_t *v_list[MAXSTUDIOVERTS];
  1151. EXTERN v_unify_t v_listdata[MAXSTUDIOVERTS];
  1152. EXTERN int numvlist;
  1153. int SortAndBalanceBones( int iCount, int iMaxCount, int bones[], float weights[] );
  1154. void Grab_Vertexanimation( s_source_t *psource, const char *pAnimationName );
  1155. extern void BuildIndividualMeshes( s_source_t *psource );
  1156. //-----------------------------------------------------------------------------
  1157. // A little class used to deal with replacement commands
  1158. //-----------------------------------------------------------------------------
  1159. class CLodScriptReplacement_t
  1160. {
  1161. public:
  1162. void SetSrcName( const char *pSrcName )
  1163. {
  1164. if( m_pSrcName )
  1165. {
  1166. delete [] m_pSrcName;
  1167. }
  1168. m_pSrcName = new char[strlen( pSrcName ) + 1];
  1169. strcpy( m_pSrcName, pSrcName );
  1170. }
  1171. void SetDstName( const char *pDstName )
  1172. {
  1173. if( m_pDstName )
  1174. {
  1175. delete [] m_pDstName;
  1176. }
  1177. m_pDstName = new char[strlen( pDstName ) + 1];
  1178. strcpy( m_pDstName, pDstName );
  1179. }
  1180. const char *GetSrcName( void ) const
  1181. {
  1182. return m_pSrcName;
  1183. }
  1184. const char *GetDstName( void ) const
  1185. {
  1186. return m_pDstName;
  1187. }
  1188. CLodScriptReplacement_t()
  1189. {
  1190. m_pSrcName = NULL;
  1191. m_pDstName = NULL;
  1192. m_pSource = 0;
  1193. }
  1194. ~CLodScriptReplacement_t()
  1195. {
  1196. delete [] m_pSrcName;
  1197. delete [] m_pDstName;
  1198. }
  1199. s_source_t* m_pSource;
  1200. private:
  1201. char *m_pSrcName;
  1202. char *m_pDstName;
  1203. bool m_bReverse;
  1204. };
  1205. struct LodScriptData_t
  1206. {
  1207. public:
  1208. float switchValue;
  1209. CUtlVector<CLodScriptReplacement_t> modelReplacements;
  1210. CUtlVector<CLodScriptReplacement_t> boneReplacements;
  1211. CUtlVector<CLodScriptReplacement_t> boneTreeCollapses;
  1212. CUtlVector<CLodScriptReplacement_t> materialReplacements;
  1213. CUtlVector<CLodScriptReplacement_t> meshRemovals;
  1214. void EnableFacialAnimation( bool val )
  1215. {
  1216. m_bFacialAnimation = val;
  1217. }
  1218. bool GetFacialAnimationEnabled() const
  1219. {
  1220. return m_bFacialAnimation;
  1221. }
  1222. void StripFromModel( bool val )
  1223. {
  1224. m_bStrippedFromModel = val;
  1225. }
  1226. bool IsStrippedFromModel() const
  1227. {
  1228. return m_bStrippedFromModel;
  1229. }
  1230. LodScriptData_t()
  1231. {
  1232. m_bFacialAnimation = true;
  1233. m_bStrippedFromModel = false;
  1234. }
  1235. private:
  1236. bool m_bFacialAnimation;
  1237. bool m_bStrippedFromModel;
  1238. };
  1239. EXTERN CUtlVector<LodScriptData_t> g_ScriptLODs;
  1240. extern bool g_collapse_bones;
  1241. extern bool g_collapse_bones_aggressive;
  1242. extern bool g_quiet;
  1243. extern bool g_verbose;
  1244. extern bool g_bCheckLengths;
  1245. extern bool g_bPrintBones;
  1246. extern bool g_bPerf;
  1247. extern bool g_bFast;
  1248. extern bool g_bDumpGraph;
  1249. extern bool g_bMultistageGraph;
  1250. extern bool g_bCreateMakefile;
  1251. extern bool g_bZBrush;
  1252. extern bool g_bVerifyOnly;
  1253. extern bool g_bUseBoneInBBox;
  1254. extern bool g_bLockBoneLengths;
  1255. extern bool g_bOverridePreDefinedBones;
  1256. extern bool g_bX360;
  1257. extern int g_minLod;
  1258. extern int g_numAllowedRootLODs;
  1259. extern bool g_bBuildPreview;
  1260. extern bool g_bCenterBonesOnVerts;
  1261. extern float g_flDefaultMotionRollback;
  1262. extern int g_minSectionFrameLimit;
  1263. extern int g_sectionFrames;
  1264. extern bool g_bNoAnimblockStall;
  1265. extern Vector g_vecMinWorldspace;
  1266. extern Vector g_vecMaxWorldspace;
  1267. EXTERN CUtlVector< char * >g_collapse;
  1268. extern float GetCollisionModelMass();
  1269. // List of defined bone flex drivers
  1270. extern DmElementHandle_t g_hDmeBoneFlexDriverList;
  1271. // the first time these are called, the name of the model/QC file is printed so that when
  1272. // running in batch mode, no echo, when dumping to a file, it can be determined which file is broke.
  1273. void MdlError( PRINTF_FORMAT_STRING char const *pMsg, ... );
  1274. void MdlWarning( PRINTF_FORMAT_STRING char const *pMsg, ... );
  1275. void CreateMakefile_AddDependency( const char *pFileName );
  1276. void EnsureDependencyFileCheckedIn( const char *pFileName );
  1277. bool ComparePath( const char *a, const char *b );
  1278. byte IsByte( int val );
  1279. char IsChar( int val );
  1280. int IsInt24( int val );
  1281. short IsShort( int val );
  1282. unsigned short IsUShort( int val );
  1283. extern CCheckUVCmd g_StudioMdlCheckUVCmd;
  1284. #endif // STUDIOMDL_H