diff options
Diffstat (limited to 'dep')
| -rw-r--r-- | dep/include/g3dlite/G3D/Vector3.inl | 6 | ||||
| -rw-r--r-- | dep/include/g3dlite/G3D/g3dmath.inl | 56 | ||||
| -rw-r--r-- | dep/src/g3dlite/Box.cpp | 94 |
3 files changed, 78 insertions, 78 deletions
diff --git a/dep/include/g3dlite/G3D/Vector3.inl b/dep/include/g3dlite/G3D/Vector3.inl index 99110ffc8eb..e2f328165bb 100644 --- a/dep/include/g3dlite/G3D/Vector3.inl +++ b/dep/include/g3dlite/G3D/Vector3.inl @@ -13,11 +13,11 @@ //---------------------------------------------------------------------------- #ifdef SSE - // If you receive an error on this line, it is because you do not have the file - // xmmintrin.h needed for MMX & SSE extensions. Download and install + // If you receive an error on this line, it is because you do not have the file + // xmmintrin.h needed for MMX & SSE extensions. Download and install // // http://download.microsoft.com/download/vstudio60ent/SP5/Wideband-Full/WIN98Me/EN-US/vs6sp5.exe - // and + // and // http://download.microsoft.com/download/vb60ent/Update/6/W9X2KXP/EN-US/vcpp5.exe // // to get this file. diff --git a/dep/include/g3dlite/G3D/g3dmath.inl b/dep/include/g3dlite/G3D/g3dmath.inl index 1068ed5bf81..ad685bc5ce4 100644 --- a/dep/include/g3dlite/G3D/g3dmath.inl +++ b/dep/include/g3dlite/G3D/g3dmath.inl @@ -42,46 +42,46 @@ inline int iCeil (double fValue) { inline int iClamp(int val, int low, int hi) { debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } } //---------------------------------------------------------------------------- inline double clamp(double val, double low, double hi) { debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } } inline float clamp(float val, float low, float hi) { debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } } //---------------------------------------------------------------------------- inline int iWrap(int val, int hi) { - if (val < 0) { - return ((val % hi) + hi) % hi; - } else { - return val % hi; - } + if (val < 0) { + return ((val % hi) + hi) % hi; + } else { + return val % hi; + } } //---------------------------------------------------------------------------- @@ -142,11 +142,11 @@ inline double aTan2 (double fY, double fX) { inline double sign (double fValue) { if (fValue > 0.0) { return 1.0; - } + } if (fValue < 0.0) { return -1.0; - } + } return 0.0; } diff --git a/dep/src/g3dlite/Box.cpp b/dep/src/g3dlite/Box.cpp index c30211fd5b9..fd3067048c0 100644 --- a/dep/src/g3dlite/Box.cpp +++ b/dep/src/g3dlite/Box.cpp @@ -131,21 +131,21 @@ void Box::getFaceCorners(int f, Vector3& v0, Vector3& v1, Vector3& v2, Vector3& bool Box::culledBy( - const Array<Plane>& plane, - int& cullingPlaneIndex, - const uint32 inMask, - uint32& outMask) const { + const Array<Plane>& plane, + int& cullingPlaneIndex, + const uint32 inMask, + uint32& outMask) const { - return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask, outMask); + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask, outMask); } bool Box::culledBy( - const Array<Plane>& plane, - int& cullingPlaneIndex, - const uint32 inMask) const { + const Array<Plane>& plane, + int& cullingPlaneIndex, + const uint32 inMask) const { - return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask); + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask); } @@ -154,23 +154,23 @@ int32 Box::dummy = 0; bool Box::culledBy( const class Plane* plane, int numPlanes, - int& cullingPlane, - const uint32 _inMask, + int& cullingPlane, + const uint32 _inMask, uint32& childMask) const { - uint32 inMask = _inMask; - assert(numPlanes < 31); + uint32 inMask = _inMask; + assert(numPlanes < 31); childMask = 0; // See if there is one plane for which all of the - // vertices are in the negative half space. + // vertices are in the negative half space. for (int p = 0; p < numPlanes; p++) { - // Only test planes that are not masked - if ((inMask & 1) != 0) { - - Vector3 corner; + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + Vector3 corner; int numContained = 0; int v = 0; @@ -178,36 +178,36 @@ bool Box::culledBy( // We can early-out only if we have found one point on each // side of the plane (i.e. if we are straddling). That // occurs when (numContained < v) && (numContained > 0) - for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { + for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { if (plane[p].halfSpaceContains(getCorner(v))) { ++numContained; } - } + } - if (numContained == 0) { - // Plane p culled the box - cullingPlane = p; + if (numContained == 0) { + // Plane p culled the box + cullingPlane = p; // The caller should not recurse into the children, // since the parent is culled. If they do recurse, // make them only test against this one plane, which // will immediately cull the volume. childMask = 1 << p; - return true; + return true; } else if (numContained < v) { // The bounding volume straddled the plane; we have // to keep testing against this plane childMask |= (1 << p); } - } + } // Move on to the next bit. - inMask = inMask >> 1; + inMask = inMask >> 1; } // None of the planes could cull this box - cullingPlane = -1; + cullingPlane = -1; return false; } @@ -215,44 +215,44 @@ bool Box::culledBy( bool Box::culledBy( const class Plane* plane, int numPlanes, - int& cullingPlane, - const uint32 _inMask) const { + int& cullingPlane, + const uint32 _inMask) const { - uint32 inMask = _inMask; - assert(numPlanes < 31); + uint32 inMask = _inMask; + assert(numPlanes < 31); // See if there is one plane for which all of the - // vertices are in the negative half space. + // vertices are in the negative half space. for (int p = 0; p < numPlanes; p++) { - // Only test planes that are not masked - if ((inMask & 1) != 0) { - - bool culled = true; + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + bool culled = true; int v; - // Assume this plane culls all points. See if there is a point - // not culled by the plane... early out when at least one point + // Assume this plane culls all points. See if there is a point + // not culled by the plane... early out when at least one point // is in the positive half space. - for (v = 0; (v < 8) && culled; ++v) { + for (v = 0; (v < 8) && culled; ++v) { culled = ! plane[p].halfSpaceContains(getCorner(v)); - } + } - if (culled) { - // Plane p culled the box - cullingPlane = p; + if (culled) { + // Plane p culled the box + cullingPlane = p; - return true; + return true; } - } + } // Move on to the next bit. - inMask = inMask >> 1; + inMask = inMask >> 1; } // None of the planes could cull this box - cullingPlane = -1; + cullingPlane = -1; return false; } |
