Added iw4 assets related to materials, xmodels

This commit is contained in:
Jan
2020-09-07 18:19:20 +02:00
parent 5e8173539b
commit b25fe9a9f7
10 changed files with 922 additions and 186 deletions

View File

@ -77,7 +77,6 @@ namespace IW4
struct PhysPreset;
struct PhysCollmap;
struct XAnimParts;
struct XModelSurfs;
struct XModel;
struct Material;
struct MaterialPixelShader;
@ -85,39 +84,40 @@ namespace IW4
struct MaterialVertexDeclaration;
struct MaterialTechniqueSet;
struct GfxImage;
struct snd_alias_list_t;
struct SndCurve;
struct LoadedSound;
struct clipMap_t;
struct ComWorld;
struct GameWorldSp;
struct GameWorldMp;
struct MapEnts;
struct FxWorld;
struct GfxWorld;
struct GfxLightDef;
struct Font_s;
struct MenuList;
struct menuDef_t;
struct LocalizeEntry;
struct WeaponCompleteDef;
struct SndDriverGlobals;
struct FxEffectDef;
struct FxImpactTable;
// struct snd_alias_list_t;
// struct SndCurve;
// struct LoadedSound;
// struct clipMap_t;
// struct ComWorld;
// struct GameWorldSp;
// struct GameWorldMp;
// struct MapEnts;
// struct FxWorld;
// struct GfxWorld;
// struct GfxLightDef;
// struct Font_s;
// struct MenuList;
// struct menuDef_t;
// struct LocalizeEntry;
// struct WeaponCompleteDef;
// struct SndDriverGlobals;
// struct FxEffectDef;
// struct FxImpactTable;
struct RawFile;
struct StringTable;
struct LeaderboardDef;
struct StructuredDataDefSet;
struct TracerDef;
struct VehicleDef;
struct AddonMapEnts;
// struct LeaderboardDef;
// struct StructuredDataDefSet;
// struct TracerDef;
// struct VehicleDef;
// struct AddonMapEnts;
union XAssetHeader
{
PhysPreset* physPreset;
PhysCollmap* physCollmap;
XAnimParts* parts;
XModelSurfs* modelSurfs;
// XModelSurfs* modelSurfs; // NOT AN ASSET
XModel* model;
Material* material;
MaterialPixelShader* pixelShader;
@ -125,32 +125,32 @@ namespace IW4
MaterialVertexDeclaration* vertexDecl;
MaterialTechniqueSet* techniqueSet;
GfxImage* image;
snd_alias_list_t* sound;
SndCurve* sndCurve;
LoadedSound* loadSnd;
clipMap_t* clipMap;
ComWorld* comWorld;
GameWorldSp* gameWorldSp;
GameWorldMp* gameWorldMp;
MapEnts* mapEnts;
FxWorld* fxWorld;
GfxWorld* gfxWorld;
GfxLightDef* lightDef;
Font_s* font;
MenuList* menuList;
menuDef_t* menu;
LocalizeEntry* localize;
WeaponCompleteDef* weapon;
SndDriverGlobals* sndDriverGlobals;
FxEffectDef* fx;
FxImpactTable* impactFx;
// snd_alias_list_t* sound;
// SndCurve* sndCurve;
// LoadedSound* loadSnd;
// clipMap_t* clipMap;
// ComWorld* comWorld;
// GameWorldSp* gameWorldSp;
// GameWorldMp* gameWorldMp;
// MapEnts* mapEnts;
// FxWorld* fxWorld;
// GfxWorld* gfxWorld;
// GfxLightDef* lightDef;
// Font_s* font;
// MenuList* menuList;
// menuDef_t* menu;
// LocalizeEntry* localize;
// WeaponCompleteDef* weapon;
// SndDriverGlobals* sndDriverGlobals;
// FxEffectDef* fx;
// FxImpactTable* impactFx;
RawFile* rawfile;
StringTable* stringTable;
LeaderboardDef* leaderboardDef;
StructuredDataDefSet* structuredDataDefSet;
TracerDef* tracerDef;
VehicleDef* vehDef;
AddonMapEnts* addonMapEnts;
// LeaderboardDef* leaderboardDef;
// StructuredDataDefSet* structuredDataDefSet;
// TracerDef* tracerDef;
// VehicleDef* vehDef;
// AddonMapEnts* addonMapEnts;
void* data;
};
@ -253,8 +253,8 @@ namespace IW4
union XAnimDynamicFrames
{
char(*_1)[3];
unsigned __int16(*_2)[3];
char (*_1)[3];
unsigned __int16 (*_2)[3];
};
union XAnimDynamicIndices
@ -274,7 +274,6 @@ namespace IW4
union XAnimPartTransData
{
XAnimPartTransFrames frames;
//float frame0[3];
vec3_t frame0;
};
@ -287,7 +286,7 @@ namespace IW4
struct __declspec(align(4)) XAnimDeltaPartQuatDataFrames2
{
__int16(*frames)[2];
__int16 (*frames)[2];
XAnimDynamicIndices indices;
};
@ -305,7 +304,7 @@ namespace IW4
struct XAnimDeltaPartQuatDataFrames
{
__int16(*frames)[4];
__int16 (*frames)[4];
XAnimDynamicIndices indices;
};
@ -358,6 +357,501 @@ namespace IW4
XAnimDeltaPart* deltaPart;
};
struct XSurfaceVertexInfo
{
__int16 vertCount[4];
unsigned __int16* vertsBlend;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
union PackedTexCoords
{
unsigned int packed;
};
union PackedUnitVec
{
unsigned int packed;
char array[4];
};
struct __declspec(align(16)) GfxPackedVertex
{
float xyz[3];
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
PackedUnitVec normal;
PackedUnitVec tangent;
};
struct XSurfaceCollisionAabb
{
unsigned __int16 mins[3];
unsigned __int16 maxs[3];
};
struct __declspec(align(16)) 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;
};
typedef __declspec(align(16)) unsigned __int16 r_index16_t;
struct XSurface
{
char tileMode;
bool deformed;
unsigned __int16 vertCount;
unsigned __int16 triCount;
char zoneHandle;
unsigned __int16 baseTriIndex;
unsigned __int16 baseVertIndex;
r_index16_t (*triIndices)[3];
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
unsigned int vertListCount;
XRigidVertList* vertList;
int partBits[6];
};
struct XModelSurfs
{
const char* name;
XSurface* surfs;
unsigned __int16 numsurfs;
int partBits[6];
};
struct XModelLodInfo
{
float dist;
unsigned __int16 numsurfs;
unsigned __int16 surfIndex;
XModelSurfs* modelSurfs;
int partBits[6];
XSurface* surfs;
char lod;
char smcBaseIndexPlusOne;
char smcSubIndexMask;
char smcBucket;
};
struct XModelCollTri_s
{
float plane[4];
float svec[4];
float tvec[4];
};
struct XModelCollSurf_s
{
XModelCollTri_s* collTris;
int numCollTris;
Bounds bounds;
int boneIdx;
int contents;
int surfFlags;
};
struct XBoneInfo
{
Bounds bounds;
float radiusSquared;
};
struct DObjAnimMat
{
float quat[4];
float trans[3];
float transWeight;
};
struct XModel
{
const char* name;
char numBones;
char numRootBones;
char numsurfs;
char lodRampType;
float scale;
unsigned int noScalePartBits[6];
unsigned __int16* boneNames;
char* parentList;
__int16* quats;
float* trans;
char* partClassification;
DObjAnimMat* baseMat;
Material** materialHandles;
XModelLodInfo lodInfo[4];
char maxLoadedLod;
char numLods;
char collLod;
char flags;
XModelCollSurf_s* collSurfs;
int numCollSurfs;
int contents;
XBoneInfo* boneInfo;
float radius;
Bounds bounds;
int memUsage;
bool bad;
PhysPreset* physPreset;
PhysCollmap* physCollmap;
};
struct WaterWritable
{
float floatTime;
};
struct complex_s
{
float real;
float imag;
};
struct water_t
{
WaterWritable writable;
complex_s* H0;
float* wTerm;
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage* image;
};
union MaterialTextureDefInfo
{
GfxImage* image;
water_t* water;
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char samplerState;
char semantic;
MaterialTextureDefInfo u;
};
struct __declspec(align(16)) MaterialConstantDef
{
unsigned int nameHash;
char name[12];
float literal[4];
};
struct GfxStateBits
{
unsigned int loadBits[2];
};
struct GfxDrawSurfFields
{
unsigned __int64 objectId : 16;
unsigned __int64 reflectionProbeIndex : 8;
unsigned __int64 hasGfxEntIndex : 1;
unsigned __int64 customIndex : 5;
unsigned __int64 materialSortedIndex : 12;
unsigned __int64 prepass : 2;
unsigned __int64 useHeroLighting : 1;
unsigned __int64 sceneLightIndex : 8;
unsigned __int64 surfType : 4;
unsigned __int64 primarySortKey : 6;
unsigned __int64 unused : 1;
};
union GfxDrawSurf
{
GfxDrawSurfFields fields;
unsigned __int64 packed;
};
struct MaterialInfo
{
const char* name;
char gameFlags;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
unsigned int surfaceTypeBits;
unsigned __int16 hashIndex;
};
struct Material
{
MaterialInfo info;
char stateBitsEntry[48];
char textureCount;
char constantCount;
char stateBitsCount;
char stateFlags;
char cameraRegion;
MaterialTechniqueSet* techniqueSet;
MaterialTextureDef* textureTable;
MaterialConstantDef* constantTable;
GfxStateBits* stateBitsTable;
};
struct __declspec(align(4)) GfxImageLoadDef
{
char levelCount;
char pad[3];
int flags;
int format;
int resourceSize;
char data[1];
};
union GfxTexture
{
// IDirect3DBaseTexture9* basemap;
// IDirect3DTexture9* map;
// IDirect3DVolumeTexture9* volmap;
// IDirect3DCubeTexture9* cubemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
struct Picmip
{
char platform[2];
};
struct CardMemory
{
int platform[2];
};
enum TextureSemantic
{
TS_2D = 0x0,
TS_FUNCTION = 0x1,
TS_COLOR_MAP = 0x2,
TS_DETAIL_MAP = 0x3,
TS_UNUSED_2 = 0x4,
TS_NORMAL_MAP = 0x5,
TS_UNUSED_3 = 0x6,
TS_UNUSED_4 = 0x7,
TS_SPECULAR_MAP = 0x8,
TS_UNUSED_5 = 0x9,
TS_UNUSED_6 = 0xA,
TS_WATER_MAP = 0xB,
};
struct GfxImage
{
GfxTexture texture;
char mapType;
char semantic;
char category;
bool useSrgbReads;
Picmip picmip;
bool noPicmip;
char track;
CardMemory cardMemory;
unsigned __int16 width;
unsigned __int16 height;
unsigned __int16 depth;
bool delayLoadPixels;
const char* name;
};
struct GfxPixelShaderLoadDef
{
unsigned int* program;
unsigned __int16 programSize;
unsigned __int16 loadForRenderer;
};
struct GfxVertexShaderLoadDef
{
unsigned int* program;
unsigned __int16 programSize;
unsigned __int16 loadForRenderer;
};
struct MaterialStreamRouting
{
char source;
char dest;
};
struct MaterialVertexStreamRouting
{
MaterialStreamRouting data[13];
void/*IDirect3DVertexDeclaration9*/* decl[16];
};
struct MaterialVertexDeclaration
{
const char* name;
char streamCount;
bool hasOptionalSource;
MaterialVertexStreamRouting routing;
};
struct MaterialVertexShaderProgram
{
void/*IDirect3DVertexShader9*/* vs;
GfxVertexShaderLoadDef loadDef;
};
struct MaterialVertexShader
{
const char* name;
MaterialVertexShaderProgram prog;
};
struct MaterialPixelShaderProgram
{
void/*IDirect3DPixelShader9*/* ps;
GfxPixelShaderLoadDef loadDef;
};
struct MaterialPixelShader
{
const char* name;
MaterialPixelShaderProgram prog;
};
struct MaterialArgumentCodeConst
{
unsigned __int16 index;
char firstRow;
char rowCount;
};
union MaterialArgumentDef
{
const float (*literalConst)[4];
MaterialArgumentCodeConst codeConst;
unsigned int codeSampler;
unsigned int nameHash;
};
enum MaterialShaderArgumentType
{
MTL_ARG_MATERIAL_VERTEX_CONST = 0x0,
MTL_ARG_LITERAL_VERTEX_CONST = 0x1,
MTL_ARG_MATERIAL_PIXEL_SAMPLER = 0x2,
MTL_ARG_CODE_PRIM_BEGIN = 0x3,
MTL_ARG_CODE_VERTEX_CONST = 0x3,
MTL_ARG_CODE_PIXEL_SAMPLER = 0x4,
MTL_ARG_CODE_PIXEL_CONST = 0x5,
MTL_ARG_CODE_PRIM_END = 0x6,
MTL_ARG_MATERIAL_PIXEL_CONST = 0x6,
MTL_ARG_LITERAL_PIXEL_CONST = 0x7,
MTL_ARG_COUNT = 0x8,
};
struct MaterialShaderArgument
{
unsigned __int16 type;
unsigned __int16 dest;
MaterialArgumentDef u;
};
struct MaterialPass
{
MaterialVertexDeclaration* vertexDecl;
MaterialVertexShader* vertexShader;
MaterialPixelShader* pixelShader;
char perPrimArgCount;
char perObjArgCount;
char stableArgCount;
char customSamplerFlags;
MaterialShaderArgument* args;
};
struct MaterialTechnique
{
const char* name;
unsigned __int16 flags;
unsigned __int16 passCount;
MaterialPass passArray[1];
};
struct MaterialTechniqueSet
{
const char* name;
char worldVertFormat;
bool hasBeenUploaded;
char unused[1];
MaterialTechniqueSet* remappedTechniqueSet;
MaterialTechnique* techniques[48];
};
union RawFileBuffer
{
const char* compressedBuffer;
const char* buffer;
};
struct RawFile
{
const char* name;
int compressedLen;
int len;
RawFileBuffer data;
};
struct StringTableCell
{
const char* string;
int hash;
};
struct StringTable
{
const char* name;
int columnCount;
int rowCount;
StringTableCell* values;
};
#ifndef __zonecodegenerator
}
#endif