Difference between revisions of "Graphics Map Asset (WaW)"

From COD Engine Research
Jump to: navigation, search
 
Line 160: Line 160:
 
struct srfTriangles_t
 
struct srfTriangles_t
 
{
 
{
   /*int vertexLayerData;
+
   int vertexLayerData;
 
   int firstVertex;
 
   int firstVertex;
   unsigned __int16 vertexCount;
+
   unsigned short vertexCount;
   unsigned __int16 triCount;
+
   unsigned short triCount;
 
   int baseIndex;
 
   int baseIndex;
 
   float topMipMins[3];
 
   float topMipMins[3];
   float topMipMaxs[3];*/
+
   float topMipMaxs[3];
   char unknown[0x2C];
+
   int stream2ByteOffset;
 
};
 
};
  
Line 210: Line 210:
 
   unsigned int emissiveSurfsBegin;
 
   unsigned int emissiveSurfsBegin;
 
   unsigned int emissiveSurfsEnd;
 
   unsigned int emissiveSurfsEnd;
      unsigned int unknownCounts[2];
+
  unsigned int smodelVisDataCount;
 +
  unsigned int surfaceVisDataCount;
 
   short *smodelVisData[3];
 
   short *smodelVisData[3];
 
   short *surfaceVisData[3];
 
   short *surfaceVisData[3];
 
   unsigned int *lodData;
 
   unsigned int *lodData;
   unsigned __int16 *sortedSurfIndex;
+
   unsigned short *sortedSurfIndex;
 
   GfxStaticModelInst *smodelInsts;
 
   GfxStaticModelInst *smodelInsts;
 
   GfxSurface *surfaces;
 
   GfxSurface *surfaces;
Line 374: Line 375:
 
struct SunLightParseParams
 
struct SunLightParseParams
 
{
 
{
   /*char name[64];
+
   char name[64];
 
   float ambientScale;
 
   float ambientScale;
 
   float ambientColor[3];
 
   float ambientColor[3];
Line 382: Line 383:
 
   float diffuseColor[3];
 
   float diffuseColor[3];
 
   bool diffuseColorHasBeenSet;
 
   bool diffuseColorHasBeenSet;
   float angles[3];*/
+
   float angles[3];
   char unknown[0x8C];
+
   float treeScatterIntensity;
 +
  float treeScatterAmount;
 
};
 
};
  
 
struct GfxWaterBuffer
 
struct GfxWaterBuffer
 
{
 
{
   unsigned int unknownCount;
+
   unsigned int bufferSize;
   char * buffer; //Size = unknownCount << 4
+
   float *buffer;
 +
};
 +
 
 +
struct GfxWorldLodChain
 +
{
 +
  float origin[3];
 +
  float lastDist;
 +
  unsigned int firstLodInfo;
 +
  unsigned short lodInfoCount;
 +
};
 +
 
 +
struct GfxWorldLodInfo
 +
{
 +
  float dist;
 +
  unsigned int firstSurf;
 +
  unsigned short surfCount;
 +
};
 +
 
 +
struct GfxLightCorona
 +
{
 +
  float origin[3];
 +
  float radius;
 +
  float color[3];
 +
  float intensity;
 
};
 
};
  
Line 399: Line 424:
 
   int nodeCount;
 
   int nodeCount;
 
   int indexCount;
 
   int indexCount;
   unsigned __int16 *indices;
+
   unsigned short *indices;
 +
#ifdef XBOX
 
   D3DIndexBuffer indexBuffer;
 
   D3DIndexBuffer indexBuffer;
 +
#endif
 
   int surfaceCount;
 
   int surfaceCount;
 
   GfxWorldStreamInfo streamInfo;
 
   GfxWorldStreamInfo streamInfo;
Line 407: Line 434:
 
   GfxImage *skyImage;
 
   GfxImage *skyImage;
 
   char skySamplerState;
 
   char skySamplerState;
      char * unknownString1;
+
  char *skyBoxModel;
 
   unsigned int vertexCount;
 
   unsigned int vertexCount;
 
   GfxWorldVertexData vd;
 
   GfxWorldVertexData vd;
