diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-08-11 21:14:29 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-08-11 21:14:29 +0300 |
commit | 29630be624a4470543f687a2f8bbf3b1b92940ac (patch) | |
tree | 0d45709c64464ddfbcbe5b809b23329dbead87b5 /indra/newview/llmeshrepository.cpp | |
parent | dfd7826552e890c0425433bdd6e12af8c1bb7c99 (diff) | |
parent | ce3658455230cf392f45cc99f44a737ee59f13bd (diff) |
Merged in lindenlab/viewer-lynx
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 27b26efa51..9577b3ab50 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3906,8 +3906,8 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail) bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) { - const LLSD* mesh = mThread->getMeshHeader(mesh_id); - if (mesh && mesh->has("physics_mesh") && (*mesh)["physics_mesh"].has("size") && ((*mesh)["physics_mesh"]["size"].asInteger() > 0)) + LLSD mesh = mThread->getMeshHeader(mesh_id); + if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0)) { return true; } @@ -3921,26 +3921,27 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) return false; } -const LLSD* LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) +LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) { LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); return mThread->getMeshHeader(mesh_id); } -const LLSD* LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id) +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() && mMeshHeaderSize[mesh_id] > 0) { - return &(iter->second); + return iter->second; } } - return NULL; + return dummy_ret; } @@ -3955,10 +3956,11 @@ void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3 S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod) { - if (mThread) + if (mThread && mesh_id.notNull()) { + LLMutexLock lock(mThread->mHeaderMutex); LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id); - if (iter != mThread->mMeshHeader.end()) + if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0) { LLSD& header = iter->second; @@ -4030,6 +4032,20 @@ void LLMeshRepository::uploadError(LLSD& args) mUploadErrorQ.push(args); } +F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value) +{ + if (mThread && mesh_id.notNull()) + { + LLMutexLock lock(mThread->mHeaderMutex); + LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id); + if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0) + { + return getStreamingCost(iter->second, radius, bytes, bytes_visible, lod, unscaled_value); + } + } + return 0.f; +} + //static F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value) { |