Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

drawbbox.c File Reference

Go to the source code of this file.

Functions

void DrawFace (geWorld *World, const geVec3d **Verts)
void DrawBoundBox (geWorld *World, const geVec3d *Pos, const geVec3d *Min, const geVec3d *Max)


Function Documentation

void DrawBoundBox geWorld World,
const geVec3d Pos,
const geVec3d Min,
const geVec3d Max
 

Definition at line 25 of file drawbbox.c.

References DrawFace(), geFloat, geVec3d_Add(), geVec3d::X, geVec3d::Y, and geVec3d::Z.

00026 {
00027         geFloat dx;
00028         geFloat dy;
00029         geFloat dz;
00030 static  geVec3d         Verts[8];
00031 static  geVec3d *       Faces[6][4] =
00032 {
00033         { &Verts[0], &Verts[1], &Verts[2], &Verts[3] }, //Top
00034         { &Verts[4], &Verts[5], &Verts[6], &Verts[7] }, //Bottom
00035         { &Verts[3], &Verts[2], &Verts[6], &Verts[7] }, //Side
00036         { &Verts[1], &Verts[0], &Verts[4], &Verts[5] }, //Side
00037         { &Verts[0], &Verts[3], &Verts[7], &Verts[4] }, //Front
00038         { &Verts[2], &Verts[1], &Verts[5], &Verts[6] }, //Back
00039 };
00040         int                     i;
00041 
00042         for     (i = 0; i < 8; i++)
00043                 geVec3d_Add(Pos, Min, &Verts[i]);
00044 
00045         dx = Max->X - Min->X;
00046         dy = Max->Y - Min->Y;
00047         dz = Max->Z - Min->Z;
00048 
00049         Verts[0].Y += dy;
00050         Verts[3].Y += dy;
00051         Verts[3].X += dx;
00052         Verts[7].X += dx;
00053 
00054         Verts[1].Y += dy;
00055         Verts[1].Z += dz;
00056         Verts[5].Z += dz;
00057         Verts[6].Z += dz;
00058         Verts[6].X += dx;
00059 
00060         Verts[2].X += dx;
00061         Verts[2].Y += dy;
00062         Verts[2].Z += dz;
00063 
00064         for     (i = 0; i < 6; i++)
00065                 DrawFace(World, &Faces[i][0]);
00066 }

void DrawFace geWorld World,
const geVec3d **  Verts
[static]
 

Definition at line 6 of file drawbbox.c.

References GE_LVertex::a, GE_LVertex::b, GE_LVertex::g, GE_GOURAUD_POLY, geFloat, geWorld_AddPolyOnce(), NULL, GE_LVertex::r, geVec3d::X, GE_LVertex::X, geVec3d::Y, GE_LVertex::Y, geVec3d::Z, and GE_LVertex::Z.

Referenced by DrawBoundBox().

00007 {
00008         GE_LVertex      LVerts[4];
00009         int                     i;
00010 
00011         for     (i = 0; i < 4; i++)
00012         {
00013                 LVerts[i].r = 40.0f;
00014                 LVerts[i].g = 40.0f;
00015                 LVerts[i].b = 80.0f + 20.0f * (geFloat)i;
00016                 LVerts[i].a = 128.0f;
00017                 LVerts[i].X = Verts[i]->X;
00018                 LVerts[i].Y = Verts[i]->Y;
00019                 LVerts[i].Z = Verts[i]->Z;
00020         }
00021 
00022         geWorld_AddPolyOnce(World, &LVerts[0], 4, NULL, GE_GOURAUD_POLY, GE_FX_TRANSPARENT, 1.0f);
00023 }


Generated on Tue Sep 30 12:37:26 2003 for GTestAndEngine by doxygen 1.3.2