Glasses Asset

From COD Engine Research

The glasses asset defines how different types of glasses around the map break, and the effects associated with that. It only exists on Black Ops 1 and 2 and changed very little. Modern Warfare 3 and Ghosts have a similar glass_map asset.

struct GlassDef
{
  const char *name;
  int maxHealth;
  float thickness;
  float minShardSize;
  float maxShardSize;
  float shardLifeProbablility;
  int maxShards;
  Material *pristineMaterial;
  Material *crackedMaterial;
  Material *shardMaterial;
  const char *crackSound;
  const char *shatterShound;
  const char *autoShatterShound;
  FxEffectDef *crackEffect;
  FxEffectDef *shatterEffect;
};

struct Glass
{
#ifdef BO2
  unsigned int numCellIndices;
  unsigned __int16 cellIndices[6];
#endif
  GlassDef * glassDef;
  unsigned int index;
  unsigned int brushModel;
  vec3_t origin;
  vec3_t angles;
  vec3_t absmin;
  vec3_t absmax;
  bool isPlanar;
  byte outlineVecCount;
  char binormalSign;
  vec2_t * outline; 
  vec3_t outlineAxis[3];
  vec3_t outlineOrigin;
  float uvScale;
  float thickness;
};

struct Glasses
{
  const char * name;
  unsigned int numGlasses;
  Glass *glasses;
  char *workMemory;
  unsigned int workMemorySize;
  unsigned int smallAllocatorBlocks;
  unsigned int maxGroups;
  unsigned int maxShards;
  unsigned int maxPhysics;
  unsigned int shardMemorySize;
  unsigned int maxFreeCmd;
  unsigned int numSlots;
  unsigned int numVerts;
  unsigned int numIndices; // is set to (numVerts * 2) & 0xFFFFFFF0
};