diff options
-rw-r--r-- | indra/newview/llface.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 82 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 3 |
3 files changed, 59 insertions, 27 deletions
diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 18db645305..63548b080a 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -190,6 +190,7 @@ public: LLPointer<LLVertexBuffer> mVertexBuffer; LLPointer<LLVertexBuffer> mLastVertexBuffer; F32 mLastUpdateTime; + LLMatrix4 mTextureMatrix; protected: friend class LLGeometryManager; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 55445f21fe..2379605803 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -245,34 +245,69 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) if (result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot)) { mTexAnimMode = result | mTextureAnimp->mMode; - LLQuaternion quat; - LLVector3 scale(1,1,1); - if (result & LLViewerTextureAnim::ROTATE) + S32 start, end; + if (mTextureAnimp->mFace == -1) { - quat.setQuat(rot, 0, 0, -1); + start = 0; + end = mDrawable->getNumFaces(); } - - if (!(result & LLViewerTextureAnim::TRANSLATE)) + else { - off_s = off_t = 0.f; + start = mTextureAnimp->mFace; + end = start + 1; } - LLVector3 trans(off_s+0.5f, off_t+0.5f, 0.f); + for (S32 i = start; i < end; i++) + { + LLQuaternion quat; + LLVector3 scale(1,1,1); + + LLFace* facep = mDrawable->getFace(i); + const LLTextureEntry* te = facep->getTextureEntry(); + LLMatrix4& tex_mat = facep->mTextureMatrix; + + if (!te) + { + continue; + } + if (result & LLViewerTextureAnim::ROTATE) + { + F32 axis = -1; + F32 s,t; + te->getScale(&s,&t); + if (s < 0) + { + axis = -axis; + } + if (t < 0) + { + axis = -axis; + } + quat.setQuat(rot, 0, 0, axis); + } + + if (!(result & LLViewerTextureAnim::TRANSLATE)) + { + te->getOffset(&off_s,&off_t); + } - mTextureMatrix.identity(); - mTextureMatrix.translate(LLVector3(-0.5f, -0.5f, 0.f)); - mTextureMatrix.rotate(quat); + LLVector3 trans(off_s+0.5f, off_t+0.5f, 0.f); - if (result & LLViewerTextureAnim::SCALE) - { - scale.setVec(scale_s, scale_t, 1.f); - LLMatrix4 mat; - mat.initAll(scale, LLQuaternion(), LLVector3()); - mTextureMatrix *= mat; + tex_mat.identity(); + tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); + tex_mat.rotate(quat); + + if (result & LLViewerTextureAnim::SCALE) + { + scale.setVec(scale_s, scale_t, 1.f); + LLMatrix4 mat; + mat.initAll(scale, LLQuaternion(), LLVector3()); + tex_mat *= mat; + } + + tex_mat.translate(trans); } - - mTextureMatrix.translate(trans); } } @@ -1845,16 +1880,15 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT || type == LLRenderPass::PASS_ALPHA) ? facep->isState(LLFace::FULLBRIGHT) : FALSE; - BOOL texanim = (type == LLRenderPass::PASS_SHINY) ? FALSE : facep->isState(LLFace::TEXTURE_ANIM); - U8 bump = (type == LLRenderPass::PASS_BUMP ? facep->getTextureEntry()->getBumpmap() : 0); const LLMatrix4* tex_mat = NULL; - if (texanim) + if (type != LLRenderPass::PASS_SHINY && facep->isState(LLFace::TEXTURE_ANIM)) { - LLVOVolume* volume = (LLVOVolume*) facep->getViewerObject(); - tex_mat = volume->getTextureMatrix(); + tex_mat = &(facep->mTextureMatrix); } + U8 bump = (type == LLRenderPass::PASS_BUMP ? facep->getTextureEntry()->getBumpmap() : 0); + //LLViewerImage* tex = facep->mAppAngle < FORCE_SIMPLE_RENDER_ANGLE ? NULL : facep->getTexture(); LLViewerImage* tex = facep->getTexture(); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index f36c367f52..3eb8ad6c14 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -85,7 +85,6 @@ public: const LLVector3 getPivotPositionAgent() const; const LLMatrix4& getRelativeXform() const { return mRelativeXform; } const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } - const LLMatrix4* getTextureMatrix() const { return &mTextureMatrix; } /*virtual*/ const LLMatrix4 getRenderMatrix() const; /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, LLVector3& end) const; @@ -194,7 +193,6 @@ protected: public: LLViewerTextureAnim *mTextureAnimp; U8 mTexAnimMode; - protected: friend class LLDrawable; @@ -205,7 +203,6 @@ protected: S32 mLOD; BOOL mLODChanged; F32 mRadius; - LLMatrix4 mTextureMatrix; LLMatrix4 mRelativeXform; LLMatrix3 mRelativeXformInvTrans; BOOL mVolumeChanged; |