DRAWING FLOORSTo draw floors, we can perform floor-casting (floor-casting refers to a techique of rendering floors). Note however, that it would be wasteful to perform floor-casting without texture mapping or shading. In other words, if the floor is not to be textured or shaded (shading will be explored later), then we can simply paint the floor with a solid color and we are done. Keeping that in mind, let us explore what is required to do floor-casting. There are several ways to do floor-casting. However, all of them use a similar technique. The technique is explained below.
2. Determine the world coordinate of the floor that had been intersected. 3. Calculate the distance between the player and the floor intersection. 4. Project the floor intersection onto the projection plane.
Examples in Javascript (with source code)
|
||