Graphics Map Asset (BO2)
The graphics map (or gfx_map) has existed on every Call of Duty so far and is part of the D3DBSP system produced by Radiant. Where the collision map is used for collision data in the map, the graphics map holds visual systems such as lights and particularly the dPVS system. The Dynamic Potentially Visible Sets (dPVS) were developed by Umbra Software to compute visibility databases in real time, and power the Call of Duty engine to this day.
struct XModelDrawInfo
{
unsigned __int16 lod;
unsigned __int16 surfId;
};
struct GfxSceneDynModel
{
XModelDrawInfo info;
unsigned __int16 dynEntId;
unsigned __int16 unknown;
};
struct BModelDrawInfo
{
unsigned __int16 surfId;
};
struct GfxSceneDynBrush
{
BModelDrawInfo info;
unsigned __int16 dynEntId;
};
struct GfxStreamingAabbTree
{
unsigned __int16 firstItem;
unsigned __int16 itemCount;
unsigned __int16 firstChild;
unsigned __int16 childCount;
float mins[3];
float maxs[3];
};
struct GfxWorldStreamInfo
{
int aabbTreeCount;
GfxStreamingAabbTree *aabbTrees;
int leafRefCount;
int *leafRefs;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
union PackedUnitVec
{
unsigned int packed;
};
struct GfxWorldVertex
{
float xyz[3];
float binormalSign;
GfxColor color;
float texCoord[2];
float lmapCoord[2];
PackedUnitVec normal;
PackedUnitVec tangent;
};
struct GfxWorldVertexData
{
GfxWorldVertex *vertices;
D3DVertexBuffer worldVb;
unsigned int unknownVertCount;
GfxWorldVertex * unknownVerts;
};
struct GfxWorldVertexLayerData
{
char *data;
D3DVertexBuffer layerVb;
};
struct GfxLight
{
char unknown1[0x150];
GfxLightDef *def;
char unknown2[0xC];
};
struct GfxReflectionProbe
{
char unknown1[0x3C];
GfxImage *reflectionImage;
char * unknown1; //Size = ((unknownCount << 1) + unknownCount) << 5
char (*unknown2)[0x70];
unsigned int unknownCount;
int unknown3;
};
struct GfxWorldDpvsPlanes
{
int cellCount;
cplane_s *planes;
unsigned __int16 *nodes;
unsigned int *sceneEntCellBits;
};
struct GfxAabbTree
{
float mins[3];
float maxs[3];
unsigned __int16 childCount;
unsigned __int16 surfaceCount;
unsigned __int16 startSurfIndex;
unsigned __int16 smodelIndexCount;
unsigned __int16 *smodelIndexes;
int childrenOffset;
};
struct GfxLightGridEntry
{
unsigned __int16 colorsIndex;
char primaryLightIndex;
char needsTrace;
};
struct GfxLightGridColors
{
char rgb[56][3];
};
struct GfxStaticModelInst
{
float mins[4];
float maxs[4];
GfxColor groundLighting;
};
struct srfTriangles_t
{
/*int vertexLayerData;
int firstVertex;
unsigned __int16 vertexCount;
unsigned __int16 triCount;
int baseIndex;
float topMipMins[3];
float topMipMaxs[3];*/
char unknown[0x30];
};
struct GfxSurface
{
srfTriangles_t tris;
Material *material;
char unknown[0x1C];
};
struct GfxCullGroup
{
float mins[3];
float maxs[3];
int surfaceCount;
int startSurfIndex;
};
struct GfxDrawSurfFields
{
__int64 _bf0;
};
union GfxDrawSurf
{
GfxDrawSurfFields fields;
unsigned __int64 packed;
};
struct GfxWorldDpvsStatic
{
unsigned int smodelCount;
unsigned int staticSurfaceCount;
unsigned int litSurfsBegin;
unsigned int litSurfsEnd;
unsigned int decalSurfsBegin;
unsigned int decalSurfsEnd;
unsigned int emissiveSurfsBegin;
unsigned int emissiveSurfsEnd;
int unknown[2];
unsigned int unknownCounts[2];
short *smodelVisData[4];
short *surfaceVisData[4];
unsigned int *lodData;
unsigned __int16 *sortedSurfIndex;
GfxStaticModelInst *smodelInsts;
GfxSurface *surfaces;
GfxCullGroup *cullGroups;
GfxStaticModelDrawInst *smodelDrawInsts;
GfxDrawSurf *surfaceMaterials;
unsigned int *surfaceCastsSunShadow;
volatile int usageCount;
};
#pragma pack(push, 4)
struct GfxPackedPlacement
{
float origin[3];
PackedUnitVec axis[3];
float scale;
};
struct GfxStaticModelDrawInst
{
float cullDist;
GfxPackedPlacement placement;
XModel *model;
char reflectionProbeIndex;
char primaryLightIndex;
unsigned __int16 lightingHandle;
char flags;
};
struct cplane_s
{
float normal[3];
float dist;
char type;
char signbits;
};
struct GfxPortalWritable
{
bool isQueued;
bool isAncestor;
char recursionDepth;
char hullPointCount;
float (*hullPoints)[2];
};
struct DpvsPlane
{
float coeffs[4];
char side[3];
};
struct GfxPortal
{
GfxPortalWritable writable;
DpvsPlane plane;
int unknown1;
GfxCell * parent;
char vertexCount;
float (*vertices)[3];
char unknown[0x30];
};
struct GfxCell
{
float mins[3];
float maxs[3];
int aabbTreeCount;
GfxAabbTree *aabbTree;
int portalCount;
GfxPortal *portals;
char reflectionProbeCount;
char *reflectionProbes;
};
struct GfxLightmapArray
{
GfxImage *primary;
GfxImage *secondary;
};
struct GfxLightGrid
{
bool hasLightRegions;
unsigned int sunPrimaryLightIndex;
unsigned __int16 mins[3];
unsigned __int16 maxs[3];
unsigned int rowAxis;
unsigned int colAxis;
unsigned __int16 *rowDataStart;
unsigned int rawRowDataSize;
char *rawRowData;
unsigned int entryCount;
GfxLightGridEntry *entries;
unsigned int colorCount;
GfxLightGridColors *colors;
unsigned int unknownCount1;
char * unknown1; //Size = unknownCount1 * 0x36
unsigned int unknownCount2;
char * unknown2; //Size = ((unknownCount2 << 2) + unknownCount2) << 3
};
struct GfxBrushModelWritable
{
float mins[3];
float maxs[3];
int unknown;
};
struct GfxBrushModel
{
GfxBrushModelWritable writable;
float bounds[2][3];
unsigned int surfaceCount;
unsigned int startSurfIndex;
int unknown;
};
struct MaterialMemory
{
Material *material;
int memory;
};
struct sunflare_t
{
bool hasValidData;
Material *spriteMaterial;
Material *flareMaterial;
float spriteSize;
float flareMinSize;
float flareMinDot;
float flareMaxSize;
float flareMaxDot;
float flareMaxAlpha;
int flareFadeInTime;
int flareFadeOutTime;
float blindMinDot;
float blindMaxDot;
float blindMaxDarken;
int blindFadeInTime;
int blindFadeOutTime;
float glareMinDot;
float glareMaxDot;
float glareMaxLighten;
int glareFadeInTime;
int glareFadeOutTime;
float sunFxPosition[3];
};
struct GfxShadowGeometry
{
unsigned __int16 surfaceCount;
unsigned __int16 smodelCount;
unsigned __int16 *sortedSurfIndex;
unsigned __int16 *smodelIndex;
};
struct GfxLightRegionAxis
{
float dir[3];
float midPoint;
float halfSize;
};
struct GfxLightRegionHull
{
float kdopMidPoint[9];
float kdopHalfSize[9];
unsigned int axisCount;
GfxLightRegionAxis *axis;
};
struct GfxLightRegion
{
unsigned int hullCount;
GfxLightRegionHull *hulls;
};
struct GfxWorldDpvsDynamic
{
unsigned int dynEntClientWordCount[2];
unsigned int dynEntClientCount[2];
unsigned int *dynEntCellBits[2];
char *dynEntVisData[2][3];
unsigned int unknown;
};
struct SunLightParseParams
{
char * name;
char unknown[0xB4];
};
struct GfxWaterBuffer
{
unsigned int unknownCount;
char * buffer; //Size = unknownCount << 4
};
struct unknownGfxWorldStruct1Internal1
{
char * unknown1; //Size = unknownCount1;
char * unknown2; //Size = unknwonCount1;
char * unknown3; //Size = unknownCount2;
unsigned int unknownCount1;
unsigned int unknownCount2;
};
struct unknownGfxWorldStruct1Internal2
{
unsigned int unknownCount1;
unsigned int unknownCount2;
char * unknown1; //Size = unknownCount1 << 4
char * unknown2; //Size = ((unknownCount2 << 1) + unknownCount2) << 1
};
struct unknownGfxWorldStruct1Internal3
{
unsigned int unknown1;
unsigned int unknownCount1;
unsigned int unknownCount2;
char * unknown2; //Size = (unknownCount1 * unknownCount2) << 4
};
struct unknownGfxWorldStruct1
{
char unknown1[0x40];
unknownGfxWorldStruct1Internal1 * unknownStruct1;
unknownGfxWorldStruct1Internal2 * unknownStruct2;
unknownGfxWorldStruct1Internal3 * unknownStruct3;
char * unknown2; //size = unknownStruct2->unknownCount1 << 4
char unknown3[0x10];
};
typedef char GfxTexture[0x34];
struct GfxWorldDraw
{
unsigned int reflectionProbeCount;
GfxReflectionProbe *reflectionProbes;
GfxTexture *reflectionProbeTextures;
int lightmapCount;
GfxLightmapArray *lightmaps;
GfxTexture *lightmapPrimaryTextures;
GfxTexture *lightmapSecondaryTextures;
GfxTexture *lightmapTertiaryTextures;
unsigned int vertexCount;
GfxWorldVertexData vd;
unsigned int vertexLayerDataSize;
GfxWorldVertexLayerData vld;
int indexCount;
unsigned __int16 *indices;
D3DIndexBuffer indexBuffer;
};
struct GfxWorld
{
const char *name;
const char *baseName;
int planeCount;
int nodeCount;
int surfaceCount;
GfxWorldStreamInfo streamInfo;
char * unknownString1;
char unknown1[0xD8];
GfxLight *sunLight;
unsigned int coronaCount;
char * coronas; //Size = coronaCount << 5
unsigned int shadowMapVolumeCount;
char * shadowMapVolumes; //Size = shadowMapVolumeCount << 4
unsigned int shadowMapVolumePlaneCount;
char * shadowMapValumePlanes; //Size = shadowMapVolumePlaneCount << 4
unsigned int exposureVolumeCount;
char * exposureVolumes; //Size = ((exposureVolumeCount << 1) + exposureVolumeCount) << 3
unsigned int exposureVolumePlaneCount;
char * exposureVolumePlanes; //Size = exposureVolumePlaneCount << 4
unsigned int unknownVolumeCount1;
char * unknownVolume1; //Size = unknownVolumeCount1 * 0x64
unsigned int unknownVolumePlaneCount1;
char * unknownVolume1Planes;
unsigned int unknownVolumeCount2;
char * unknownVolume2; //Size = ((unknownVolumeCount2 << 1) + unknownVolumeCount2) << 4
unsigned int unknownVolumePlaneCount2;
char * unknownVolume2Planes;
unsigned int unknownVolumeCount3;
char * unknownVolume3; //Size = ((unknownVolumeCount3 << 3) + unknownVolumeCount3) << 2
unsigned int unknownVolumePlaneCount3;
char * unknownVolume3Planes;
char unknown2[0x10];
GfxWorldDpvsPlanes dpvsPlanes;
int cellBitsCount;
GfxCell *cells;
GfxWorldDraw worldDraw;
GfxLightGrid lightGrid;
int modelCount;
GfxBrushModel *models;
float mins[3];
float maxs[3];
unsigned int checksum;
int materialMemoryCount;
MaterialMemory *materialMemory;
sunflare_t sun;
float outdoorLookupMatrix[4][4];
GfxImage *outdoorImage;
unsigned int *cellCasterBits;
GfxSceneDynModel *sceneDynModel;
GfxSceneDynBrush *sceneDynBrush;
unsigned int *primaryLightEntityShadowVis;
unsigned int *primaryLightDynEntShadowVis[2];
unsigned int unknownCount1;
unknownGfxWorldStruct1 * unknownStructArray;
GfxShadowGeometry *shadowGeom;
GfxWorldDpvsStatic dpvs;
GfxWorldDpvsDynamic dpvsDyn;
int unknown3;
GfxWaterBuffer waterBuffer[2];
int unknown4[2];
};
#pragma pack(pop)Keep in mind that the checksum is checked on other clients using the mapcrc dvar.