Line 421: Line 448:
 
   GfxReflectionProbe *reflectionProbes;
 
   GfxReflectionProbe *reflectionProbes;
 
   GfxTexture *reflectionProbeTextures;
 
   GfxTexture *reflectionProbeTextures;
      unsigned int coronaCount;
+
  unsigned int coronaCount;
      char * coronas; //Size = coronaCount << 5
+
  GfxLightCoronoa *coronas;
 
   GfxWorldDpvsPlanes dpvsPlanes;
 
   GfxWorldDpvsPlanes dpvsPlanes;
 
   int cellBitsCount;
 
   int cellBitsCount;
Line 451: Line 478:
 
   GfxWorldDpvsStatic dpvs;
 
   GfxWorldDpvsStatic dpvs;
 
   GfxWorldDpvsDynamic dpvsDyn;
 
   GfxWorldDpvsDynamic dpvsDyn;
      unsigned int worldLodChainCount;
+
  unsigned int worldLodChainCount;
      char * worldLodChains; //Size = ((worldLodChainCount << 1) + worldLodChainCount) << 3
+
  GfxWorldLodChain *worldLodChains; //Size = ((worldLodChainCount << 1) + worldLodChainCount) << 3
      unsigned int worldLodInfosCount;
+
  unsigned int worldLodInfoCount;
      char * worldLodInfos; //Size = ((worldLodInfosCount << 1) + worldLodInfosCount) << 3
+
  GfxWorldLodInfo *worldLodInfos;
 
   unsigned int worldLodSurfaceCount;
 
   unsigned int worldLodSurfaceCount;
   unsigned int * worldLodSurfaces;
+
   unsigned int *worldLodSurfaces;
      GfxWaterBuffer waterBuffer[2];
+
  GfxWaterBuffer waterBuffers[2];
      Material * unknownMaterial;
+
  Material *waterMaterial;
 
};
 
};
 
#pragma pack(pop)
 
#pragma pack(pop)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Keep in mind that the checksum is checked on other clients using the mapcrc dvar.
 
Keep in mind that the checksum is checked on other clients using the mapcrc dvar.

Latest revision as of 18:16, 7 February 2015

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. The extra data at the end is believed to be an update to this system.

struct XModelDrawInfo
{
  unsigned __int16 lod;
  unsigned __int16 surfId;
};
 
struct GfxSceneDynModel
{
  XModelDrawInfo info;
  unsigned __int16 dynEntId;
};
 
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;
};
 
struct GfxWorldVertexLayerData
{
  char *data;
  D3DVertexBuffer layerVb;
};
 
struct GfxLight
{
  char type;
  char canUseShadowMap;
  char unused[2];
  float color[3];
  float dir[3];
  float origin[3];
  float radius;
  float cosHalfFovOuter;
  float cosHalfFovInner;
  int exponent;
  unsigned int spotShadowIndex;
  GfxLightDef *def;
};
 
struct GfxReflectionProbe
{
  float origin[3];
  GfxImage *reflectionImage;
};
 
struct GfxImageLoadDef
{
  char levelCount;
  char flags;
  __int16 dimensions[3];
  int format;
  GfxTexture texture;
};
 
union GfxTexture
{
  D3DBaseTexture *basemap;
  D3DTexture *map;
  D3DVolumeTexture *volmap;
  D3DCubeTexture *cubemap;
  GfxImageLoadDef *loadDef;
};
 
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[3];
  float maxs[3];
  GfxColor groundLighting;
};
 
struct srfTriangles_t
{
  int vertexLayerData;
  int firstVertex;
  unsigned short vertexCount;
  unsigned short triCount;
  int baseIndex;
  float topMipMins[3];
  float topMipMaxs[3];
  int stream2ByteOffset;
};
 
