Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
24
62-03.md
24
62-03.md
|
|
@ -15,9 +15,9 @@ as coordinated by **UpdateWorld()**, is this:
|
|||
- Project wall vertices to screen coordinates.
|
||||
- Walk the walls back to front, and for each wall that lies at least
|
||||
partially in the view pyramid, perform backface culling (skip walls
|
||||
facing away from the viewer), and draw the wall if it’s not culled.
|
||||
facing away from the viewer), and draw the wall if it's not culled.
|
||||
|
||||
Next, we’ll look at each part of the pipeline more closely. The pipeline
|
||||
Next, we'll look at each part of the pipeline more closely. The pipeline
|
||||
is too complex for me to be able to discuss each part in complete
|
||||
detail. Some sources for further reading are *Computer Graphics*, by
|
||||
Foley and van Dam (ISBN 0-201-12110-7), and the *DDJ Essential Books on
|
||||
|
|
@ -27,7 +27,7 @@ Graphics Programming* CD.
|
|||
|
||||
The sample BSP program performs first-person rendering; that is, it
|
||||
renders the world as seen from your eyes as you move about. The rate of
|
||||
movement is controlled by key-handling code that’s not shown in Listing
|
||||
movement is controlled by key-handling code that's not shown in Listing
|
||||
62.1; however, the variables set by the key-handling code are used in
|
||||
**UpdateViewPos()** to bring the current location up to date.
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ around the but only viewing horizontally. Although the BSP tree is only
|
|||
2-D, it is quite possible to support looking up and down to at least
|
||||
some extent, particularly if the world dataset is restricted so that,
|
||||
for example, there are never two rooms stacked on top of each other, or
|
||||
any tilted walls. For simplicity’s sake, I have chosen not to implement
|
||||
any tilted walls. For simplicity's sake, I have chosen not to implement
|
||||
this in Listing 62.1, but you may find it educational to add it to the
|
||||
program yourself.
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ the right of the viewer.
|
|||
|
||||
As I discussed in the previous chapter, rotation to a new coordinate
|
||||
system can be performed by using the dot product to project points onto
|
||||
the axes of the new coordinate system, and that’s what
|
||||
the axes of the new coordinate system, and that's what
|
||||
**TransformVertices()** does, after first translating (moving) the
|
||||
coordinate system to have its origin at the viewpoint. (It’s necessary
|
||||
coordinate system to have its origin at the viewpoint. (It's necessary
|
||||
to perform the translation first so that the viewing rotation is around
|
||||
the viewpoint.) Note that this operation can equivalently be viewed as a
|
||||
matrix math operation, and that this is in fact the more common way to
|
||||
|
|
@ -82,8 +82,8 @@ in turn. First, the z coordinates of the two ends of the wall are
|
|||
calculated. (Remember, walls are vertical and their ends go straight up
|
||||
and down, so the top and bottom of each end have the same x and z
|
||||
coordinates.) If both ends are on the near side of the front clip plane,
|
||||
then the polygon is fully clipped, and we’re done with it. If both ends
|
||||
are on the far side, then the polygon isn’t z-clipped, and we leave it
|
||||
then the polygon is fully clipped, and we're done with it. If both ends
|
||||
are on the far side, then the polygon isn't z-clipped, and we leave it
|
||||
unchanged. If the polygon straddles the near clip plane, then the wall
|
||||
is trimmed to stop at the near clip plane by adjusting the t value of
|
||||
the nearest endpoint appropriately; this calculation is a simple matter
|
||||
|
|
@ -99,7 +99,7 @@ the screen. Like z-clipping, x-clipping can be done as a 2-D clip,
|
|||
because the walls and the left and right sides of the frustum are all
|
||||
vertical. We compare both the start and endpoint of each wall to the
|
||||
left and right sides of the frustum, and reject, accept, or clip each
|
||||
wall’s t values accordingly. The test for x clipping is very simple,
|
||||
wall's t values accordingly. The test for x clipping is very simple,
|
||||
because the edges of the frustum are defined as the planes where x==z
|
||||
and -x==z.
|
||||
|
||||
|
|
@ -114,15 +114,15 @@ rejection in y, using y==z and ==z as the y boundaries of the frustum.
|
|||
However, we leave partial clipping to be handled as a 2-D clipping
|
||||
problem; we are able to do this only because our earlier z-clip to the
|
||||
near clip plane guarantees that no remaining polygon point can have
|
||||
z\<=0, ensuring that when we project we’ll always pass valid,
|
||||
z\<=0, ensuring that when we project we'll always pass valid,
|
||||
y-clippable screenspace vertices to the polygon filler.
|
||||
|
||||
### Projection to Screenspace {#Heading8}
|
||||
|
||||
At this point, we have viewspace vertices for each wall that’s at least
|
||||
At this point, we have viewspace vertices for each wall that's at least
|
||||
partially visible. All we have to do is project these vertices according
|
||||
to z distance—that is, perform perspective projection—and scale the
|
||||
results to the width of the screen, then we’ll be ready to draw.
|
||||
results to the width of the screen, then we'll be ready to draw.
|
||||
Although this step is logically separate from clipping, it is performed
|
||||
as the last step for visible walls in **ClipWalls()**.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue