diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2009-02-18 21:10:16 +0000 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2009-02-18 21:10:16 +0000 |
commit | abdc99f21b542c4fea67030ddbd7166c9d1c6c63 (patch) | |
tree | 3e984e405adfdec189ca8a047daca5250737ffbf /indra/newview/llspatialpartition.h | |
parent | 34412f0530cf6a411b4de906a8e9da59cbcb3a85 (diff) |
Merge of QAR-1267 to trunk. This was a combo merge of QAR-1175 (maint-render-9) and QAR-1236 (dll-msvcrt-2)
svn merge -r 109838:112264 svn+ssh://svn.lindenlab.com/svn/linden/branches/maint-render/maint-render-9-merge-r109833
Diffstat (limited to 'indra/newview/llspatialpartition.h')
-rw-r--r-- | indra/newview/llspatialpartition.h | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 2f0d80414d..4d67b374c8 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -42,6 +42,7 @@ #include "llgltypes.h" #include "llcubemap.h" #include "lldrawpool.h" +#include "llface.h" #include <queue> @@ -55,6 +56,9 @@ class LLSpatialGroup; 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); +// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera +U8* get_box_fan_indices(LLCamera* camera, const LLVector3& center); + class LLDrawInfo : public LLRefCount { protected: @@ -82,6 +86,9 @@ public: F32 mPartSize; F32 mVSize; LLSpatialGroup* mGroup; + LLFace* mFace; //associated face + F32 mDistance; + LLVector3 mExtents[2]; struct CompareTexture { @@ -101,6 +108,16 @@ public: } }; + struct CompareVertexBuffer + { //sort by texture + bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) + { + // sort by pointer, sort NULL down to the end + return lhs.get() != rhs.get() + && (lhs.isNull() || (rhs.notNull() && lhs->mVertexBuffer.get() > rhs->mVertexBuffer.get())); + } + }; + struct CompareTexturePtrMatrix { bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) @@ -121,6 +138,16 @@ public: && (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump)); } }; + + struct CompareDistanceGreater + { + bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) + { + // sort by mBump value, sort NULL down to the end + return lhs.get() != rhs.get() + && (lhs.isNull() || (rhs.notNull() && lhs->mDistance > rhs->mDistance)); + } + }; }; class LLSpatialGroup : public LLOctreeListener<LLDrawable> @@ -136,7 +163,8 @@ public: typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; typedef std::map<U32, drawmap_elem_t > draw_map_t; typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; - typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_map_t; + typedef std::map<LLPointer<LLViewerImage>, 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; @@ -226,6 +254,7 @@ public: BOOL needsUpdate(); BOOL changeLOD(); void rebuildGeom(); + void rebuildMesh(); void dirtyGeom() { setState(GEOM_DIRTY); } void dirtyMesh() { setState(MESH_DIRTY); } @@ -286,8 +315,10 @@ public: std::vector<LLFace*> mFaceList; virtual ~LLGeometryManager() { } virtual void rebuildGeom(LLSpatialGroup* group) = 0; + virtual void rebuildMesh(LLSpatialGroup* group) = 0; virtual void getGeometry(LLSpatialGroup* group) = 0; virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count); + virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage); }; @@ -320,7 +351,9 @@ public: virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera); virtual void rebuildGeom(LLSpatialGroup* group); + 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 BOOL isVisible(const LLVector3& v); @@ -329,9 +362,12 @@ public: virtual BOOL isBridge() { return asBridge() != NULL; } void renderDebug(); + void renderIntersectingBBoxes(LLCamera* camera); void restoreGL(); void resetVertexBuffers(); - + BOOL isOcclusionEnabled(); + BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax); + public: LLSpatialGroup::OctreeNode* mOctree; BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed @@ -445,6 +481,7 @@ private: drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; }; + //spatial partition for water (implemented in LLVOWater.cpp) class LLWaterPartition : public LLSpatialPartition { @@ -511,8 +548,11 @@ class LLVolumeGeometryManager: public LLGeometryManager public: virtual ~LLVolumeGeometryManager() { } virtual void rebuildGeom(LLSpatialGroup* group); + virtual void rebuildMesh(LLSpatialGroup* group); virtual void getGeometry(LLSpatialGroup* group); + void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort = FALSE); void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type); + }; //spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp) @@ -522,6 +562,7 @@ public: LLVolumePartition(); virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } + virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } }; @@ -532,6 +573,7 @@ public: LLVolumeBridge(LLDrawable* drawable); virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } + virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } }; |