wowserhq / wowser

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

Render map-level skyboxes #147

Open fallenoak opened 8 years ago

fallenoak commented 8 years ago

Now that rendering is progressing nicely, it'd be great to have something other than the renderer's clear color to look at in the distance.

Note that this issue is specific to the skyboxes used for maps. WMO skyboxes are defined a bit differently, and can be handled in a follow up issue.

Progress

To render skyboxes correctly in relation to the camera and terrain/doodads/WMOs/etc, we'll want to disable autoClear on the renderer, and switch to a two-pass rendering approach. We'll also want to make sure to copy the camera position to the skybox each tick of animate.

The renderer changes in the animation loop will look something like this:

  1. Clear the renderer to an appropriate color-- this color will probably will come from light params once we have a light manager
  2. Render a THREE.Scene that only contains the skybox M2
  3. Call clearDepth() on the renderer (ensures the skybox remains underneath everything)
  4. Render a THREE.Scene that contains everything else (terrain, doodads, WMOs, etc)