diff options
Diffstat (limited to 'indra/llmath/lloctree.h')
-rw-r--r-- | indra/llmath/lloctree.h | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index fab8070259..90d4d742c9 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -2,30 +2,25 @@ * @file lloctree.h * @brief Octree declaration. * - * $LicenseInfo:firstyear=2005&license=viewergpl$ - * - * Copyright (c) 2005-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,10 +32,10 @@ #include <vector> #include <set> -#ifdef LL_RELEASE_FOR_DOWNLOAD -#define OCT_ERRS llwarns +#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG +#define OCT_ERRS LL_ERRS("OctreeErrors") #else -#define OCT_ERRS llerrs +#define OCT_ERRS LL_WARNS("OctreeErrors") #endif #define LL_OCTREE_PARANOIA_CHECK 0 @@ -64,11 +59,10 @@ public: }; template <class T> -class LLOctreeTraveler : public LLTreeTraveler<T> +class LLOctreeTraveler { public: - virtual void traverse(const LLTreeNode<T>* node); - virtual void visit(const LLTreeNode<T>* state) { } + virtual void traverse(const LLOctreeNode<T>* node); virtual void visit(const LLOctreeNode<T>* branch) = 0; }; @@ -183,7 +177,6 @@ public: { mMax.mdV[i] = mCenter.mdV[i] + mSize.mdV[i]; mMin.mdV[i] = mCenter.mdV[i] - mSize.mdV[i]; - mCenter.mdV[i] = mCenter.mdV[i]; } } @@ -330,6 +323,16 @@ public: //push center in direction of data LLOctreeNode<T>::pushCenter(center, size, data); + // handle case where floating point number gets too small + if( llabs(center.mdV[0] - getCenter().mdV[0]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[1] - getCenter().mdV[1]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[2] - getCenter().mdV[2]) < F_APPROXIMATELY_ZERO) + { + mData.insert(data); + BaseType::insert(data); + return true; + } + #if LL_OCTREE_PARANOIA_CHECK if (getChildCount() == 8) { @@ -567,8 +570,6 @@ public: { } - bool isLeaf() { return false; } - bool balance() { if (this->getChildCount() == 1 && @@ -691,19 +692,16 @@ public: } }; - //======================== // LLOctreeTraveler //======================== template <class T> -void LLOctreeTraveler<T>::traverse(const LLTreeNode<T>* tree_node) +void LLOctreeTraveler<T>::traverse(const LLOctreeNode<T>* node) { - const LLOctreeNode<T>* node = (const LLOctreeNode<T>*) tree_node; node->accept(this); for (U32 i = 0; i < node->getChildCount(); i++) { traverse(node->getChild(i)); } } - #endif |