From b2afb8800bb033a04bb3ecdf0363068d56648ef1 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:54 -0500 Subject: Second Life viewer sources 1.15.0.2 --- linden/indra/newview/llspatialpartition.cpp | 69 +++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 14 deletions(-) (limited to 'linden/indra/newview/llspatialpartition.cpp') 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 @@ * * Copyright (c) 2003-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -145,7 +146,7 @@ LLSpatialGroup::~LLSpatialGroup() { sZombieGroups--; } - + LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); clearDrawMap(); } @@ -216,10 +217,34 @@ void LLSpatialGroup::validate() #if LL_OCTREE_PARANOIA_CHECK sg_assert(!isState(DIRTY)); + sg_assert(!isDead()); LLVector3 myMin = mBounds[0] - mBounds[1]; LLVector3 myMax = mBounds[0] + mBounds[1]; + validateDrawMap(); + + for (element_iter i = getData().begin(); i != getData().end(); ++i) + { + LLDrawable* drawable = *i; + sg_assert(drawable->getSpatialGroup() == this); + if (drawable->getSpatialBridge()) + { + sg_assert(drawable->getSpatialBridge() == mSpatialPartition->asBridge()); + } + + if (drawable->isSpatialBridge()) + { + LLSpatialPartition* part = drawable->asPartition(); + if (!part) + { + llerrs << "Drawable reports it is a spatial bridge but not a partition." << llendl; + } + LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); + group->validate(); + } + } + for (U32 i = 0; i < mOctreeNode->getChildCount(); ++i) { LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0); @@ -245,8 +270,8 @@ void LLSpatialGroup::validate() void validate_draw_info(LLDrawInfo& params) { -#if LL_DEBUG -/* if (params.mVertexBuffer.isNull()) +#if LL_OCTREE_PARANOIA_CHECK + if (params.mVertexBuffer.isNull()) { llerrs << "Draw batch has no vertex buffer." << llendl; } @@ -257,12 +282,12 @@ void validate_draw_info(LLDrawInfo& params) llerrs << "Draw batch has invalid range." << llendl; } - if (params.mEnd >= params.mVertexBuffer->getNumVerts()) + if (params.mEnd >= (U32) params.mVertexBuffer->getNumVerts()) { llerrs << "Draw batch has buffer overrun error." << llendl; } - if (params.mOffset + params.mCount > params.mVertexBuffer->getNumIndices()) + if (params.mOffset + params.mCount > (U32) params.mVertexBuffer->getNumIndices()) { llerrs << "Draw batch has index buffer ovverrun error." << llendl; } @@ -283,13 +308,14 @@ void validate_draw_info(LLDrawInfo& params) llerrs << "Draw batch has vertex buffer index out of range error (index too high)." << llendl; } } - }*/ + } #endif } void LLSpatialGroup::validateDrawMap() { -/* for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i) +#if LL_OCTREE_PARANOIA_CHECK + for (draw_map_t::iterator i = mDrawMap.begin(); i != mDrawMap.end(); ++i) { std::vector& draw_vec = i->second; for (std::vector::iterator j = draw_vec.begin(); j != draw_vec.end(); ++j) @@ -298,7 +324,8 @@ void LLSpatialGroup::validateDrawMap() validate_draw_info(params); } - }*/ + } +#endif } void LLSpatialGroup::makeStatic() @@ -361,7 +388,7 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc } else { - drawablep->setSpatialGroup(this, 0); + drawablep->setSpatialGroup(this); validate_drawable(drawablep); setState(OBJECT_DIRTY | GEOM_DIRTY); mLastAddTime = gFrameTimeSeconds; @@ -369,7 +396,10 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc { mBridgeList.push_back((LLSpatialBridge*) drawablep); } - setState(IMAGE_DIRTY); + if (drawablep->getRadius() > 1.f) + { + setState(IMAGE_DIRTY); + } } return TRUE; @@ -570,7 +600,7 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) } else { - drawablep->setSpatialGroup(NULL, -1); + drawablep->setSpatialGroup(NULL); setState(GEOM_DIRTY); if (drawablep->isSpatialBridge()) { @@ -883,6 +913,16 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); setState(DEAD); + + for (element_iter i = getData().begin(); i != getData().end(); ++i) + { + LLDrawable* drawable = *i; + if (drawable->getSpatialGroup() == this) + { + drawable->setSpatialGroup(NULL); + } + } + clearDrawMap(); mOcclusionVerts = NULL; mVertexBuffer = NULL; @@ -1124,7 +1164,7 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - drawablep->setSpatialGroup(NULL, -1); + drawablep->setSpatialGroup(NULL); if (!curp->removeObject(drawablep)) { @@ -1676,8 +1716,9 @@ void LLSpatialPartition::processImagery(LLCamera* camera) gPipeline.mCubeBuffer->initGL(); } + S32 res = gSavedSettings.getS32("RenderReflectionRes"); gPipeline.generateReflectionMap(gPipeline.mCubeBuffer, cube_cam, 128); - gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map, 64); + gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map, res); group->mReflectionMap = cube_map; group->setState(LLSpatialGroup::GEOM_DIRTY); } @@ -2152,7 +2193,7 @@ void LLSpatialPartition::doOcclusion(LLCamera* camera) glFlush(); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); } class LLOctreeGet : public LLSpatialGroup::OctreeTraveler -- cgit v1.1