summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/pipeline.cpp47
-rw-r--r--indra/newview/pipeline.h2
2 files changed, 42 insertions, 7 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1a1d29ac32..4ac95fa939 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8902,33 +8902,68 @@ LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups()
}
-void LLPipeline::loadMesh(LLVOVolume* volume, LLUUID mesh_id)
+void LLPipeline::loadMesh(LLVOVolume* vobj, LLUUID mesh_id, S32 detail)
{
-
{
LLMutexLock lock(mMeshMutex);
//add volume to list of loading meshes
mesh_load_map::iterator iter = mLoadingMeshes.find(mesh_id);
if (iter != mLoadingMeshes.end())
{ //request pending for this mesh, append volume id to list
- iter->second.insert(volume->getID());
+ iter->second.insert(vobj->getID());
return;
}
//first request for this mesh
- mLoadingMeshes[mesh_id].insert(volume->getID());
+ mLoadingMeshes[mesh_id].insert(vobj->getID());
}
if (gAssetStorage->hasLocalAsset(mesh_id, LLAssetType::AT_MESH))
{ //already have asset, load desired LOD in background
- mPendingMeshes.push_back(new LLMeshThread(mesh_id, volume->getVolume()));
+ mPendingMeshes.push_back(new LLMeshThread(mesh_id, vobj->getVolume()));
}
else
{ //fetch asset and load when done
gAssetStorage->getAssetData(mesh_id, LLAssetType::AT_MESH,
- getMeshAssetCallback, volume->getVolume(), TRUE);
+ getMeshAssetCallback, vobj->getVolume(), TRUE);
}
+ //do a quick search to see if we can't display something while we wait for this mesh to load
+ LLVolume* volume = vobj->getVolume();
+
+ if (volume)
+ {
+ LLVolumeParams params = volume->getParams();
+
+ LLVolumeLODGroup* group = LLPrimitive::getVolumeManager()->getGroup(params);
+
+ if (group)
+ {
+ //first see what the next lowest LOD available might be
+ for (S32 i = detail-1; i >= 0; --i)
+ {
+ LLVolume* lod = group->refLOD(i);
+ if (lod && lod->getNumVolumeFaces() > 0)
+ {
+ volume->copyVolumeFaces(lod);
+ group->derefLOD(lod);
+ return;
+ }
+ }
+
+ //no lower LOD is a available, is a higher lod available?
+ for (S32 i = detail+1; i < 4; ++i)
+ {
+ LLVolume* lod = group->refLOD(i);
+ if (lod && lod->getNumVolumeFaces() > 0)
+ {
+ volume->copyVolumeFaces(lod);
+ group->derefLOD(lod);
+ return;
+ }
+ }
+ }
+ }
}
//static
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index bf654f88b1..3300f866e3 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -280,7 +280,7 @@ public:
//mesh management functions
- void loadMesh(LLVOVolume* volume, LLUUID mesh_id);
+ void loadMesh(LLVOVolume* volume, LLUUID mesh_id, S32 detail = 0);
void addTrianglesDrawn(S32 count);
BOOL hasRenderType(const U32 type) const { return (type && (mRenderTypeMask & (1<<type))) ? TRUE : FALSE; }