diff options
Diffstat (limited to 'linden/indra/newview/llspatialpartition.cpp')
-rw-r--r-- | linden/indra/newview/llspatialpartition.cpp | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/linden/indra/newview/llspatialpartition.cpp b/linden/indra/newview/llspatialpartition.cpp index 24ac1ca..46b9df9 100644 --- a/linden/indra/newview/llspatialpartition.cpp +++ b/linden/indra/newview/llspatialpartition.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2003-2007, Linden Research, Inc. | 5 | * Copyright (c) 2003-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -145,7 +146,7 @@ LLSpatialGroup::~LLSpatialGroup() | |||
145 | { | 146 | { |
146 | sZombieGroups--; | 147 | sZombieGroups--; |
147 | } | 148 | } |
148 | 149 | ||
149 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 150 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
150 | clearDrawMap(); | 151 | clearDrawMap(); |
151 | } | 152 | } |
@@ -216,10 +217,34 @@ void LLSpatialGroup::validate() | |||
216 | #if LL_OCTREE_PARANOIA_CHECK | 217 | #if LL_OCTREE_PARANOIA_CHECK |
217 | 218 | ||
218 | sg_assert(!isState(DIRTY)); | 219 | sg_assert(!isState(DIRTY)); |
220 | sg_assert(!isDead()); | ||
219 | 221 | ||
220 | LLVector3 myMin = mBounds[0] - mBounds[1]; | 222 | LLVector3 myMin = mBounds[0] - mBounds[1]; |
221 | LLVector3 myMax = mBounds[0] + mBounds[1]; | 223 | LLVector3 myMax = mBounds[0] + mBounds[1]; |
222 | 224 | ||
225 | validateDrawMap(); | ||
226 | |||
227 | for (element_iter i = getData().begin(); i != getData().end(); ++i) | ||
228 | { | ||
229 | LLDrawable* drawable = *i; | ||
230 | sg_assert(drawable->getSpatialGroup() == this); | ||
231 | if (drawable->getSpatialBridge()) | ||
232 | { | ||
233 | sg_assert(drawable->getSpatialBridge() == mSpatialPartition->asBridge()); | ||
234 | } | ||
235 | |||
236 | if (drawable->isSpatialBridge()) | ||
237 | { | ||
238 | LLSpatialPartition* part = drawable->asPartition(); | ||
239 | if (!part) | ||
240 | { | ||
241 | llerrs << "Drawable reports it is a spatial bridge but not a partition." << llendl; | ||
242 | } | ||
243 | LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); | ||
244 | group->validate(); | ||
245 | } | ||
246 | } | ||
247 | |||
223 | for (U32 i = 0; i < mOctreeNode->getChildCount(); ++i) | 248 | for (U32 i = 0; i < mOctreeNode->getChildCount(); ++i) |
224 | { | 249 | { |
225 | LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0); | 250 | LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0); |
@@ -245,8 +270,8 @@ void LLSpatialGroup::validate() | |||
245 | 270 | ||
246 | void validate_draw_info(LLDrawInfo& params) | 271 | void validate_draw_info(LLDrawInfo& params) |
247 | { | 272 | { |
248 | #if LL_DEBUG | 273 | #if LL_OCTREE_PARANOIA_CHECK |
249 | /* if (params.mVertexBuffer.isNull()) | 274 | if (params.mVertexBuffer.isNull()) |
250 | { | 275 | { |
251 | llerrs << "Draw batch has no vertex buffer." << llendl; | 276 | llerrs << "Draw batch has no vertex buffer." << llendl; |
252 | } | 277 | } |
@@ -257,12 +282,12 @@ void validate_draw_info(LLDrawInfo& params) | |||
257 | llerrs << "Draw batch has invalid range." << llendl; | 282 | llerrs << "Draw batch has invalid range." << llendl; |
258 | } | 283 | } |
259 | 284 | ||
260 | if (params.mEnd >= params.mVertexBuffer->getNumVerts()) | 285 | if (params.mEnd >= (U32) params.mVertexBuffer->getNumVerts()) |
261 | { | 286 | { |
262 | llerrs << "Draw batch has buffer overrun error." << llendl; | 287 | llerrs << "Draw batch has buffer overrun error." << llendl; |
263 | } | 288 | } |
264 | 289 | ||
265 | if (params.mOffset + params.mCount > params.mVertexBuffer->getNumIndices()) | 290 | if (params.mOffset + params.mCount > (U32) params.mVertexBuffer->getNumIndices()) |
266 | { | 291 | { |
267 | llerrs << "Draw batch has index buffer ovverrun error." << llendl; | 292 | llerrs << "Draw batch has index buffer ovverrun error." << llendl; |
268 | } | 293 | } |
@@ -283,13 +308,14 @@ void validate_draw_info(LLDrawInfo& params) | |||
283 | llerrs << "Draw batch has vertex buffer index out of range error (index too high)." << llendl; | 308 | llerrs << "Draw batch has vertex buffer index out of range error (index too high)." << llendl; |
284 | } | 309 | } |
285 | } | 310 | } |
286 | }*/ | 311 | } |
287 | #endif | 312 | #endif |
288 | } | 313 | } |
289 | 314 | ||
290 | void LLSpatialGroup::validateDrawMap() | 315 | void LLSpatialGroup::validateDrawMap() |
291 | { | 316 | { |
292 | /* for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i) | 317 | #if LL_OCTREE_PARANOIA_CHECK |
318 | for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i) | ||
293 | { | 319 | { |
294 | std::vector<LLDrawInfo*>& draw_vec = i->second; | 320 | std::vector<LLDrawInfo*>& draw_vec = i->second; |
295 | for (std::vector<LLDrawInfo*>::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j) | 321 | for (std::vector<LLDrawInfo*>::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j) |
@@ -298,7 +324,8 @@ void LLSpatialGroup::validateDrawMap() | |||
298 | 324 | ||
299 | validate_draw_info(params); | 325 | validate_draw_info(params); |
300 | } | 326 | } |
301 | }*/ | 327 | } |
328 | #endif | ||
302 | } | 329 | } |
303 | 330 | ||
304 | void LLSpatialGroup::makeStatic() | 331 | void LLSpatialGroup::makeStatic() |
@@ -361,7 +388,7 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc | |||
361 | } | 388 | } |
362 | else | 389 | else |
363 | { | 390 | { |
364 | drawablep->setSpatialGroup(this, 0); | 391 | drawablep->setSpatialGroup(this); |
365 | validate_drawable(drawablep); | 392 | validate_drawable(drawablep); |
366 | setState(OBJECT_DIRTY | GEOM_DIRTY); | 393 | setState(OBJECT_DIRTY | GEOM_DIRTY); |
367 | mLastAddTime = gFrameTimeSeconds; | 394 | mLastAddTime = gFrameTimeSeconds; |
@@ -369,7 +396,10 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc | |||
369 | { | 396 | { |
370 | mBridgeList.push_back((LLSpatialBridge*) drawablep); | 397 | mBridgeList.push_back((LLSpatialBridge*) drawablep); |
371 | } | 398 | } |
372 | setState(IMAGE_DIRTY); | 399 | if (drawablep->getRadius() > 1.f) |
400 | { | ||
401 | setState(IMAGE_DIRTY); | ||
402 | } | ||
373 | } | 403 | } |
374 | 404 | ||
375 | return TRUE; | 405 | return TRUE; |
@@ -570,7 +600,7 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) | |||
570 | } | 600 | } |
571 | else | 601 | else |
572 | { | 602 | { |
573 | drawablep->setSpatialGroup(NULL, -1); | 603 | drawablep->setSpatialGroup(NULL); |
574 | setState(GEOM_DIRTY); | 604 | setState(GEOM_DIRTY); |
575 | if (drawablep->isSpatialBridge()) | 605 | if (drawablep->isSpatialBridge()) |
576 | { | 606 | { |
@@ -883,6 +913,16 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node) | |||
883 | { | 913 | { |
884 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 914 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
885 | setState(DEAD); | 915 | setState(DEAD); |
916 | |||
917 | for (element_iter i = getData().begin(); i != getData().end(); ++i) | ||
918 | { | ||
919 | LLDrawable* drawable = *i; | ||
920 | if (drawable->getSpatialGroup() == this) | ||
921 | { | ||
922 | drawable->setSpatialGroup(NULL); | ||
923 | } | ||
924 | } | ||
925 | |||
886 | clearDrawMap(); | 926 | clearDrawMap(); |
887 | mOcclusionVerts = NULL; | 927 | mOcclusionVerts = NULL; |
888 | mVertexBuffer = NULL; | 928 | mVertexBuffer = NULL; |
@@ -1124,7 +1164,7 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) | |||
1124 | { | 1164 | { |
1125 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 1165 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
1126 | 1166 | ||
1127 | drawablep->setSpatialGroup(NULL, -1); | 1167 | drawablep->setSpatialGroup(NULL); |
1128 | 1168 | ||
1129 | if (!curp->removeObject(drawablep)) | 1169 | if (!curp->removeObject(drawablep)) |
1130 | { | 1170 | { |
@@ -1676,8 +1716,9 @@ void LLSpatialPartition::processImagery(LLCamera* camera) | |||
1676 | gPipeline.mCubeBuffer->initGL(); | 1716 | gPipeline.mCubeBuffer->initGL(); |
1677 | } | 1717 | } |
1678 | 1718 | ||
1719 | S32 res = gSavedSettings.getS32("RenderReflectionRes"); | ||
1679 | gPipeline.generateReflectionMap(gPipeline.mCubeBuffer, cube_cam, 128); | 1720 | gPipeline.generateReflectionMap(gPipeline.mCubeBuffer, cube_cam, 128); |
1680 | gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map, 64); | 1721 | gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map, res); |
1681 | group->mReflectionMap = cube_map; | 1722 | group->mReflectionMap = cube_map; |
1682 | group->setState(LLSpatialGroup::GEOM_DIRTY); | 1723 | group->setState(LLSpatialGroup::GEOM_DIRTY); |
1683 | } | 1724 | } |
@@ -2152,7 +2193,7 @@ void LLSpatialPartition::doOcclusion(LLCamera* camera) | |||
2152 | 2193 | ||
2153 | glFlush(); | 2194 | glFlush(); |
2154 | 2195 | ||
2155 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 2196 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); |
2156 | } | 2197 | } |
2157 | 2198 | ||
2158 | class LLOctreeGet : public LLSpatialGroup::OctreeTraveler | 2199 | class LLOctreeGet : public LLSpatialGroup::OctreeTraveler |