DB/Light: Difference between revisions

From wowdev
Jump to navigation Jump to search
m (Undo revision 27946 by Schlumpf (talk))
(37 intermediate revisions by 6 users not shown)
Line 1: Line 1:
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.
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.
 
If no Light setting is set, hardcoded, default one is used (the one default for Eastern Kingdoms (Azeroth) map, used f.e. in Elwynn Forest). If Light setting has coordinates 0, 0, 0 and radiuses 0, 0, it overrides default one and becomes a new default (worldwide) setting for map it is on.
 
Local Light settings (non0 coords and radiuses) override worldwide Light setting. Soft transition between local Light setting and worldwide (or neighbour local) setting happens between faloffStart and falloffEnd radiuses.
 
The coordinates in the database are in inches rather than yards, so need a multiplication by 36 to make sense in other coordinate systems. This was confirmed at Blizzcon 2019 (WoW Developers' Tales) to be a remnant of a very early pre-release engine change where everything was in inches but had numeric issues due to numbers getting to big. This database was just never adapted and hackfixed instead.  


== Header Info ==
Records...................550
Fields.....................12 
Record Size................48
String Block Size...........1
== Structure ==
== Structure ==
All "Params" fields are reference to [[LightParams.dbc]].ID and corresponding records in [[LightIntBand.dbc]], [[LightFloatBand.dbc]] (later, both Band dbcs have been merged into [[DB/LightData]]) and [[LightSkybox.dbc]] - one Light setting can consist of up to 8 different Light params, which are then used under different circumstances.
  '''Column Field Type Notes'''
  '''Column Field Type Notes'''
  1 ID Integer
  1 ID Integer
  2 iRefID_[[Map.dbc|Map]] Integer
  2 iRefID_[[Map.dbc|Map]] Integer
  3 x position Float The x position of this "light" multiplied by 36, if not on a map with terrain: x-17066.666.
  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.
4 y position Float The y position of this "light" multiplied by 36, if not on a map with terrain: y-17066.666.
  6 falloffStart Float Inner radius, where is only this light(skybox) present. To get this, take radius in yards and multiply it by 36.
5 z position Float The z position of this "light" multiplied 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.
  6 inner radius Float The inner radius of this "light" multiplied by 36 (if you are within the inner radius there shouldn't be any interpolation with other lights)
  8 ParamsClear Integer Used in clear weather.
  7 outer radius Float The outer radius of this "light" multiplied by 36 (if you are outside the inner radius but inside the outer radius then this light can be interpolated with other lights)
  9 ParamsClearWat Integer Used in clear weather while being underwater.
  8 Sky & Fog Integer An entry for [[LightIntBand.dbc]] & [[LightFloatBand.dbc]] which each control how various properties wor
  10 ParamsStorm Integer Used in rainy/snowy/sandstormy weather.
  9 Water Settings Integer This is a pointer for just the water settings in [[LightIntBand.dbc]]
  11 ParamsStormWat Integer Used in rainy/snowy/sandstormy weather while being underwater.
  10 Unknown Integer This should be to [[LightParams.dbc]].
  12 ParamsDeath Integer Only 4 and in newer ones 3 are used as value here (with some exceptions). Changing this seems to have no effect in 3.3.5a (is death light setting hardcoded?)
  11 Unknown Integer <.. [[LightParams.dbc]], [[LightIntBand.dbc]] or [[LightFloatBand.dbc]]
  13 ParamsUnk1 Integer Following 3 Params are used only in WotLK records, and not very commonly. Perhaps used in different phases.
  12 Unknown Integer most likely more Params! ..>
  14 ParamsUnk2 Integer
  13 Unknown Integer Only set for some entries in DeathknightStart, Northrend and NexusRaid. They have other values too!
  15 ParamsUnk3 Integer
  14 Unknown Null This is in WotLK! Same above.
 
  15 Unknown Null This is in WotLK!
[[User:Amaroth|Amaroth]] 7th June 2017
 
===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 conversion above doesn't 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;


==1.12.1.5875==
struct LightRec {
  uint32_t m_ID;
  {{Template:Type/foreign_key|table=Map}} 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_sunset?,
    params_other?,
    params_death,
    params_num,
  };
  {{Template:Type/foreign_key|table= LightParams}} m_lightParamsID[params_num];
};
==6.0.1.18179==
struct LightRec {
  uint32_t m_ID;
  {{Template:Type/foreign_key|table=Map}} 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,
  };
  {{Template:Type/foreign_key|table= LightParams}} m_lightParamsID[params_num];
};
[[Category:DBC]]
[[Category:DBC]]
[[Category:DBC_Vanilla]]
[[Category:DBC_WotLK]]
[[Category:DBC_WoD]][[Category:6.0.1.18179]]

Revision as of 23:50, 4 November 2019

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.

If no Light setting is set, hardcoded, default one is used (the one default for Eastern Kingdoms (Azeroth) map, used f.e. in Elwynn Forest). If Light setting has coordinates 0, 0, 0 and radiuses 0, 0, it overrides default one and becomes a new default (worldwide) setting for map it is on.

Local Light settings (non0 coords and radiuses) override worldwide Light setting. Soft transition between local Light setting and worldwide (or neighbour local) setting happens between faloffStart and falloffEnd radiuses.

The coordinates in the database are in inches rather than yards, so need a multiplication by 36 to make sense in other coordinate systems. This was confirmed at Blizzcon 2019 (WoW Developers' Tales) to be a remnant of a very early pre-release engine change where everything was in inches but had numeric issues due to numbers getting to big. This database was just never adapted and hackfixed instead.

Structure

All "Params" fields are reference to LightParams.dbc.ID and corresponding records in LightIntBand.dbc, LightFloatBand.dbc (later, both Band dbcs have been merged into DB/LightData) and LightSkybox.dbc - one Light setting can consist of up to 8 different Light params, which are then used under different circumstances.

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 and in newer ones 3 are used as value here (with some exceptions). Changing this seems to have no effect in 3.3.5a (is death light setting hardcoded?)
13 	ParamsUnk1 	Integer		Following 3 Params are used only in WotLK records, and not very commonly. Perhaps used in different phases.
14 	ParamsUnk2 	Integer		
15 	ParamsUnk3 	Integer		

Amaroth 7th June 2017

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 conversion above doesn't 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;

1.12.1.5875

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_sunset?,
    params_other?,
    params_death,
    params_num,
  };
  foreign_key<uint32_t, &LightParamsRec::m_ID> m_lightParamsID[params_num];
};

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];
};