Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -15,7 +15,7 @@ worry about.
Independent span sorting is ideal for scenes with lots of moving objects
that never actually touch each other, such as a space battle. Next,
we’ll look at an implementation of independent 1/z span sorting.
we'll look at an implementation of independent 1/z span sorting.
### 1/z Span Sorting in Action {#Heading8}
@ -89,7 +89,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
for (i=0 ; i<3 ; i++)
viewvec.v[i] = ppoly->verts[0].v[i] - currentpos.v[i];
// Use an epsilon here so we don’t get polygons tilted so
// Use an epsilon here so we don't get polygons tilted so
// sharply that the gradients are unusable or invalid
if (DotProduct (&viewvec, &pplane->normal) < -0.01)
return 1;
@ -97,7 +97,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
}
// Add the polygon’s edges to the global edge table.
// Add the polygon's edges to the global edge table.
void AddPolygonEdges (plane_t *plane, polygon2D_t *screenpoly)
{
double distinv, deltax, deltay, slope;
@ -106,7 +106,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
numverts = screenpoly->numverts;
// Clamp the polygon’s vertices just in case some very near
// Clamp the polygon's vertices just in case some very near
// points have wandered out of range due to floating-point
// imprecision
for (i=0 ; i<numverts ; i++) {
@ -129,7 +129,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
bottomy = (int)ceil(screenpoly->verts[nextvert].y);
height = bottomy - topy;
if (height == 0)
continue; // doesn’t cross any scan lines
continue; // doesn't cross any scan lines
if (height < 0) {
// Leading edge
temp = topy;
@ -172,16 +172,16 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
pavailedge->pnextremove = removeedges[bottomy - 1];
removeedges[bottomy - 1] = pavailedge;
// Associate the edge with the surface we’ll create for
// Associate the edge with the surface we'll create for
// this polygon
pavailedge->psurf = pavailsurf;
// Make sure we don’t overflow the edge array
// Make sure we don't overflow the edge array
if (pavailedge < &edges[MAX_EDGES])
pavailedge++;
}
// Create the surface, so we’ll know how to sort and draw from
// Create the surface, so we'll know how to sort and draw from
// the edges
pavailsurf->state = 0;
pavailsurf->color = currentcolor;
@ -198,7 +198,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
xcenter * pavailsurf->zinvstepx -
ycenter * pavailsurf->zinvstepy;
// Make sure we don’t overflow the surface array
// Make sure we don't overflow the surface array
if (pavailsurf < &surfs[MAX_SURFS])
pavailsurf++;
}
@ -261,14 +261,14 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
for (pedge=edgehead.pnext ; pedge ; pedge=pedge->pnext) {
psurf = pedge->psurf;
if (pedge->leading) {
// It’s a leading edge. Figure out where it is
// It's a leading edge. Figure out where it is
// relative to the current surfaces and insert in
// the surface stack; if it’s on top, emit the span
// the surface stack; if it's on top, emit the span
// for the current top.
// First, make sure the edges don’t cross
// First, make sure the edges don't cross
if (++psurf->state == 1) {
fx = (double)pedge->x * (1.0 / (double)0x10000);
// Calculate the surface’s 1/z value at this pixel
// Calculate the surface's 1/z value at this pixel
zinv = psurf->zinv00 + psurf->zinvstepx * fx +
psurf->zinvstepy * fy;
// See if that makes it a new top surface
@ -276,7 +276,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
zinv2 = psurf2->zinv00 + psurf2->zinvstepx * fx +
psurf2->zinvstepy * fy;
if (zinv >= zinv2) {
// It’s a new top surface
// It's a new top surface
// emit the span for the current top
x = (pedge->x + 0xFFFF) >> 16;
pspan->count = x - psurf2->visxstart;
@ -284,7 +284,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
pspan->y = y;
pspan->x = psurf2->visxstart;
pspan->color = psurf2->color;
// Make sure we don’t overflow
// Make sure we don't overflow
// the span array
if (pspan < &spans[MAX_SPANS])
pspan++;
@ -313,19 +313,19 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
}
}
} else {
// It’s a trailing edge; if this was the top surface,
// It's a trailing edge; if this was the top surface,
// emit the span and remove it.
// First, make sure the edges didn’t cross
// First, make sure the edges didn't cross
if (—psurf->state == 0) {
if (surfstack.pnext == psurf) {
// It’s on top, emit the span
// It's on top, emit the span
x = ((pedge->x + 0xFFFF) >> 16);
pspan->count = x - psurf->visxstart;
if (pspan->count > 0) {
pspan->y = y;
pspan->x = psurf->visxstart;
pspan->color = psurf->color;
// Make sure we don’t overflow
// Make sure we don't overflow
// the span array
if (pspan < &spans[MAX_SPANS])
pspan++;
@ -427,7 +427,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
TransformPolygon (&tpoly1, &tpoly2);
ProjectPolygon (&tpoly2, &screenpoly);
// Move the polygon’s plane into viewspace
// Move the polygon's plane into viewspace
// First move it into worldspace (object relative)
tnormal = ppoly[i].plane.normal;
plane.distance = ppoly[i].plane.distance +
@ -454,7 +454,7 @@ for real-world applications than the 3-D clipping demo from Chapter 65.
ScanEdges ();
DrawSpans ();
// We’ve drawn the frame; copy it to the screen
// We've drawn the frame; copy it to the screen
hdcScreen = GetDC(hwndOutput);
holdpal = SelectPalette(hdcScreen, hpalDIB, FALSE);
RealizePalette(hdcScreen);