summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2009-11-05 17:12:18 -0600
committerDave Parks <davep@lindenlab.com>2009-11-05 17:12:18 -0600
commit1c495c56c1011f4514d96b75cbcfb5a8256de78f (patch)
treea339f94beb753b2a6429c46c93de03d8169cda84
parentebad60bf1dcd6839ac57ced2edc93de0daffd8b9 (diff)
Fix for crash on teleport to mesh enabled region.
Fix for flashing meshes on LOD switch.
-rw-r--r--indra/llprimitive/llprimitive.cpp4
-rw-r--r--indra/newview/pipeline.cpp47
-rw-r--r--indra/newview/pipeline.h2
3 files changed, 46 insertions, 7 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index da1cfc2074..52265e7ad5 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -744,6 +744,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai
return TRUE;
}
+#if 0
U32 old_face_mask = mVolumep->mFaceMask;
S32 face_bit = 0;
@@ -941,6 +942,9 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai
setTE(te_num, *(old_tes.getTexture(face_mapping[face_bit])));
}
}
+#else
+ setNumTEs(mVolumep->getNumFaces());
+#endif
return TRUE;
}
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; }