XPlor/libs/assets/model.h
2025-06-07 11:20:47 -04:00

265 lines
4.7 KiB
C

#ifndef MODEL_H
#define MODEL_H
#include "material.h"
struct XSurfaceVertexInfo
{
__int16 vertCount[4];
unsigned __int16 *vertsBlend;
};
union GfxColor
{
unsigned int packed;
unsigned __int8 array[4];
};
union PackedTexCoords
{
unsigned int packed;
};
union PackedUnitVec
{
unsigned int packed;
};
struct GfxPackedVertex
{
float xyz[3];
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
PackedUnitVec normal;
PackedUnitVec tangent;
};
struct $E41E24A1CD47CDFA361AA9F99910948B
{
unsigned __int32 Type : 2;
unsigned __int32 BaseAddress : 30;
unsigned __int32 Endian : 2;
unsigned __int32 Size : 24;
unsigned __int32 AddressClamp : 1;
unsigned __int32 : 1;
unsigned __int32 RequestSize : 2;
unsigned __int32 ClampDisable : 2;
};
union GPUVERTEX_FETCH_CONSTANT
{
$E41E24A1CD47CDFA361AA9F99910948B __s0;
unsigned int dword[2];
};
struct D3DVertexBuffer : D3DResource
{
GPUVERTEX_FETCH_CONSTANT Format;
};
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
{
float trans[3];
float scale[3];
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 D3DIndexBuffer : D3DResource
{
unsigned int Address;
unsigned int Size;
};
struct XSurface
{
unsigned __int8 tileMode;
bool deformed;
unsigned __int16 vertCount;
unsigned __int16 triCount;
unsigned __int16 *triIndices;
XSurfaceVertexInfo vertInfo;
GfxPackedVertex *verts0;
D3DVertexBuffer vb0;
unsigned int vertListCount;
XRigidVertList *vertList;
D3DIndexBuffer indexBuffer;
int partBits[4];
};
struct DObjAnimMat
{
float quat[4];
float trans[3];
float transWeight;
};
struct XModelLodInfo
{
float dist;
unsigned __int16 numsurfs;
unsigned __int16 surfIndex;
int partBits[4];
};
struct XModelCollSurf_s
{
float mins[3];
float maxs[3];
int boneIdx;
int contents;
int surfFlags;
};
struct XBoneInfo
{
float bounds[2][3];
float offset[3];
float radiusSquared;
};
struct XModelHighMipBounds
{
float mins[3];
float maxs[3];
};
struct XModelStreamInfo
{
XModelHighMipBounds *highMipBounds;
};
struct PhysPreset
{
const char *name;
int type;
float mass;
float bounce;
float friction;
float bulletForceScale;
float explosiveForceScale;
const char *sndAliasPrefix;
float piecesSpreadFraction;
float piecesUpwardVelocity;
bool tempDefaultToCylinder;
};
struct cplane_s
{
float normal[3];
float dist;
unsigned __int8 type;
unsigned __int8 signbits;
unsigned __int8 pad[2];
};
struct cbrushside_t
{
cplane_s *plane;
unsigned int materialNum;
__int16 firstAdjacentSideOffset;
unsigned __int8 edgeCount;
};
struct BrushWrapper
{
float mins[3];
int contents;
float maxs[3];
unsigned int numsides;
cbrushside_t *sides;
__int16 axialMaterialNum[2][3];
unsigned __int8 *baseAdjacentSide;
__int16 firstAdjacentSideOffsets[2][3];
unsigned __int8 edgeCount[2][3];
int totalEdgeCount;
cplane_s *planes;
};
struct PhysGeomInfo
{
BrushWrapper *brush;
int type;
float orientation[3][3];
float offset[3];
float halfLengths[3];
};
struct PhysMass
{
float centerOfMass[3];
float momentsOfInertia[3];
float productsOfInertia[3];
};
struct PhysGeomList
{
unsigned int count;
PhysGeomInfo *geoms;
PhysMass mass;
};
struct Model
{
const char *name;
unsigned __int8 numBones;
unsigned __int8 numRootBones;
unsigned __int8 numsurfs;
unsigned __int8 lodRampType;
unsigned __int16 *boneNames;
unsigned __int8 *parentList;
__int16 *quats;
float *trans;
unsigned __int8 *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];
__int16 numLods;
__int16 collLod;
XModelStreamInfo streamInfo;
int memUsage;
unsigned __int8 flags;
PhysPreset *physPreset;
PhysGeomList *physGeoms;
};
#endif // MODEL_H