Change HTML4 entities to HTML5
< to < > to > & to &
This commit is contained in:
parent
56a4baa60e
commit
b8e7ce7165
105 changed files with 1117 additions and 1117 deletions
58
51-04.html
58
51-04.html
|
|
@ -42,34 +42,34 @@
|
|||
/* Transforms all vertices in the specified object into view spa ce, then
|
||||
perspective projects them to screen space and maps them to screen coordinates,
|
||||
storing the results in the object. */
|
||||
#include <math.h>
|
||||
#include <math.h>
|
||||
#include “polygon.h”/
|
||||
|
||||
void XformAndProjectPoints(double Xform[4][4],
|
||||
struct Object * ObjectToXform)
|
||||
{
|
||||
int i, NumPoints = ObjectToXform->NumVerts;
|
||||
struct Point3 * Points = ObjectToXform->VertexList;
|
||||
struct Point3 * XformedPoints = ObjectToXform->XformedVertexList;
|
||||
struct Point3 * ProjectedPoints = ObjectToXform->ProjectedVertexList;
|
||||
struct Point * ScreenPoints = ObjectToXform->ScreenVertexList;
|
||||
int i, NumPoints = ObjectToXform->NumVerts;
|
||||
struct Point3 * Points = ObjectToXform->VertexList;
|
||||
struct Point3 * XformedPoints = ObjectToXform->XformedVertexList;
|
||||
struct Point3 * ProjectedPoints = ObjectToXform->ProjectedVertexList;
|
||||
struct Point * ScreenPoints = ObjectToXform->ScreenVertexList;
|
||||
|
||||
for (i=0; i<NumPoints; i++, Points++, XformedPoints++,
|
||||
for (i=0; i<NumPoints; i++, Points++, XformedPoints++,
|
||||
ProjectedPoints++, ScreenPoints++) {
|
||||
/* Transform to view space */
|
||||
XformVec(Xform, (double *)Points, (double *)XformedPoints);
|
||||
/* Perspective-project to screen space */
|
||||
ProjectedPoints->X = XformedPoints->X / XformedPoints->Z *
|
||||
ProjectedPoints->X = XformedPoints->X / XformedPoints->Z *
|
||||
PROJECTION_RATIO * (SCREEN_WIDTH / 2.0);
|
||||
ProjectedPoints->Y = XformedPoints->Y / XformedPoints->Z *
|
||||
ProjectedPoints->Y = XformedPoints->Y / XformedPoints->Z *
|
||||
PROJECTION_RATIO * (SCREEN_WIDTH / 2.0);
|
||||
ProjectedPoints->Z = XformedPoints->Z;
|
||||
ProjectedPoints->Z = XformedPoints->Z;
|
||||
/* Convert to screen coordinates. The Y coord is negated to
|
||||
flip from increasing Y being up to increasing Y being down,
|
||||
as expected by the polygon filler. Add in half the screen
|
||||
width and height to center on the screen. */
|
||||
ScreenPoints->X = ((int) floor(ProjectedPoints->X + 0.5)) + SCREEN_WIDTH/2;
|
||||
ScreenPoints->Y = (-((int) floor(ProjectedPoints->Y + 0.5))) +
|
||||
ScreenPoints->X = ((int) floor(ProjectedPoints->X + 0.5)) + SCREEN_WIDTH/2;
|
||||
ScreenPoints->Y = (-((int) floor(ProjectedPoints->Y + 0.5))) +
|
||||
SCREEN_HEIGHT/2;
|
||||
}
|
||||
}
|
||||
|
|
@ -85,19 +85,19 @@ void XformAndProjectPoints(double Xform[4][4],
|
|||
|
||||
void DrawVisibleFaces(struct Object * ObjectToXform)
|
||||
{
|
||||
int i, j, NumFaces = ObjectToXform->NumFaces, NumVertices;
|
||||
int i, j, NumFaces = ObjectToXform->NumFaces, NumVertices;
|
||||
int * VertNumsPtr;
|
||||
struct Face * FacePtr = ObjectToXform->FaceList;
|
||||
struct Point * ScreenPoints = ObjectToXform->ScreenVertexList;
|
||||
struct Face * FacePtr = ObjectToXform->FaceList;
|
||||
struct Point * ScreenPoints = ObjectToXform->ScreenVertexList;
|
||||
long v1,v2,w1,w2;
|
||||
struct Point Vertices[MAX_POLY_LENGTH];
|
||||
struct PointListHeader Polygon;
|
||||
|
||||
/* Draw each visible face (polygon) of the object in turn */
|
||||
for (i=0; i<NumFaces; i++, FacePtr++) {
|
||||
NumVertices = FacePtr->NumVerts;
|
||||
for (i=0; i<NumFaces; i++, FacePtr++) {
|
||||
NumVertices = FacePtr->NumVerts;
|
||||
/* Copy over the face’s vertices from the vertex list */
|
||||
for (j=0, VertNumsPtr=FacePtr->VertNums; j<NumVertices; j++)
|
||||
for (j=0, VertNumsPtr=FacePtr->VertNums; j<NumVertices; j++)
|
||||
Vertices[j] = ScreenPoints[*VertNumsPtr++];
|
||||
/* Draw only if outside face showing (if the normal to the
|
||||
polygon points toward the viewer; that is, has a positive
|
||||
|
|
@ -106,30 +106,30 @@ void DrawVisibleFaces(struct Object * ObjectToXform)
|
|||
w1 = Vertices[NumVertices-1].X - Vertices[0].X;
|
||||
v2 = Vertices[1].Y - Vertices[0].Y;
|
||||
w2 = Vertices[NumVertices-1].Y - Vertices[0].Y;
|
||||
if ((v1*w2 - v2*w1) > 0) {
|
||||
if ((v1*w2 - v2*w1) > 0) {
|
||||
/* It is facing the screen, so draw */
|
||||
/* Appropriately adjust the extent of the rectangle used to
|
||||
erase this page later */
|
||||
for (j=0; j<NumVertices; j++) {
|
||||
if (Vertices[j].X > EraseRect[NonDisplayedPage].Right)
|
||||
if (Vertices[j].X < SCREEN_WIDTH)
|
||||
for (j=0; j<NumVertices; j++) {
|
||||
if (Vertices[j].X > EraseRect[NonDisplayedPage].Right)
|
||||
if (Vertices[j].X < SCREEN_WIDTH)
|
||||
EraseRect[NonDisplayedPage].Right = Vertices[j].X;
|
||||
else EraseRect[NonDisplayedPage].Right = SCREEN_WIDTH;
|
||||
if (Vertices[j].Y > EraseRect[NonDisplayedPage].Bottom)
|
||||
if (Vertices[j].Y < SCREEN_HEIGHT)
|
||||
if (Vertices[j].Y > EraseRect[NonDisplayedPage].Bottom)
|
||||
if (Vertices[j].Y < SCREEN_HEIGHT)
|
||||
EraseRect[NonDisplayedPage].Bottom = Vertices[j].Y;
|
||||
else EraseRect[NonDisplayedPage].Bottom=SCREEN_HEIGHT;
|
||||
if (Vertices[j].X < EraseRect[NonDisplayedPage].Left)
|
||||
if (Vertices[j].X > 0)
|
||||
if (Vertices[j].X < EraseRect[NonDisplayedPage].Left)
|
||||
if (Vertices[j].X > 0)
|
||||
EraseRect[NonDisplayedPage].Left = Vertices[j].X;
|
||||
else EraseRect[NonDisplayedPage].Left = 0;
|
||||
if (Vertices[j].Y < EraseRect[NonDisplayedPage].Top)
|
||||
if (Vertices[j].Y > 0)
|
||||
if (Vertices[j].Y < EraseRect[NonDisplayedPage].Top)
|
||||
if (Vertices[j].Y > 0)
|
||||
EraseRect[NonDisplayedPage].Top = Vertices[j].Y;
|
||||
else EraseRect[NonDisplayedPage].Top = 0;
|
||||
}
|
||||
/* Draw the polygon */
|
||||
DRAW_POLYGON(Vertices, NumVertices, FacePtr->Color, 0, 0);
|
||||
DRAW_POLYGON(Vertices, NumVertices, FacePtr->Color, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue