summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-09-29 16:09:21 -0500
committerDave Parks <davep@lindenlab.com>2010-09-29 16:09:21 -0500
commit0c93da0501ab1debd6fa11af29a215be81f7b803 (patch)
tree6000b7d56747ddc210c52f7fea55a99a8aee6414 /indra/newview/llmeshrepository.cpp
parent91a8d7a2191e670e160e64859792db390b5d1757 (diff)
SH-224 Add new streaming cost algorithm debug displays to viewer.
Add the ability to clear LOD slots. Make triangle count UI more responsive to Generate LOD button. Add triangle count debug display for current selection. Reviewed by Nyx
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r--indra/newview/llmeshrepository.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 508e1a9444..5347b7313e 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -2121,6 +2121,28 @@ const LLMeshDecomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh
return NULL;
}
+const LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id)
+{
+ return mThread->getMeshHeader(mesh_id);
+}
+
+const LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
+{
+ static LLSD dummy_ret;
+ if (mesh_id.notNull())
+ {
+ LLMutexLock lock(mHeaderMutex);
+ mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
+ if (iter != mMeshHeader.end())
+ {
+ return iter->second;
+ }
+ }
+
+ return dummy_ret;
+}
+
+
void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints)
{
@@ -2493,6 +2515,50 @@ void LLMeshRepository::uploadError(LLSD& args)
mUploadErrorQ.push(args);
}
+//static
+F32 LLMeshRepository::getStreamingCost(const LLSD& header, F32 radius)
+{
+ F32 dlowest = llmin(radius/0.06f, 256.f);
+ F32 dlow = llmin(radius/0.24f, 256.f);
+ F32 dmid = llmin(radius/1.0f, 256.f);
+ F32 dhigh = 0.f;
+
+
+ F32 bytes_lowest = header["lowest_lod"]["size"].asReal()/1024.f;
+ F32 bytes_low = header["low_lod"]["size"].asReal()/1024.f;
+ F32 bytes_mid = header["medium_lod"]["size"].asReal()/1024.f;
+ F32 bytes_high = header["high_lod"]["size"].asReal()/1024.f;
+
+ if (bytes_high == 0.f)
+ {
+ return 0.f;
+ }
+
+ if (bytes_mid == 0.f)
+ {
+ bytes_mid = bytes_high;
+ }
+
+ if (bytes_low == 0.f)
+ {
+ bytes_low = bytes_mid;
+ }
+
+ if (bytes_lowest == 0.f)
+ {
+ bytes_lowest = bytes_low;
+ }
+
+ F32 cost = 0.f;
+ cost += llmax(256.f-dlowest, 1.f)/32.f*bytes_lowest;
+ cost += llmax(dlowest-dlow, 1.f)/32.f*bytes_low;
+ cost += llmax(dlow-dmid, 1.f)/32.f*bytes_mid;
+ cost += llmax(dmid-dhigh, 1.f)/32.f*bytes_high;
+
+ cost *= gSavedSettings.getF32("MeshStreamingCostScaler");
+ return cost;
+}
+
LLPhysicsDecomp::LLPhysicsDecomp()
: LLThread("Physics Decomp")