From f376ec167c86ad8e702c9fcc4c643fe998e18269 Mon Sep 17 00:00:00 2001 From: Don Kjer <don@lindenlab.com> Date: Mon, 18 Jul 2011 18:50:57 -0700 Subject: Adding support for viewer reading mesh params from an alternative param type. --- indra/llprimitive/llprimitive.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 76faa1b8c5..8903d8e049 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -103,6 +103,7 @@ public: PARAMS_LIGHT = 0x20, PARAMS_SCULPT = 0x30, PARAMS_LIGHT_IMAGE = 0x40, + PARAMS_MESH = 0x50, }; public: -- cgit v1.2.3 From e8b71e0585ab126f9e77da93d6830a1a73a7aa92 Mon Sep 17 00:00:00 2001 From: Don Kjer <don@lindenlab.com> Date: Mon, 18 Jul 2011 18:57:40 -0700 Subject: Changed mesh param type to not conflict with one in-use on server --- indra/llprimitive/llprimitive.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 8903d8e049..998016f8f6 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -103,7 +103,8 @@ public: PARAMS_LIGHT = 0x20, PARAMS_SCULPT = 0x30, PARAMS_LIGHT_IMAGE = 0x40, - PARAMS_MESH = 0x50, + PARAMS_RESERVED = 0x50, // Used on server-side + PARAMS_MESH = 0x60, }; public: -- cgit v1.2.3 From c37603d9ce2be463b76f8f179177a79537bae399 Mon Sep 17 00:00:00 2001 From: prep <prep@lindenlab.com> Date: Wed, 20 Jul 2011 14:05:13 -0400 Subject: fix for sh-1847: Removed assert when a vert is outside [-5,5] domain --- indra/llprimitive/llmodel.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 434fb7650b..ea0ea931af 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2329,8 +2329,6 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 k = 0; k < 3; k++) { - llassert(v[k] <= 0.51f && v[k] >= -0.51f); - //convert to 16-bit normalized across domain U16 val = (U16) (((v[k]-min.mV[k])/range.mV[k])*65535); -- cgit v1.2.3 From 50b9c63382121df879680cf43f5be6fc09686607 Mon Sep 17 00:00:00 2001 From: seth_productengine <none@none> Date: Fri, 22 Jul 2011 22:40:18 +0300 Subject: SH-1868 WIP Added user-supplied metric data for uploading a model. The mesh category string selected by user within the model data and sent to the server during calculating the upload fee and upload requests. The accounting info and the upload permissions warning in the bottom left corner of the floater are temporarily made mutually exclusive. --- indra/llprimitive/llmodel.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 3f58eba07d..35fdf3f3d6 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -148,6 +148,7 @@ public: static LLModel* loadModelFromDomMesh(domMesh* mesh); static std::string getElementLabel(daeElement* element); std::string getName() const; + std::string getMetric() const {return mMetric;} EModelStatus getStatus() const {return mStatus;} static std::string getStatusString(U32 status) ; @@ -234,6 +235,8 @@ public: std::string mRequestedLabel; // name requested in UI, if any. std::string mLabel; // name computed from dae. + std::string mMetric; // user-supplied metric data for upload + LLVector3 mNormalizedScale; LLVector3 mNormalizedTranslation; -- cgit v1.2.3 From 7fc12cd43dcb21df88be5c47c319d0d3f6498216 Mon Sep 17 00:00:00 2001 From: prep <prep@lindenlab.com> 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 ++++---- indra/llprimitive/llmodel.h | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/llprimitive') 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) { 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 -- cgit v1.2.3 From 0713e8c97a75cb209c5d36fba0bdf20dc107a981 Mon Sep 17 00:00:00 2001 From: nyx <none@none> Date: Fri, 29 Jul 2011 17:21:27 -0400 Subject: BUILDFIX: fixing build for linux, casting doubles as parameters to abs --- indra/llprimitive/llmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 90c1c252ed..74e5657d28 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -225,7 +225,7 @@ public: bool areEqual( double a, double b ) { const float epsilon = 1e-5f; - return (abs(a - b) > epsilon) && (a < b); + return (abs((int)(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 ) -- cgit v1.2.3 From c013c3ab5360f25ad4f9d0c7663c342367105324 Mon Sep 17 00:00:00 2001 From: prep linden <prep@lindenlab.com> Date: Fri, 29 Jul 2011 17:44:42 -0400 Subject: Removed joint Positional Compare because it was crashing on some rigs --- indra/llprimitive/llmodel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 9dab3a0400..4f4e642f68 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -224,7 +224,7 @@ public: bool areEqual( double a, double b ) { const float epsilon = 1e-5f; - return (abs(a - b) > epsilon) && (a < b); + 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 ) @@ -239,7 +239,7 @@ public: //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, JointPositionalCompare > weight_map; + typedef std::map<LLVector3, weight_list > weight_map; weight_map mSkinWeights; //get list of weight influences closest to given position -- cgit v1.2.3 From df94d0c778e63ce053cfd1fa4423b180bab6adfb Mon Sep 17 00:00:00 2001 From: prep <prep@lindenlab.com> 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 +++++++++++++ indra/llprimitive/llmodel.h | 23 ++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) (limited to 'indra/llprimitive') 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()) diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index b5dd9bf87d..9a7b9fa271 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -219,20 +219,17 @@ public: }; - struct JointPositionalCompare + //Are the doubles the same w/in epsilon specified tolerance + bool areEqual( double a, double b ) { - //Are the doubles the same w/in epsilon specified tolerance - bool areEqual( double a, double b ) - { - const float epsilon = 1e-5f; - return (abs((int)(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; - } - }; + const float epsilon = 1e-5f; + return (fabs((a - b)) < epsilon) ? true : false ; + } + //Make sure that we return false for any values that are within the tolerance for equivalence + bool jointPositionalLookup( const LLVector3& a, const LLVector3& b ) + { + return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? true : false; + } //copy of position array for this model -- mPosition[idx].mV[X,Y,Z] std::vector<LLVector3> mPosition; -- cgit v1.2.3 From 71ac45a28b238bac4ac0cf43ee85f04589ffa116 Mon Sep 17 00:00:00 2001 From: prep linden <prep@lindenlab.com> Date: Tue, 30 Aug 2011 09:32:16 -0400 Subject: Handling of material mismatches - lod materials are required to be a subset of the high lod, introduced addEmptyFace() for when parity does not exist between model material counts --- indra/llprimitive/llmodel.cpp | 61 +++++++++++++++++++++++++++++++++++++++++-- indra/llprimitive/llmodel.h | 6 +++-- 2 files changed, 63 insertions(+), 4 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d8e4d4a173..d13e6b662c 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1903,14 +1903,70 @@ bool LLModel::loadModel(std::istream& is) } -void LLModel::matchMaterialOrder(LLModel* ref) +bool LLModel::isMaterialListSubset( LLModel* ref ) { - llassert(ref->mMaterialList.size() == mMaterialList.size()); + int refCnt = ref->mMaterialList.size(); + int modelCnt = mMaterialList.size(); + + for (U32 src = 0; src < modelCnt; ++src) + { + bool foundRef = false; + + for (U32 dst = 0; dst < refCnt; ++dst) + { + //llinfos<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<llendl; + foundRef = mMaterialList[src] == ref->mMaterialList[dst]; + + if ( foundRef ) + { + break; + } + } + if (!foundRef) + { + return false; + } + } + + return true; +} + +bool LLModel::needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) +{ + bool changed = false; + if ( refFaceCnt< modelFaceCnt ) + { + refFaceCnt += modelFaceCnt - refFaceCnt; + changed = true; + } + else + if ( modelFaceCnt < refFaceCnt ) + { + modelFaceCnt += refFaceCnt - modelFaceCnt; + changed = true; + } + + return changed; +} +bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ) +{ + //Is this a subset? + //LODs cannot currently add new materials, e.g. + //1. ref = a,b,c lod1 = d,e => This is not permitted + //2. ref = a,b,c lod1 = c => This would be permitted + + bool isASubset = isMaterialListSubset( ref ); + if ( !isASubset ) + { + return false; + } + std::map<std::string, U32> index_map; //build a map of material slot names to face indexes bool reorder = false; + std::set<std::string> base_mat; std::set<std::string> cur_mat; @@ -1952,6 +2008,7 @@ void LLModel::matchMaterialOrder(LLModel* ref) //override material list with reference model ordering mMaterialList = ref->mMaterialList; + return true; } diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 9a7b9fa271..1cf528fd9f 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -176,8 +176,10 @@ public: //reorder face list based on mMaterialList in this and reference so //order matches that of reference (material ordering touchup) - void matchMaterialOrder(LLModel* reference); - + bool matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); + bool isMaterialListSubset( LLModel* ref ); + bool needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt ); + std::vector<std::string> mMaterialList; //data used for skin weights -- cgit v1.2.3 From 2df669c402b5344397499186e73d0886dd5da4d1 Mon Sep 17 00:00:00 2001 From: prep linden <prep@lindenlab.com> Date: Tue, 30 Aug 2011 10:46:41 -0400 Subject: Log error message if material list is not a subset of reference model --- indra/llprimitive/llmodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d13e6b662c..6e4bb7ec97 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1959,6 +1959,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn bool isASubset = isMaterialListSubset( ref ); if ( !isASubset ) { + llinfos<<"Material of model is not a subset of reference."<<llendl; return false; } -- cgit v1.2.3