summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llvocache.cpp49
-rwxr-xr-xindra/newview/llvocache.h17
2 files changed, 56 insertions, 10 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 7ba0c31ffc..5a2f477f19 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -470,6 +470,31 @@ void LLVOCacheEntry::updateParentBoundingInfo(const LLVOCacheEntry* child)
//-------------------------------------------------------------------
//LLVOCachePartition
//-------------------------------------------------------------------
+LLVOCacheGroup::~LLVOCacheGroup()
+{
+ if(mOcclusionState[0] & ACTIVE_OCCLUSION)
+ {
+ ((LLVOCachePartition*)mSpatialPartition)->removeOccluder(this);
+ }
+}
+
+//virtual
+void LLVOCacheGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
+{
+ if (child->getListenerCount() == 0)
+ {
+ new LLVOCacheGroup(child, mSpatialPartition);
+ }
+ else
+ {
+ OCT_ERRS << "LLVOCacheGroup redundancy detected." << LL_ENDL;
+ }
+
+ unbound();
+
+ ((LLviewerOctreeGroup*)child->getListener(0))->unbound();
+}
+
LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
{
mLODPeriod = 16;
@@ -483,7 +508,7 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
mCulledTime[i] = 0;
mCullHistory[i] = -1;
}
- new LLOcclusionCullingGroup(mOctree, this);
+ new LLVOCacheGroup(mOctree, this);
}
void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry)
@@ -751,11 +776,11 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
void LLVOCachePartition::addOccluders(LLviewerOctreeGroup* gp)
{
- LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)gp;
+ LLVOCacheGroup* group = (LLVOCacheGroup*)gp;
if(!group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION))
{
- group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
+ group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION, LLOcclusionCullingGroup::STATE_MODE_ALL_CAMERAS);
mOccludedGroups.insert(group);
}
}
@@ -769,9 +794,9 @@ void LLVOCachePartition::processOccluders(LLCamera* camera)
LLVector3 region_agent = mRegionp->getOriginAgent();
LLVector4a shift(region_agent[0], region_agent[1], region_agent[2]);
- for(std::set<LLOcclusionCullingGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
+ for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
{
- LLOcclusionCullingGroup* group = *iter;
+ LLVOCacheGroup* group = *iter;
group->doOcclusion(camera, &shift);
}
}
@@ -783,15 +808,23 @@ void LLVOCachePartition::resetOccluders()
return;
}
- for(std::set<LLOcclusionCullingGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
+ for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter)
{
- LLOcclusionCullingGroup* group = *iter;
- group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
+ LLVOCacheGroup* group = *iter;
+ group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION, LLOcclusionCullingGroup::STATE_MODE_ALL_CAMERAS);
}
mOccludedGroups.clear();
sNeedsOcclusionCheck = FALSE;
}
+void LLVOCachePartition::removeOccluder(LLVOCacheGroup* group)
+{
+ if(mOccludedGroups.empty())
+ {
+ return;
+ }
+ mOccludedGroups.erase(group);
+}
//-------------------------------------------------------------------
//LLVOCache
//-------------------------------------------------------------------
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index cc755b6231..16ed05dc94 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -160,6 +160,18 @@ public:
static U32 sMinFrameRange;
};
+class LLVOCacheGroup : public LLOcclusionCullingGroup
+{
+public:
+ LLVOCacheGroup(OctreeNode* node, LLViewerOctreePartition* part) : LLOcclusionCullingGroup(node, part){}
+
+ //virtual
+ void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
+
+protected:
+ virtual ~LLVOCacheGroup();
+};
+
class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable<LLVOCachePartition>
{
public:
@@ -171,7 +183,8 @@ public:
void addOccluders(LLviewerOctreeGroup* gp);
void resetOccluders();
void processOccluders(LLCamera* camera);
-
+ void removeOccluder(LLVOCacheGroup* group);
+
private:
void selectBackObjects(LLCamera &camera); //select objects behind camera.
@@ -181,7 +194,7 @@ public:
private:
U32 mCullHistory[LLViewerCamera::NUM_CAMERAS];
U32 mCulledTime[LLViewerCamera::NUM_CAMERAS];
- std::set<LLOcclusionCullingGroup*> mOccludedGroups;
+ std::set<LLVOCacheGroup*> mOccludedGroups;
S32 mBackSlectionEnabled; //enable to select back objects if > 0.
U32 mIdleHash;