diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-20 16:40:43 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-20 16:40:43 -0700 |
commit | 988eae369882f57eeb4bca893dcc2c46eb773ec7 (patch) | |
tree | 8518e405fceeff8a0593329c1a0d335a30b79031 /indra/llappearance | |
parent | 50bb863be1c0e3528fd850aac812fc6196a7c4fc (diff) | |
parent | 7da4c651911743707c0cc7cd4bebdcefb52eb379 (diff) |
merge
Diffstat (limited to 'indra/llappearance')
-rw-r--r-- | indra/llappearance/llpolymorph.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 8a17819083..93c2f15a53 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -597,19 +597,31 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); scaled_normals[vert_index_mesh].add(norm); norm = scaled_normals[vert_index_mesh]; + + // guard against degenerate input data before we create NaNs below! + // norm.normalize3fast(); normals[vert_index_mesh] = norm; // calculate new binormals LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; + + // guard against degenerate input data before we create NaNs below! + // + if (!binorm.isFinite3() || (binorm.dot3(binorm).getF32() <= F_APPROXIMATELY_ZERO)) + { + binorm.set(1,0,0,1); + } + binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); scaled_binormals[vert_index_mesh].add(binorm); LLVector4a tangent; tangent.setCross3(scaled_binormals[vert_index_mesh], norm); LLVector4a& normalized_binormal = binormals[vert_index_mesh]; - normalized_binormal.setCross3(norm, tangent); + + normalized_binormal.setCross3(norm, tangent); normalized_binormal.normalize3fast(); - + tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight; } |