summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-05 15:40:12 -0400
committerGitHub <noreply@github.com>2024-09-05 15:40:12 -0400
commit04568da18d2261f3f7b851cf5341b766c9648204 (patch)
tree83d5db1c173636bb77ebb33e860fac77ab5d79e8 /indra/newview/llspatialpartition.cpp
parent18d81e20f0b0044c16615953d7b69d7fb34d3449 (diff)
parentff2d79906ccef217194d5d9ec9d7025db03592a8 (diff)
Merge pull request #2513 from secondlife/lua-merge-dev
Merge develop branch into Lua project branch.
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp49
1 files changed, 19 insertions, 30 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 782d57aed8..e517d009f5 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -29,7 +29,6 @@
#include "llspatialpartition.h"
#include "llappviewer.h"
-#include "llcallstack.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
#include "llimageworker.h"
@@ -409,7 +408,7 @@ LLSpatialGroup* LLSpatialGroup::getParent()
bool LLSpatialGroup::removeObject(LLDrawable *drawablep, bool from_octree)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
if(!drawablep)
{
@@ -498,7 +497,7 @@ public:
void LLSpatialGroup::setState(U32 state, S32 mode)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
llassert(state <= LLSpatialGroup::STATE_MASK);
@@ -547,7 +546,7 @@ public:
void LLSpatialGroup::clearState(U32 state, S32 mode)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
llassert(state <= LLSpatialGroup::STATE_MASK);
@@ -634,7 +633,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)
F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
LLVector4a eye;
LLVector4a origin;
@@ -729,7 +728,7 @@ F32 LLSpatialGroup::getUpdateUrgency() const
bool LLSpatialGroup::changeLOD()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
if (hasState(ALPHA_DIRTY | OBJECT_DIRTY))
{
@@ -755,14 +754,6 @@ bool LLSpatialGroup::changeLOD()
if (fabsf(ratio) >= getSpatialPartition()->mSlopRatio)
{
- LL_DEBUGS("RiggedBox") << "changeLOD true because of ratio compare "
- << fabsf(ratio) << " " << getSpatialPartition()->mSlopRatio << LL_ENDL;
- LL_DEBUGS("RiggedBox") << "sg " << this << "\nmDistance " << mDistance
- << " mLastUpdateDistance " << mLastUpdateDistance
- << " mRadius " << mRadius
- << " fab ratio " << fabsf(ratio)
- << " slop " << getSpatialPartition()->mSlopRatio << LL_ENDL;
-
return true;
}
}
@@ -818,7 +809,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
if (child->getListenerCount() == 0)
{
@@ -1051,7 +1042,8 @@ public:
LLSpatialGroup* group = (LLSpatialGroup*)base_group;
group->checkOcclusion();
- if (group->getOctreeNode()->getParent() && //never occlusion cull the root node
+ if (group->getOctreeNode() &&
+ group->getOctreeNode()->getParent() && //never occlusion cull the root node
LLPipeline::sUseOcclusion && //ignore occlusion if disabled
group->isOcclusionState(LLSpatialGroup::OCCLUDED))
{
@@ -1675,8 +1667,9 @@ void renderOctree(LLSpatialGroup* group)
glLineWidth(1.f);
gGL.flush();
- LLVOAvatar* lastAvatar = nullptr;
+ const LLVOAvatar* lastAvatar = nullptr;
U64 lastMeshId = 0;
+ bool skipLastSkin = false;
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
{
@@ -1705,15 +1698,9 @@ void renderOctree(LLSpatialGroup* group)
{
gGL.pushMatrix();
gGL.loadMatrix(gGLModelView);
- if (lastAvatar != face->mAvatar ||
- lastMeshId != face->mSkinInfo->mHash)
+ if (!LLRenderPass::uploadMatrixPalette(face->mAvatar, face->mSkinInfo, lastAvatar, lastMeshId, skipLastSkin))
{
- if (!LLRenderPass::uploadMatrixPalette(face->mAvatar, face->mSkinInfo))
- {
- continue;
- }
- lastAvatar = face->mAvatar;
- lastMeshId = face->mSkinInfo->mHash;
+ continue;
}
}
for (S32 j = 0; j < drawable->getNumFaces(); j++)
@@ -2035,7 +2022,7 @@ void renderNormals(LLDrawable *drawablep)
obj_scale.normalize3();
// Create inverse-scale vector for normals
- inv_scale.set(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ], 0.0);
+ inv_scale.set(1.0f / scale_v3.mV[VX], 1.0f / scale_v3.mV[VY], 1.0f/ scale_v3.mV[VZ], 0.0f);
inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice
inv_scale.normalize3fast();
@@ -2763,7 +2750,7 @@ void renderTexelDensity(LLDrawable* drawable)
break;
}
- checkerboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f));
+ checkerboard_matrix.initScale(LLVector3((F32)texturep->getWidth(discard_level) / 8.f, (F32)texturep->getHeight(discard_level) / 8.f, 1.f));
gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, true);
gGL.matrixMode(LLRender::MM_TEXTURE);
@@ -3978,12 +3965,14 @@ void LLCullResult::clear()
for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
{
- for (U32 j = 0; j < mRenderMapSize[i]; j++)
+ drawinfo_list_t& render_map = mRenderMap[i];
+ U32 render_map_size = llmin((U32)render_map.size(), mRenderMapSize[i]);
+ for (U32 j = 0; j < render_map_size; j++)
{
- mRenderMap[i][j] = 0;
+ render_map[j] = 0;
}
mRenderMapSize[i] = 0;
- mRenderMapEnd[i] = &(mRenderMap[i][0]);
+ mRenderMapEnd[i] = &render_map.front();
}
}