diff options
Diffstat (limited to 'linden/indra/newview/llspatialpartition.h')
-rw-r--r-- | linden/indra/newview/llspatialpartition.h | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/linden/indra/newview/llspatialpartition.h b/linden/indra/newview/llspatialpartition.h index be0163b..deb8b0e 100644 --- a/linden/indra/newview/llspatialpartition.h +++ b/linden/indra/newview/llspatialpartition.h | |||
@@ -52,6 +52,8 @@ | |||
52 | class LLSpatialPartition; | 52 | class LLSpatialPartition; |
53 | class LLSpatialBridge; | 53 | class LLSpatialBridge; |
54 | class LLSpatialGroup; | 54 | class LLSpatialGroup; |
55 | class LLTextureAtlas; | ||
56 | class LLTextureAtlasSlot; | ||
55 | 57 | ||
56 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); | 58 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); |
57 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); | 59 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); |
@@ -66,12 +68,13 @@ protected: | |||
66 | 68 | ||
67 | public: | 69 | public: |
68 | LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, | 70 | LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, |
69 | LLViewerImage* image, LLVertexBuffer* buffer, | 71 | LLImageGL* gl_image, LLViewerImage* image, LLVertexBuffer* buffer, |
70 | BOOL fullbright = FALSE, U8 bump = 0, BOOL particle = FALSE, F32 part_size = 0); | 72 | BOOL fullbright = FALSE, U8 bump = 0, BOOL particle = FALSE, F32 part_size = 0); |
71 | 73 | ||
72 | 74 | ||
73 | LLPointer<LLVertexBuffer> mVertexBuffer; | 75 | LLPointer<LLVertexBuffer> mVertexBuffer; |
74 | LLPointer<LLViewerImage> mTexture; | 76 | LLPointer<LLImageGL> mTexture; |
77 | LLPointer<LLViewerImage> mViewerTexture; | ||
75 | LLColor4U mGlowColor; | 78 | LLColor4U mGlowColor; |
76 | S32 mDebugColor; | 79 | S32 mDebugColor; |
77 | const LLMatrix4* mTextureMatrix; | 80 | const LLMatrix4* mTextureMatrix; |
@@ -159,11 +162,13 @@ public: | |||
159 | 162 | ||
160 | typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t; | 163 | typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t; |
161 | typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t; | 164 | typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t; |
165 | typedef std::list<LLPointer<LLSpatialGroup> > sg_list_t; | ||
162 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t; | 166 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t; |
163 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; | 167 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; |
164 | typedef std::map<U32, drawmap_elem_t > draw_map_t; | 168 | typedef std::map<U32, drawmap_elem_t > draw_map_t; |
165 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; | 169 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; |
166 | typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_texture_map_t; | 170 | typedef std::map<LLPointer<LLImageGL>, buffer_list_t> buffer_texture_map_t; // KL render-pipeline |
171 | // typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_texture_map_t; // KL standard | ||
167 | typedef std::map<U32, buffer_texture_map_t> buffer_map_t; | 172 | typedef std::map<U32, buffer_texture_map_t> buffer_map_t; |
168 | 173 | ||
169 | typedef LLOctreeListener<LLDrawable> BaseType; | 174 | typedef LLOctreeListener<LLDrawable> BaseType; |
@@ -183,6 +188,14 @@ public: | |||
183 | } | 188 | } |
184 | }; | 189 | }; |
185 | 190 | ||
191 | struct CompareUpdateUrgency | ||
192 | { | ||
193 | bool operator()(const LLPointer<LLSpatialGroup> lhs, const LLPointer<LLSpatialGroup> rhs) | ||
194 | { | ||
195 | return lhs->getUpdateUrgency() > rhs->getUpdateUrgency(); | ||
196 | } | ||
197 | }; | ||
198 | |||
186 | struct CompareDepthGreater | 199 | struct CompareDepthGreater |
187 | { | 200 | { |
188 | bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) | 201 | bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) |
@@ -209,6 +222,10 @@ public: | |||
209 | IMAGE_DIRTY = 0x00004000, | 222 | IMAGE_DIRTY = 0x00004000, |
210 | OCCLUSION_DIRTY = 0x00008000, | 223 | OCCLUSION_DIRTY = 0x00008000, |
211 | MESH_DIRTY = 0x00010000, | 224 | MESH_DIRTY = 0x00010000, |
225 | NEW_DRAWINFO = 0x00020000, | ||
226 | IN_BUILD_Q1 = 0x00040000, | ||
227 | IN_BUILD_Q2 = 0x00080000, | ||
228 | |||
212 | } eSpatialState; | 229 | } eSpatialState; |
213 | 230 | ||
214 | typedef enum | 231 | typedef enum |
@@ -252,6 +269,7 @@ public: | |||
252 | 269 | ||
253 | void updateDistance(LLCamera& camera); | 270 | void updateDistance(LLCamera& camera); |
254 | BOOL needsUpdate(); | 271 | BOOL needsUpdate(); |
272 | F32 getUpdateUrgency() const; | ||
255 | BOOL changeLOD(); | 273 | BOOL changeLOD(); |
256 | void rebuildGeom(); | 274 | void rebuildGeom(); |
257 | void rebuildMesh(); | 275 | void rebuildMesh(); |
@@ -261,6 +279,8 @@ public: | |||
261 | element_list& getData() { return mOctreeNode->getData(); } | 279 | element_list& getData() { return mOctreeNode->getData(); } |
262 | U32 getElementCount() const { return mOctreeNode->getElementCount(); } | 280 | U32 getElementCount() const { return mOctreeNode->getElementCount(); } |
263 | 281 | ||
282 | void drawObjectBox(LLColor4 col); | ||
283 | |||
264 | //LISTENER FUNCTIONS | 284 | //LISTENER FUNCTIONS |
265 | virtual void handleInsertion(const TreeNode* node, LLDrawable* face); | 285 | virtual void handleInsertion(const TreeNode* node, LLDrawable* face); |
266 | virtual void handleRemoval(const TreeNode* node, LLDrawable* face); | 286 | virtual void handleRemoval(const TreeNode* node, LLDrawable* face); |
@@ -269,6 +289,36 @@ public: | |||
269 | virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); | 289 | virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); |
270 | virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); | 290 | virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); |
271 | 291 | ||
292 | //------------------- | ||
293 | //for atlas use | ||
294 | //------------------- | ||
295 | //atlas | ||
296 | void setCurUpdatingTime(U32 t) {mCurUpdatingTime = t ;} | ||
297 | U32 getCurUpdatingTime() const { return mCurUpdatingTime ;} | ||
298 | |||
299 | void setCurUpdatingSlot(LLTextureAtlasSlot* slotp) ; | ||
300 | LLTextureAtlasSlot* getCurUpdatingSlot(LLViewerImage* imagep, S8 recursive_level = 3) ; | ||
301 | |||
302 | void setCurUpdatingTexture(LLViewerImage* tex){ mCurUpdatingTexture = tex ;} | ||
303 | LLViewerImage* getCurUpdatingTexture() const { return mCurUpdatingTexture ;} | ||
304 | |||
305 | BOOL hasAtlas(LLTextureAtlas* atlasp) ; | ||
306 | LLTextureAtlas* getAtlas(S8 ncomponents, S8 to_be_reserved, S8 recursive_level = 3) ; | ||
307 | void addAtlas(LLTextureAtlas* atlasp, S8 recursive_level = 3) ; | ||
308 | void removeAtlas(LLTextureAtlas* atlasp, BOOL remove_group = TRUE, S8 recursive_level = 3) ; | ||
309 | void clearAtlasList() ; | ||
310 | private: | ||
311 | U32 mCurUpdatingTime ; | ||
312 | //do not make the below two to use LLPointer | ||
313 | //because mCurUpdatingTime invalidates them automatically. | ||
314 | LLTextureAtlasSlot* mCurUpdatingSlotp ; | ||
315 | LLViewerImage* mCurUpdatingTexture ; | ||
316 | |||
317 | std::vector< std::list<LLTextureAtlas*> > mAtlasList ; | ||
318 | //------------------- | ||
319 | //end for atlas use | ||
320 | //------------------- | ||
321 | |||
272 | protected: | 322 | protected: |
273 | virtual ~LLSpatialGroup(); | 323 | virtual ~LLSpatialGroup(); |
274 | 324 | ||
@@ -327,7 +377,7 @@ class LLSpatialPartition: public LLGeometryManager | |||
327 | public: | 377 | public: |
328 | static BOOL sFreezeState; //if true, no spatialgroup state updates will be made | 378 | static BOOL sFreezeState; //if true, no spatialgroup state updates will be made |
329 | 379 | ||
330 | LLSpatialPartition(U32 data_mask, U32 mBufferUsage = GL_STATIC_DRAW_ARB); | 380 | LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage); |
331 | virtual ~LLSpatialPartition(); | 381 | virtual ~LLSpatialPartition(); |
332 | 382 | ||
333 | LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); | 383 | LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); |
@@ -373,7 +423,7 @@ public: | |||
373 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed | 423 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed |
374 | BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane | 424 | BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane |
375 | U32 mBufferUsage; | 425 | U32 mBufferUsage; |
376 | BOOL mRenderByGroup; | 426 | const BOOL mRenderByGroup; |
377 | U32 mLODSeed; | 427 | U32 mLODSeed; |
378 | U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) | 428 | U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) |
379 | U32 mVertexDataMask; | 429 | U32 mVertexDataMask; |
@@ -392,7 +442,7 @@ protected: | |||
392 | public: | 442 | public: |
393 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; | 443 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; |
394 | 444 | ||
395 | LLSpatialBridge(LLDrawable* root, U32 data_mask); | 445 | LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask); |
396 | 446 | ||
397 | virtual BOOL isSpatialBridge() const { return TRUE; } | 447 | virtual BOOL isSpatialBridge() const { return TRUE; } |
398 | 448 | ||