Fix for small textures not being loaded. From SH-659.
parent
72fd8359ba
commit
2c2508e6c5
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1155,7 +1155,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
if (rebuild_tcoord)
|
||||
{
|
||||
LLVector2 tc = vf.mVertices[i].mTexCoord;
|
||||
|
||||
|
||||
if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
|
||||
{
|
||||
LLVector3 vec = vf.mVertices[i].mPosition;
|
||||
|
|
@ -1331,7 +1331,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
mTexExtents[0].setVec(0,0);
|
||||
mTexExtents[1].setVec(1,1);
|
||||
xform(mTexExtents[0], cos_ang, sin_ang, os, ot, ms, mt);
|
||||
xform(mTexExtents[1], cos_ang, sin_ang, os, ot, ms, mt);
|
||||
xform(mTexExtents[1], cos_ang, sin_ang, os, ot, ms, mt);
|
||||
|
||||
F32 es = vf.mTexCoordExtents[1].mV[0] - vf.mTexCoordExtents[0].mV[0] ;
|
||||
F32 et = vf.mTexCoordExtents[1].mV[1] - vf.mTexCoordExtents[0].mV[1] ;
|
||||
mTexExtents[0][0] *= es ;
|
||||
mTexExtents[1][0] *= es ;
|
||||
mTexExtents[0][1] *= et ;
|
||||
mTexExtents[1][1] *= et ;
|
||||
}
|
||||
|
||||
mLastVertexBuffer = mVertexBuffer;
|
||||
|
|
|
|||
Loading…
Reference in New Issue