diff options
author | Jacek Antonelli | 2009-11-19 04:19:06 -0600 |
---|---|---|
committer | Jacek Antonelli | 2009-11-19 04:19:06 -0600 |
commit | 1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427 (patch) | |
tree | e09ccbc010e326a48fd91ba15b58afd7fb836b3f /linden/indra/newview/llspatialpartition.h | |
parent | Fixed minor formatting issue in MANIFESTO.txt. (diff) | |
parent | Fixed CMake setting errors (diff) | |
download | meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.zip meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.gz meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.bz2 meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.xz |
Merge remote branch 'mccabe/1.3.0-next' into next
Conflicts:
linden/indra/cmake/00-Common.cmake
linden/indra/newview/skins/default/xui/de/floater_about.xml
linden/indra/newview/skins/default/xui/fr/floater_about.xml
linden/indra/newview/skins/default/xui/ja/floater_about.xml
linden/indra/newview/skins/default/xui/ko/floater_about.xml
linden/indra/newview/skins/default/xui/zh/floater_about.xml
linden/install.xml
Diffstat (limited to 'linden/indra/newview/llspatialpartition.h')
-rw-r--r-- | linden/indra/newview/llspatialpartition.h | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/linden/indra/newview/llspatialpartition.h b/linden/indra/newview/llspatialpartition.h index 20cb061..df96152 100644 --- a/linden/indra/newview/llspatialpartition.h +++ b/linden/indra/newview/llspatialpartition.h | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -41,6 +42,7 @@ | |||
41 | #include "llgltypes.h" | 42 | #include "llgltypes.h" |
42 | #include "llcubemap.h" | 43 | #include "llcubemap.h" |
43 | #include "lldrawpool.h" | 44 | #include "lldrawpool.h" |
45 | #include "llface.h" | ||
44 | 46 | ||
45 | #include <queue> | 47 | #include <queue> |
46 | 48 | ||
@@ -54,6 +56,9 @@ class LLSpatialGroup; | |||
54 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); | 56 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); |
55 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); | 57 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); |
56 | 58 | ||
59 | // get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera | ||
60 | U8* get_box_fan_indices(LLCamera* camera, const LLVector3& center); | ||
61 | |||
57 | class LLDrawInfo : public LLRefCount | 62 | class LLDrawInfo : public LLRefCount |
58 | { | 63 | { |
59 | protected: | 64 | protected: |
@@ -81,6 +86,9 @@ public: | |||
81 | F32 mPartSize; | 86 | F32 mPartSize; |
82 | F32 mVSize; | 87 | F32 mVSize; |
83 | LLSpatialGroup* mGroup; | 88 | LLSpatialGroup* mGroup; |
89 | LLFace* mFace; //associated face | ||
90 | F32 mDistance; | ||
91 | LLVector3 mExtents[2]; | ||
84 | 92 | ||
85 | struct CompareTexture | 93 | struct CompareTexture |
86 | { | 94 | { |
@@ -100,6 +108,16 @@ public: | |||
100 | } | 108 | } |
101 | }; | 109 | }; |
102 | 110 | ||
111 | struct CompareVertexBuffer | ||
112 | { //sort by texture | ||
113 | bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) | ||
114 | { | ||
115 | // sort by pointer, sort NULL down to the end | ||
116 | return lhs.get() != rhs.get() | ||
117 | && (lhs.isNull() || (rhs.notNull() && lhs->mVertexBuffer.get() > rhs->mVertexBuffer.get())); | ||
118 | } | ||
119 | }; | ||
120 | |||
103 | struct CompareTexturePtrMatrix | 121 | struct CompareTexturePtrMatrix |
104 | { | 122 | { |
105 | bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) | 123 | bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) |
@@ -120,6 +138,16 @@ public: | |||
120 | && (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump)); | 138 | && (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump)); |
121 | } | 139 | } |
122 | }; | 140 | }; |
141 | |||
142 | struct CompareDistanceGreater | ||
143 | { | ||
144 | bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) | ||
145 | { | ||
146 | // sort by mBump value, sort NULL down to the end | ||
147 | return lhs.get() != rhs.get() | ||
148 | && (lhs.isNull() || (rhs.notNull() && lhs->mDistance > rhs->mDistance)); | ||
149 | } | ||
150 | }; | ||
123 | }; | 151 | }; |
124 | 152 | ||
125 | class LLSpatialGroup : public LLOctreeListener<LLDrawable> | 153 | class LLSpatialGroup : public LLOctreeListener<LLDrawable> |
@@ -135,7 +163,8 @@ public: | |||
135 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; | 163 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; |
136 | typedef std::map<U32, drawmap_elem_t > draw_map_t; | 164 | typedef std::map<U32, drawmap_elem_t > draw_map_t; |
137 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; | 165 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; |
138 | typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_map_t; | 166 | typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_texture_map_t; |
167 | typedef std::map<U32, buffer_texture_map_t> buffer_map_t; | ||
139 | 168 | ||
140 | typedef LLOctreeListener<LLDrawable> BaseType; | 169 | typedef LLOctreeListener<LLDrawable> BaseType; |
141 | typedef LLOctreeListener<LLDrawable> OctreeListener; | 170 | typedef LLOctreeListener<LLDrawable> OctreeListener; |
@@ -225,6 +254,7 @@ public: | |||
225 | BOOL needsUpdate(); | 254 | BOOL needsUpdate(); |
226 | BOOL changeLOD(); | 255 | BOOL changeLOD(); |
227 | void rebuildGeom(); | 256 | void rebuildGeom(); |
257 | void rebuildMesh(); | ||
228 | 258 | ||
229 | void dirtyGeom() { setState(GEOM_DIRTY); } | 259 | void dirtyGeom() { setState(GEOM_DIRTY); } |
230 | void dirtyMesh() { setState(MESH_DIRTY); } | 260 | void dirtyMesh() { setState(MESH_DIRTY); } |
@@ -285,8 +315,10 @@ public: | |||
285 | std::vector<LLFace*> mFaceList; | 315 | std::vector<LLFace*> mFaceList; |
286 | virtual ~LLGeometryManager() { } | 316 | virtual ~LLGeometryManager() { } |
287 | virtual void rebuildGeom(LLSpatialGroup* group) = 0; | 317 | virtual void rebuildGeom(LLSpatialGroup* group) = 0; |
318 | virtual void rebuildMesh(LLSpatialGroup* group) = 0; | ||
288 | virtual void getGeometry(LLSpatialGroup* group) = 0; | 319 | virtual void getGeometry(LLSpatialGroup* group) = 0; |
289 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count); | 320 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count); |
321 | |||
290 | virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage); | 322 | virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage); |
291 | }; | 323 | }; |
292 | 324 | ||
@@ -319,7 +351,9 @@ public: | |||
319 | virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera); | 351 | virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera); |
320 | 352 | ||
321 | virtual void rebuildGeom(LLSpatialGroup* group); | 353 | virtual void rebuildGeom(LLSpatialGroup* group); |
354 | virtual void rebuildMesh(LLSpatialGroup* group); | ||
322 | 355 | ||
356 | BOOL visibleObjectsInFrustum(LLCamera& camera); | ||
323 | S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum | 357 | S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum |
324 | 358 | ||
325 | BOOL isVisible(const LLVector3& v); | 359 | BOOL isVisible(const LLVector3& v); |
@@ -328,9 +362,12 @@ public: | |||
328 | virtual BOOL isBridge() { return asBridge() != NULL; } | 362 | virtual BOOL isBridge() { return asBridge() != NULL; } |
329 | 363 | ||
330 | void renderDebug(); | 364 | void renderDebug(); |
365 | void renderIntersectingBBoxes(LLCamera* camera); | ||
331 | void restoreGL(); | 366 | void restoreGL(); |
332 | void resetVertexBuffers(); | 367 | void resetVertexBuffers(); |
333 | 368 | BOOL isOcclusionEnabled(); | |
369 | BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax); | ||
370 | |||
334 | public: | 371 | public: |
335 | LLSpatialGroup::OctreeNode* mOctree; | 372 | LLSpatialGroup::OctreeNode* mOctree; |
336 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed | 373 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed |
@@ -362,7 +399,7 @@ public: | |||
362 | virtual void updateSpatialExtents(); | 399 | virtual void updateSpatialExtents(); |
363 | virtual void updateBinRadius(); | 400 | virtual void updateBinRadius(); |
364 | virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE); | 401 | virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE); |
365 | virtual void updateDistance(LLCamera& camera_in); | 402 | virtual void updateDistance(LLCamera& camera_in, bool force_update); |
366 | virtual void makeActive(); | 403 | virtual void makeActive(); |
367 | virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE); | 404 | virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE); |
368 | virtual BOOL updateMove(); | 405 | virtual BOOL updateMove(); |
@@ -444,6 +481,7 @@ private: | |||
444 | drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; | 481 | drawinfo_list_t mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; |
445 | }; | 482 | }; |
446 | 483 | ||
484 | |||
447 | //spatial partition for water (implemented in LLVOWater.cpp) | 485 | //spatial partition for water (implemented in LLVOWater.cpp) |
448 | class LLWaterPartition : public LLSpatialPartition | 486 | class LLWaterPartition : public LLSpatialPartition |
449 | { | 487 | { |
@@ -510,8 +548,11 @@ class LLVolumeGeometryManager: public LLGeometryManager | |||
510 | public: | 548 | public: |
511 | virtual ~LLVolumeGeometryManager() { } | 549 | virtual ~LLVolumeGeometryManager() { } |
512 | virtual void rebuildGeom(LLSpatialGroup* group); | 550 | virtual void rebuildGeom(LLSpatialGroup* group); |
551 | virtual void rebuildMesh(LLSpatialGroup* group); | ||
513 | virtual void getGeometry(LLSpatialGroup* group); | 552 | virtual void getGeometry(LLSpatialGroup* group); |
553 | void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort = FALSE); | ||
514 | void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type); | 554 | void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type); |
555 | |||
515 | }; | 556 | }; |
516 | 557 | ||
517 | //spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp) | 558 | //spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp) |
@@ -521,6 +562,7 @@ public: | |||
521 | LLVolumePartition(); | 562 | LLVolumePartition(); |
522 | virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } | 563 | virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } |
523 | virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } | 564 | virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } |
565 | virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } | ||
524 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } | 566 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } |
525 | }; | 567 | }; |
526 | 568 | ||
@@ -531,6 +573,7 @@ public: | |||
531 | LLVolumeBridge(LLDrawable* drawable); | 573 | LLVolumeBridge(LLDrawable* drawable); |
532 | virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } | 574 | virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } |
533 | virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } | 575 | virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } |
576 | virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } | ||
534 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } | 577 | virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); } |
535 | }; | 578 | }; |
536 | 579 | ||