wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
240 stars 63 forks source link

Implement light manager #138

Open fallenoak opened 8 years ago

fallenoak commented 8 years ago

Rather than hardcoding values for diffuse light, ambient light, fog color, fog start, and fog end directly in each material, we should centralize the values in a light manager, and use EventEmitter to notify materials when a change occurs. Initial values should be copied from the light manager at the time the material is instantiated.

It seems to me that the appropriate place for this new manager to live is on Map. We can eventually hook in to render(x, y) on Map and use that to trigger DBC checks for new values for the light manager to use.

For the purposes of this issue, let's keep things simple: we can set up the light manager, give it initial values, and set up relevant event subscriptions, but let's skip out on hooking up DBC lookups for now.