summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/settings.xml15
-rw-r--r--indra/newview/llvieweroctree.h12
-rwxr-xr-xindra/newview/llviewerregion.cpp10
-rwxr-xr-xindra/newview/llvocache.cpp60
-rwxr-xr-xindra/newview/llvocache.h19
-rwxr-xr-xindra/newview/llworld.cpp2
6 files changed, 90 insertions, 28 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8642114362..435dddda77 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -765,6 +765,17 @@
<key>Value</key>
<real>0.0311</real>
</map>
+ <key>BackShpereCullingRadius</key>
+ <map>
+ <key>Comment</key>
+ <string>Radius of back sphere in meters, objects behind camera but within this radius are loaded for rendering</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>20.0</real>
+ </map>
<key>BottomPanelNew</key>
<map>
<key>Comment</key>
@@ -6879,10 +6890,10 @@
<key>Value</key>
<integer>1</integer>
</map>
- <key>ObjectCacheViewCullingEnabled</key>
+ <key>RequestFullRegionCache</key>
<map>
<key>Comment</key>
- <string>Enable the object cache view culling. Needs to restart viewer.</string>
+ <string>If set, ask sim to send full region object cache. Needs to restart viewer.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
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/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 99db71c2ee..6e9f649d23 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2483,11 +2483,11 @@ void LLViewerRegion::unpackRegionHandshake()
U32 flags = 0;
if(sVOCacheCullingEnabled)
{
- flags = 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects.
- if(mImpl->mCacheMap.empty())
- {
- flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes.
- }
+ flags |= 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects.
+ }
+ if(mImpl->mCacheMap.empty())
+ {
+ flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes.
}
msg->addU32("Flags", flags );
msg->sendReliable(host);
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 01666778b1..ada412be8c 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)
@@ -615,11 +640,11 @@ private:
class LLVOCacheOctreeBackCull : public LLViewerOctreeCull
{
public:
- LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp)
+ LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 back_sphere_radius)
: LLViewerOctreeCull(camera), mRegionp(regionp)
{
mLocalShift = shift;
- mSphereRadius = 20.f; //20m
+ mSphereRadius = back_sphere_radius;
}
virtual S32 frustumCheck(const LLviewerOctreeGroup* group)
@@ -653,7 +678,7 @@ private:
LLVector3 mLocalShift; //shift vector from agent space to local region space.
};
-void LLVOCachePartition::selectBackObjects(LLCamera &camera)
+void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_radius)
{
if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
{
@@ -674,7 +699,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera)
//localize the camera
LLVector3 region_agent = mRegionp->getOriginAgent();
- LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp);
+ LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, back_sphere_radius);
culler.traverse(mOctree);
mBackSlectionEnabled--;
@@ -689,6 +714,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera)
S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
{
static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
+ static LLCachedControl<F32> back_sphere_radius(gSavedSettings,"BackShpereCullingRadius");
if(!LLViewerRegion::sVOCacheCullingEnabled)
{
@@ -720,7 +746,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
}
if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash)
{
- selectBackObjects(camera);//process back objects selection
+ selectBackObjects(camera, back_sphere_radius);//process back objects selection
return 0; //nothing changed, reduce frequency of culling
}
}
@@ -755,11 +781,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 +799,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 +813,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..b58bb3d499 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,9 +183,10 @@ public:
void addOccluders(LLviewerOctreeGroup* gp);
void resetOccluders();
void processOccluders(LLCamera* camera);
-
+ void removeOccluder(LLVOCacheGroup* group);
+
private:
- void selectBackObjects(LLCamera &camera); //select objects behind camera.
+ void selectBackObjects(LLCamera &camera, F32 back_sphere_radius); //select objects behind camera.
public:
static BOOL sNeedsOcclusionCheck;
@@ -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;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index d600abeb0a..f283cdb4b8 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -110,7 +110,7 @@ LLWorld::LLWorld() :
gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
- LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled") && gSavedSettings.getBOOL("ObjectCacheEnabled");
+ LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("RequestFullRegionCache") && gSavedSettings.getBOOL("ObjectCacheEnabled");
}