aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llvovolume.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llvovolume.cpp56
1 files changed, 49 insertions, 7 deletions
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp
index e4318ff..4b357e2 100644
--- a/linden/indra/newview/llvovolume.cpp
+++ b/linden/indra/newview/llvovolume.cpp
@@ -83,8 +83,8 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
83 mVolumeImpl(NULL) 83 mVolumeImpl(NULL)
84{ 84{
85 mTexAnimMode = 0; 85 mTexAnimMode = 0;
86 mRelativeXform.identity(); 86 mRelativeXform.setIdentity();
87 mRelativeXformInvTrans.identity(); 87 mRelativeXformInvTrans.setIdentity();
88 88
89 mLOD = MIN_LOD; 89 mLOD = MIN_LOD;
90 mTextureAnimp = NULL; 90 mTextureAnimp = NULL;
@@ -326,7 +326,7 @@ void LLVOVolume::animateTextures()
326 } 326 }
327 327
328 LLMatrix4& tex_mat = *facep->mTextureMatrix; 328 LLMatrix4& tex_mat = *facep->mTextureMatrix;
329 tex_mat.identity(); 329 tex_mat.setIdentity();
330 tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); 330 tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f));
331 tex_mat.rotate(quat); 331 tex_mat.rotate(quat);
332 332
@@ -452,7 +452,7 @@ void LLVOVolume::updateTextures()
452 452
453 if (isHUDAttachment()) 453 if (isHUDAttachment())
454 { 454 {
455 F32 area = (F32) gCamera->getScreenPixelArea(); 455 F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea();
456 vsize = area; 456 vsize = area;
457 imagep->setBoostLevel(LLViewerImage::BOOST_HUD); 457 imagep->setBoostLevel(LLViewerImage::BOOST_HUD);
458 face->setPixelArea(area); // treat as full screen 458 face->setPixelArea(area); // treat as full screen
@@ -557,7 +557,7 @@ F32 LLVOVolume::getTextureVirtualSize(LLFace* face)
557 LLVector3 center = face->getPositionAgent(); 557 LLVector3 center = face->getPositionAgent();
558 LLVector3 size = (face->mExtents[1] - face->mExtents[0]) * 0.5f; 558 LLVector3 size = (face->mExtents[1] - face->mExtents[0]) * 0.5f;
559 559
560 F32 face_area = LLPipeline::calcPixelArea(center, size, *gCamera); 560 F32 face_area = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
561 561
562 face->setPixelArea(face_area); 562 face->setPixelArea(face_area);
563 563
@@ -651,7 +651,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
651 } 651 }
652 652
653 updateRadius(); 653 updateRadius();
654 mDrawable->updateDistance(*gCamera); 654 mDrawable->updateDistance(*LLViewerCamera::getInstance());
655 655
656 return mDrawable; 656 return mDrawable;
657} 657}
@@ -741,7 +741,23 @@ void LLVOVolume::sculpt()
741 741
742 742
743 S32 current_discard = getVolume()->getSculptLevel(); 743 S32 current_discard = getVolume()->getSculptLevel();
744 llassert_always(current_discard >= -2 && current_discard <= max_discard); 744 if(current_discard < -2)
745 {
746 llwarns << "WARNING!!: Current discard of sculpty at " << current_discard
747 << " is less than -2." << llendl;
748
749 // corrupted volume... don't update the sculpty
750 return;
751 }
752 else if (current_discard > max_discard)
753 {
754 llwarns << "WARNING!!: Current discard of sculpty at " << current_discard
755 << " is more than than allowed max of " << max_discard << llendl;
756
757 // corrupted volume... don't update the sculpty
758 return;
759 }
760
745 if (current_discard == discard_level) // no work to do here 761 if (current_discard == discard_level) // no work to do here
746 return; 762 return;
747 763
@@ -2047,6 +2063,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
2047 { 2063 {
2048 if (group->isState(LLSpatialGroup::MESH_DIRTY)) 2064 if (group->isState(LLSpatialGroup::MESH_DIRTY))
2049 { 2065 {
2066 S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ;
2067
2050 group->mBuilt = 1.f; 2068 group->mBuilt = 1.f;
2051 LLFastTimer ftm(LLFastTimer::FTM_REBUILD_VBO); 2069 LLFastTimer ftm(LLFastTimer::FTM_REBUILD_VBO);
2052 2070
@@ -2055,6 +2073,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
2055 for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) 2073 for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
2056 { 2074 {
2057 LLDrawable* drawablep = *drawable_iter; 2075 LLDrawable* drawablep = *drawable_iter;
2076
2077 if (drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) )
2078 {
2079 continue;
2080 }
2081
2058 if (drawablep->isState(LLDrawable::REBUILD_ALL)) 2082 if (drawablep->isState(LLDrawable::REBUILD_ALL))
2059 { 2083 {
2060 LLVOVolume* vobj = drawablep->getVOVolume(); 2084 LLVOVolume* vobj = drawablep->getVOVolume();
@@ -2096,6 +2120,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
2096 group->mVertexBuffer->setBuffer(0); 2120 group->mVertexBuffer->setBuffer(0);
2097 } 2121 }
2098 2122
2123 //if not all buffers are unmapped
2124 if(num_mapped_veretx_buffer != LLVertexBuffer::sMappedCount)
2125 {
2126 llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ;
2127 for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
2128 {
2129 LLDrawable* drawablep = *drawable_iter;
2130 for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
2131 {
2132 LLFace* face = drawablep->getFace(i);
2133 if (face && face->mVertexBuffer.notNull() && face->mVertexBuffer->isLocked())
2134 {
2135 face->mVertexBuffer->setBuffer(0) ;
2136 }
2137 }
2138 }
2139 }
2140
2099 group->clearState(LLSpatialGroup::MESH_DIRTY); 2141 group->clearState(LLSpatialGroup::MESH_DIRTY);
2100 } 2142 }
2101 2143