summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp18
-rw-r--r--indra/llprimitive/lldaeloader.h11
-rw-r--r--indra/llprimitive/llmodelloader.cpp63
-rw-r--r--indra/llprimitive/llmodelloader.h27
4 files changed, 53 insertions, 66 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index c1b74b1fd7..6ff9613c80 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -801,15 +801,16 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
// LLDAELoader
//-----------------------------------------------------------------------------
LLDAELoader::LLDAELoader(
- std::string filename,
- S32 lod,
+ std::string filename,
+ S32 lod,
load_callback_t load_cb,
joint_lookup_func_t joint_lookup_func,
texture_load_func_t texture_load_func,
- state_callback_t state_cb,
- void* opaque_userdata,
- JointTransformMap& jointMap,
- JointSet& jointsFromNodes,
+ state_callback_t state_cb,
+ void* opaque_userdata,
+ JointTransformMap& jointTransformMap,
+ JointNameSet& jointsFromNodes,
+ JointNameSet& legalJointNames,
U32 modelLimit)
: LLModelLoader(
filename,
@@ -819,8 +820,9 @@ LLDAELoader::LLDAELoader(
texture_load_func,
state_cb,
opaque_userdata,
- jointMap,
- jointsFromNodes),
+ jointTransformMap,
+ jointsFromNodes,
+ legalJointNames),
mGeneratedModelLimit(modelLimit)
{
}
diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h
index 7d91a6063b..896451320c 100644
--- a/indra/llprimitive/lldaeloader.h
+++ b/indra/llprimitive/lldaeloader.h
@@ -47,15 +47,16 @@ public:
dae_model_map mModelsMap;
LLDAELoader(
- std::string filename,
- S32 lod,
+ std::string filename,
+ S32 lod,
LLModelLoader::load_callback_t load_cb,
LLModelLoader::joint_lookup_func_t joint_lookup_func,
LLModelLoader::texture_load_func_t texture_load_func,
LLModelLoader::state_callback_t state_cb,
- void* opaque_userdata,
- JointTransformMap& jointMap,
- JointSet& jointsFromNodes,
+ void* opaque_userdata,
+ JointTransformMap& jointTransformMap,
+ JointNameSet& jointsFromNodes,
+ JointNameSet& legalJointNames,
U32 modelLimit);
virtual ~LLDAELoader() ;
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 81d92d151b..9cf0f10a7e 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -102,16 +102,17 @@ void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3&
// LLModelLoader
//-----------------------------------------------------------------------------
LLModelLoader::LLModelLoader(
- std::string filename,
- S32 lod,
+ std::string filename,
+ S32 lod,
load_callback_t load_cb,
joint_lookup_func_t joint_lookup_func,
texture_load_func_t texture_load_func,
- state_callback_t state_cb,
- void* opaque_userdata,
- JointTransformMap& jointMap,
- JointSet& jointsFromNodes )
-: mJointList( jointMap )
+ state_callback_t state_cb,
+ void* opaque_userdata,
+ JointTransformMap& jointTransformMap,
+ JointNameSet& jointsFromNodes,
+ JointNameSet& legalJointNames)
+: mJointList( jointTransformMap )
, mJointsFromNode( jointsFromNodes )
, LLThread("Model Loader")
, mFilename(filename)
@@ -127,33 +128,15 @@ LLModelLoader::LLModelLoader(
, mNoOptimize(false)
, mCacheOnlyHitIfRigged(false)
{
- mJointMap["mPelvis"] = "mPelvis";
- mJointMap["mTorso"] = "mTorso";
- mJointMap["mChest"] = "mChest";
- mJointMap["mNeck"] = "mNeck";
- mJointMap["mHead"] = "mHead";
- mJointMap["mSkull"] = "mSkull";
- mJointMap["mEyeRight"] = "mEyeRight";
- mJointMap["mEyeLeft"] = "mEyeLeft";
- mJointMap["mCollarLeft"] = "mCollarLeft";
- mJointMap["mShoulderLeft"] = "mShoulderLeft";
- mJointMap["mElbowLeft"] = "mElbowLeft";
- mJointMap["mWristLeft"] = "mWristLeft";
- mJointMap["mCollarRight"] = "mCollarRight";
- mJointMap["mShoulderRight"] = "mShoulderRight";
- mJointMap["mElbowRight"] = "mElbowRight";
- mJointMap["mWristRight"] = "mWristRight";
- mJointMap["mHipRight"] = "mHipRight";
- mJointMap["mKneeRight"] = "mKneeRight";
- mJointMap["mAnkleRight"] = "mAnkleRight";
- mJointMap["mFootRight"] = "mFootRight";
- mJointMap["mToeRight"] = "mToeRight";
- mJointMap["mHipLeft"] = "mHipLeft";
- mJointMap["mKneeLeft"] = "mKneeLeft";
- mJointMap["mAnkleLeft"] = "mAnkleLeft";
- mJointMap["mFootLeft"] = "mFootLeft";
- mJointMap["mToeLeft"] = "mToeLeft";
-
+ // Recognize all names we've been told are legal.
+ for (JointNameSet::iterator joint_name_it = legalJointNames.begin();
+ joint_name_it != legalJointNames.end(); ++joint_name_it)
+ {
+ const std::string& name = *joint_name_it;
+ mJointMap[name] = name;
+ }
+
+ // Also support various legacy aliases for commonly used joints
mJointMap["avatar_mPelvis"] = "mPelvis";
mJointMap["avatar_mTorso"] = "mTorso";
mJointMap["avatar_mChest"] = "mChest";
@@ -501,8 +484,8 @@ void LLModelLoader::critiqueJointToNodeMappingFromScene( void )
//Do the actual nodes back the joint listing from the dae?
//if yes then this is a fully rigged asset, otherwise it's just a partial rig
- JointSet::iterator jointsFromNodeIt = mJointsFromNode.begin();
- JointSet::iterator jointsFromNodeEndIt = mJointsFromNode.end();
+ JointNameSet::iterator jointsFromNodeIt = mJointsFromNode.begin();
+ JointNameSet::iterator jointsFromNodeEndIt = mJointsFromNode.end();
bool result = true;
if ( !mJointsFromNode.empty() )
@@ -547,8 +530,8 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
bool result = false;
- JointSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin();
- JointSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end();
+ JointNameSet :: const_iterator masterJointIt = mMasterLegacyJointList.begin();
+ JointNameSet :: const_iterator masterJointEndIt = mMasterLegacyJointList.end();
std::vector<std::string> :: const_iterator modelJointIt = jointListFromAsset.begin();
std::vector<std::string> :: const_iterator modelJointItEnd = jointListFromAsset.end();
@@ -581,8 +564,8 @@ bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vector<std::
{
bool result = false;
- JointSet :: const_iterator masterJointIt = mMasterJointList.begin();
- JointSet :: const_iterator masterJointEndIt = mMasterJointList.end();
+ JointNameSet :: const_iterator masterJointIt = mMasterJointList.begin();
+ JointNameSet :: const_iterator masterJointEndIt = mMasterJointList.end();
std::vector<std::string> :: const_iterator modelJointIt = jointListFromAsset.begin();
std::vector<std::string> :: const_iterator modelJointItEnd = jointListFromAsset.end();
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index bb4d06dca3..894de2c76f 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -34,10 +34,10 @@
class LLJoint;
-typedef std::map<std::string, LLMatrix4> JointTransformMap;
-typedef std::map<std::string, LLMatrix4>:: iterator JointTransformMapIt;
-typedef std::map<std::string, std::string> JointMap;
-typedef std::deque<std::string> JointSet;
+typedef std::map<std::string, LLMatrix4> JointTransformMap;
+typedef std::map<std::string, LLMatrix4>::iterator JointTransformMapIt;
+typedef std::map<std::string, std::string> JointMap;
+typedef std::deque<std::string> JointNameSet;
const S32 SLM_SUPPORTED_VERSION = 3;
const S32 NUM_LOD = 4;
@@ -116,18 +116,19 @@ public:
//map of avatar joints as named in COLLADA assets to internal joint names
JointMap mJointMap;
JointTransformMap& mJointList;
- JointSet& mJointsFromNode;
+ JointNameSet& mJointsFromNode;
LLModelLoader(
- std::string filename,
- S32 lod,
+ std::string filename,
+ S32 lod,
LLModelLoader::load_callback_t load_cb,
LLModelLoader::joint_lookup_func_t joint_lookup_func,
LLModelLoader::texture_load_func_t texture_load_func,
LLModelLoader::state_callback_t state_cb,
- void* opaque_userdata,
- JointTransformMap& jointMap,
- JointSet& jointsFromNodes);
+ void* opaque_userdata,
+ JointTransformMap& jointTransformMap,
+ JointNameSet& jointsFromNodes,
+ JointNameSet& legalJointNames);
virtual ~LLModelLoader() ;
virtual void setNoNormalize() { mNoNormalize = true; }
@@ -189,7 +190,7 @@ protected:
LLModelLoader::joint_lookup_func_t mJointLookupFunc;
LLModelLoader::texture_load_func_t mTextureLoadFunc;
LLModelLoader::state_callback_t mStateCallback;
- void* mOpaqueData;
+ void* mOpaqueData;
bool mRigParityWithScene;
bool mRigValidJointUpload;
@@ -198,8 +199,8 @@ protected:
bool mNoNormalize;
bool mNoOptimize;
- JointSet mMasterJointList;
- JointSet mMasterLegacyJointList;
+ JointNameSet mMasterJointList;
+ JointNameSet mMasterLegacyJointList;
JointTransformMap mJointTransformMap;
static std::list<LLModelLoader*> sActiveLoaderList;