diff options
author | prep linden <prep@lindenlab.com> | 2011-02-01 15:00:06 -0500 |
---|---|---|
committer | prep linden <prep@lindenlab.com> | 2011-02-01 15:00:06 -0500 |
commit | b3a8189e05244c3c5aed8ca161a708bc4c22eacd (patch) | |
tree | 16dae9480387499a82764d82fde21d3d9484e5b3 /indra/llmath | |
parent | 7662e5d4acb37ee28a8a22173bcf5c853c8a71b8 (diff) | |
parent | d08372f71d575ebc3050806660655e1c7c7cff84 (diff) |
merge
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llvolume.cpp | 40 | ||||
-rw-r--r-- | indra/llmath/llvolume.h | 4 |
2 files changed, 39 insertions, 5 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 617a8b4ca3..2f662b757b 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5393,19 +5393,53 @@ BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) delete mOctree;
mOctree = NULL;
+ 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) ;
+
+ for(U32 i = 0 ; i < mNumVertices ; i++)
+ {
+ if(mTexCoordExtents[0].mV[0] > mTexCoords[i].mV[0])
+ {
+ mTexCoordExtents[0].mV[0] = mTexCoords[i].mV[0] ;
+ }
+ if(mTexCoordExtents[1].mV[0] < mTexCoords[i].mV[0])
+ {
+ mTexCoordExtents[1].mV[0] = mTexCoords[i].mV[0] ;
+ }
+
+ if(mTexCoordExtents[0].mV[1] > mTexCoords[i].mV[1])
+ {
+ mTexCoordExtents[0].mV[1] = mTexCoords[i].mV[1] ;
+ }
+ if(mTexCoordExtents[1].mV[1] < mTexCoords[i].mV[1])
+ {
+ mTexCoordExtents[1].mV[1] = mTexCoords[i].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 LLVolumeFace::getVertexData(U16 index, LLVolumeFace::VertexData& cv)
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index eceaced9e2..5bd65c2bf2 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -901,7 +901,7 @@ public: LLVector4a* mExtents; //minimum and maximum point of face LLVector4a* mCenter; - LLVector2 mTexCoordExtents[2]; //minimum and maximum of texture coordinates of the face. + LLVector2 mTexCoordExtents[2]; //minimum and maximum of texture coordinates of the face. S32 mNumVertices; S32 mNumIndices; @@ -909,7 +909,7 @@ public: LLVector4a* mPositions; LLVector4a* mNormals; LLVector4a* mBinormals; - LLVector2* mTexCoords; + LLVector2* mTexCoords; U16* mIndices; std::vector<S32> mEdge; |