diff options
author | prep <prep@lindenlab.com> | 2011-07-28 16:09:17 -0400 |
---|---|---|
committer | prep <prep@lindenlab.com> | 2011-07-28 16:09:17 -0400 |
commit | 7fc12cd43dcb21df88be5c47c319d0d3f6498216 (patch) | |
tree | 601277df1789818bb52066f2b65a3a9453112306 /indra/llprimitive/llmodel.h | |
parent | 9395bcee52a9786185d90c52a22564b1d975e4ea (diff) |
Fix for sh-2044, sh-2039 and sh-2166 (Avatar weights were sometimes not correctly applied upon import.
Diffstat (limited to 'indra/llprimitive/llmodel.h')
-rw-r--r-- | indra/llprimitive/llmodel.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 3f58eba07d..9dab3a0400 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -217,13 +217,29 @@ public: } }; + + struct JointPositionalCompare + { + //Are the doubles the same w/in epsilon specified tolerance + bool areEqual( double a, double b ) + { + const float epsilon = 1e-5f; + return (abs(a - b) > epsilon) && (a < b); + } + //Make sure that we return false for any values that are within the tolerance for equivalence + bool operator() ( const LLVector3& a, const LLVector3& b ) + { + return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? false : true; + } + }; + //copy of position array for this model -- mPosition[idx].mV[X,Y,Z] std::vector<LLVector3> mPosition; //map of positions to skin weights --- mSkinWeights[pos].mV[0..4] == <joint_index>.<weight> //joint_index corresponds to mJointList typedef std::vector<JointWeight> weight_list; - typedef std::map<LLVector3, weight_list > weight_map; + typedef std::map<LLVector3, weight_list, JointPositionalCompare > weight_map; weight_map mSkinWeights; //get list of weight influences closest to given position |