XModel Asset (BO2)

From COD Engine Research
Jump to: navigation, search
struct DObjAnimMat
{
  vec4_t quat;
  vec3_t trans;
  float transWeight;
};
 
struct XSurfaceVertexInfo
{
  __int16 vertCount[4];
  unsigned __int16 *vertsBlend;		//Hope this is right, Size = ((((vertCount[2] + (vertCount[2] << 2)) + ((vertCount[3] << 3) - vertCount[3])) + ((vertCount[1] << 1) + vertCount[1])) + vertCount[0]) << 1
  float * tensionData;	//Count = unknownCount4 + unknownCount3 + unknownCount2 + unknownCount1
};
 
union unknownXModelStruct1Internal2
{
  GfxPackedVertex *verts0;
	char * unknownOption2;			//Size = ((parent struct::vertCount << 1) + parent struct::vertCount) << 3
};
 
struct XSurfaceCollisionAabb
{
  unsigned __int16 mins[3];
  unsigned __int16 maxs[3];
};
 
struct XSurfaceCollisionNode
{
  XSurfaceCollisionAabb aabb;
  unsigned __int16 childBeginIndex;
  unsigned __int16 childCount;
};
 
struct XSurfaceCollisionLeaf
{
  unsigned __int16 triangleBeginIndex;
};
 
struct XSurfaceCollisionTree
{
  vec3_t trans;
  vec3_t scale;
  unsigned int nodeCount;
  XSurfaceCollisionNode *nodes;
  unsigned int leafCount;
  XSurfaceCollisionLeaf *leafs;
};
 
struct XRigidVertList
{
  unsigned __int16 boneOffset;
  unsigned __int16 vertCount;
  unsigned __int16 triOffset;
  unsigned __int16 triCount;
  XSurfaceCollisionTree *collisionTree;
};
 
struct __declspec(align(16)) XSurface
{
	char unknownData1[0x10];
  char tileMode;
  char vertListCount;
  unsigned __int16 flags;
  unsigned __int16 vertCount;
  unsigned __int16 triCount;
  unsigned __int16 baseVertIndex;
  unsigned __int16 *triIndices;							//Loaded Last, size = ((triCount << 1) + triCount) << 1
  XSurfaceVertexInfo vertInfo;
	unknownXModelStruct1Internal2 unkInternal2;		//if flags & 1 then use option2 else use verts0
  D3DVertexBuffer vertexBuffer;
  union
  {
    XRigidVertList *vertList;
    XRigidVertList *vertListEA;
  };
  D3DIndexBuffer indexBuffer;
  int partBits[5];
};
 
struct cplane_s
{
  float normal[3];
  float dist;
  char type;
  char signbits;
};
 
struct cbrushside_t
{
  cplane_s *plane;
  int cflags;
  int sflags;
};
 
struct BrushWrapper
{
  vec3_t mins;
  int contents;
  vec3_t maxs;
  unsigned int numsides;
  cbrushside_t *sides;
  int axial_cflags[2][3];
  int axial_sflags[2][3];
  unsigned int numverts;
  vec3_t *verts;
  cplane_s *planes;
};
 
struct PhysGeomInfo
{
  BrushWrapper *brush;
  int type;
  vec3_t orientation[3];
  vec3_t offset;
  vec3_t halfLengths;
};
 
struct PhysGeomList
{
  unsigned int count;
  PhysGeomInfo *geoms;
  int contents;
};
 
struct Collmap
{
  PhysGeomList *geomList;
};
 
struct XModelLodInfo
{
  float dist;
  unsigned __int16 numsurfs;
  unsigned __int16 surfIndex;
  int partBits[5];
};
 
struct XModelCollSurf_s
{
  vec3_t mins;
  vec3_t maxs;
  int boneIdx;
  int contents;
  int surfFlags;
};
 
struct XBoneInfo
{
  vec3_t bounds[2];
  vec3_t offset;
  float radiusSquared;
  char collmap;
};
 
struct XModel
{
  const char *name;
  char numBones;
  char numRootBones;
  char numsurfs;
  char lodRampType;
  union
  {
    ScriptString * boneNames;
    ScriptString * localBoneNames;
  };
  union
  {
    char * parentList;  //size = numBones - numRootBones
    char * localParentList;  //size = numBones - numRootBones
  };
  union
  {
    unsigned short * quats;		//size = (numBones - numRootBones) << 3
    unsigned short * localQuats;	//size = (numBones - numRootBones) << 3
  };
  union
  {
    float * trans;							//size = (numBones - numRootBones) << 4
    float * localTrans;							//size = (numBones - numRootBones) << 4
  };
  char *partClassification;		//size = numBones
  DObjAnimMat *baseMat;					//size = numBones << 5
  XSurface *surfs;	//count = numsurfs
  Material **materialHandles;		//count = numsurfs
  XModelLodInfo lodInfo[4];
  XModelCollSurf_s *collSurfs;
  int numCollSurfs;
  int contents;
  union
  {
    XBoneInfo *localBoneInfo;
    XBoneInfo *boneInfo;
  };
  float radius;
  vec3_t mins;
  vec3_t maxs;
  __int16 numLods;
  __int16 collLod;
  float *himipInvSqRadii;
  int memUsage;
  int flags;
  PhysPreset *physPreset;
  char numCollmaps;
  Collmap *collmaps;
  PhysConstraints *physConstraints;
  vec3_t lightingOriginOffset;
  float lightingOriginRange;
};
#pragma pack(pop)