summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
authorAura Linden <aura@lindenlab.com>2013-07-11 17:49:13 -0700
committerAura Linden <aura@lindenlab.com>2013-07-11 17:49:13 -0700
commitce9962b33872db65b70c9b10901ec9062cb59169 (patch)
tree94be5367128e241ef1c6f802e8551a9b4ed786ff /indra/llappearance
parent8642f57dd95864ec6b002f6519701f30866c6502 (diff)
parent6060e5e46acbeb20a301070a0fd0efea029d33d0 (diff)
Merged in viewer-release
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/llpolymorph.cpp16
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;
}