A scene with a WMO backdrop now clears its frame and draws its sky as
DrawWorldScene (0x00681070) does before its terrain and map objects:
- No interior group holds the camera and the camera is dry: clear to
black (mask 3), then DrawSky (0x006D4940). The pass draws the stars,
the sun disc, the white moon, moon02, the gradient dome, the clouds
and the skybox slots, in the depth range [0.975, 0.98] of the device
viewport, around the eye. The scene's view has no translation, as the
world's has none, so the same pass fits.
- An interior group holds the camera: clear to the drawn fog's colour
(light state +0x80) and draw no sky. Under liquid outside: the zone
fog's colour.
The pass draws the world's sky objects, which BuildLightTable
(0x006D2260, from 0x006D4530 each world frame) makes from the world's
camera and light. The scene makes the light-derived parts again, as the
build makes them, then puts the world's back:
- the light state's heading (+0x30) from the scene camera's forward:
atan2(y, x), or atan2(z, x) when x*x + y*y is not above the double
0.0001 (0x00811658), plus the float 2pi (0x0080295C) below 0;
- for a backdrop in a map, that map's light at the scene camera
(BuildMapLight, as the outdoor water already takes it) in the live
table (0x00CE9C0C), with no screen tint (+0x44, the player's) and the
override and slots (+0x54..+0x6B) cleared;
- the dome's colours (ColourSkyDome 0x006D0F50, 5 x columns + 2 at
[0x00CE99A0+0x14]);
- colour band 9 (record +0x20) into the sun disc and white moon
(0x00CE9858, +0x0C, 0x20 apart);
- the skybox slots (0x006D2C79): each {LightSkybox id, weight} pair at
record +0x78 with an id, a weight above 0 and an id below the
LightSkybox count (0x00CE9DB4) interns its row's path (InternSkybox
0x006D4640) into slot +0x5C, weight +0x64. A null row, which the
engine would read through, is skipped.
The pass runs only while the sky flag (+0x198) is set and the dome has
its colours, so a scene at the glue screen keeps a plain clear. World
stack 8 is identity around the pass and the render states are pushed.
The camera claim (ClaimCameraMapObject 0x006821F0) now runs for every
WMO, not only for those with their own fog. The world claims the camera
whatever the fog, and its liquid probe reads the claim.
Not done: the cloud texture stays the world's, because the world builds
it a band at a time from its own light. From inside, the world also
draws the sky when its portal walk (WalkPortals 0x006B41C0) reaches an
exterior group; the scene does not. The sun and moon glares (0x006D48C0)
are not drawn.