V2 spatial partition, and all the pipeline changes that go with it.
Note: Deferred mode is not finished, and thus broken. Don't use!
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include "llcubemap.h"
|
||||
#include "lldrawpool.h"
|
||||
#include "llface.h"
|
||||
#include "llviewercamera.h"
|
||||
|
||||
#include <queue>
|
||||
|
||||
@@ -153,12 +154,12 @@ public:
|
||||
class LLSpatialGroup : public LLOctreeListener<LLDrawable>
|
||||
{
|
||||
friend class LLSpatialPartition;
|
||||
friend class LLOctreeStateCheck;
|
||||
public:
|
||||
static U32 sNodeCount;
|
||||
static BOOL sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
|
||||
|
||||
typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
|
||||
typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t;
|
||||
typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t;
|
||||
typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t;
|
||||
typedef std::map<U32, drawmap_elem_t > draw_map_t;
|
||||
@@ -183,6 +184,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct CompareUpdateUrgency
|
||||
{
|
||||
bool operator()(const LLPointer<LLSpatialGroup> lhs, const LLPointer<LLSpatialGroup> rhs)
|
||||
{
|
||||
return lhs->getUpdateUrgency() > rhs->getUpdateUrgency();
|
||||
}
|
||||
};
|
||||
|
||||
struct CompareDepthGreater
|
||||
{
|
||||
bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs)
|
||||
@@ -193,53 +202,67 @@ public:
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OCCLUDED = 0x00000001,
|
||||
IN_QUEUE = 0x00000002,
|
||||
QUERY_PENDING = 0x00000004,
|
||||
ACTIVE_OCCLUSION = 0x00000008,
|
||||
DISCARD_QUERY = 0x00000010,
|
||||
DEAD = 0x00000020,
|
||||
EARLY_FAIL = 0x00000040,
|
||||
DIRTY = 0x00000080,
|
||||
OBJECT_DIRTY = 0x00000100,
|
||||
GEOM_DIRTY = 0x00000200,
|
||||
ALPHA_DIRTY = 0x00000800,
|
||||
SKIP_FRUSTUM_CHECK = 0x00001000,
|
||||
IN_IMAGE_QUEUE = 0x00002000,
|
||||
IMAGE_DIRTY = 0x00004000,
|
||||
OCCLUSION_DIRTY = 0x00008000,
|
||||
MESH_DIRTY = 0x00010000,
|
||||
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,
|
||||
OCCLUSION_DIRTY = 0x00000100,
|
||||
MESH_DIRTY = 0x00000200,
|
||||
NEW_DRAWINFO = 0x00000400,
|
||||
IN_BUILD_Q1 = 0x00000800,
|
||||
IN_BUILD_Q2 = 0x00001000,
|
||||
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_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 isDead() { return isState(DEAD); }
|
||||
BOOL isState(U32 state) const { return mState & state ? TRUE : FALSE; }
|
||||
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(U32 state);
|
||||
void clearState(U32 state);
|
||||
void setState(eSpatialState state);
|
||||
void clearState(eSpatialState state);
|
||||
|
||||
void clearDrawMap();
|
||||
void validate();
|
||||
void checkStates();
|
||||
void validateDrawMap();
|
||||
|
||||
void setState(U32 state, S32 mode);
|
||||
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);
|
||||
|
||||
LLSpatialGroup* getParent();
|
||||
|
||||
void clearState(U32 state, S32 mode);
|
||||
|
||||
BOOL addObject(LLDrawable *drawablep, BOOL add_all = FALSE, BOOL from_octree = FALSE);
|
||||
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 LLVector3 &offset);
|
||||
BOOL boundObjects(BOOL empty, LLVector3& newMin, LLVector3& newMax);
|
||||
@@ -252,6 +275,7 @@ public:
|
||||
|
||||
void updateDistance(LLCamera& camera);
|
||||
BOOL needsUpdate();
|
||||
F32 getUpdateUrgency() const;
|
||||
BOOL changeLOD();
|
||||
void rebuildGeom();
|
||||
void rebuildMesh();
|
||||
@@ -261,6 +285,8 @@ public:
|
||||
element_list& getData() { return mOctreeNode->getData(); }
|
||||
U32 getElementCount() const { return mOctreeNode->getElementCount(); }
|
||||
|
||||
void drawObjectBox(LLColor4 col);
|
||||
|
||||
//LISTENER FUNCTIONS
|
||||
virtual void handleInsertion(const TreeNode* node, LLDrawable* face);
|
||||
virtual void handleRemoval(const TreeNode* node, LLDrawable* face);
|
||||
@@ -273,6 +299,7 @@ protected:
|
||||
virtual ~LLSpatialGroup();
|
||||
|
||||
U32 mState;
|
||||
U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS];
|
||||
S32 mLODHash;
|
||||
static S32 sLODSeed;
|
||||
|
||||
@@ -291,12 +318,12 @@ public:
|
||||
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
F32* mOcclusionVerts;
|
||||
GLuint mOcclusionQuery;
|
||||
GLuint mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
U32 mBufferUsage;
|
||||
draw_map_t mDrawMap;
|
||||
|
||||
S32 mVisible;
|
||||
S32 mVisible[LLViewerCamera::NUM_CAMERAS];
|
||||
F32 mDistance;
|
||||
F32 mDepth;
|
||||
F32 mLastUpdateDistance;
|
||||
@@ -309,6 +336,15 @@ public:
|
||||
F32 mRadius;
|
||||
};
|
||||
|
||||
inline LLSpatialGroup::eOcclusionState operator|(const LLSpatialGroup::eOcclusionState &a, const LLSpatialGroup::eOcclusionState &b)
|
||||
{
|
||||
return LLSpatialGroup::eOcclusionState(+a | +b);
|
||||
}
|
||||
inline LLSpatialGroup::eSpatialState operator|(const LLSpatialGroup::eSpatialState &a, const LLSpatialGroup::eSpatialState &b)
|
||||
{
|
||||
return LLSpatialGroup::eSpatialState(+a | +b);
|
||||
}
|
||||
|
||||
class LLGeometryManager
|
||||
{
|
||||
public:
|
||||
@@ -325,9 +361,8 @@ public:
|
||||
class LLSpatialPartition: public LLGeometryManager
|
||||
{
|
||||
public:
|
||||
static BOOL sFreezeState; //if true, no spatialgroup state updates will be made
|
||||
|
||||
LLSpatialPartition(U32 data_mask, U32 mBufferUsage = GL_STATIC_DRAW_ARB);
|
||||
//static BOOL sFreezeState; //if true, no spatialgroup state updates will be made
|
||||
LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage);
|
||||
virtual ~LLSpatialPartition();
|
||||
|
||||
LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE);
|
||||
@@ -392,7 +427,7 @@ protected:
|
||||
public:
|
||||
typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t;
|
||||
|
||||
LLSpatialBridge(LLDrawable* root, U32 data_mask);
|
||||
LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask);
|
||||
|
||||
virtual BOOL isSpatialBridge() const { return TRUE; }
|
||||
|
||||
@@ -473,14 +508,22 @@ private:
|
||||
U32 mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES];
|
||||
|
||||
sg_list_t mVisibleGroups;
|
||||
sg_list_t::iterator mVisibleGroupsEnd;
|
||||
sg_list_t mAlphaGroups;
|
||||
sg_list_t::iterator mAlphaGroupsEnd;
|
||||
sg_list_t mOcclusionGroups;
|
||||
sg_list_t::iterator mOcclusionGroupsEnd;
|
||||
sg_list_t mDrawableGroups;
|
||||
sg_list_t::iterator mDrawableGroupsEnd;
|
||||
drawable_list_t mVisibleList;
|
||||
drawable_list_t::iterator mVisibleListEnd;
|
||||
bridge_list_t mVisibleBridge;
|
||||
bridge_list_t::iterator mVisibleBridgeEnd;
|
||||
drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES];
|
||||
drawinfo_list_t::iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES];
|
||||
};
|
||||
|
||||
|
||||
//spatial partition for water (implemented in LLVOWater.cpp)
|
||||
class LLWaterPartition : public LLSpatialPartition
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user