summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llsphere.cpp9
-rw-r--r--indra/llmath/lltreenode.h5
-rw-r--r--indra/llmath/llvolume.cpp52
-rw-r--r--indra/llmath/llvolumemgr.cpp2
-rw-r--r--indra/llmath/llvolumeoctree.cpp5
5 files changed, 45 insertions, 28 deletions
diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp
index 7292e3c0de..3f04ca704c 100644
--- a/indra/llmath/llsphere.cpp
+++ b/indra/llmath/llsphere.cpp
@@ -73,14 +73,14 @@ F32 LLSphere::getRadius() const
bool LLSphere::contains(const LLSphere& other_sphere) const
{
F32 separation = (mCenter - other_sphere.mCenter).length();
- return (mRadius >= separation + other_sphere.mRadius) ? true : false;
+ return mRadius >= separation + other_sphere.mRadius;
}
// returns 'true' if this sphere completely contains other_sphere
bool LLSphere::overlaps(const LLSphere& other_sphere) const
{
F32 separation = (mCenter - other_sphere.mCenter).length();
- return (separation <= mRadius + other_sphere.mRadius) ? true : false;
+ return mRadius >= separation - other_sphere.mRadius;
}
// returns overlap
@@ -93,9 +93,8 @@ F32 LLSphere::getOverlap(const LLSphere& other_sphere) const
bool LLSphere::operator==(const LLSphere& rhs) const
{
- // TODO? -- use approximate equality for centers?
- return (mRadius == rhs.mRadius
- && mCenter == rhs.mCenter);
+ return fabs(mRadius - rhs.mRadius) <= FLT_EPSILON &&
+ (mCenter - rhs.mCenter).length() <= FLT_EPSILON;
}
std::ostream& operator<<( std::ostream& output_stream, const LLSphere& sphere)
diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h
index 0b479c4564..ce104b88a0 100644
--- a/indra/llmath/lltreenode.h
+++ b/indra/llmath/lltreenode.h
@@ -56,10 +56,11 @@ public:
virtual bool insert(T* data);
virtual bool remove(T* data);
virtual void notifyRemoval(T* data);
- virtual U32 getListenerCount() { return mListeners.size(); }
+ virtual U32 hasListeners() const { return !mListeners.empty(); }
+ virtual U32 getListenerCount() const { return mListeners.size(); }
virtual LLTreeListener<T>* getListener(U32 index) const
{
- if(index < mListeners.size())
+ if (index < mListeners.size())
{
return mListeners[index];
}
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 5375e2813b..a4b039fd55 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -6878,45 +6878,63 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
mIndices[cur_index++] = s+1 + mNumS*t; //bottom right
mIndices[cur_index++] = s+1 + mNumS*(t+1); //top right
- mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; //bottom left/top right neighbor face
- if (t < mNumT-2) { //top right/top left neighbor face
+ // bottom left/top right neighbor face
+ mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1;
+
+ if (t < mNumT-2)
+ { // top right/top left neighbor face
mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1;
}
- else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor
+ else if (mNumT <= 3 || volume->getPath().isOpen())
+ { // no neighbor
mEdge[cur_edge++] = -1;
}
- else { //wrap on T
+ else
+ { // wrap on T
mEdge[cur_edge++] = s*2+1;
}
- if (s > 0) { //top left/bottom left neighbor face
+
+ if (s > 0)
+ { // top left/bottom left neighbor face
mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1;
}
- else if (flat_face || volume->getProfile().isOpen() == true) { //no neighbor
+ else if (flat_face || volume->getProfile().isOpen())
+ { // no neighbor
mEdge[cur_edge++] = -1;
}
- else { //wrap on S
+ else
+ { // wrap on S
mEdge[cur_edge++] = (mNumS-1)*2*t+(mNumS-2)*2+1;
}
-
- if (t > 0) { //bottom left/bottom right neighbor face
+
+ if (t > 0)
+ { // bottom left/bottom right neighbor face
mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2;
}
- else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor
+ else if (mNumT <= 3 || volume->getPath().isOpen())
+ { // no neighbor
mEdge[cur_edge++] = -1;
}
- else { //wrap on T
+ else
+ { // wrap on T
mEdge[cur_edge++] = (mNumS-1)*2*(mNumT-2)+s*2;
}
- if (s < mNumS-2) { //bottom right/top right neighbor face
+
+ if (s < mNumS-2)
+ { // bottom right/top right neighbor face
mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2;
}
- else if (flat_face || volume->getProfile().isOpen() == true) { //no neighbor
+ else if (flat_face || volume->getProfile().isOpen())
+ { // no neighbor
mEdge[cur_edge++] = -1;
}
- else { //wrap on S
+ else
+ { // wrap on S
mEdge[cur_edge++] = (mNumS-1)*2*t;
}
- mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; //top right/bottom left neighbor face
+
+ // top right/bottom left neighbor face
+ mEdge[cur_edge++] = (mNumS-1)*2*t+s*2;
}
}
}
@@ -7053,7 +7071,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
if (sculpt_stitching == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes
{
- if (volume->getPath().isOpen() == false)
+ if (!volume->getPath().isOpen())
{ //wrap normals on T
for (S32 i = 0; i < mNumS; i++)
{
@@ -7064,7 +7082,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
}
}
- if ((volume->getProfile().isOpen() == false) && !(s_bottom_converges))
+ if (!volume->getProfile().isOpen() && !s_bottom_converges)
{ //wrap normals on S
for (S32 i = 0; i < mNumT; i++)
{
diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp
index d1e145cff1..06794fd23f 100644
--- a/indra/llmath/llvolumemgr.cpp
+++ b/indra/llmath/llvolumemgr.cpp
@@ -71,7 +71,7 @@ bool LLVolumeMgr::cleanup()
iter != end; iter++)
{
LLVolumeLODGroup *volgroupp = iter->second;
- if (volgroupp->cleanupRefs() == false)
+ if (!volgroupp->cleanupRefs())
{
no_refs = false;
}
diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp
index cef4d66c04..61455affec 100644
--- a/indra/llmath/llvolumeoctree.cpp
+++ b/indra/llmath/llvolumeoctree.cpp
@@ -71,10 +71,9 @@ bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, c
grt = f.greaterThan(rhs).getGatheredBits();
- return (grt & 0x7) ? false : true;
+ return (grt & 0x7) == 0;
}
-
LLVolumeOctreeListener::LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* node)
{
node->addListener(this);
@@ -84,7 +83,7 @@ LLVolumeOctreeListener::~LLVolumeOctreeListener()
{
}
-
+
void LLVolumeOctreeListener::handleChildAddition(const LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* parent,
LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* child)
{