XModel Asset (CoD4)

From COD Engine Research
Revision as of 16:56, 17 March 2014 by CraigChrist8239 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
struct cplane_s
{
  float normal[3];
  float dist;
  char type;
  char signbits;
  char pad[2];
};
 
#pragma pack(push, 2)
struct cbrushside_t
{
  cplane_s *plane;
  unsigned int materialNum;
  __int16 firstAdjacentSideOffset;
  char edgeCount;
};
#pragma pack(pop)
 
struct DObjAnimMat
{
  float quat[4];
  float trans[3];
  float transWeight;
};
 
struct XSurfaceVertexInfo
{
  short vertCount[4];
  unsigned short *vertsBlend;
};
 
union GfxColor
{
  unsigned int packed;
  char array[4];
};
 
union PackedTexCoords
{
  unsigned int packed;
};
 
union PackedUnitVec
{
  unsigned int packed;
};
 
struct GfxPackedVertex
{
  float xyz[3];
  float binormalSign;
#ifdef XBOX
  GfxColor color;
  PackedTexCoords texCoord;
  PackedUnitVec normal;
  PackedUnitVec tangent;
#endif
};
 
struct GfxPackedVertexInfo
{
  GfxColor color;
  PackedTexCoords texCoord;
  PackedUnitVec normal;
  PackedUnitVec tangent;
};
 
struct XSurfaceCollisionAabb
{
  unsigned short mins[3];
  unsigned short maxs[3];
};
 
struct XSurfaceCollisionNode
{
  XSurfaceCollisionAabb aabb;
  unsigned short childBeginIndex;
  unsigned short childCount;
};
 
struct XSurfaceCollisionLeaf
{
  unsigned short triangleBeginIndex;
};
 
struct XSurfaceCollisionTree
{
  float trans[3];
  float scale[3];
  unsigned int nodeCount;
  XSurfaceCollisionNode *nodes;
  unsigned int leafCount;
  XSurfaceCollisionLeaf *leafs;
};
 
struct XRigidVertList
{
  unsigned short boneOffset;
  unsigned short vertCount;
  unsigned short triOffset;
  unsigned short triCount;
  XSurfaceCollisionTree *collisionTree;
};
 
struct UnknownXSurfaceStruct
{
  char unknown[8];
};
 
typedef unsigned short r_index16_t;
 
#pragma pack(push, 4)
struct XSurface
{
  char tileMode;
  bool deformed;
  unsigned short vertCount;
  unsigned short triCount;
  r_index16_t *triIndices;	// loaded last
  XSurfaceVertexInfo vertInfo;
#ifdef XBOX
  D3DVertexBuffer vb;
#endif
  GfxPackedVertex *verts;
#ifdef PS3
  UnknownXSurfaceStruct struct1;// 0x1C
  GfxPackedVertexInfo *vertInfo;// 0x24
  UnknownXSurfaceStruct struct2;// 0x28
#endif
  unsigned int vertListCount;	// 0x30
  XRigidVertList *vertList;	// 0x34
#ifdef XBOX
  D3DIndexBuffer indexBuffer;
#endif
#ifdef PS3
  int partBit;
#elif defined XBOX
  int partBits[4];
#endif
};
 
struct BrushWrapper
{
  float mins[3];
  int contents;
  float maxs[3];
  unsigned int numsides;
  cbrushside_t *sides;
  __int16 axialMaterialNum[2][3];
  char *baseAdjacentSide;
  __int16 firstAdjacentSideOffsets[2][3];
  char edgeCount[2][3];
  int totalEdgeCount;
  cplane_s *planes;
};
#pragma pack(pop)
 
struct PhysMass
{
  float centerOfMass[3];
  float momentsOfInertia[3];
  float productsOfInertia[3];
};
 
struct PhysGeomInfo
{
  BrushWrapper *brush;
  int type;
  float orientation[3][3];
  float offset[3];
  float halfLengths[3];
};
 
struct PhysGeomList
{
  unsigned int count;
  PhysGeomInfo *geoms;
  PhysMass mass;
};
 
struct XBoneInfo
{
  float bounds[2][3];
  float offset[3];
  float radiusSquared;
};
 
struct XModelStreamInfo
{
  XModelHighMipBounds *highMipBounds;
};
 
struct XModelHighMipBounds
{
  float mins[3];
  float maxs[3];
};
 
struct XModelCollSurf_s
{
  float mins[3];
  float maxs[3];
  int boneIdx;
  int contents;
  int surfFlags;
};
 
struct XModelLodInfo
{
  float dist;
  unsigned short numsurfs;
  unsigned short surfIndex;
  int partBits[4];
};
 
#pragma pack(push, 4)
struct XModel
{
  const char *name;
  char numBones;
  char numRootBones;
  char numsurfs;
  ScriptString *boneNames;
  char *parentList;
  short *quats;
  float *trans;
  char *partClassification;
  DObjAnimMat *baseMat;
  XSurface *surfs;
  Material **materialHandles;
  XModelLodInfo lodInfo[4];
  XModelCollSurf_s *collSurfs;
  int numCollSurfs;
  int contents;
  XBoneInfo *boneInfo;
  float radius;
  float mins[3];
  float maxs[3];
  short numLods;
  short collLod;
  XModelStreamInfo streamInfo;	// is not loaded on ps3
  int memUsage;
  char flags;
  PhysPreset *physPreset;
  PhysGeomList *physGeoms;
};
#pragma pack(pop)