diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-09-25 19:20:46 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-09-25 19:20:46 -0700 |
commit | 18b219cf83a1cd405cf36b9f58fc48f717409598 (patch) | |
tree | e50c6ac1ae9a6b8017f4a1333245cb3ab77e35bc /indra | |
parent | d092f3e1dc1c322a0c3c1e55b9b6e1792d6b0f59 (diff) |
Start removing the concept of placement mode - it's either a mirror or not.
DRTVWR-583
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llface.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llheroprobemanager.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 31 |
3 files changed, 30 insertions, 37 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 4dd991ee60..2c04224fa0 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -490,28 +490,6 @@ U16 LLFace::getGeometry(LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &no LLVector3 LLFace::getAverageNormal() { - if (!mHasAverageNormal) - { - if (mVertexBuffer.notNull()) - { - if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL)) - { - LLStrider<LLVector3> normals; - mVertexBuffer->getNormalStrider(normals, mGeomIndex, mGeomCount); - LLVector3 normal_total; - - for (int i = 0; i < mVertexBuffer->getNumVerts(); i++) - { - normal_total += *normals.get(); - normals++; - } - - mAverageNormal = normal_total / mVertexBuffer->getNumVerts(); - mHasAverageNormal = true; - } - } - } - return mAverageNormal; } @@ -1916,14 +1894,21 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, F32* normals = (F32*) norm.get(); LLVector4a* src = vf.mNormals; LLVector4a* end = src+num_vertices; - + + LLVector4a normal_total; + while (src < end) { LLVector4a normal; mat_normal.rotate(*src++, normal); normal.store4a(normals); + normal_total.add(normal); normals += 4; } + + normal_total.div(LLVector4a(num_vertices)); + + mAverageNormal = LLVector3(normal_total[0], normal_total[1], normal_total[2]); } if (rebuild_tangent) diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index c3d7ce6e76..fe9f669365 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -110,7 +110,8 @@ void LLHeroProbeManager::update() { if (mNearestHero != nullptr && mNearestHero->mDrawable.notNull()) { - LLVector3 hero_pos = mNearestHero->mDrawable->mXform.getWorldPosition(); + + LLVector3 hero_pos = mNearestHero->mDrawable->getFace(mNearestHero->mirrorPlacementMode())->getPositionAgent(); LLVector4a hit_pos; LLVector3 focus_point; @@ -119,7 +120,7 @@ void LLHeroProbeManager::update() LLMatrix4 rotationMatrix; - rotationMatrix.rotate(angleInRadians, LLVector4(mNearestHero->mDrawable->getFace(0)->getAverageNormal())); + rotationMatrix.rotate(angleInRadians, LLVector4(mNearestHero->mDrawable->getFace(mNearestHero->mirrorPlacementMode())->getAverageNormal())); LLVector3 translatedPoint; LLVector3 rotatedTranslatedPoint; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index dcdb66a6d4..9ac9ef7ea6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1161,18 +1161,25 @@ void detectMirror(const std::string &str, bool &mirror, U8 &mode) { mirror = true; } - else if (word == "ReflectedX" && mirror) - { - mode = 0; - } - else if (word == "ReflectedY" && mirror) - { - mode = 1; - } - else if (word == "ReflectedZ" && mirror) - { - mode = 2; - } + + if (mirror) + { + bool num = false; + std::string::const_iterator it = word.begin(); + while (it != word.end()) + { + num = std::isdigit(*it); + ++it; + + if (!num) + break; + } + + if (num) + { + mode = atoi(word.c_str()); + } + } } } |