diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llface.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/llface.h | 5 | ||||
| -rw-r--r-- | indra/newview/llheroprobemanager.cpp | 10 | 
3 files changed, 42 insertions, 0 deletions
| diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index c1776705f9..4dd991ee60 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -488,6 +488,33 @@ U16 LLFace::getGeometry(LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &no  	return mGeomIndex;  } +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; +} +  void LLFace::updateCenterAgent()  {  	if (mDrawablep->isActive()) diff --git a/indra/newview/llface.h b/indra/newview/llface.h index eb3b47d6d6..d4f4313073 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -176,6 +176,8 @@ public:  								LLStrider<LLVector3> &normals,  								LLStrider<LLVector2> &texCoords,   								LLStrider<U16>  &indices); +     +    LLVector3       getAverageNormal();  	S32 getColors(LLStrider<LLColor4U> &colors);  	S32 getIndices(LLStrider<U16> &indices); @@ -278,6 +280,9 @@ private:  	U32			mIndicesCount;  	U32			mIndicesIndex;		// index into mVertexBuffer's index array  	S32         mIndexInTex[LLRender::NUM_TEXTURE_CHANNELS]; +     +    LLVector3   mAverageNormal; +    bool        mHasAverageNormal;  	LLXformMatrix* mXform; diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index 687ebbf168..c3d7ce6e76 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -118,11 +118,20 @@ void LLHeroProbeManager::update()                  F32 angleInRadians = 180 * DEG_TO_RAD;                  LLMatrix4 rotationMatrix; +                 +                rotationMatrix.rotate(angleInRadians, LLVector4(mNearestHero->mDrawable->getFace(0)->getAverageNormal()));                  LLVector3 translatedPoint;                  LLVector3 rotatedTranslatedPoint;                  LLVector3 rotatedPoint; +                translatedPoint = camera_pos - hero_pos; +                rotatedTranslatedPoint = translatedPoint * rotationMatrix; +                rotatedPoint = rotatedTranslatedPoint + hero_pos; +                 +                probe_pos.load3(rotatedPoint.mV); + +                /*                  switch (mNearestHero->mirrorPlacementMode()) {                      case 0: @@ -161,6 +170,7 @@ void LLHeroProbeManager::update()                          probe_pos.load3(rotatedPoint.mV);                          break;                  } +                 */              }              mHeroProbeStrength = 1; | 
