Material Asset: Difference between revisions
Aerosoul94 (talk | contribs) mNo edit summary |
|||
| Line 194: | Line 194: | ||
union MaterialTextureDefInfo | union MaterialTextureDefInfo | ||
{ | { | ||
GfxImage *image; // MaterialTextureDef->semantic != TS_WATER_MAP | |||
water_t *water; // MaterialTextureDef->semantic == TS_WATER_MAP | |||
}; | }; | ||
struct MaterialTextureDef | struct MaterialTextureDef | ||
{ | { | ||
unsigned int nameHash; | |||
char nameStart; | |||
char nameEnd; | |||
char samplerState; | |||
char semantic; | |||
char isMatureContent; | |||
#ifdef BO1 | |||
MaterialTextureDefInfo u; | |||
#elif | |||
GfxImage *image; | |||
#endif | |||
}; | }; | ||
| Line 226: | Line 228: | ||
union GfxDrawSurf | union GfxDrawSurf | ||
{ | { | ||
GFxDrawSurfFields fields; | |||
unsigned long long packed; | |||
}; | }; | ||
struct __declspec(align(8)) MaterialInfo | struct __declspec(align(8)) MaterialInfo | ||
{ | { | ||
const char *name; | |||
unsigned int gameFlags; | |||
char pad; | |||
char sortKey; | |||
char textureAtlasRowCount; | |||
char textureAtlasColumnCount; | |||
int unknown2; | int unknown2; | ||
GfxDrawSurf drawSurf; | |||
int surfaceFlags; | |||
#ifdef BO2 | #ifdef BO2 | ||
int contents; | |||
#endif | #endif | ||
}; | }; | ||
| Line 248: | Line 250: | ||
struct Material | struct Material | ||
{ | { | ||
MaterialInfo info; | |||
char stateBitsEntry[TECHNIQUE_COUNT]; // see MaterialTechniqueType | |||
char textureCount; | |||
char constantCount; | |||
char stateBitsCount; | |||
char stateFlags; | |||
char cameraRegion; | |||
char probeMipBits; | |||
MaterialTechniqueSet *techniqueSet; | |||
MaterialTextureDef *textureTable; | |||
MaterialConstantDef *constantTable; | MaterialConstantDef *constantTable; | ||
GfxStateBits *stateBitTable; | GfxStateBits *stateBitTable; | ||
| Line 265: | Line 268: | ||
}; | }; | ||
</source> | </source> | ||
== Ghosts == | == Ghosts == | ||
<source lang="cpp"> | <source lang="cpp"> | ||
Revision as of 07:20, 21 December 2014
Call of Duty 4 & World at War & Modern Warfare 2 & Modern Warfare 3
struct MaterialConstantDef
{
int nameHash;
char name[12];
vec4_t literal;
};
struct GfxStateBits
{
#ifdef XBOX
int loadBits[2];
#elif defined PS3
int (*loadBits)[2];
#ifdef MW2 || MW3
int unknown;
#endif
#endif
};
struct WaterWritable
{
float floatTime;
};
struct water_t
{
WaterWritable writable;
float *H0X; // Count = M * N
float *H0Y; // Count = M * N
float *wTerm; // Count = M * N
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage *image;
};
/* MaterialTextureDef->semantic */
#define TS_2D 0x0
#define TS_FUNCTION 0x1
#define TS_COLOR_MAP 0x2
#define TS_UNUSED_1 0x3
#define TS_UNUSED_2 0x4
#define TS_NORMAL_MAP 0x5
#define TS_UNUSED_3 0x6
#define TS_UNUSED_4 0x7
#define TS_SPECULAR_MAP 0x8
#define TS_UNUSED_5 0x9
#define TS_UNUSED_6 0xA
#define TS_WATER_MAP 0xB
union MaterialTextureDefInfo
{
GfxImage *image; // MaterialTextureDef->semantic != TS_WATER_MAP
water_t *water; // MaterialTextureDef->semantic == TS_WATER_MAP
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char sampleState;
char semantic;
#ifdef WAW
int unknown;
#endif
MaterialTextureDefInfo u;
};
union GFxDrawSurfFields
{
unsigned long long unused,
primarySortKey,
surfType,
primaryLightIndex,
prepass,
materialSortedIndex,
customIndex,
reflectionProbeIndex,
objectId;
};
union GfxDrawSurf
{
GFxDrawSurfFields fields;
unsigned long long packed;
};
struct __declspec(align(8)) MaterialInfo
{
const char *name;
char gameFlags;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
int surfaceTypeBits;
};
struct Material
{
MaterialInfo info;
char stateBitsEntry[TECHNIQUE_COUNT]; // see MaterialTechniqueType
char textureCount;
char constantCount;
char stateBitsCount;
char stateFlags;
char cameraRegion;
#ifdef PS3
unsigned short ushorts[TECHNIQUE_COUNT];
unsigned short *ushortArray; // count = TECHNIQUE_COUNT, see MaterialTechniqueType
#endif
MaterialTechniqueSet *techniqueSet;
MaterialTextureDef *textureTable;
MaterialConstantDef *constantTable;
GfxStateBits *stateBitTable;
#ifdef MW2 || MW3
const char **unknownXStringArray;
#endif
};Black Ops & Black Ops 2
struct MaterialConstantDef
{
int nameHash;
char name[12];
vec4_t literal;
};
struct GfxStateBits
{
#ifdef XBOX || BO2 // ps3 uses this for bo2..
int loadBits[2];
#elif defined PS3
int (*loadBits)[2];
#endif
};
struct WaterWritable
{
float floatTime;
};
struct water_t
{
WaterWritable writable;
float *H0X; // Count = M * N
float *H0Y; // Count = M * N
float *wTerm; // Count = M * N
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage *image;
};
/* MaterialTextureDef->semantic */
#define TS_2D 0x0
#define TS_FUNCTION 0x1
#define TS_COLOR_MAP 0x2
#define TS_UNUSED_1 0x3
#define TS_UNUSED_2 0x4
#define TS_NORMAL_MAP 0x5
#define TS_UNUSED_3 0x6
#define TS_UNUSED_4 0x7
#define TS_SPECULAR_MAP 0x8
#define TS_UNUSED_5 0x9
#define TS_UNUSED_6 0xA
#define TS_WATER_MAP 0xB
union MaterialTextureDefInfo
{
GfxImage *image; // MaterialTextureDef->semantic != TS_WATER_MAP
water_t *water; // MaterialTextureDef->semantic == TS_WATER_MAP
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char samplerState;
char semantic;
char isMatureContent;
#ifdef BO1
MaterialTextureDefInfo u;
#elif
GfxImage *image;
#endif
};
union GFxDrawSurfFields
{
unsigned long long unused,
primarySortKey,
surfType,
primaryLightIndex,
prepass,
materialSortedIndex,
customIndex,
reflectionProbeIndex,
objectId;
};
union GfxDrawSurf
{
GFxDrawSurfFields fields;
unsigned long long packed;
};
struct __declspec(align(8)) MaterialInfo
{
const char *name;
unsigned int gameFlags;
char pad;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
int unknown2;
GfxDrawSurf drawSurf;
int surfaceFlags;
#ifdef BO2
int contents;
#endif
};
struct Material
{
MaterialInfo info;
char stateBitsEntry[TECHNIQUE_COUNT]; // see MaterialTechniqueType
char textureCount;
char constantCount;
char stateBitsCount;
char stateFlags;
char cameraRegion;
char probeMipBits;
MaterialTechniqueSet *techniqueSet;
MaterialTextureDef *textureTable;
MaterialConstantDef *constantTable;
GfxStateBits *stateBitTable;
#ifdef BO2
Material *unknownMaterial;
int unknown;
#endif
};Ghosts
struct MaterialConstantDef
{
unsigned int nameHash;
char name[12];
float literal[4];
};
struct GfxStateBits
{
int (*loadBits)[3];
char unknown1[0xE];
char unknown2[0xE];
char unknown3[2];
char unknown4[2];
};
struct WaterWritable
{
float floatTime;
};
struct water_t
{
WaterWritable writable;
float *H0X; // Count = M * N
float *H0Y; // Count = M * N
float *wTerm; // Count = M * N
int M;
int N;
float Lx;
float Lz;
float gravity;
float windvel;
float winddir[2];
float amplitude;
float codeConstant[4];
GfxImage *image;
};
/* MaterialTextureDef->semantic */
#define TS_2D 0x0
#define TS_FUNCTION 0x1
#define TS_COLOR_MAP 0x2
#define TS_UNUSED_1 0x3
#define TS_UNUSED_2 0x4
#define TS_NORMAL_MAP 0x5
#define TS_UNUSED_3 0x6
#define TS_UNUSED_4 0x7
#define TS_SPECULAR_MAP 0x8
#define TS_UNUSED_5 0x9
#define TS_UNUSED_6 0xA
#define TS_WATER_MAP 0xB
union MaterialTextureDefInfo
{
GfxImage *image;
water_t *water;
};
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
char sampleState;
char semantic;
MaterialTextureDefInfo u;
};
union GFxDrawSurfFields
{
unsigned long long unused,
primarySortKey,
surfType,
primaryLightIndex,
prepass,
materialSortedIndex,
customIndex,
reflectionProbeIndex,
objectId;
};
union GfxDrawSurf
{
GFxDrawSurfFields fields;
unsigned long long packed;
};
struct __declspec(align(8)) MaterialInfo // 0x20
{
const char *name;
char gameFlags;
char sortKey;
char textureAtlasRowCount;
char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
int surfaceTypeBits;
char unknown[0xC];
};
struct Material // 0xB8
{
MaterialInfo info;
char stateBitsEntry[TECHNIQUE_COUNT]; // see MaterialTechniqueType
char textureCount; // 0x47
char constantCount; // 0x48
char stateBitsCount; // 0x49
char stateFlags; // 0x4A
char cameraRegion; // 0x4B
char unknown; // 0x4C
char stringCount; // 0x4D
#ifdef PS3
unsigned short ushorts[TECHNIQUE_COUNT];
unsigned short *ushortArray; // count = TECHNIQUE_COUNT, see MaterialTechniqueType
#endif
MaterialTechniqueSet *techniqueSet;
MaterialTextureDef *textureTable; // count = textureCount
MaterialConstantDef *constantTable; // count = constantCount
GfxStateBits *stateBitTable; // count = stateBitsCount
const char **XStringArray; // count = stringCount
int unknown;
};