From 7fc12cd43dcb21df88be5c47c319d0d3f6498216 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 28 Jul 2011 16:09:17 -0400 Subject: Fix for sh-2044, sh-2039 and sh-2166 (Avatar weights were sometimes not correctly applied upon import. --- indra/llprimitive/llmodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llprimitive/llmodel.cpp') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index ea0ea931af..def276c808 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1692,13 +1692,13 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) } else { //no exact match found, get closest point - const F32 epsilon = 2.f/65536; + const F32 epsilon = 1e-5f; weight_map::iterator iter_up = mSkinWeights.lower_bound(pos); weight_map::iterator iter_down = ++iter_up; weight_map::iterator best = iter_up; - F32 min_dist = (iter->first - pos).magVecSquared(); + F32 min_dist = (iter->first - pos).magVec(); bool done = false; while (!done) @@ -1709,7 +1709,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) if (iter_up != mSkinWeights.end() && ++iter_up != mSkinWeights.end()) { done = false; - F32 dist = (iter_up->first - pos).magVecSquared(); + F32 dist = (iter_up->first - pos).magVec(); if (dist < epsilon) { @@ -1727,7 +1727,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { done = false; - F32 dist = (iter_down->first - pos).magVecSquared(); + F32 dist = (iter_down->first - pos).magVec(); if (dist < epsilon) { -- cgit v1.2.3 From df94d0c778e63ce053cfd1fa4423b180bab6adfb Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 3 Aug 2011 17:01:34 -0400 Subject: Fixes for sh-2039, sh-1336, and sh-2044. Vertices were having incorrect weights assigned. --- indra/llprimitive/llmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/llprimitive/llmodel.cpp') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index def276c808..d8e4d4a173 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1679,6 +1679,19 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BO LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { + //1. If a vertex has been weighted then we'll find it via pos and return it's weight list + weight_map::iterator iterPos = mSkinWeights.begin(); + weight_map::iterator iterEnd = mSkinWeights.end(); + + for ( ; iterPos!=iterEnd; ++iterPos ) + { + if ( jointPositionalLookup( iterPos->first, pos ) ) + { + return iterPos->second; + } + } + + //2. Otherwise we'll use the older implementation weight_map::iterator iter = mSkinWeights.find(pos); if (iter != mSkinWeights.end()) -- cgit v1.2.3