summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolumemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath/llvolumemgr.cpp')
-rwxr-xr-x[-rw-r--r--]indra/llmath/llvolumemgr.cpp68
1 files changed, 36 insertions, 32 deletions
diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp
index 53641fceab..3b8f08e0c6 100644..100755
--- a/indra/llmath/llvolumemgr.cpp
+++ b/indra/llmath/llvolumemgr.cpp
@@ -1,38 +1,31 @@
/**
* @file llvolumemgr.cpp
*
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2002-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2002&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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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$
*/
#include "linden_common.h"
#include "llvolumemgr.h"
-#include "llmemtype.h"
#include "llvolume.h"
@@ -154,7 +147,7 @@ void LLVolumeMgr::unrefVolume(LLVolume *volumep)
volume_lod_group_map_t::iterator iter = mVolumeLODGroups.find(params);
if( iter == mVolumeLODGroups.end() )
{
- llerrs << "Warning! Tried to cleanup unknown volume type! " << *params << llendl;
+ LL_ERRS() << "Warning! Tried to cleanup unknown volume type! " << *params << LL_ENDL;
if (mDataMutex)
{
mDataMutex->unlock();
@@ -188,7 +181,6 @@ void LLVolumeMgr::insertGroup(LLVolumeLODGroup* volgroup)
// protected
LLVolumeLODGroup* LLVolumeMgr::createNewGroup(const LLVolumeParams& volume_params)
{
- LLMemType m1(LLMemType::MTYPE_VOLUME);
LLVolumeLODGroup* volgroup = new LLVolumeLODGroup(volume_params);
insertGroup(volgroup);
return volgroup;
@@ -215,7 +207,7 @@ void LLVolumeMgr::dump()
{
mDataMutex->unlock();
}
- llinfos << "Average usage of LODs " << avg << llendl;
+ LL_INFOS() << "Average usage of LODs " << avg << LL_ENDL;
}
void LLVolumeMgr::useMutex()
@@ -278,18 +270,18 @@ bool LLVolumeLODGroup::cleanupRefs()
bool res = true;
if (mRefs != 0)
{
- llwarns << "Volume group has remaining refs:" << getNumRefs() << llendl;
+ LL_WARNS() << "Volume group has remaining refs:" << getNumRefs() << LL_ENDL;
mRefs = 0;
for (S32 i = 0; i < NUM_LODS; i++)
{
if (mLODRefs[i] > 0)
{
- llwarns << " LOD " << i << " refs = " << mLODRefs[i] << llendl;
+ LL_WARNS() << " LOD " << i << " refs = " << mLODRefs[i] << LL_ENDL;
mLODRefs[i] = 0;
mVolumeLODs[i] = NULL;
}
}
- llwarns << *getVolumeParams() << llendl;
+ LL_WARNS() << *getVolumeParams() << LL_ENDL;
res = false;
}
return res;
@@ -303,7 +295,6 @@ LLVolume* LLVolumeLODGroup::refLOD(const S32 detail)
mRefs++;
if (mVolumeLODs[detail].isNull())
{
- LLMemType m1(LLMemType::MTYPE_VOLUME);
mVolumeLODs[detail] = new LLVolume(mVolumeParams, mDetailScales[detail]);
}
mLODRefs[detail]++;
@@ -320,7 +311,7 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep)
{
llassert_always(mLODRefs[i] > 0);
mLODRefs[i]--;
-#if 1 // SJB: Possible opt: keep other lods around
+#if 0 // SJB: Possible opt: keep other lods around
if (!mLODRefs[i])
{
mVolumeLODs[i] = NULL;
@@ -329,7 +320,7 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep)
return TRUE;
}
}
- llerrs << "Deref of non-matching LOD in volume LOD group" << llendl;
+ LL_ERRS() << "Deref of non-matching LOD in volume LOD group" << LL_ENDL;
return FALSE;
}
@@ -375,6 +366,19 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail)
return mDetailScales[detail];
}
+S32 LLVolumeLODGroup::getVolumeDetailFromScale(const F32 detail)
+{
+ for (S32 i = 1; i < 4; i++)
+ {
+ if (mDetailScales[i] > detail)
+ {
+ return i-1;
+ }
+ }
+
+ return 3;
+}
+
F32 LLVolumeLODGroup::dump()
{
F32 usage = 0.f;
@@ -389,7 +393,7 @@ F32 LLVolumeLODGroup::dump()
std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]);
- llinfos << dump_str << llendl;
+ LL_INFOS() << dump_str << LL_ENDL;
return usage;
}