summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-10-02 17:56:41 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-10-02 17:56:41 -0600
commit3fa868e9d65f221a8080b281ec836acc1aa5fd48 (patch)
treeb7fd24a563045cf413873c32096eeb91a00fcf09 /indra
parentb3d42e9b99db7e14354338383239122ef4cbeade (diff)
parentda8ac532072d5f054d30e46021b429fa72c3ab66 (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvieweroctree.h12
-rwxr-xr-xindra/newview/llvocache.cpp49
-rwxr-xr-xindra/newview/llvocache.h17
3 files changed, 64 insertions, 14 deletions
diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h
index 6ebd1d6da1..174af5e22f 100644
--- a/indra/newview/llvieweroctree.h
+++ b/indra/newview/llvieweroctree.h
@@ -83,7 +83,9 @@ public:
NUM_DATA_TYPE
}eEntryDataType_t;
- ~LLViewerOctreeEntry();
+protected:
+ virtual ~LLViewerOctreeEntry();
+
public:
LLViewerOctreeEntry();
@@ -187,7 +189,7 @@ class LLviewerOctreeGroup : public LLOctreeListener<LLViewerOctreeEntry>
{
friend class LLViewerOctreeCull;
protected:
- ~LLviewerOctreeGroup();
+ virtual ~LLviewerOctreeGroup();
public:
enum
@@ -303,13 +305,15 @@ public:
STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras
} eSetStateMode;
+protected:
+ virtual ~LLOcclusionCullingGroup();
+
public:
LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part);
LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLviewerOctreeGroup(rhs)
{
*this = rhs;
- }
- ~LLOcclusionCullingGroup();
+ }
void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE);
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 01666778b1..20e69cbea9 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -473,6 +473,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)
: LLTrace::MemTrackable<LLVOCachePartition>("LLVOCachePartition")
{
@@ -487,7 +512,7 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
mCulledTime[i] = 0;
mCullHistory[i] = -1;
}
- new LLOcclusionCullingGroup(mOctree, this);
+ new LLVOCacheGroup(mOctree, this);
}
void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry)
@@ -755,11 +780,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);
}
}
@@ -773,9 +798,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);
}
}
@@ -787,15 +812,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;