Apply occlusion refactor.
This commit is contained in:
@@ -523,6 +523,7 @@ set(viewer_SOURCE_FILES
|
||||
llviewerobject.cpp
|
||||
llviewerobjectbackup.cpp
|
||||
llviewerobjectlist.cpp
|
||||
llvieweroctree.cpp
|
||||
llviewerparcelmedia.cpp
|
||||
llviewerparcelmediaautoplay.cpp
|
||||
llviewerparcelmgr.cpp
|
||||
@@ -1059,6 +1060,7 @@ set(viewer_HEADER_FILES
|
||||
llviewerobject.h
|
||||
llviewerobjectbackup.h
|
||||
llviewerobjectlist.h
|
||||
llvieweroctree.h
|
||||
llviewerparcelmedia.h
|
||||
llviewerparcelmediaautoplay.h
|
||||
llviewerparcelmgr.h
|
||||
|
||||
@@ -75,7 +75,6 @@ extern bool gShiftFrame;
|
||||
//
|
||||
|
||||
// static
|
||||
U32 LLDrawable::sCurVisible = 0;
|
||||
U32 LLDrawable::sNumZombieDrawables = 0;
|
||||
F32 LLDrawable::sCurPixelAngle = 0;
|
||||
std::vector<LLPointer<LLDrawable> > LLDrawable::sDeadList;
|
||||
@@ -85,9 +84,16 @@ std::vector<LLPointer<LLDrawable> > LLDrawable::sDeadList;
|
||||
// static
|
||||
void LLDrawable::incrementVisible()
|
||||
{
|
||||
sCurVisible++;
|
||||
LLViewerOctreeEntryData::incrementVisible();
|
||||
sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView();
|
||||
}
|
||||
|
||||
LLDrawable::LLDrawable(LLViewerObject *vobj)
|
||||
: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE),
|
||||
mVObjp(vobj)
|
||||
{
|
||||
init();
|
||||
}
|
||||
void LLDrawable::init()
|
||||
{
|
||||
// mXform
|
||||
@@ -95,21 +101,16 @@ void LLDrawable::init()
|
||||
mRenderType = 0;
|
||||
mCurrentScale = LLVector3(1,1,1);
|
||||
mDistanceWRTCamera = 0.0f;
|
||||
mPositionGroup.clear();
|
||||
mExtents[0].clear();
|
||||
mExtents[1].clear();
|
||||
|
||||
mState = 0;
|
||||
mVObjp = NULL;
|
||||
|
||||
// mFaces
|
||||
mSpatialGroupp = NULL;
|
||||
mVisible = sCurVisible - 2;//invisible for the current frame and the last frame.
|
||||
mRadius = 0.f;
|
||||
|
||||
mGeneration = -1;
|
||||
mBinRadius = 1.f;
|
||||
mBinIndex = -1;
|
||||
mSpatialBridge = NULL;
|
||||
|
||||
LLViewerOctreeEntry* entry = NULL;
|
||||
setOctreeEntry(entry);
|
||||
initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -142,6 +143,7 @@ void LLDrawable::destroy()
|
||||
{
|
||||
LL_INFOS() << "- Zombie drawables: " << sNumZombieDrawables << LL_ENDL;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
void LLDrawable::markDead()
|
||||
@@ -151,6 +153,7 @@ void LLDrawable::markDead()
|
||||
LL_WARNS() << "Warning! Marking dead multiple times!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
setState(DEAD);
|
||||
|
||||
if (mSpatialBridge)
|
||||
{
|
||||
@@ -161,7 +164,6 @@ void LLDrawable::markDead()
|
||||
sNumZombieDrawables++;
|
||||
|
||||
// We're dead. Free up all of our references to other objects
|
||||
setState(DEAD);
|
||||
cleanupReferences();
|
||||
// sDeadList.push_back(this);
|
||||
}
|
||||
@@ -215,6 +217,8 @@ void LLDrawable::cleanupReferences()
|
||||
|
||||
gPipeline.unlinkDrawable(this);
|
||||
|
||||
removeFromOctree();
|
||||
|
||||
{
|
||||
LLFastTimer t(FTM_DEREF_DRAWABLE);
|
||||
// Cleanup references to other objects
|
||||
@@ -223,6 +227,17 @@ void LLDrawable::cleanupReferences()
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawable::removeFromOctree()
|
||||
{
|
||||
if(!mEntry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mEntry->removeData(this);
|
||||
mEntry = NULL;
|
||||
}
|
||||
|
||||
void LLDrawable::cleanupDeadDrawables()
|
||||
{
|
||||
/*
|
||||
@@ -481,6 +496,12 @@ void LLDrawable::makeActive()
|
||||
}
|
||||
updatePartition();
|
||||
}
|
||||
else if (!isRoot() && !mParent->isActive()) //this should not happen, but occasionally it does...
|
||||
{
|
||||
mParent->makeActive();
|
||||
//NOTE: linked set will now NEVER become static
|
||||
mParent->setState(LLDrawable::ACTIVE_CHILD);
|
||||
}
|
||||
|
||||
llassert(isAvatar() || isRoot() || mParent->isActive());
|
||||
}
|
||||
@@ -775,7 +796,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
|
||||
LLVOVolume* volume = getVOVolume();
|
||||
if (volume)
|
||||
{
|
||||
if (getSpatialGroup())
|
||||
if (getGroup())
|
||||
{
|
||||
pos.set(getPositionGroup().getF32ptr());
|
||||
}
|
||||
@@ -893,9 +914,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
|
||||
}
|
||||
}
|
||||
|
||||
mExtents[0].add(shift_vector);
|
||||
mExtents[1].add(shift_vector);
|
||||
mPositionGroup.add(shift_vector);
|
||||
shift(shift_vector);
|
||||
}
|
||||
else if (mSpatialBridge)
|
||||
{
|
||||
@@ -903,9 +922,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
|
||||
}
|
||||
else if (isAvatar())
|
||||
{
|
||||
mExtents[0].add(shift_vector);
|
||||
mExtents[1].add(shift_vector);
|
||||
mPositionGroup.add(shift_vector);
|
||||
shift(shift_vector);
|
||||
}
|
||||
|
||||
mVObjp->onShift(shift_vector);
|
||||
@@ -917,40 +934,24 @@ const LLVector3& LLDrawable::getBounds(LLVector3& min, LLVector3& max) const
|
||||
return mXform.getPositionW();
|
||||
}
|
||||
|
||||
const LLVector4a* LLDrawable::getSpatialExtents() const
|
||||
{
|
||||
return mExtents;
|
||||
}
|
||||
|
||||
void LLDrawable::setSpatialExtents(const LLVector3& min, const LLVector3& max)
|
||||
{
|
||||
mExtents[0].load3(min.mV);
|
||||
mExtents[1].load3(max.mV);
|
||||
}
|
||||
|
||||
void LLDrawable::setSpatialExtents(const LLVector4a& min, const LLVector4a& max)
|
||||
{
|
||||
mExtents[0] = min;
|
||||
mExtents[1] = max;
|
||||
}
|
||||
|
||||
void LLDrawable::setPositionGroup(const LLVector4a& pos)
|
||||
{
|
||||
mPositionGroup = pos;
|
||||
}
|
||||
|
||||
void LLDrawable::updateSpatialExtents()
|
||||
{
|
||||
if (mVObjp)
|
||||
{
|
||||
mVObjp->updateSpatialExtents(mExtents[0], mExtents[1]);
|
||||
const LLVector4a* exts = getSpatialExtents();
|
||||
LLVector4a extents[2];
|
||||
extents[0] = exts[0];
|
||||
extents[1] = exts[1];
|
||||
|
||||
mVObjp->updateSpatialExtents(extents[0], extents[1]);
|
||||
setSpatialExtents(extents[0], extents[1]);
|
||||
}
|
||||
|
||||
updateBinRadius();
|
||||
|
||||
if (mSpatialBridge.notNull())
|
||||
{
|
||||
mPositionGroup.splat(0.f);
|
||||
getGroupPosition().splat(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -959,11 +960,11 @@ void LLDrawable::updateBinRadius()
|
||||
{
|
||||
if (mVObjp.notNull())
|
||||
{
|
||||
mBinRadius = llmin(mVObjp->getBinRadius(), 256.f);
|
||||
setBinRadius(llmin(mVObjp->getBinRadius(), 256.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
mBinRadius = llmin(getRadius()*4.f, 256.f);
|
||||
setBinRadius(llmin(getRadius()*4.f, 256.f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -997,26 +998,56 @@ void LLDrawable::updateUVMinMax()
|
||||
{
|
||||
}
|
||||
|
||||
LLSpatialGroup* LLDrawable::getSpatialGroup() const
|
||||
//virtual
|
||||
bool LLDrawable::isVisible() const
|
||||
{
|
||||
if (LLViewerOctreeEntryData::isVisible())
|
||||
{
|
||||
llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
|
||||
return mSpatialGroupp;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
|
||||
{
|
||||
//precondition: mSpatialGroupp MUST be null or DEAD or mSpatialGroupp MUST NOT contain this
|
||||
llassert(!mSpatialGroupp || mSpatialGroupp->isDead() || !mSpatialGroupp->hasElement(this));
|
||||
LLViewerOctreeGroup* group = mEntry->getGroup();
|
||||
if (group && group->isVisible())
|
||||
{
|
||||
LLViewerOctreeEntryData::setVisible();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//virtual
|
||||
bool LLDrawable::isRecentlyVisible() const
|
||||
{
|
||||
//currently visible or visible in the previous frame.
|
||||
bool vis = LLViewerOctreeEntryData::isRecentlyVisible();
|
||||
|
||||
if(!vis)
|
||||
{
|
||||
const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one.
|
||||
vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE);
|
||||
}
|
||||
|
||||
return vis ;
|
||||
}
|
||||
void LLDrawable::setGroup(LLViewerOctreeGroup *groupp)
|
||||
{
|
||||
LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup();
|
||||
|
||||
//precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this
|
||||
//llassert(!cur_groupp || cur_groupp->isDead() || !cur_groupp->hasElement(this));
|
||||
|
||||
//precondition: groupp MUST be null or groupp MUST contain this
|
||||
llassert(!groupp || groupp->hasElement(this));
|
||||
llassert(!groupp || (LLSpatialGroup*)groupp->hasElement(this));
|
||||
|
||||
/*if (mSpatialGroupp && (groupp != mSpatialGroupp))
|
||||
/*if (mSpatialGroupp && (groupp != mSpatialGroupp))
|
||||
{
|
||||
mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY);
|
||||
}*/
|
||||
|
||||
if (mSpatialGroupp != groupp && getVOVolume())
|
||||
if (cur_groupp != groupp && getVOVolume())
|
||||
{ //NULL out vertex buffer references for volumes on spatial group change to maintain
|
||||
//requirement that every face vertex buffer is either NULL or points to a vertex buffer
|
||||
//contained by its drawable's spatial group
|
||||
@@ -1032,10 +1063,10 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
|
||||
|
||||
//postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1
|
||||
//postcondition: if next group is NOT NULL, binIndex must not be -1
|
||||
llassert(groupp == NULL ? (mSpatialGroupp == NULL || mSpatialGroupp->isDead()) || getBinIndex() == -1 :
|
||||
getBinIndex() != -1);
|
||||
//llassert(groupp == NULL ? (mSpatialGroupp == NULL || mSpatialGroupp->isDead()) || getBinIndex() == -1 :
|
||||
// getBinIndex() != -1);
|
||||
|
||||
mSpatialGroupp = groupp;
|
||||
LLViewerOctreeEntryData::setGroup(groupp);
|
||||
}
|
||||
|
||||
LLSpatialPartition* LLDrawable::getSpatialPartition()
|
||||
@@ -1081,89 +1112,18 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
|
||||
return retval;
|
||||
}
|
||||
|
||||
const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one.
|
||||
//static
|
||||
S32 LLDrawable::getMinVisFrameRange()
|
||||
{
|
||||
return MIN_VIS_FRAME_RANGE ;
|
||||
}
|
||||
|
||||
BOOL LLDrawable::isRecentlyVisible() const
|
||||
{
|
||||
//currently visible or visible in the previous frame.
|
||||
BOOL vis = isVisible() || (sCurVisible - mVisible < MIN_VIS_FRAME_RANGE) ;
|
||||
|
||||
if(!vis)
|
||||
{
|
||||
LLSpatialGroup* group = getSpatialGroup();
|
||||
if (group && group->isRecentlyVisible())
|
||||
{
|
||||
mVisible = sCurVisible;
|
||||
vis = TRUE ;
|
||||
}
|
||||
}
|
||||
|
||||
return vis ;
|
||||
}
|
||||
|
||||
BOOL LLDrawable::isVisible() const
|
||||
{
|
||||
if (mVisible == sCurVisible)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result.
|
||||
//should be safe to just always ask the spatial group for visibility.
|
||||
if (isActive())
|
||||
{
|
||||
if (isRoot())
|
||||
{
|
||||
LLSpatialGroup* group = mSpatialBridge.notNull() ? mSpatialBridge->getSpatialGroup() :
|
||||
getSpatialGroup();
|
||||
if (group && group->isVisible())
|
||||
{
|
||||
mVisible = sCurVisible;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getParent()->isVisible())
|
||||
{
|
||||
mVisible = sCurVisible;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
LLSpatialGroup* group = getSpatialGroup();
|
||||
if (group && group->isVisible())
|
||||
{
|
||||
mVisible = sCurVisible;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//=======================================
|
||||
// Spatial Partition Bridging Drawable
|
||||
//=======================================
|
||||
|
||||
LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) :
|
||||
LLDrawable(root->getVObj()),
|
||||
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB)
|
||||
{
|
||||
mBridge = this;
|
||||
mDrawable = root;
|
||||
root->setSpatialBridge(this);
|
||||
|
||||
mBinIndex = -1;
|
||||
|
||||
mRenderType = mDrawable->mRenderType;
|
||||
mDrawableType = mDrawable->mRenderType;
|
||||
|
||||
@@ -1184,10 +1144,13 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat
|
||||
|
||||
LLSpatialBridge::~LLSpatialBridge()
|
||||
{
|
||||
if(mEntry)
|
||||
{
|
||||
LLSpatialGroup* group = getSpatialGroup();
|
||||
if (group)
|
||||
{
|
||||
group->mSpatialPartition->remove(this, group);
|
||||
group->getSpatialPartition()->remove(this, group);
|
||||
}
|
||||
}
|
||||
|
||||
//delete octree here so listeners will still be able to access bridge specific state
|
||||
@@ -1209,10 +1172,10 @@ void LLSpatialBridge::updateSpatialExtents()
|
||||
root->rebound();
|
||||
}
|
||||
|
||||
const LLVector4a* root_bounds = root->getBounds();
|
||||
LLVector4a offset;
|
||||
LLVector4a size = root->mBounds[1];
|
||||
LLVector4a size = root_bounds[1];
|
||||
|
||||
//VECTORIZE THIS
|
||||
const LLMatrix4a& mat = mDrawable->getXform()->getWorldMatrix();
|
||||
|
||||
LLVector4a t;
|
||||
@@ -1221,7 +1184,7 @@ void LLSpatialBridge::updateSpatialExtents()
|
||||
LLVector4a center;
|
||||
mat.affineTransform(t, center);
|
||||
|
||||
mat.rotate(root->mBounds[0], offset);
|
||||
mat.rotate(root_bounds[0], offset);
|
||||
center.add(offset);
|
||||
|
||||
LLVector4a v[4];
|
||||
@@ -1243,8 +1206,8 @@ void LLSpatialBridge::updateSpatialExtents()
|
||||
scale.mul(size);
|
||||
mat.rotate(scale, v[3]);
|
||||
|
||||
LLVector4a& newMin = mExtents[0];
|
||||
LLVector4a& newMax = mExtents[1];
|
||||
LLVector4a newMin;
|
||||
LLVector4a newMax;
|
||||
newMin = newMax = center;
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -1258,19 +1221,21 @@ void LLSpatialBridge::updateSpatialExtents()
|
||||
newMin.setMin(newMin, min);
|
||||
newMax.setMax(newMax, max);
|
||||
}
|
||||
setSpatialExtents(newMin, newMax);
|
||||
|
||||
LLVector4a diagonal;
|
||||
diagonal.setSub(newMax, newMin);
|
||||
mRadius = diagonal.getLength3().getF32() * 0.5f;
|
||||
|
||||
mPositionGroup.setAdd(newMin,newMax);
|
||||
mPositionGroup.mul(0.5f);
|
||||
LLVector4a& pos = getGroupPosition();
|
||||
pos.setAdd(newMin,newMax);
|
||||
pos.mul(0.5f);
|
||||
updateBinRadius();
|
||||
}
|
||||
|
||||
void LLSpatialBridge::updateBinRadius()
|
||||
{
|
||||
mBinRadius = llmin( mOctree->getSize()[0]*0.5f, 256.f);
|
||||
setBinRadius(llmin( mOctree->getSize()[0]*0.5f, 256.f));
|
||||
}
|
||||
|
||||
LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
|
||||
@@ -1312,7 +1277,7 @@ LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
|
||||
|
||||
void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, BOOL for_select)
|
||||
{
|
||||
mVisible = sCurVisible;
|
||||
LLViewerOctreeEntryData::setVisible();
|
||||
|
||||
#if 0 && !LL_RELEASE_FOR_DOWNLOAD
|
||||
//crazy paranoid rules checking
|
||||
@@ -1347,21 +1312,21 @@ void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results,
|
||||
#endif
|
||||
}
|
||||
|
||||
class LLOctreeMarkNotCulled: public LLOctreeTraveler<LLDrawable>
|
||||
class LLOctreeMarkNotCulled: public OctreeTraveler
|
||||
{
|
||||
public:
|
||||
LLCamera* mCamera;
|
||||
|
||||
LLOctreeMarkNotCulled(LLCamera* camera_in) : mCamera(camera_in) { }
|
||||
|
||||
virtual void traverse(const LLOctreeNode<LLDrawable>* node)
|
||||
virtual void traverse(const OctreeNode* node)
|
||||
{
|
||||
LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
|
||||
group->setVisible();
|
||||
LLOctreeTraveler<LLDrawable>::traverse(node);
|
||||
OctreeTraveler::traverse(node);
|
||||
}
|
||||
|
||||
void visit(const LLOctreeNode<LLDrawable>* branch)
|
||||
void visit(const OctreeNode* branch)
|
||||
{
|
||||
gPipeline.markNotCulled((LLSpatialGroup*) branch->getListener(0), *mCamera);
|
||||
}
|
||||
@@ -1405,7 +1370,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>*
|
||||
}
|
||||
|
||||
if (!group ||
|
||||
LLDrawable::getCurrentFrame() - av->mVisible > 1 ||
|
||||
LLDrawable::getCurrentFrame() - av->getVisible() > 1 ||
|
||||
impostor ||
|
||||
!loaded)
|
||||
{
|
||||
@@ -1556,9 +1521,7 @@ BOOL LLSpatialBridge::updateMove()
|
||||
|
||||
void LLSpatialBridge::shiftPos(const LLVector4a& vec)
|
||||
{
|
||||
mExtents[0].add(vec);
|
||||
mExtents[1].add(vec);
|
||||
mPositionGroup.add(vec);
|
||||
LLDrawable::shift(vec);
|
||||
}
|
||||
|
||||
void LLSpatialBridge::cleanupReferences()
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llrect.h"
|
||||
#include "llappviewer.h" // for gFrameTimeSeconds
|
||||
#include "llvieweroctree.h"
|
||||
|
||||
class LLCamera;
|
||||
class LLDrawPool;
|
||||
@@ -64,10 +65,12 @@ const U32 SILHOUETTE_HIGHLIGHT = 0;
|
||||
|
||||
// All data for new renderer goes into this class.
|
||||
LL_ALIGN_PREFIX(16)
|
||||
class LLDrawable : public LLRefCount
|
||||
class LLDrawable
|
||||
: public LLViewerOctreeEntryData
|
||||
{
|
||||
public:
|
||||
LLDrawable(const LLDrawable& rhs)
|
||||
: LLViewerOctreeEntryData(rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
@@ -90,7 +93,7 @@ public:
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
|
||||
LLDrawable() { init(); }
|
||||
LLDrawable(LLViewerObject *vobj);
|
||||
|
||||
void markDead(); // Mark this drawable as dead
|
||||
BOOL isDead() const { return isState(DEAD); }
|
||||
@@ -98,11 +101,9 @@ public:
|
||||
|
||||
BOOL isLight() const;
|
||||
|
||||
BOOL isVisible() const;
|
||||
BOOL isRecentlyVisible() const;
|
||||
virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
|
||||
|
||||
|
||||
LLSpatialGroup* getSpatialGroup()const {return (LLSpatialGroup*)getGroup();}
|
||||
LLViewerRegion* getRegion() const { return mVObjp->getRegion(); }
|
||||
const LLTextureEntry* getTextureEntry(U8 which) const { return mVObjp->getTE(which); }
|
||||
LLPointer<LLViewerObject>& getVObj() { return mVObjp; }
|
||||
@@ -115,16 +116,12 @@ public:
|
||||
const LLVector3& getPosition() const { return mXform.getPosition(); }
|
||||
const LLVector3& getWorldPosition() const { return mXform.getPositionW(); }
|
||||
const LLVector3 getPositionAgent() const;
|
||||
const LLVector4a& getPositionGroup() const { return mPositionGroup; }
|
||||
const LLVector3& getScale() const { return mCurrentScale; }
|
||||
void setScale(const LLVector3& scale) { mCurrentScale = scale; }
|
||||
const LLQuaternion& getWorldRotation() const { return mXform.getWorldRotation(); }
|
||||
const LLQuaternion& getRotation() const { return mXform.getRotation(); }
|
||||
F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); }
|
||||
S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; }
|
||||
F32 getBinRadius() const { return mBinRadius; }
|
||||
S32 getBinIndex() const { return mBinIndex; }
|
||||
void setBinIndex(S32 index) const { mBinIndex = index; }
|
||||
|
||||
void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }
|
||||
LLXformMatrix* getXform() { return &mXform; }
|
||||
@@ -188,8 +185,12 @@ public:
|
||||
BOOL getLit() const { return isState(UNLIT) ? FALSE : TRUE; }
|
||||
void setLit(BOOL lit) { lit ? clearState(UNLIT) : setState(UNLIT); }
|
||||
|
||||
bool isVisible() const;
|
||||
bool isRecentlyVisible() const;
|
||||
|
||||
virtual void cleanupReferences();
|
||||
|
||||
void setGroup(LLViewerOctreeGroup* group);
|
||||
void setRadius(const F32 radius);
|
||||
F32 getRadius() const { return mRadius; }
|
||||
F32 getVisibilityRadius() const;
|
||||
@@ -199,11 +200,6 @@ public:
|
||||
const LLVector3& getBounds(LLVector3& min, LLVector3& max) const;
|
||||
virtual void updateSpatialExtents();
|
||||
virtual void updateBinRadius();
|
||||
const LLVector4a* getSpatialExtents() const;
|
||||
void setSpatialExtents(const LLVector3& min, const LLVector3& max);
|
||||
void setSpatialExtents(const LLVector4a& min, const LLVector4a& max);
|
||||
|
||||
void setPositionGroup(const LLVector4a& pos);
|
||||
|
||||
void setRenderType(S32 type) { mRenderType = type; }
|
||||
BOOL isRenderType(S32 type) { return mRenderType == type; }
|
||||
@@ -212,10 +208,13 @@ public:
|
||||
// Debugging methods
|
||||
S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...
|
||||
|
||||
void setSpatialGroup(LLSpatialGroup *groupp);
|
||||
LLSpatialGroup *getSpatialGroup() const;
|
||||
LLSpatialPartition* getSpatialPartition();
|
||||
|
||||
void removeFromOctree();
|
||||
|
||||
void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }
|
||||
LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; }
|
||||
|
||||
// Statics
|
||||
static void incrementVisible();
|
||||
static void cleanupDeadDrawables();
|
||||
@@ -298,10 +297,6 @@ public:
|
||||
ANIMATED_CHILD = 0x20000000,
|
||||
ACTIVE_CHILD = 0x40000000,
|
||||
} EDrawableFlags;
|
||||
|
||||
private: //aligned members
|
||||
LL_ALIGN_16(LLVector4a mExtents[2]);
|
||||
LL_ALIGN_16(LLVector4a mPositionGroup);
|
||||
|
||||
public:
|
||||
LL_ALIGN_16(LLXformMatrix mXform);
|
||||
@@ -311,12 +306,6 @@ public:
|
||||
|
||||
F32 mDistanceWRTCamera;
|
||||
|
||||
static S32 getCurrentFrame() { return sCurVisible; }
|
||||
static S32 getMinVisFrameRange();
|
||||
|
||||
void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }
|
||||
LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; }
|
||||
|
||||
static F32 sCurPixelAngle; //current pixels per radian
|
||||
|
||||
private:
|
||||
@@ -326,19 +315,13 @@ private:
|
||||
S32 mRenderType;
|
||||
LLPointer<LLViewerObject> mVObjp;
|
||||
face_list_t mFaces;
|
||||
LLSpatialGroup* mSpatialGroupp;
|
||||
LLPointer<LLDrawable> mSpatialBridge;
|
||||
|
||||
mutable U32 mVisible;
|
||||
F32 mRadius;
|
||||
F32 mBinRadius;
|
||||
mutable S32 mBinIndex;
|
||||
S32 mGeneration;
|
||||
|
||||
LLVector3 mCurrentScale;
|
||||
|
||||
static U32 sCurVisible; // Counter for what value of mVisible means currently visible
|
||||
|
||||
static U32 sNumZombieDrawables;
|
||||
static std::vector<LLPointer<LLDrawable> > sDeadList;
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
@@ -303,7 +303,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
|
||||
for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
|
||||
{
|
||||
LLSpatialGroup* group = *i;
|
||||
if (group->mSpatialPartition->mRenderByGroup &&
|
||||
if (group->getSpatialPartition()->mRenderByGroup &&
|
||||
!group->isDead())
|
||||
{
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
|
||||
@@ -343,14 +343,14 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
|
||||
{
|
||||
LLSpatialGroup* group = *i;
|
||||
llassert(group);
|
||||
llassert(group->mSpatialPartition);
|
||||
llassert(group->getSpatialPartition());
|
||||
|
||||
if (group->mSpatialPartition->mRenderByGroup &&
|
||||
if (group->getSpatialPartition()->mRenderByGroup &&
|
||||
!group->isDead())
|
||||
{
|
||||
bool is_particle_or_hud_particle = group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
|
||||
|| group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_CLOUD
|
||||
|| group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
|
||||
bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
|
||||
|| group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_CLOUD
|
||||
|| group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
|
||||
|
||||
bool draw_glow_for_this_partition = !depth_only && mVertexShaderLevel > 0; // no shaders = no glow.
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
|
||||
LLSpatialPartition* part = region->getSpatialPartition(i);
|
||||
if (part)
|
||||
{
|
||||
part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE);
|
||||
part->cull(*LLViewerCamera::getInstance(), &potentials);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,20 +52,15 @@
|
||||
#define SG_STATE_INHERIT_MASK (OCCLUDED)
|
||||
#define SG_INITIAL_STATE_MASK (DIRTY | GEOM_DIRTY)
|
||||
|
||||
class LLViewerOctreePartition;
|
||||
class LLSpatialPartition;
|
||||
class LLSpatialBridge;
|
||||
class LLSpatialGroup;
|
||||
class LLViewerRegion;
|
||||
|
||||
S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad);
|
||||
S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared);
|
||||
|
||||
S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad);
|
||||
S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared);
|
||||
void pushVerts(LLFace* face, U32 mask);
|
||||
|
||||
// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera
|
||||
U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center);
|
||||
U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center);
|
||||
|
||||
|
||||
class LLDrawInfo : public LLRefCount
|
||||
{
|
||||
@@ -213,13 +208,13 @@ public:
|
||||
};
|
||||
|
||||
LL_ALIGN_PREFIX(64)
|
||||
class LLSpatialGroup : public LLOctreeListener<LLDrawable>
|
||||
class LLSpatialGroup : public LLOcclusionCullingGroup
|
||||
{
|
||||
friend class LLSpatialPartition;
|
||||
friend class LLOctreeStateCheck;
|
||||
public:
|
||||
|
||||
LLSpatialGroup(const LLSpatialGroup& rhs)
|
||||
LLSpatialGroup(const LLSpatialGroup& rhs) : LLOcclusionCullingGroup(rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
@@ -240,7 +235,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
static std::set<GLuint> sPendingQueries; //pending occlusion queries
|
||||
static U32 sNodeCount;
|
||||
static BOOL sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
|
||||
|
||||
@@ -252,14 +246,7 @@ public:
|
||||
typedef std::map<LLFace*, buffer_list_t> buffer_texture_map_t;
|
||||
typedef std::map<U32, buffer_texture_map_t> buffer_map_t;
|
||||
|
||||
typedef LLOctreeListener<LLDrawable> BaseType;
|
||||
typedef LLOctreeListener<LLDrawable> OctreeListener;
|
||||
typedef LLTreeNode<LLDrawable> TreeNode;
|
||||
typedef LLOctreeNode<LLDrawable> OctreeNode;
|
||||
typedef LLOctreeRoot<LLDrawable> OctreeRoot;
|
||||
typedef LLOctreeTraveler<LLDrawable> OctreeTraveler;
|
||||
typedef LLOctreeNode<LLDrawable>::element_iter element_iter;
|
||||
typedef LLOctreeNode<LLDrawable>::element_list element_list;
|
||||
|
||||
|
||||
struct CompareDistanceGreater
|
||||
{
|
||||
@@ -287,119 +274,59 @@ public:
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OCCLUDED = 0x00010000,
|
||||
QUERY_PENDING = 0x00020000,
|
||||
ACTIVE_OCCLUSION = 0x00040000,
|
||||
DISCARD_QUERY = 0x00080000,
|
||||
EARLY_FAIL = 0x00100000,
|
||||
} eOcclusionState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEAD = 0x00000001,
|
||||
DIRTY = 0x00000002,
|
||||
OBJECT_DIRTY = 0x00000004,
|
||||
GEOM_DIRTY = 0x00000008,
|
||||
ALPHA_DIRTY = 0x00000010,
|
||||
SKIP_FRUSTUM_CHECK = 0x00000020,
|
||||
IN_IMAGE_QUEUE = 0x00000040,
|
||||
IMAGE_DIRTY = 0x00000080,
|
||||
MESH_DIRTY = 0x00000100,
|
||||
NEW_DRAWINFO = 0x00000200,
|
||||
IN_BUILD_Q1 = 0x00000400,
|
||||
IN_BUILD_Q2 = 0x00000800,
|
||||
GEOM_DIRTY = LLViewerOctreeGroup::INVALID_STATE,
|
||||
ALPHA_DIRTY = (GEOM_DIRTY << 1),
|
||||
IN_IMAGE_QUEUE = (ALPHA_DIRTY << 1),
|
||||
IMAGE_DIRTY = (IN_IMAGE_QUEUE << 1),
|
||||
MESH_DIRTY = (IMAGE_DIRTY << 1),
|
||||
NEW_DRAWINFO = (MESH_DIRTY << 1),
|
||||
IN_BUILD_Q1 = (NEW_DRAWINFO << 1),
|
||||
IN_BUILD_Q2 = (IN_BUILD_Q1 << 1),
|
||||
STATE_MASK = 0x0000FFFF,
|
||||
} eSpatialState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATE_MODE_SINGLE = 0, //set one node
|
||||
STATE_MODE_BRANCH, //set entire branch
|
||||
STATE_MODE_DIFF, //set entire branch as long as current state is different
|
||||
STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras
|
||||
} eSetStateMode;
|
||||
|
||||
LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part);
|
||||
|
||||
BOOL isHUDGroup() ;
|
||||
BOOL isDead() { return isState(DEAD); }
|
||||
BOOL isState(eSpatialState state) const; //Using enum type here and below to force type-safeness.
|
||||
BOOL isOcclusionState(eOcclusionState state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; }
|
||||
U32 getState() { return mState; }
|
||||
void setState(eSpatialState state);
|
||||
void clearState(eSpatialState state);
|
||||
|
||||
void clearDrawMap();
|
||||
void validate();
|
||||
void checkStates();
|
||||
void validateDrawMap();
|
||||
|
||||
void setState(eSpatialState state, S32 mode);
|
||||
void clearState(eSpatialState state, S32 mode);
|
||||
|
||||
void setOcclusionState(eOcclusionState state, S32 mode = STATE_MODE_SINGLE);
|
||||
void clearOcclusionState(eOcclusionState state, S32 mode = STATE_MODE_SINGLE);
|
||||
void clearState(eSpatialState state) {mState &= ~state;}
|
||||
bool hasState(eSpatialState state) const {return mState & state;}
|
||||
|
||||
LLSpatialGroup* getParent();
|
||||
|
||||
|
||||
BOOL addObject(LLDrawable *drawablep, BOOL add_all = FALSE, BOOL from_octree = FALSE);
|
||||
BOOL addObject(LLDrawable *drawablep);
|
||||
BOOL removeObject(LLDrawable *drawablep, BOOL from_octree = FALSE);
|
||||
BOOL updateInGroup(LLDrawable *drawablep, BOOL immediate = FALSE); // Update position if it's in the group
|
||||
BOOL isVisible() const;
|
||||
BOOL isRecentlyVisible() const;
|
||||
void setVisible();
|
||||
void shift(const LLVector4a &offset);
|
||||
BOOL boundObjects(BOOL empty, LLVector4a& newMin, LLVector4a& newMax);
|
||||
void unbound();
|
||||
BOOL rebound();
|
||||
void checkOcclusion(); //read back last occlusion query (if any)
|
||||
void doOcclusion(LLCamera* camera); //issue occlusion query
|
||||
void destroyGL(bool keep_occlusion = false);
|
||||
|
||||
void updateDistance(LLCamera& camera);
|
||||
BOOL needsUpdate();
|
||||
F32 getUpdateUrgency() const;
|
||||
BOOL changeLOD();
|
||||
void rebuildGeom();
|
||||
void rebuildMesh();
|
||||
|
||||
void setState(eSpatialState state) {mState |= state;}
|
||||
void dirtyGeom() { setState(GEOM_DIRTY); }
|
||||
void dirtyMesh() { setState(MESH_DIRTY); }
|
||||
|
||||
//octree wrappers to make code more readable
|
||||
//element_list& getData() { return mOctreeNode->getData(); } //unused
|
||||
element_iter getDataBegin() { return mOctreeNode->getDataBegin(); }
|
||||
element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }
|
||||
bool hasElement(LLDrawable* drawablep) { return std::find(mOctreeNode->getDataBegin(), mOctreeNode->getDataEnd(), drawablep) != mOctreeNode->getDataEnd(); }
|
||||
U32 getElementCount() const { return mOctreeNode->getElementCount(); }
|
||||
bool isEmpty() const { return mOctreeNode->isEmpty(); }
|
||||
|
||||
void drawObjectBox(LLColor4 col);
|
||||
|
||||
LLSpatialPartition* getSpatialPartition() {return (LLSpatialPartition*)mSpatialPartition;}
|
||||
|
||||
//LISTENER FUNCTIONS
|
||||
virtual void handleInsertion(const TreeNode* node, LLDrawable* face);
|
||||
virtual void handleRemoval(const TreeNode* node, LLDrawable* face);
|
||||
virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* face);
|
||||
virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* face);
|
||||
virtual void handleDestruction(const TreeNode* node);
|
||||
virtual void handleStateChange(const TreeNode* node);
|
||||
virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
|
||||
virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BOUNDS = 0,
|
||||
EXTENTS = 2,
|
||||
OBJECT_BOUNDS = 4,
|
||||
OBJECT_EXTENTS = 6,
|
||||
VIEW_ANGLE = 8,
|
||||
LAST_VIEW_ANGLE = 9,
|
||||
V4_COUNT = 10
|
||||
} eV4Index;
|
||||
|
||||
LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
|
||||
LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
|
||||
LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
|
||||
LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
|
||||
LL_ALIGN_16(LLVector4a mViewAngle);
|
||||
LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
|
||||
|
||||
@@ -408,10 +335,6 @@ public:
|
||||
protected:
|
||||
virtual ~LLSpatialGroup();
|
||||
|
||||
U32 mState;
|
||||
U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
|
||||
U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS];
|
||||
S32 mLODHash;
|
||||
static S32 sLODSeed;
|
||||
|
||||
public:
|
||||
@@ -422,16 +345,12 @@ public:
|
||||
F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node
|
||||
|
||||
F32 mBuilt;
|
||||
OctreeNode* mOctreeNode;
|
||||
LLSpatialPartition* mSpatialPartition;
|
||||
|
||||
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
GLuint mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
U32 mBufferUsage;
|
||||
draw_map_t mDrawMap;
|
||||
|
||||
S32 mVisible[LLViewerCamera::NUM_CAMERAS];
|
||||
F32 mDistance;
|
||||
F32 mDepth;
|
||||
F32 mLastUpdateDistance;
|
||||
@@ -463,7 +382,7 @@ public:
|
||||
virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage);
|
||||
};
|
||||
|
||||
class LLSpatialPartition: public LLGeometryManager
|
||||
class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManager
|
||||
{
|
||||
public:
|
||||
//static BOOL sFreezeState; //if true, no spatialgroup state updates will be made
|
||||
@@ -494,7 +413,8 @@ public:
|
||||
virtual void rebuildMesh(LLSpatialGroup* group);
|
||||
|
||||
BOOL visibleObjectsInFrustum(LLCamera& camera);
|
||||
S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum
|
||||
/*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum
|
||||
S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results); // Cull on arbitrary frustum
|
||||
|
||||
BOOL isVisible(const LLVector3& v);
|
||||
bool isHUDPartition() ;
|
||||
@@ -507,25 +427,19 @@ public:
|
||||
void renderIntersectingBBoxes(LLCamera* camera);
|
||||
void restoreGL();
|
||||
void resetVertexBuffers();
|
||||
BOOL isOcclusionEnabled();
|
||||
BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax);
|
||||
|
||||
public:
|
||||
LLSpatialGroup::OctreeNode* mOctree;
|
||||
LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this
|
||||
// use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe
|
||||
// to call asBridge() from the destructor
|
||||
BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
|
||||
|
||||
BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
|
||||
U32 mBufferUsage;
|
||||
const BOOL mRenderByGroup;
|
||||
U32 mLODSeed;
|
||||
U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed)
|
||||
U32 mVertexDataMask;
|
||||
F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25);
|
||||
BOOL mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering
|
||||
U32 mDrawableType;
|
||||
U32 mPartitionType;
|
||||
};
|
||||
|
||||
// class for creating bridges between spatial partitions
|
||||
@@ -707,7 +621,6 @@ class LLVolumeGeometryManager: public LLGeometryManager
|
||||
DISTANCE_SORT
|
||||
} eSortType;
|
||||
|
||||
virtual ~LLVolumeGeometryManager() { }
|
||||
virtual void rebuildGeom(LLSpatialGroup* group);
|
||||
virtual void rebuildMesh(LLSpatialGroup* group);
|
||||
virtual void getGeometry(LLSpatialGroup* group);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
// System includes
|
||||
#include <iomanip> // for setprecision
|
||||
|
||||
U32 LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
LLViewerCamera::eCameraID LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
LLViewerCamera::LLViewerCamera() : LLCamera()
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
NUM_CAMERAS
|
||||
} eCameraID;
|
||||
|
||||
static U32 sCurCameraID;
|
||||
static LLViewerCamera::eCameraID sCurCameraID;
|
||||
|
||||
LLViewerCamera();
|
||||
|
||||
|
||||
@@ -1825,7 +1825,7 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
|
||||
LLSpatialPartition* part = region->getSpatialPartition(i);
|
||||
if (part)
|
||||
{
|
||||
part->cull(camera, &pick_drawables, TRUE);
|
||||
part->cull(camera, &pick_drawables);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1494
indra/newview/llvieweroctree.cpp
Normal file
1494
indra/newview/llvieweroctree.cpp
Normal file
File diff suppressed because it is too large
Load Diff
397
indra/newview/llvieweroctree.h
Normal file
397
indra/newview/llvieweroctree.h
Normal file
@@ -0,0 +1,397 @@
|
||||
/**
|
||||
* @file llvieweroctree.h
|
||||
* @brief LLViewerObjectOctree.cpp header file, defining all supporting classes.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_VIEWEROCTREE_H
|
||||
#define LL_VIEWEROCTREE_H
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "v2math.h"
|
||||
#include "v3math.h"
|
||||
#include "v4math.h"
|
||||
#include "m4math.h"
|
||||
#include "llvector4a.h"
|
||||
#include "llquaternion.h"
|
||||
#include "lloctree.h"
|
||||
#include "llviewercamera.h"
|
||||
|
||||
class LLViewerRegion;
|
||||
class LLViewerOctreeEntryData;
|
||||
class LLViewerOctreeGroup;
|
||||
class LLViewerOctreeEntry;
|
||||
class LLViewerOctreePartition;
|
||||
|
||||
typedef LLOctreeListener<LLViewerOctreeEntry> OctreeListener;
|
||||
typedef LLTreeNode<LLViewerOctreeEntry> TreeNode;
|
||||
typedef LLOctreeNode<LLViewerOctreeEntry> OctreeNode;
|
||||
typedef LLOctreeRoot<LLViewerOctreeEntry> OctreeRoot;
|
||||
typedef LLOctreeTraveler<LLViewerOctreeEntry> OctreeTraveler;
|
||||
|
||||
#if LL_OCTREE_PARANOIA_CHECK
|
||||
#define assert_octree_valid(x) x->validate()
|
||||
#define assert_states_valid(x) ((LLViewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates()
|
||||
#else
|
||||
#define assert_octree_valid(x)
|
||||
#define assert_states_valid(x)
|
||||
#endif
|
||||
|
||||
// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera
|
||||
U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center);
|
||||
U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center);
|
||||
|
||||
S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad);
|
||||
S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared);
|
||||
|
||||
S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad);
|
||||
S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared);
|
||||
|
||||
class LLViewerOctreeEntry : public LLRefCount
|
||||
{
|
||||
friend class LLViewerOctreeEntryData;
|
||||
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
LLDRAWABLE = 0,
|
||||
NUM_DATA_TYPE
|
||||
}eEntryDataType_t;
|
||||
|
||||
protected:
|
||||
virtual ~LLViewerOctreeEntry();
|
||||
|
||||
public:
|
||||
LLViewerOctreeEntry();
|
||||
|
||||
void nullGroup(); //called by group handleDestruction() only
|
||||
void setGroup(LLViewerOctreeGroup* group);
|
||||
void removeData(LLViewerOctreeEntryData* data);
|
||||
|
||||
LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];}
|
||||
bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;}
|
||||
const LLVector4a* getSpatialExtents() const {return mExtents;}
|
||||
const LLVector4a& getPositionGroup() const {return mPositionGroup;}
|
||||
LLViewerOctreeGroup* getGroup()const {return mGroup;}
|
||||
|
||||
F32 getBinRadius() const {return mBinRadius;}
|
||||
S32 getBinIndex() const {return mBinIndex; }
|
||||
void setBinIndex(S32 index) const {mBinIndex = index; }
|
||||
|
||||
private:
|
||||
void addData(LLViewerOctreeEntryData* data);
|
||||
|
||||
private:
|
||||
LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here.
|
||||
LLViewerOctreeGroup* mGroup;
|
||||
|
||||
//aligned members
|
||||
LL_ALIGN_16(LLVector4a mExtents[2]);
|
||||
LL_ALIGN_16(LLVector4a mPositionGroup);
|
||||
F32 mBinRadius;
|
||||
mutable S32 mBinIndex;
|
||||
mutable U32 mVisible;
|
||||
|
||||
} ;//LL_ALIGN_POSTFIX(16);
|
||||
|
||||
//defines an abstract class for entry data
|
||||
//LL_ALIGN_PREFIX(16)
|
||||
class LLViewerOctreeEntryData : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
virtual ~LLViewerOctreeEntryData();
|
||||
|
||||
public:
|
||||
LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type);
|
||||
|
||||
LLViewerOctreeEntry::eEntryDataType_t getDataType() const {return mDataType;}
|
||||
LLViewerOctreeEntry* getEntry() {return mEntry;}
|
||||
|
||||
virtual void setOctreeEntry(LLViewerOctreeEntry* entry);
|
||||
void removeOctreeEntry();
|
||||
|
||||
F32 getBinRadius() const {return mEntry->getBinRadius();}
|
||||
const LLVector4a* getSpatialExtents() const;
|
||||
LLViewerOctreeGroup* getGroup()const;
|
||||
const LLVector4a& getPositionGroup() const;
|
||||
|
||||
void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;}
|
||||
void setSpatialExtents(const LLVector3& min, const LLVector3& max);
|
||||
void setSpatialExtents(const LLVector4a& min, const LLVector4a& max);
|
||||
void setPositionGroup(const LLVector4a& pos);
|
||||
|
||||
virtual void setGroup(LLViewerOctreeGroup* group);
|
||||
void shift(const LLVector4a &shift_vector);
|
||||
|
||||
U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;}
|
||||
void setVisible() const;
|
||||
void resetVisible() const;
|
||||
virtual bool isVisible() const;
|
||||
virtual bool isRecentlyVisible() const;
|
||||
|
||||
static S32 getCurrentFrame() { return sCurVisible; }
|
||||
|
||||
protected:
|
||||
LLVector4a& getGroupPosition() {return mEntry->mPositionGroup;}
|
||||
void initVisible(U32 visible) {mEntry->mVisible = visible;}
|
||||
|
||||
static void incrementVisible() {sCurVisible++;}
|
||||
protected:
|
||||
LLPointer<LLViewerOctreeEntry> mEntry;
|
||||
LLViewerOctreeEntry::eEntryDataType_t mDataType;
|
||||
static U32 sCurVisible; // Counter for what value of mVisible means currently visible
|
||||
};//LL_ALIGN_POSTFIX(16);
|
||||
|
||||
class LLViewerOctreeGroup
|
||||
: public LLOctreeListener<LLViewerOctreeEntry>
|
||||
{
|
||||
friend class LLViewerOctreeCull;
|
||||
protected:
|
||||
virtual ~LLViewerOctreeGroup();
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
CLEAN = 0x00000000,
|
||||
DIRTY = 0x00000001,
|
||||
OBJECT_DIRTY = 0x00000002,
|
||||
SKIP_FRUSTUM_CHECK = 0x00000004,
|
||||
DEAD = 0x00000008,
|
||||
INVALID_STATE = 0x00000010,
|
||||
};
|
||||
|
||||
public:
|
||||
typedef LLOctreeNode<LLViewerOctreeEntry>::element_iter element_iter;
|
||||
typedef LLOctreeNode<LLViewerOctreeEntry>::element_list element_list;
|
||||
|
||||
LLViewerOctreeGroup(OctreeNode* node);
|
||||
LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
|
||||
bool removeFromGroup(LLViewerOctreeEntryData* data);
|
||||
bool removeFromGroup(LLViewerOctreeEntry* entry);
|
||||
|
||||
virtual void unbound();
|
||||
virtual void rebound();
|
||||
|
||||
BOOL isDead() { return hasState(DEAD); }
|
||||
|
||||
void setVisible();
|
||||
BOOL isVisible() const;
|
||||
virtual BOOL isRecentlyVisible() const;
|
||||
S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];}
|
||||
bool isEmpty() const { return mOctreeNode->isEmpty(); }
|
||||
|
||||
U32 getState() {return mState; }
|
||||
bool isDirty() const {return mState & DIRTY;}
|
||||
bool hasState(U32 state) const {return mState & state;}
|
||||
void setState(U32 state) {mState |= state;}
|
||||
void clearState(U32 state) {mState &= ~state;}
|
||||
|
||||
//LISTENER FUNCTIONS
|
||||
virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj);
|
||||
virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj);
|
||||
virtual void handleDestruction(const TreeNode* node);
|
||||
virtual void handleStateChange(const TreeNode* node);
|
||||
virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
|
||||
virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child);
|
||||
|
||||
OctreeNode* getOctreeNode() {return mOctreeNode;}
|
||||
LLViewerOctreeGroup* getParent();
|
||||
|
||||
const LLVector4a* getBounds() const {return mBounds;}
|
||||
const LLVector4a* getExtents() const {return mExtents;}
|
||||
const LLVector4a* getObjectBounds() const {return mObjectBounds;}
|
||||
const LLVector4a* getObjectExtents() const {return mObjectExtents;}
|
||||
|
||||
//octree wrappers to make code more readable
|
||||
//element_list& getData() { return mOctreeNode->getData(); } //unused
|
||||
element_iter getDataBegin() { return mOctreeNode->getDataBegin(); }
|
||||
element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }
|
||||
U32 getElementCount() const { return mOctreeNode->getElementCount(); }
|
||||
bool hasElement(LLViewerOctreeEntryData* data);
|
||||
|
||||
protected:
|
||||
void checkStates();
|
||||
private:
|
||||
virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut);
|
||||
|
||||
protected:
|
||||
U32 mState;
|
||||
OctreeNode* mOctreeNode;
|
||||
|
||||
LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
|
||||
LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
|
||||
LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
|
||||
LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
|
||||
|
||||
S32 mVisible[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
};
|
||||
//octree group which has capability to support occlusion culling
|
||||
//LL_ALIGN_PREFIX(16)
|
||||
class LLOcclusionCullingGroup : public LLViewerOctreeGroup
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
OCCLUDED = 0x00010000,
|
||||
QUERY_PENDING = 0x00020000,
|
||||
ACTIVE_OCCLUSION = 0x00040000,
|
||||
DISCARD_QUERY = 0x00080000,
|
||||
EARLY_FAIL = 0x00100000,
|
||||
} eOcclusionState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATE_MODE_SINGLE = 0, //set one node
|
||||
STATE_MODE_BRANCH, //set entire branch
|
||||
STATE_MODE_DIFF, //set entire branch as long as current state is different
|
||||
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;
|
||||
}
|
||||
|
||||
bool setState(U32 state) const { return mState & state; }
|
||||
bool hasState(U32 state) const { return mState & state; }
|
||||
|
||||
void setOcclusionState(eOcclusionState state, S32 mode = STATE_MODE_SINGLE);
|
||||
void clearOcclusionState(eOcclusionState state, S32 mode = STATE_MODE_SINGLE);
|
||||
void checkOcclusion(); //read back last occlusion query (if any)
|
||||
void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query
|
||||
BOOL isOcclusionState(eOcclusionState state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; }
|
||||
U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];}
|
||||
|
||||
BOOL needsUpdate();
|
||||
U32 getLastOcclusionIssuedTime();
|
||||
|
||||
//virtual
|
||||
void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
|
||||
|
||||
//virtual
|
||||
BOOL isRecentlyVisible() const;
|
||||
LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;}
|
||||
|
||||
static U32 getNewOcclusionQueryObjectName();
|
||||
static void releaseOcclusionQueryObjectName(U32 name);
|
||||
|
||||
protected:
|
||||
void releaseOcclusionQueryObjectNames();
|
||||
|
||||
private:
|
||||
BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds);
|
||||
|
||||
protected:
|
||||
U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
|
||||
U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
S32 mLODHash;
|
||||
|
||||
LLViewerOctreePartition* mSpatialPartition;
|
||||
U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
public:
|
||||
static std::set<U32> sPendingQueries; //pending occlusion queries
|
||||
};
|
||||
|
||||
class LLViewerOctreePartition
|
||||
{
|
||||
public:
|
||||
LLViewerOctreePartition();
|
||||
virtual ~LLViewerOctreePartition();
|
||||
|
||||
// Cull on arbitrary frustum
|
||||
virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0;
|
||||
BOOL isOcclusionEnabled();
|
||||
|
||||
public:
|
||||
U32 mPartitionType;
|
||||
U32 mDrawableType;
|
||||
OctreeNode* mOctree;
|
||||
BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
|
||||
U32 mLODSeed;
|
||||
U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed)
|
||||
};
|
||||
|
||||
class LLViewerOctreeCull : public OctreeTraveler
|
||||
{
|
||||
public:
|
||||
LLViewerOctreeCull(LLCamera* camera)
|
||||
: mCamera(camera), mRes(0) { }
|
||||
|
||||
virtual void traverse(const OctreeNode* n);
|
||||
|
||||
protected:
|
||||
virtual bool earlyFail(LLViewerOctreeGroup* group);
|
||||
|
||||
//agent space group cull
|
||||
S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group);
|
||||
S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group);
|
||||
|
||||
//agent space object set cull
|
||||
S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group);
|
||||
S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group);
|
||||
|
||||
//local region space group cull
|
||||
S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
|
||||
|
||||
//local region space object set cull
|
||||
S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group);
|
||||
S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift);
|
||||
|
||||
virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0;
|
||||
virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0;
|
||||
|
||||
bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius);
|
||||
virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group);
|
||||
virtual void preprocess(LLViewerOctreeGroup* group);
|
||||
virtual void processGroup(LLViewerOctreeGroup* group);
|
||||
virtual void visit(const OctreeNode* branch);
|
||||
|
||||
protected:
|
||||
LLCamera *mCamera;
|
||||
S32 mRes;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -180,8 +180,8 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo
|
||||
|
||||
if (group != NULL)
|
||||
{
|
||||
LLVector3 center(group->mOctreeNode->getCenter().getF32ptr());
|
||||
LLVector3 size(group->mOctreeNode->getSize().getF32ptr());
|
||||
LLVector3 center(group->getOctreeNode()->getCenter().getF32ptr());
|
||||
LLVector3 size(group->getOctreeNode()->getSize().getF32ptr());
|
||||
size += LLVector3(0.01f, 0.01f, 0.01f);
|
||||
mMinObjPos = center - size;
|
||||
mMaxObjPos = center + size;
|
||||
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
LLCapabilityListener mCapabilityListener;
|
||||
|
||||
//spatial partitions for objects in this region
|
||||
std::vector<LLSpatialPartition*> mObjectPartition;
|
||||
std::vector<LLViewerOctreePartition*> mObjectPartition;
|
||||
};
|
||||
|
||||
// support for secondlife:///app/region/{REGION} SLapps
|
||||
@@ -532,10 +532,10 @@ LLViewerRegion::~LLViewerRegion()
|
||||
delete mImpl->mEventPoll;
|
||||
LLHTTPSender::clearSender(mImpl->mHost);
|
||||
|
||||
saveObjectCache();
|
||||
|
||||
std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer());
|
||||
|
||||
saveObjectCache();
|
||||
|
||||
delete mImpl;
|
||||
mImpl = NULL;
|
||||
|
||||
@@ -2226,7 +2226,7 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
|
||||
{
|
||||
if (type < mImpl->mObjectPartition.size())
|
||||
{
|
||||
return mImpl->mObjectPartition[type];
|
||||
return (LLSpatialPartition*)mImpl->mObjectPartition[type];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -74,11 +74,13 @@ class LLDataPacker;
|
||||
class LLDataPackerBinaryBuffer;
|
||||
class LLHost;
|
||||
class LLBBox;
|
||||
class LLSpatialGroup;
|
||||
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3)
|
||||
class LLViewerTexture;
|
||||
// [/SL:KB]
|
||||
|
||||
class LLViewerRegionImpl;
|
||||
class LLViewerOctreeGroup;
|
||||
|
||||
class LLViewerRegion: public LLCapabilityProvider // implements this interface
|
||||
{
|
||||
|
||||
@@ -645,10 +645,10 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count
|
||||
mFaceList.clear();
|
||||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawablep = *i;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
|
||||
if (drawablep->isDead())
|
||||
{
|
||||
@@ -766,8 +766,9 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group)
|
||||
LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
|
||||
//facep->getTexture(),
|
||||
buffer, fullbright);
|
||||
info->mExtents[0] = group->mObjectExtents[0];
|
||||
info->mExtents[1] = group->mObjectExtents[1];
|
||||
const LLVector4a* bounds = group->getObjectExtents();
|
||||
info->mExtents[0] = bounds[0];
|
||||
info->mExtents[1] = bounds[1];
|
||||
info->mVSize = vsize;
|
||||
draw_vec.push_back(info);
|
||||
//for alpha sorting
|
||||
|
||||
@@ -760,7 +760,7 @@ static LLFastTimer::DeclareTimer FTM_REBUILD_PARTICLE_VBO("Particle VBO");
|
||||
|
||||
void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
|
||||
{
|
||||
if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY))
|
||||
if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -806,10 +806,10 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co
|
||||
mFaceList.clear();
|
||||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawablep = *i;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
|
||||
if (drawablep->isDead())
|
||||
{
|
||||
@@ -976,8 +976,9 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
||||
LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
|
||||
//facep->getTexture(),
|
||||
buffer, fullbright);
|
||||
info->mExtents[0] = group->mObjectExtents[0];
|
||||
info->mExtents[1] = group->mObjectExtents[1];
|
||||
const LLVector4a* bounds = group->getBounds();
|
||||
info->mExtents[0] = bounds[0];
|
||||
info->mExtents[1] = bounds[1];
|
||||
info->mVSize = vsize;
|
||||
info->mBlendFuncDst = bf_dst;
|
||||
info->mBlendFuncSrc = bf_src;
|
||||
|
||||
@@ -4402,9 +4402,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
|
||||
group->mLastUpdateViewAngle = group->mViewAngle;
|
||||
|
||||
if (!group->isState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY))
|
||||
if (!group->hasState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY))
|
||||
{
|
||||
if (group->isState(LLSpatialGroup::MESH_DIRTY) && !LLPipeline::sDelayVBUpdate)
|
||||
if (group->hasState(LLSpatialGroup::MESH_DIRTY) && !LLPipeline::sDelayVBUpdate)
|
||||
{
|
||||
rebuildMesh(group);
|
||||
}
|
||||
@@ -4417,7 +4417,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
|
||||
LLVOAvatar* pAvatarVO = NULL;
|
||||
|
||||
LLSpatialBridge* bridge = group->mSpatialPartition->asBridge();
|
||||
LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
|
||||
if (bridge)
|
||||
{
|
||||
if (bridge->mAvatar.isNull())
|
||||
@@ -4442,7 +4442,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
group->mSurfaceArea = 0;
|
||||
|
||||
//cache object box size since it might be used for determining visibility
|
||||
group->mObjectBoxSize = group->mObjectBounds[1].getLength3().getF32();
|
||||
group->mObjectBoxSize = group->getObjectBounds()[1].getLength3().getF32();
|
||||
|
||||
group->clearDrawMap();
|
||||
|
||||
@@ -4466,12 +4466,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
U32 spec_count = 0;
|
||||
U32 normspec_count = 0;
|
||||
|
||||
U32 useage = group->mSpatialPartition->mBufferUsage;
|
||||
U32 useage = group->getSpatialPartition()->mBufferUsage;
|
||||
|
||||
static const LLCachedControl<S32> render_max_vbo_size("RenderMaxVBOSize", 512);
|
||||
static const LLCachedControl<S32> render_max_node_size("RenderMaxNodeSize",8192);
|
||||
U32 max_vertices = (render_max_vbo_size*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
|
||||
U32 max_total = (render_max_node_size*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
|
||||
U32 max_vertices = (render_max_vbo_size*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
|
||||
U32 max_total = (render_max_node_size*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
|
||||
max_vertices = llmin(max_vertices, (U32) 65535);
|
||||
|
||||
U32 cur_total = 0;
|
||||
@@ -4482,10 +4482,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST);
|
||||
|
||||
//get all the faces into a list
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = *drawable_iter;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
|
||||
if (drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) )
|
||||
{
|
||||
@@ -5249,10 +5249,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
||||
if (!LLPipeline::sDelayVBUpdate)
|
||||
{
|
||||
//drawables have been rebuilt, clear rebuild status
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = *drawable_iter;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
drawablep->clearState(LLDrawable::REBUILD_ALL);
|
||||
}
|
||||
}
|
||||
@@ -5280,14 +5280,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
||||
{
|
||||
llassert(group);
|
||||
static int warningsCount = 20;
|
||||
if (group && group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY))
|
||||
if (group && group->hasState(LLSpatialGroup::MESH_DIRTY) && !group->hasState(LLSpatialGroup::GEOM_DIRTY))
|
||||
{
|
||||
LLFastTimer ftm(FTM_REBUILD_VOLUME_VB);
|
||||
LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); //make sure getgeometryvolume shows up in the right place in timers
|
||||
|
||||
group->mBuilt = 1.f;
|
||||
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
S32 num_mapped_vertex_buffer = LLVertexBuffer::sMappedCount ;
|
||||
|
||||
const U32 MAX_BUFFER_COUNT = 4096;
|
||||
@@ -5297,7 +5297,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
||||
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = *drawable_iter;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
|
||||
if (!drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) )
|
||||
{
|
||||
@@ -5367,10 +5367,10 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
||||
LL_WARNS() << "Not all mapped vertex buffers are unmapped!" << LL_ENDL ;
|
||||
warningsCount = 1;
|
||||
}
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = *drawable_iter;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
||||
{
|
||||
LLFace* face = drawablep->getFace(i);
|
||||
@@ -5498,7 +5498,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
|
||||
|
||||
//calculate maximum number of vertices to store in a single buffer
|
||||
static const LLCachedControl<S32> render_max_vbo_size("RenderMaxVBOSize", 512);
|
||||
U32 max_vertices = (render_max_vbo_size*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
|
||||
U32 max_vertices = (render_max_vbo_size*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
|
||||
max_vertices = llmin(max_vertices, (U32) 65535);
|
||||
|
||||
{
|
||||
@@ -6335,17 +6335,17 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
|
||||
void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count)
|
||||
{
|
||||
//initialize to default usage for this partition
|
||||
U32 usage = group->mSpatialPartition->mBufferUsage;
|
||||
U32 usage = group->getSpatialPartition()->mBufferUsage;
|
||||
|
||||
//clear off any old faces
|
||||
mFaceList.clear();
|
||||
|
||||
//for each drawable
|
||||
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = *drawable_iter;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
|
||||
if (drawablep->isDead())
|
||||
{
|
||||
|
||||
@@ -154,6 +154,10 @@ void LLWorld::destroyClass()
|
||||
{
|
||||
mEdgeWaterObjects[i] = NULL;
|
||||
}
|
||||
|
||||
//make all visible drawbles invisible.
|
||||
LLDrawable::incrementVisible();
|
||||
|
||||
}
|
||||
|
||||
void LLWorld::setRegionSize(const U32& width, const U32& length)
|
||||
@@ -700,7 +704,7 @@ void LLWorld::updateVisibilities()
|
||||
if (part)
|
||||
{
|
||||
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
|
||||
const LLVector4a* bounds = group->mBounds;
|
||||
const LLVector4a* bounds = group->getBounds();
|
||||
if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
|
||||
{
|
||||
mCulledRegionList.erase(curiter);
|
||||
@@ -724,7 +728,7 @@ void LLWorld::updateVisibilities()
|
||||
if (part)
|
||||
{
|
||||
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
|
||||
const LLVector4a* bounds = group->mBounds;
|
||||
const LLVector4a* bounds = group->getBounds();
|
||||
if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1]))
|
||||
{
|
||||
regionp->calculateCameraDistance();
|
||||
|
||||
@@ -1300,18 +1300,18 @@ S32 LLPipeline::setLightingDetail(S32 level)
|
||||
return mLightingDetail;
|
||||
}
|
||||
|
||||
class LLOctreeDirtyTexture : public LLOctreeTraveler<LLDrawable>
|
||||
class LLOctreeDirtyTexture : public OctreeTraveler
|
||||
{
|
||||
public:
|
||||
const std::set<LLViewerFetchedTexture*>& mTextures;
|
||||
|
||||
LLOctreeDirtyTexture(const std::set<LLViewerFetchedTexture*>& textures) : mTextures(textures) { }
|
||||
|
||||
virtual void visit(const LLOctreeNode<LLDrawable>* node)
|
||||
virtual void visit(const OctreeNode* node)
|
||||
{
|
||||
LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
|
||||
|
||||
if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())
|
||||
if (!group->hasState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())
|
||||
{
|
||||
for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
|
||||
{
|
||||
@@ -1591,11 +1591,9 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj)
|
||||
LL_ERRS() << "Null object passed to allocDrawable!" << LL_ENDL;
|
||||
}
|
||||
|
||||
LLDrawable *drawable = new LLDrawable();
|
||||
LLDrawable *drawable = new LLDrawable(vobj);
|
||||
vobj->mDrawable = drawable;
|
||||
|
||||
drawable->mVObjp = vobj;
|
||||
|
||||
//encompass completely sheared objects by taking
|
||||
//the most extreme point possible (<1,1,0.5>)
|
||||
drawable->setRadius(LLVector3(1,1,0.5f).scaleVec(vobj->getScale()).length());
|
||||
@@ -1635,7 +1633,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
|
||||
if (drawablep->getSpatialGroup())
|
||||
{
|
||||
LLFastTimer t(FTM_REMOVE_FROM_SPATIAL_PARTITION);
|
||||
if (!drawablep->getSpatialGroup()->mSpatialPartition->remove(drawablep, drawablep->getSpatialGroup()))
|
||||
if (!drawablep->getSpatialGroup()->getSpatialPartition()->remove(drawablep, drawablep->getSpatialGroup()))
|
||||
{
|
||||
#ifdef LL_RELEASE_FOR_DOWNLOAD
|
||||
LL_WARNS() << "Couldn't remove object from spatial group!" << LL_ENDL;
|
||||
@@ -2015,7 +2013,7 @@ void check_references(LLSpatialGroup* group, LLDrawable* drawable)
|
||||
{
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
if (drawable == *i)
|
||||
if (drawable == (LLDrawable*)(*i)->getDrawable())
|
||||
{
|
||||
LL_ERRS() << "LLDrawable deleted while actively reference by LLPipeline." << LL_ENDL;
|
||||
}
|
||||
@@ -2037,9 +2035,12 @@ void check_references(LLSpatialGroup* group, LLFace* face)
|
||||
{
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawable = *i;
|
||||
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
|
||||
if(drawable)
|
||||
{
|
||||
check_references(drawable, face);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPipeline::checkReferences(LLFace* face)
|
||||
@@ -2217,7 +2218,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
|
||||
min = LLVector3(X,X,X);
|
||||
max = LLVector3(-X,-X,-X);
|
||||
|
||||
U32 saved_camera_id = LLViewerCamera::sCurCameraID;
|
||||
LLViewerCamera::eCameraID saved_camera_id = LLViewerCamera::sCurCameraID;
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
BOOL res = TRUE;
|
||||
@@ -2444,15 +2445,16 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
|
||||
return;
|
||||
}
|
||||
|
||||
const LLVector4a* bounds = group->getBounds();
|
||||
if (sMinRenderSize > 0.f &&
|
||||
llmax(llmax(group->mBounds[1][0], group->mBounds[1][1]), group->mBounds[1][2]) < sMinRenderSize)
|
||||
llmax(llmax(bounds[1][0], bounds[1][1]), bounds[1][2]) < sMinRenderSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
assertInitialized();
|
||||
|
||||
if (!group->mSpatialPartition->mRenderByGroup)
|
||||
if (!group->getSpatialPartition()->mRenderByGroup)
|
||||
{ //render by drawable
|
||||
sCull->pushDrawableGroup(group);
|
||||
}
|
||||
@@ -2760,7 +2762,7 @@ void LLPipeline::rebuildGroups()
|
||||
{
|
||||
group->rebuildGeom();
|
||||
|
||||
if (group->mSpatialPartition->mRenderByGroup)
|
||||
if (group->getSpatialPartition()->mRenderByGroup)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@@ -3094,23 +3096,23 @@ void LLPipeline::markMeshDirty(LLSpatialGroup* group)
|
||||
|
||||
void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)
|
||||
{
|
||||
if (group && !group->isDead() && group->mSpatialPartition)
|
||||
if (group && !group->isDead() && group->getSpatialPartition())
|
||||
{
|
||||
if (group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD)
|
||||
if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD)
|
||||
{
|
||||
priority = TRUE;
|
||||
}
|
||||
|
||||
if (priority)
|
||||
{
|
||||
if (!group->isState(LLSpatialGroup::IN_BUILD_Q1))
|
||||
if (!group->hasState(LLSpatialGroup::IN_BUILD_Q1))
|
||||
{
|
||||
llassert_always(!mGroupQ1Locked);
|
||||
|
||||
mGroupQ1.push_back(group);
|
||||
group->setState(LLSpatialGroup::IN_BUILD_Q1);
|
||||
|
||||
if (group->isState(LLSpatialGroup::IN_BUILD_Q2))
|
||||
if (group->hasState(LLSpatialGroup::IN_BUILD_Q2))
|
||||
{
|
||||
LLSpatialGroup::sg_vector_t::iterator iter = std::find(mGroupQ2.begin(), mGroupQ2.end(), group);
|
||||
if (iter != mGroupQ2.end())
|
||||
@@ -3121,7 +3123,7 @@ void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!group->isState(LLSpatialGroup::IN_BUILD_Q2 | LLSpatialGroup::IN_BUILD_Q1))
|
||||
else if (!group->hasState(LLSpatialGroup::IN_BUILD_Q2 | LLSpatialGroup::IN_BUILD_Q1))
|
||||
{
|
||||
llassert_always(!mGroupQ2Locked);
|
||||
//LL_ERRS() << "Non-priority updates not yet supported!" << LL_ENDL;
|
||||
@@ -3199,10 +3201,10 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
|
||||
else
|
||||
{
|
||||
group->setVisible();
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
markVisible(*i, camera);
|
||||
markVisible((LLDrawable*)(*i)->getDrawable(), camera);
|
||||
}
|
||||
|
||||
if (!sDelayVBUpdate)
|
||||
@@ -3287,10 +3289,10 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
|
||||
{
|
||||
if (!sSkipUpdate && group->changeLOD())
|
||||
{
|
||||
OctreeGuard guard(group->mOctreeNode);
|
||||
OctreeGuard guard(group->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawablep = *i;
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
stateSort(drawablep, camera);
|
||||
}
|
||||
|
||||
@@ -3413,10 +3415,10 @@ void forAllDrawables(LLCullResult::sg_iterator begin,
|
||||
{
|
||||
for (LLCullResult::sg_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
OctreeGuard guard((*i)->mOctreeNode);
|
||||
OctreeGuard guard((*i)->getOctreeNode());
|
||||
for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)
|
||||
{
|
||||
func(*j);
|
||||
func((LLDrawable*)(*j)->getDrawable());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3653,7 +3655,7 @@ void LLPipeline::postSort(LLCamera& camera)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (group->isState(LLSpatialGroup::NEW_DRAWINFO) && group->isState(LLSpatialGroup::GEOM_DIRTY))
|
||||
if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY))
|
||||
{ //no way this group is going to be drawable without a rebuild
|
||||
group->rebuildGeom();
|
||||
}
|
||||
@@ -3691,7 +3693,7 @@ void LLPipeline::postSort(LLCamera& camera)
|
||||
|
||||
if (alpha != group->mDrawMap.end())
|
||||
{ //store alpha groups for sorting
|
||||
LLSpatialBridge* bridge = group->mSpatialPartition->asBridge();
|
||||
LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
|
||||
if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
|
||||
{
|
||||
if (bridge)
|
||||
@@ -4912,7 +4914,7 @@ void LLPipeline::renderDebug()
|
||||
continue;
|
||||
}
|
||||
|
||||
LLSpatialBridge* bridge = group->mSpatialPartition->asBridge();
|
||||
LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
|
||||
|
||||
if (bridge && (!bridge->mDrawable || bridge->mDrawable->isDead()))
|
||||
{
|
||||
@@ -9945,7 +9947,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
||||
mShadowFrustPoints[j].clear();
|
||||
}
|
||||
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j;
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::eCameraID(LLViewerCamera::CAMERA_SHADOW0+j);
|
||||
|
||||
//restore render matrices
|
||||
glh_set_current_modelview(saved_view);
|
||||
@@ -10304,7 +10306,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
||||
//update shadow targets
|
||||
for (U32 i = 0; i < 2; i++)
|
||||
{ //for each current shadow
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW4+i;
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::eCameraID(LLViewerCamera::CAMERA_SHADOW4 + i);
|
||||
|
||||
if (mShadowSpotLight[i].notNull() &&
|
||||
(mShadowSpotLight[i] == mTargetShadowSpotLight[0] ||
|
||||
@@ -10416,7 +10418,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
||||
|
||||
static LLCullResult result[2];
|
||||
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+i+4;
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::eCameraID(LLViewerCamera::CAMERA_SHADOW0 + i + 4);
|
||||
|
||||
renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width);
|
||||
|
||||
@@ -10463,7 +10465,7 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu
|
||||
LLSpatialGroup* group = *i;
|
||||
if (!group->isDead() &&
|
||||
(!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) &&
|
||||
gPipeline.hasRenderType(group->mSpatialPartition->mDrawableType) &&
|
||||
gPipeline.hasRenderType(group->getSpatialPartition()->mDrawableType) &&
|
||||
group->mDrawMap.find(type) != group->mDrawMap.end())
|
||||
{
|
||||
pass->renderGroup(group,type,mask,texture);
|
||||
|
||||
Reference in New Issue
Block a user