Lightdef Asset: Difference between revisions

From COD Engine Research
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
[[Category:BO1]]
[[Category:BO1]]
[[Category:BO2]]
[[Category:BO2]]
[[Category:BO3]]
The lightdef asset contains information pertaining to individual lights (not global lights). This asset is very simple and hasn't changed very much from the Call of Duty 4 Alpha to Ghosts.
== Call of Duty 4 & World at War & Modern Warfare 2 & Black Ops 1 & 2 & 3 ==
<syntaxhighlight lang="cpp">
#pragma pack(push, 4)
struct GfxLightImage
{
  GfxImage *image;
  char samplerState;
};
#pragma pack(pop)


The lightdef asset contains information pertaining to individual lights (not global lights). This asset is very simple and hasn't changed very much from the Call of Duty 4 Alpha to Ghosts.
struct GfxLightDef
== Call of Duty 4 & World at War & Modern Warfare 2 & Black Ops 1 & 2 ==
{
#pragma pack(push, 4)
  const char *name;
struct GfxLightImage
  GfxLightImage attenuation;
{
  int lmapLookupStart;
  GfxImage *image;
};
  char samplerState;
</syntaxhighlight>
};
#pragma pack(pop)
struct GfxLightDef
{
  const char *name;
  GfxLightImage attenuation;
  int lmapLookupStart;
};
lmapLookupStart is a constant value for all lightdefs. Only name and the attenuation change.
lmapLookupStart is a constant value for all lightdefs. Only name and the attenuation change.
== Modern Warfare 3 & Ghosts ==
== Modern Warfare 3 & Ghosts & Advanced Warfare ==
#pragma pack(push, 4)
<syntaxhighlight lang="cpp">
struct GfxLightImage
#pragma pack(push, 4)
{
struct GfxLightImage
  GfxImage *image;
{
  char samplerState;
  GfxImage *image;
};
  char samplerState;
#pragma pack(pop)
};
#pragma pack(pop)
struct GfxLightDef
 
{
struct GfxLightDef
  const char *name;
{
  GfxLightImage attenuation[2];
  const char *name;
  int lmapLookupStart;
  GfxLightImage attenuation;
};
  GfxLightImage cucoloris;
The MW3 lightdef uses 2 attenuations, so the current source format will not work.
  int lmapLookupStart;
};
</syntaxhighlight>
 
== Source Format ==
== Source Format ==
The lightdef source files are essentially extensionless text files located at "raw/lights". There is 1 char for the samplerState and a null terminated string for the name of the image asset to use. For example, here is the "candle" asset from Call of Duty 4.
The lightdef source files are essentially extensionless text files located at "raw/lights". There is 1 char for the samplerState and a null terminated string for the name of the image asset to use. For example, here is the "candle" asset from Call of Duty 4.
  bfalloff_candle
  bfalloff_candle
Keep in mind that the file does contain a null character on the end that cannot be represented. The "b" is the samplerState.
Keep in mind that the file does contain a null character on the end that cannot be represented. The "b" is the samplerState.

Latest revision as of 07:20, 31 October 2015

The lightdef asset contains information pertaining to individual lights (not global lights). This asset is very simple and hasn't changed very much from the Call of Duty 4 Alpha to Ghosts.

Call of Duty 4 & World at War & Modern Warfare 2 & Black Ops 1 & 2 & 3

#pragma pack(push, 4)
struct GfxLightImage
{
  GfxImage *image;
  char samplerState;
};
#pragma pack(pop)

struct GfxLightDef
{
  const char *name;
  GfxLightImage attenuation;
  int lmapLookupStart;
};

lmapLookupStart is a constant value for all lightdefs. Only name and the attenuation change.

Modern Warfare 3 & Ghosts & Advanced Warfare

#pragma pack(push, 4)
struct GfxLightImage
{
  GfxImage *image;
  char samplerState;
};
#pragma pack(pop)

struct GfxLightDef
{
  const char *name;
  GfxLightImage attenuation;
  GfxLightImage cucoloris;
  int lmapLookupStart;
};

Source Format

The lightdef source files are essentially extensionless text files located at "raw/lights". There is 1 char for the samplerState and a null terminated string for the name of the image asset to use. For example, here is the "candle" asset from Call of Duty 4.

bfalloff_candle

Keep in mind that the file does contain a null character on the end that cannot be represented. The "b" is the samplerState.