28 #include "../precompiled.h"
38 int i, p1, p2, pointCull[8], culled, outside;
42 idMat3 localAxis, localScaled;
48 float boxMin, boxMax, base;
53 projectionBounds[0].x = boxMin - base;
54 projectionBounds[1].x = boxMax - base;
55 projectionBounds[0].y = projectionBounds[0].z = -1.0f;
56 projectionBounds[1].y = projectionBounds[1].z = 1.0f;
61 projectionBounds.
Clear();
71 for ( i = 0; i < 4; i++ ) {
75 culled &= pointCull[p1] & pointCull[p2];
76 outside |= pointCull[p1] | pointCull[p2];
90 for ( i = 0; i < 4; i++ ) {
96 for ( i = 0; i < 4; i++ ) {
103 if ( outside != 1 && outside != 2 && outside != 4 && outside != 8 ) {
107 localScaled[0] *=
dFar;
108 localScaled[1] *=
dLeft;
109 localScaled[2] *=
dUp;
112 if ( (outside & 2) && (outside & 8) ) {
113 BoundsRayIntersection( bounds, localOrigin, localScaled[0] - localScaled[1] - localScaled[2], scale1, scale2 );
114 if ( scale1 <= scale2 && scale1 >= 0.0
f ) {
119 if ( (outside & 2) && (outside & 4) ) {
120 BoundsRayIntersection( bounds, localOrigin, localScaled[0] - localScaled[1] + localScaled[2], scale1, scale2 );
121 if ( scale1 <= scale2 && scale1 >= 0.0
f ) {
126 if ( (outside & 1) && (outside & 8) ) {
127 BoundsRayIntersection( bounds, localOrigin, localScaled[0] + localScaled[1] - localScaled[2], scale1, scale2 );
128 if ( scale1 <= scale2 && scale1 >= 0.0
f ) {
133 if ( (outside & 1) && (outside & 2) ) {
134 BoundsRayIntersection( bounds, localOrigin, localScaled[0] + localScaled[1] + localScaled[2], scale1, scale2 );
135 if ( scale1 <= scale2 && scale1 >= 0.0
f ) {
GLsizei const GLfloat * points
const idVec3 & GetExtents(void) const
void AddLocalLineToProjectionBoundsUseCull(const idVec3 &start, const idVec3 &end, int startCull, int endCull, idBounds &bounds) const
idMat3 Transpose(void) const
void AddLocalLineToProjectionBoundsSetCull(const idVec3 &start, const idVec3 &end, int &startCull, int &endCull, idBounds &bounds) const
bool ProjectionBounds(const idBounds &bounds, idBounds &projectionBounds) const
void BoxToPoints(const idVec3 ¢er, const idVec3 &extents, const idMat3 &axis, idVec3 points[8])
bool AddPoint(const idVec3 &v)
const idMat3 & GetAxis(void) const
const idVec3 & GetCenter(void) const
bool BoundsRayIntersection(const idBounds &bounds, const idVec3 &start, const idVec3 &dir, float &scale1, float &scale2) const
void AxisProjection(const idVec3 &dir, float &min, float &max) const