DRTVWR-412 WIP - more work for importer merge from viewer-release
parent
fc74e02cde
commit
ebad0c6868
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() ;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1708,6 +1708,21 @@ void LLModelPreview::clearModel(S32 lod)
|
|||
mScene[lod].clear();
|
||||
}
|
||||
|
||||
void LLModelPreview::getLegalJointNames(JointNameSet& legal_joint_names)
|
||||
{
|
||||
// Get all standard skeleton joints from the preview avatar.
|
||||
LLVOAvatar *av = getPreviewAvatar();
|
||||
const LLVOAvatar::avatar_joint_list_t &skel = av->getSkeleton();
|
||||
for (S32 i=0; i<skel.size(); i++)
|
||||
{
|
||||
LLAvatarJoint *joint = skel[i];
|
||||
if (joint)
|
||||
{
|
||||
legal_joint_names.push_back(joint->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable_slm)
|
||||
{
|
||||
assert_main_thread();
|
||||
|
|
@ -1750,6 +1765,10 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
|
|||
clearGLODGroup();
|
||||
}
|
||||
|
||||
|
||||
JointNameSet legal_joint_names;
|
||||
getLegalJointNames(legal_joint_names);
|
||||
|
||||
mModelLoader = new LLDAELoader(
|
||||
filename,
|
||||
lod,
|
||||
|
|
@ -1760,6 +1779,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
|
|||
this,
|
||||
mJointTransformMap,
|
||||
mJointsFromNode,
|
||||
legal_joint_names,
|
||||
gSavedSettings.getU32("ImporterModelLimit"));
|
||||
|
||||
if (force_disable_slm)
|
||||
|
|
@ -3689,6 +3709,11 @@ BOOL LLModelPreview::render()
|
|||
}
|
||||
}
|
||||
|
||||
if (regen)
|
||||
{
|
||||
genBuffers(mPreviewLOD, skin_weight);
|
||||
}
|
||||
|
||||
if (!skin_weight)
|
||||
{
|
||||
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ public:
|
|||
virtual BOOL needsRender() { return mNeedsUpdate; }
|
||||
void setPreviewLOD(S32 lod);
|
||||
void clearModel(S32 lod);
|
||||
void getLegalJointNames(JointNameSet& legal_joint_names);
|
||||
void loadModel(std::string filename, S32 lod, bool force_disable_slm = false);
|
||||
void loadModelCallback(S32 lod);
|
||||
void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false);
|
||||
|
|
@ -405,7 +406,7 @@ private:
|
|||
|
||||
bool mLastJointUpdate;
|
||||
|
||||
JointSet mJointsFromNode;
|
||||
JointNameSet mJointsFromNode;
|
||||
JointTransformMap mJointTransformMap;
|
||||
|
||||
LLPointer<LLVOAvatar> mPreviewAvatar;
|
||||
|
|
|
|||
Loading…
Reference in New Issue