diff options
Diffstat (limited to 'indra/llappearance')
-rw-r--r-- | indra/llappearance/llpolymorph.cpp | 12 | ||||
-rw-r--r-- | indra/llappearance/llwearable.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index d40dfadfc8..6bda38bd97 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -598,16 +598,28 @@ 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.normalize3fast(); diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 8c2a1721b7..6e4d2b2242 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -116,7 +116,7 @@ public: protected: typedef std::map<S32, LLLocalTextureObject*> te_map_t; void syncImages(te_map_t &src, te_map_t &dst); - void destroyTextures(); + void destroyTextures(); void createVisualParams(LLAvatarAppearance *avatarp); void createLayers(S32 te, LLAvatarAppearance *avatarp); BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size); |