Remove colour attributes from body and strip most of the font tags out

This commit is contained in:
James Gregory 2013-12-30 13:57:02 +11:00
commit c1f88ddb41
362 changed files with 1632 additions and 1706 deletions

View file

@ -24,7 +24,7 @@
<!--CHAPTER=62//-->
<!--PAGES=1160-1162//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//--></HEAD><BODY LINK=#0000FF ALINK=#000099 VLINK=#0000FF BGCOLOR=#FFFFFF>
<!--UNASSIGNED2//--></HEAD><body>
<CENTER>
<TABLE BORDER>
@ -37,7 +37,7 @@
</CENTER>
<P><BR></P>
</P>
<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Walking the Tree, Backface Culling and Drawing</FONT></H3>
<H3><A NAME="Heading9"></A>Walking the Tree, Backface Culling and Drawing</H3>
<P>Now that we have all the walls clipped to the frustum, with vertices projected into screen coordinates, all we have to do is draw them back to front; that&rsquo;s the job of <B>DrawWallsBackToFront()</B>. Basically, this routine walks the BSP tree, descending recursively from each node to draw the farther children of each node first, then the wall at the node, then the nearer children. In the interests of efficiency, this particular implementation performs a data-recursive walk of the tree, rather than the more familiar code recursion. Interestingly, the performance speedup from data recursion turned out to be more modest than I had expected, based on past experience; see Chapter 59 for further details.</P>
<P>As it comes to each wall, <B>DrawWallsBackToFront()</B> first descends to draw the farther subtree. Next, if the wall is both visible and pointing toward the viewer, it is drawn as a solid polygon. The polygon filler (not shown in Listing 62.1) is a modification of the polygon filler I presented in Chapters 38 and 39.</P>
<P>It&rsquo;s worth noting how backface culling and front/back wall orientation testing are performed. (Note that walls are always one-sided, visible only from the front.) I discussed backface culling in general in the previous chapter, and mentioned two possible approaches: generating a screenspace normal (perpendicular vector) to the polygon and seeing which way that points, or taking the world or screenspace dot product between the vector from the viewpoint to any polygon point and the polygon&rsquo;s normal and checking the sign. Listing 62.1 does both, but because our BSP tree is 2-D and the viewer is always upright, we can save some work.</P>
@ -45,9 +45,9 @@
<P>The wall orinetation test used for walking the BSP tree, performed in <B>WallFacingViewer()</B> takes the other approach, and checks the viewspace sign of the dot product of the wall&rsquo;s normal with a vector from the viewpoint to the wall. Again, this code takes advantage of the 2-D nature of the tree to generate the wall normal by swapping x and z and altering signs. We can&rsquo;t use the quicker screenspace x test here that we used for backface culling, because not all walls can be projected into screenspace; for example, trying to project a wall at z==0 would result in division by zero.</P>
<P>All the visible, front-facing walls are drawn into a buffer by <B>DrawWallsBackToFront()</B>, then <B>UpdateWorld()</B> calls Win32 to copy the new frame to the screen. The frame of animation is complete.</P>
<P><A NAME="Fig4"><!-- </A><A HREF="javascript:displayWindow('images/62-04.jpg',390,207 )"> --><IMG SRC="images/62-04.jpg"><BR><!-- </A>
<BR><A HREF="javascript:displayWindow('images/62-04.jpg',390,207)"> --><FONT COLOR="#000077"><B>Figure 62.4</B></FONT></A>&nbsp;&nbsp;<I>Fast backspace culling test in screenspace.</I>
<BR><A HREF="javascript:displayWindow('images/62-04.jpg',390,207)"> --><B>Figure 62.4</B></A>&nbsp;&nbsp;<I>Fast backspace culling test in screenspace.</I>
</P>
<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">Notes on the BSP Renderer</FONT></H4>
<H4 ALIGN="LEFT"><A NAME="Heading10"></A>Notes on the BSP Renderer</H4>
<P>Listing 62.1 is far from complete or optimal. There is no such thing as a tiny BSP rendering demo, because 3D rendering, even when based on a 2-D BSP tree, requires a substantial amount of code and complexity. Listing 62.1 is reasonably close to a minimum rendering engine, and is specifically intended to illuminate basic BSP principles, given the space limitations of one chapter in a book that&rsquo;s already larger than it should be. Think of Listing 62.1 as a learning tool and a starting point.
</P>
<P>The most obvious lack in Listing 62.1 is that there is no support for floors and ceilings; the walls float in space, unsupported. Is it necessary to go to 3-D BSP trees to get a normal-looking world?</P>
@ -65,7 +65,7 @@
<hr width="90%" size="1" noshade>
<div align="center">
<font face="Verdana,sans-serif" size="1">Graphics Programming Black Book &copy; 2001 Michael Abrash</font>
Graphics Programming Black Book &copy; 2001 Michael Abrash
</div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->