struct GfxSurface
{
  srfTriangles_t tris;
  Material *material;
  char lightmapIndex;
  char reflectionProbeIndex;
  char primaryLightIndex;
  bool castsSunShadow;
  float bounds[2][3];
};
 
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;
  unsigned int smodelVisDataCount;
  unsigned int surfaceVisDataCount;
  short *smodelVisData[3];
  short *surfaceVisData[3];
  unsigned int *lodData;
  unsigned short *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;*/
  char unknown[0x18];
};
 
struct cplane_s
{
  float normal[3];
  float dist;
  char type;
  char signbits;
};
 
struct GfxCell
{
  float mins[3];
  float maxs[3];
  int aabbTreeCount;
  GfxAabbTree *aabbTree;
  int portalCount;
  GfxPortal *portals;
  int cullGroupCount;
  int *cullGroups;
  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;
};
 
struct GfxBrushModelWritable
{
  float mins[3];
  float maxs[3];
};
 
struct GfxBrushModel
{
  GfxBrushModelWritable writable;
  float bounds[2][3];
  unsigned int surfaceCount;
  unsigned int startSurfIndex;
};
 
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];
};
 
struct SunLightParseParams
{
  char name[64];
  float ambientScale;
  float ambientColor[3];
  float diffuseFraction;
  float sunLight;
  float sunColor[3];
  float diffuseColor[3];
  bool diffuseColorHasBeenSet;
  float angles[3];
  float treeScatterIntensity;
  float treeScatterAmount;
};
 
struct GfxWaterBuffer
{
  unsigned int bufferSize;
  float *buffer;
};
 
struct GfxWorldLodChain
{
  float origin[3];
  float lastDist;
  unsigned int firstLodInfo;
  unsigned short lodInfoCount;
};
 
struct GfxWorldLodInfo
{
  float dist;
  unsigned int firstSurf;
  unsigned short surfCount;
};
 
struct GfxLightCorona
{
  float origin[3];
  float radius;
  float color[3];
  float intensity;
};
 
struct GfxWorld
{
  const char *name;
  const char *baseName;
  int planeCount;
  int nodeCount;
  int indexCount;
  unsigned short *indices;
#ifdef XBOX
  D3DIndexBuffer indexBuffer;
#endif
  int surfaceCount;
  GfxWorldStreamInfo streamInfo;
  int skySurfCount;
  int *skyStartSurfs;
  GfxImage *skyImage;
  char skySamplerState;
  char *skyBoxModel;
  unsigned int vertexCount;
  GfxWorldVertexData vd;
  unsigned int vertexLayerDataSize;
  GfxWorldVertexLayerData vld;
  SunLightParseParams sunParse;
  GfxLight *sunLight;
  float sunColorFromBsp[3];
  unsigned int sunPrimaryLightIndex;
  unsigned int primaryLightCount;
  int cullGroupCount;
  unsigned int reflectionProbeCount;
  GfxReflectionProbe *reflectionProbes;
  GfxTexture *reflectionProbeTextures;
  unsigned int coronaCount;
  GfxLightCoronoa *coronas;
  GfxWorldDpvsPlanes dpvsPlanes;
  int cellBitsCount;
  GfxCell *cells;
  int lightmapCount;
  GfxLightmapArray *lightmaps;
  GfxLightGrid lightGrid;
  GfxTexture *lightmapPrimaryTextures;
  GfxTexture *lightmapSecondaryTextures;
  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];
  char *primaryLightForModelDynEnt;
  GfxShadowGeometry *shadowGeom;
  GfxLightRegion *lightRegion;
  GfxWorldDpvsStatic dpvs;
  GfxWorldDpvsDynamic dpvsDyn;
  unsigned int worldLodChainCount;
  GfxWorldLodChain *worldLodChains; //Size = ((worldLodChainCount << 1) + worldLodChainCount) << 3
  unsigned int worldLodInfoCount;
  GfxWorldLodInfo *worldLodInfos;
  unsigned int worldLodSurfaceCount;
  unsigned int *worldLodSurfaces;
  GfxWaterBuffer waterBuffers[2];
  Material *waterMaterial;
};
#pragma pack(pop)

Keep in mind that the checksum is checked on other clients using the mapcrc dvar.