fix for SH-1878: Viewer hang in GLOD_Group::adaptTriangleBudget during LLModelPreview::genLODs;

SH-1891: viewer crashes while previewing "RYOMA 3D XML File.dae";
SH-1890: Crash loading palm tree
meow-7.2.2
Xiaohong Bao 2011-06-24 15:09:10 -06:00
parent c3ac5be995
commit f83b08b69c
3 changed files with 45 additions and 34 deletions

View File

@ -2774,11 +2774,13 @@ void LLVolume::makeTetrahedron()
n[2] = cv[2].getNormal();
n += 3;
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
if(tc)
{
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
}
//side 2
cv[0].setPosition(p[3]);
@ -2797,11 +2799,14 @@ void LLVolume::makeTetrahedron()
n[2] = cv[2].getNormal();
n += 3;
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
if(tc)
{
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
}
//side 3
cv[0].setPosition(p[3]);
cv[1].setPosition(p[1]);
@ -2819,10 +2824,13 @@ void LLVolume::makeTetrahedron()
n[2] = cv[2].getNormal();
n += 3;
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
if(tc)
{
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
}
//side 4
cv[0].setPosition(p[2]);
@ -2841,10 +2849,13 @@ void LLVolume::makeTetrahedron()
n[2] = cv[2].getNormal();
n += 3;
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
if(tc)
{
tc[0] = cv[0].mTexCoord;
tc[1] = cv[1].mTexCoord;
tc[2] = cv[2].mTexCoord;
tc += 3;
}
//set index buffer
for (U16 i = 0; i < 12; i++)
@ -5613,7 +5624,16 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) src.mPositions, vert_size);
LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) src.mNormals, vert_size);
LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) src.mTexCoords, tc_size);
if(src.mTexCoords)
{
LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) src.mTexCoords, tc_size);
}
else
{
ll_aligned_free_16(mTexCoords) ;
mTexCoords = NULL ;
}
if (src.mBinormals)

View File

@ -260,7 +260,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (!tc_source)
{
ll_aligned_free_16(face.mTexCoords);
ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
@ -291,7 +291,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (!tc_source)
{
ll_aligned_free_16(face.mTexCoords);
ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
}
@ -479,7 +479,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (!tc_source)
{
ll_aligned_free_16(face.mTexCoords);
ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
@ -513,7 +513,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (!tc_source)
{
ll_aligned_free_16(face.mTexCoords);
ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
}
@ -713,7 +713,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
if (!t)
{
ll_aligned_free_16(face.mTexCoords);
ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
}

View File

@ -4500,16 +4500,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
bool skinned = include_skin_weights && !mdl->mSkinWeights.empty();
U32 mask = LLVertexBuffer::MAP_VERTEX;
if (vf.mNormals)
{
mask |= LLVertexBuffer::MAP_NORMAL;
}
if (vf.mTexCoords)
{
mask |= LLVertexBuffer::MAP_TEXCOORD0;
}
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0 ;
if (skinned)
{