void C_TestTraceline::DrawCube( Vector& center, unsigned char* pColor ) { Vector facePoints[8]; Vector bmins, bmaxs; bmins[0] = center[0] - CUBE_SIZE; bmins[1] = center[1] - CUBE_SIZE; bmins[2] = center[2] - CUBE_SIZE; bmaxs[0] = center[0] + CUBE_SIZE; bmaxs[1] = center[1] + CUBE_SIZE; bmaxs[2] = center[2] + CUBE_SIZE; facePoints[0][0] = bmins[0]; facePoints[0][1] = bmins[1]; facePoints[0][2] = bmins[2]; facePoints[1][0] = bmins[0]; facePoints[1][1] = bmins[1]; facePoints[1][2] = bmaxs[2]; facePoints[2][0] = bmins[0]; facePoints[2][1] = bmaxs[1]; facePoints[2][2] = bmins[2]; facePoints[3][0] = bmins[0]; facePoints[3][1] = bmaxs[1]; facePoints[3][2] = bmaxs[2]; facePoints[4][0] = bmaxs[0]; facePoints[4][1] = bmins[1]; facePoints[4][2] = bmins[2]; facePoints[5][0] = bmaxs[0]; facePoints[5][1] = bmins[1]; facePoints[5][2] = bmaxs[2]; facePoints[6][0] = bmaxs[0]; facePoints[6][1] = bmaxs[1]; facePoints[6][2] = bmins[2]; facePoints[7][0] = bmaxs[0]; facePoints[7][1] = bmaxs[1]; facePoints[7][2] = bmaxs[2]; int nFaces[6][4] = { { 0, 2, 3, 1 }, { 0, 1, 5, 4 }, { 4, 5, 7, 6 }, { 2, 6, 7, 3 }, { 1, 3, 7, 5 }, { 0, 4, 6, 2 } }; for (int nFace = 0; nFace < 6; nFace++) { int nP1, nP2, nP3, nP4; nP1 = nFaces[nFace][0]; nP2 = nFaces[nFace][1]; nP3 = nFaces[nFace][2]; nP4 = nFaces[nFace][3]; // Draw the face. CMeshBuilder meshBuilder; IMesh* pMesh = materials->GetDynamicMesh(); meshBuilder.DrawQuad( pMesh, facePoints[nP1].Base(), facePoints[nP2].Base(), facePoints[nP3].Base(), facePoints[nP4].Base(), pColor, true ); } }