DB/Light

From wowdev
Revision as of 16:42, 7 June 2017 by Amaroth (talk | contribs)
Jump to navigation Jump to search

This is the starting file for what controls the lights, fogs, sky color, water color, and well other similar items. This information prior to 1.9 used to be stored in the .LIT files but in 1.9 was moved to Light.dbc and the other Light DBC files.

Light(skybox) with X/Y/Z 0/0/0 and inner/outer radiuses 0/0 is worldwide and overwrites default one, but doesn't overlap another, local and specific ones, it only transitions into them between their outer and inner radiuses.

Structure

All "Params" fields are refference to LightParams.dbc.ID and corresponding records in LightIntBand.dbc, LightFloatBand.dbc and LightSkybox.dbc.

Column 	Field 		Type 		Notes
1 	ID		Integer 	
2 	iRefID_Map	Integer 	
3 	position	Float[3]	X/Y/Z position of the center of light(skybox) sphere. To get them, spawn a model in Noggit on that place, get its X/Y/Z coords and multiply them by 36.
6 	falloffStart 	Float		Inner radius, where is only this light(skybox) present. To get this, take radius in yards and multiply it by 36.
7 	falloffEnd 	Float		Outer radius, in space between outer and inner radius is a soft transition from this light(skybox) to surrounding/worldwide ones. Again, yards*36.
8 	ParamsClear	Integer 	Used in clear weather.
9 	ParamsClearWat 	Integer		Used in clear weather while being underwater.
10 	ParamsStorm 	Integer		Used in rainy/snowy/sandstormy weather.
11 	ParamsStormWat 	Integer		Used in rainy/snowy/sandstormy weather while being underwater.
12 	ParamsDeath	Integer		Only 4, 3 and sometimes 2 values are used. Seems to be ignored by 3.3.5a client.
13 	ParamsUnk1 	Integer		Only set for some entries in DeathknightStart, Northrend and NexusRaid. They have other values too!
14 	ParamsUnk2 	Integer		These may be for different phases.
15 	ParamsUnk3 	Integer		

LightRec::ConvertDBToGameCoords()

pos.x = 17066.666 - pos.x / 36.0f;
pos.y = 17066.666 - pos.y / 36.0f; 
pos.z = pos.z / 36.0f;
falloffStart = falloffStart / 36.0f;
falloffEnd = falloffEnd / 36.0f;


For the record, the convertion above doesnt translate light into world coordinates(the ones that are used in wow net protocol). Considering x is at index 0 in position field, y is at index 1 and z is at index 2, the correct formulas would be

worldPos.x = 17066.666 - position.z / 36.0f;
worldPos.y = 17066.666 - position.x / 36.0f; 
worldPos.z = position.y / 36.0f;

6.0.1.18179

struct LightRec {
  uint32_t m_ID;
  foreign_key<uint32_t, &MapRec::m_ID> m_continentID;
  float m_x; // (0,0,0) = global light, used as fallback if in no other light. If there is no (0,0,0) entry for a continent, use m_ID == 1 as fallback
  float m_y;
  float m_z;
  float m_falloffStart;
  float m_falloffEnd;
  enum {
    params_standard,
    params_standard_underwater,
    params_stormy,
    params_stormy_underwater,
    params_death,
    params_unk_5,
    params_unk_6,
    params_unk_7,
    params_num,
  };
  foreign_key<uint32_t, &LightParamsRec::m_ID> m_lightParamsID[params_num];
};