DRAWING CEILINGS
To draw the ceiling, the floor-casting process can be reversed. Instead
of tracing rays from the bottom of a wall slice in downward
direction, trace the ray from the top of the wall in the upward
direction. This is actually pretty straightforward once the theory behind
floor-casting has been grasped.
Figure 27: Casting to find
the ceiling.
Later, we will explain how to simulate the illusion of looking up,
looking down, flying, and crouching. If the programmer does not wish
to simulate these, it is possible to draw the floor and the ceiling
at the same time. This is because the distance of the player's eyes
to the floor and ceiling is equal/symetrical. (Floors and ceilings are
symmetrical since the player's eyes is exactly at the midpoint between
floors and ceilings.)
|