2025-06-07 11:20:47 -04:00
|
|
|
#ifndef MODEL_H
|
|
|
|
|
#define MODEL_H
|
|
|
|
|
|
|
|
|
|
#include "material.h"
|
2025-07-10 00:04:52 -04:00
|
|
|
#include "scriptstringlist.h"
|
2025-06-07 11:20:47 -04:00
|
|
|
|
|
|
|
|
struct XSurfaceVertexInfo
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
qint16 vertCount[4];
|
|
|
|
|
qint32 vertsBlendPtr;
|
|
|
|
|
quint16 vertsBlend;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
union GfxColor
|
|
|
|
|
{
|
|
|
|
|
unsigned int packed;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 array[4];
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-10 01:07:48 -04:00
|
|
|
struct GPUVERTEX_RAW_REQEUST
|
2025-06-07 11:20:47 -04:00
|
|
|
{
|
2025-07-10 01:07:48 -04:00
|
|
|
quint32 Type : 2;
|
|
|
|
|
quint32 BaseAddress : 30;
|
|
|
|
|
quint32 Endian : 2;
|
|
|
|
|
quint32 Size : 24;
|
|
|
|
|
quint32 AddressClamp : 1;
|
|
|
|
|
quint32 : 1;
|
|
|
|
|
quint32 RequestSize : 2;
|
|
|
|
|
quint32 ClampDisable : 2;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
union GPUVERTEX_FETCH_CONSTANT
|
|
|
|
|
{
|
2025-07-10 01:07:48 -04:00
|
|
|
GPUVERTEX_RAW_REQEUST request;
|
2025-06-07 11:20:47 -04:00
|
|
|
unsigned int dword[2];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct D3DVertexBuffer : D3DResource
|
|
|
|
|
{
|
|
|
|
|
GPUVERTEX_FETCH_CONSTANT Format;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XSurfaceCollisionAabb
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 mins[3];
|
|
|
|
|
quint16 maxs[3];
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XSurfaceCollisionNode
|
|
|
|
|
{
|
|
|
|
|
XSurfaceCollisionAabb aabb;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 childBeginIndex;
|
|
|
|
|
quint16 childCount;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XSurfaceCollisionLeaf
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 triangleBeginIndex;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XSurfaceCollisionTree
|
|
|
|
|
{
|
|
|
|
|
float trans[3];
|
|
|
|
|
float scale[3];
|
|
|
|
|
unsigned int nodeCount;
|
2025-07-10 00:04:52 -04:00
|
|
|
QVector<XSurfaceCollisionNode> nodes;
|
2025-06-07 11:20:47 -04:00
|
|
|
unsigned int leafCount;
|
2025-07-10 00:04:52 -04:00
|
|
|
QVector<XSurfaceCollisionLeaf> leafs;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XRigidVertList
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 boneOffset;
|
|
|
|
|
quint16 vertCount;
|
|
|
|
|
quint16 triOffset;
|
|
|
|
|
quint16 triCount;
|
2025-06-07 11:20:47 -04:00
|
|
|
XSurfaceCollisionTree *collisionTree;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct D3DIndexBuffer : D3DResource
|
|
|
|
|
{
|
|
|
|
|
unsigned int Address;
|
|
|
|
|
unsigned int Size;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XSurface
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 tileMode;
|
2025-06-07 11:20:47 -04:00
|
|
|
bool deformed;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 vertCount;
|
|
|
|
|
quint16 triCount;
|
|
|
|
|
quint16 *triIndices;
|
2025-06-07 11:20:47 -04:00
|
|
|
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;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint16 numsurfs;
|
|
|
|
|
quint16 surfIndex;
|
2025-06-07 11:20:47 -04:00
|
|
|
int partBits[4];
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-10 00:04:52 -04:00
|
|
|
struct XModelCollSurf
|
2025-06-07 11:20:47 -04:00
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
qint32 namePtr;
|
|
|
|
|
QString name;
|
|
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
int type;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
float mass;
|
|
|
|
|
float bounce;
|
|
|
|
|
float friction;
|
|
|
|
|
float bulletForceScale;
|
|
|
|
|
float explosiveForceScale;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 sndAliasPrefixPtr;
|
|
|
|
|
QString sndAliasPrefix;
|
|
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
float piecesSpreadFraction;
|
|
|
|
|
float piecesUpwardVelocity;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
bool tempDefaultToCylinder;
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-10 00:04:52 -04:00
|
|
|
struct CPlane
|
2025-06-07 11:20:47 -04:00
|
|
|
{
|
|
|
|
|
float normal[3];
|
|
|
|
|
float dist;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 type;
|
|
|
|
|
quint8 signbits;
|
|
|
|
|
quint8 pad[2];
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
2025-07-10 00:04:52 -04:00
|
|
|
struct CBrushSide
|
2025-06-07 11:20:47 -04:00
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
qint32 planePtr;
|
|
|
|
|
CPlane plane;
|
|
|
|
|
uint materialNum;
|
|
|
|
|
qint16 firstAdjacentSideOffset;
|
|
|
|
|
quint8 edgeCount;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct BrushWrapper
|
|
|
|
|
{
|
|
|
|
|
float mins[3];
|
|
|
|
|
int contents;
|
|
|
|
|
float maxs[3];
|
|
|
|
|
unsigned int numsides;
|
2025-07-10 00:04:52 -04:00
|
|
|
CBrushSide *sides;
|
2025-06-07 11:20:47 -04:00
|
|
|
__int16 axialMaterialNum[2][3];
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 *baseAdjacentSide;
|
2025-06-07 11:20:47 -04:00
|
|
|
__int16 firstAdjacentSideOffsets[2][3];
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 edgeCount[2][3];
|
2025-06-07 11:20:47 -04:00
|
|
|
int totalEdgeCount;
|
2025-07-10 00:04:52 -04:00
|
|
|
CPlane *planes;
|
2025-06-07 11:20:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2025-07-10 00:04:52 -04:00
|
|
|
QString name;
|
|
|
|
|
qint32 namePtr;
|
|
|
|
|
quint8 numBones;
|
|
|
|
|
quint8 numRootBones;
|
|
|
|
|
quint8 numsurfs;
|
|
|
|
|
quint8 lodRampType;
|
|
|
|
|
|
|
|
|
|
quint32 boneNamesPtr;
|
|
|
|
|
ScriptStringList boneNames;
|
|
|
|
|
|
|
|
|
|
quint32 parentListPtr;
|
|
|
|
|
quint8 *parentList;
|
|
|
|
|
|
|
|
|
|
qint32 quatsPtr;
|
|
|
|
|
qint16 *quats;
|
|
|
|
|
|
|
|
|
|
qint32 transPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
float *trans;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 partClassPtr;
|
|
|
|
|
quint8 *partClassification;
|
|
|
|
|
|
|
|
|
|
qint32 baseMatPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
DObjAnimMat *baseMat;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 surfsPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
XSurface *surfs;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 matHandlesPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
Material **materialHandles;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
XModelLodInfo lodInfo[4];
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 collSurfsPtr;
|
|
|
|
|
XModelCollSurf *collSurfs;
|
|
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
int numCollSurfs;
|
|
|
|
|
int contents;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint32 boneInfoPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
XBoneInfo *boneInfo;
|
2025-07-10 00:04:52 -04:00
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
float radius;
|
|
|
|
|
float mins[3];
|
|
|
|
|
float maxs[3];
|
2025-07-10 00:04:52 -04:00
|
|
|
|
|
|
|
|
qint16 numLods;
|
|
|
|
|
qint16 collLod;
|
|
|
|
|
|
2025-06-07 11:20:47 -04:00
|
|
|
XModelStreamInfo streamInfo;
|
|
|
|
|
int memUsage;
|
2025-07-10 00:04:52 -04:00
|
|
|
quint8 flags;
|
|
|
|
|
std::shared_ptr<PhysPreset> physPreset;
|
|
|
|
|
|
|
|
|
|
qint32 physGeomsPtr;
|
2025-06-07 11:20:47 -04:00
|
|
|
PhysGeomList *physGeoms;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // MODEL_H
|