summaryrefslogtreecommitdiff
path: root/indra/newview/llreflectionmap.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-05-18 23:09:57 -0500
committerDave Parks <davep@lindenlab.com>2022-05-18 23:09:57 -0500
commit63878a60eb8ab6884ed3aeec63a28e5089636092 (patch)
tree9ec9560c89feb5304c13cc12248bec12ee25cb2d /indra/newview/llreflectionmap.cpp
parent53c692c9597551c9a1ba8eee346432de51d9d22d (diff)
SL-17416 Box reflection probe influence volumes
Diffstat (limited to 'indra/newview/llreflectionmap.cpp')
-rw-r--r--indra/newview/llreflectionmap.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp
index c146a888cf..4ac2803208 100644
--- a/indra/newview/llreflectionmap.cpp
+++ b/indra/newview/llreflectionmap.cpp
@@ -106,6 +106,7 @@ void LLReflectionMap::autoAdjustOrigin()
}
else if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME)
{
+ mPriority = 8;
// cast a ray towards 8 corners of bounding box
// nudge origin towards center of empty space
@@ -182,6 +183,9 @@ void LLReflectionMap::autoAdjustOrigin()
}
else
{
+ // user placed probe
+ mPriority = 64;
+
// use center of octree node volume for nodes that are just branches without data
mOrigin = node->getCenter();
@@ -196,13 +200,15 @@ void LLReflectionMap::autoAdjustOrigin()
}
else if (mViewerObject)
{
+ mPriority = 64;
mOrigin.load3(mViewerObject->getPositionAgent().mV);
- mRadius = mViewerObject->getScale().mV[0];
+ mRadius = mViewerObject->getScale().mV[0]*0.5f;
}
}
bool LLReflectionMap::intersects(LLReflectionMap* other)
{
+ // TODO: incorporate getBox
LLVector4a delta;
delta.setSub(other->mOrigin, mOrigin);
@@ -214,3 +220,56 @@ bool LLReflectionMap::intersects(LLReflectionMap* other)
return dist < r2;
}
+
+bool LLReflectionMap::getBox(LLMatrix4& box)
+{
+ if (mViewerObject)
+ {
+ LLVolume* volume = mViewerObject->getVolume();
+ if (volume)
+ {
+ LLVOVolume* vobjp = (LLVOVolume*)mViewerObject;
+
+ U8 profile = volume->getProfileType();
+ U8 path = volume->getPathType();
+
+ if (profile == LL_PCODE_PROFILE_SQUARE &&
+ path == LL_PCODE_PATH_LINE)
+ {
+ // nope
+ /*box = vobjp->getRelativeXform();
+ box *= vobjp->mDrawable->getRenderMatrix();
+ LLMatrix4 modelview(gGLModelView);
+ box *= modelview;
+ box.invert();*/
+
+ // nope
+ /*box = LLMatrix4(gGLModelView);
+ box *= vobjp->mDrawable->getRenderMatrix();
+ box *= vobjp->getRelativeXform();
+ box.invert();*/
+
+ glh::matrix4f mv(gGLModelView);
+ glh::matrix4f scale;
+ LLVector3 s = vobjp->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f));
+ mRadius = s.magVec();
+ scale.set_scale(glh::vec3f(s.mV));
+ if (vobjp->mDrawable != nullptr)
+ {
+ glh::matrix4f rm((F32*)vobjp->mDrawable->getWorldMatrix().mMatrix);
+
+ glh::matrix4f rt((F32*)vobjp->getRelativeXform().mMatrix);
+
+ mv = mv * rm * scale; // *rt;
+ mv = mv.inverse();
+
+ box = LLMatrix4(mv.m);
+
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}