diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-01-21 16:25:23 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-01-21 16:25:23 -0700 |
commit | 4af7e9eb64097c9fdcef86758fc42932d3ccd477 (patch) | |
tree | 3d4d5300b0c476d8343baad8d28c0809806d5c8b /indra/llmath | |
parent | bb3be2c07f492577254ae9ace5675eb92d10f061 (diff) | |
parent | e3f5b66d5a649b061e470bba44fa29a56f7b93b5 (diff) |
Merge viewer-development-shining up to REV 3bf724ecb7c6 (fix for SH-829: Viewer attempting to load precached images in file types that are not being used.)
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llvolume.cpp | 41 | ||||
-rw-r--r-- | indra/llmath/llvolume.h | 1 |
2 files changed, 39 insertions, 3 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 14e1ca8d43..71b92962fb 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -4406,19 +4406,54 @@ std::ostream& operator<<(std::ostream &s, const LLVolume *volumep) BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) { + BOOL ret = FALSE ; if (mTypeMask & CAP_MASK) { - return createCap(volume, partial_build); + ret = createCap(volume, partial_build); } else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK)) { - return createSide(volume, partial_build); + ret = createSide(volume, partial_build); } else { llerrs << "Unknown/uninitialized face type!" << llendl; - return FALSE; } + + //update the range of the texture coordinates + if(ret) + { + mTexCoordExtents[0].setVec(1.f, 1.f) ; + mTexCoordExtents[1].setVec(0.f, 0.f) ; + + U32 end = mVertices.size() ; + for(U32 i = 0 ; i < end ; i++) + { + if(mTexCoordExtents[0].mV[0] > mVertices[i].mTexCoord.mV[0]) + { + mTexCoordExtents[0].mV[0] = mVertices[i].mTexCoord.mV[0] ; + } + if(mTexCoordExtents[1].mV[0] < mVertices[i].mTexCoord.mV[0]) + { + mTexCoordExtents[1].mV[0] = mVertices[i].mTexCoord.mV[0] ; + } + + if(mTexCoordExtents[0].mV[1] > mVertices[i].mTexCoord.mV[1]) + { + mTexCoordExtents[0].mV[1] = mVertices[i].mTexCoord.mV[1] ; + } + if(mTexCoordExtents[1].mV[1] < mVertices[i].mTexCoord.mV[1]) + { + mTexCoordExtents[1].mV[1] = mVertices[i].mTexCoord.mV[1] ; + } + } + mTexCoordExtents[0].mV[0] = llmax(0.f, mTexCoordExtents[0].mV[0]) ; + mTexCoordExtents[0].mV[1] = llmax(0.f, mTexCoordExtents[0].mV[1]) ; + mTexCoordExtents[1].mV[0] = llmin(1.f, mTexCoordExtents[1].mV[0]) ; + mTexCoordExtents[1].mV[1] = llmin(1.f, mTexCoordExtents[1].mV[1]) ; + } + + return ret ; } void LerpPlanarVertex(LLVolumeFace::VertexData& v0, diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index d48a79ee46..28b9895ff3 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -831,6 +831,7 @@ public: S32 mNumT; LLVector3 mExtents[2]; //minimum and maximum point of face + LLVector2 mTexCoordExtents[2]; //minimum and maximum of texture coordinates of the face. std::vector<VertexData> mVertices; std::vector<U16> mIndices; |