From 940adfe4d02ab0ecf69635afe7f959abe1fe2c44 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 May 2015 11:16:51 -0400 Subject: WIP bvh diagnostics --- indra/newview/app_settings/logcontrol.xml | 1 + indra/newview/llfloaterbvhpreview.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index de3732f339..6d5cf6e8f7 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,6 +42,7 @@ tags + BVH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/character/avatar_skeleton_orig.xml b/indra/newview/character/avatar_skeleton_orig.xml new file mode 100644 index 0000000000..6b07bbc1d3 --- /dev/null +++ b/indra/newview/character/avatar_skeleton_orig.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 2a2c0b81f0..23c5b7192d 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1316,48 +1316,8 @@ LLModelLoader::LLModelLoader( std::string filename, S32 lod, LLModelPreview* pre , mJointsFromNode( jointsFromNodes ) , LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE), mNumOfFetchingTextures(0) { - 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"; - - // FIXME BENTO change this to use the skeleton info rather than hardwiring - mJointMap["mLeftWingShoulder"] = "mLeftWingShoulder"; - mJointMap["mLeftWingElbow"] = "mLeftWingElbow"; - mJointMap["mLeftWingWrist"] = "mLeftWingWrist"; - mJointMap["mLeftWingTip"] = "mLeftWingTip"; - mJointMap["mRightWingShoulder"] = "mRightWingShoulder"; - mJointMap["mRightWingElbow"] = "mRightWingElbow"; - mJointMap["mRightWingWrist"] = "mRightWingWrist"; - mJointMap["mRightWingTip"] = "mRightWingTip"; - - mJointMap["mTail_1"] = "mTail_1"; - mJointMap["mTail_2"] = "mTail_2"; - mJointMap["mTail_3"] = "mTail_3"; - mJointMap["mTail_4"] = "mTail_4"; - + // Accepted joint aliases - the origins and continued relevance of these is unclear. + mJointMap["avatar_mPelvis"] = "mPelvis"; mJointMap["avatar_mTorso"] = "mTorso"; mJointMap["avatar_mChest"] = "mChest"; @@ -1407,6 +1367,21 @@ LLModelLoader::LLModelLoader( std::string filename, S32 lod, LLModelPreview* pre mJointMap["lShin"] = "mKneeLeft"; mJointMap["lFoot"] = "mFootLeft"; + // Get all standard skeleton joints from the preview avatar. + if (mPreview) + { + LLVOAvatar *av = mPreview->getPreviewAvatar(); + const LLVOAvatar::avatar_joint_list_t &skel = av->getSkeleton(); + for (S32 i=0; igetName()] = joint->getName(); + } + } + } + if (mPreview) { //only try to load from slm if viewer is configured to do so and this is the diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6622fa7d9c..e372676a4f 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1259,7 +1259,7 @@ bool idle_startup() LLPostProcess::initClass(); display_startup(); - LLAvatarAppearance::initClass(); + LLAvatarAppearance::initClass(gSavedSettings.getString("AvatarFileName"),gSavedSettings.getString("SkeletonFileName")); display_startup(); LLViewerObject::initVOClasses(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 253271322c..202b63dec0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5153,7 +5153,10 @@ void LLVOAvatar::clearAttachmentPosOverrides() for (; iter != end; ++iter) { LLJoint* pJoint = (*iter); - pJoint->clearAttachmentPosOverrides(); + if (pJoint) + { + pJoint->clearAttachmentPosOverrides(); + } } } -- cgit v1.2.3 From 217fb294340b63ce8b3ffa1503649396043c1881 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Aug 2015 16:23:01 -0400 Subject: SL-135 WIP - added additional lad/skel configs --- indra/newview/character/avatar_lad_tentacles.xml | 12505 ++++++++++++++++++ indra/newview/character/avatar_lad_wings_tail.xml | 12615 +++++++++++++++++++ .../character/avatar_skeleton_tentacles.xml | 281 + .../character/avatar_skeleton_wings_tail.xml | 105 + 4 files changed, 25506 insertions(+) create mode 100644 indra/newview/character/avatar_lad_tentacles.xml create mode 100644 indra/newview/character/avatar_lad_wings_tail.xml create mode 100644 indra/newview/character/avatar_skeleton_tentacles.xml create mode 100644 indra/newview/character/avatar_skeleton_wings_tail.xml (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad_tentacles.xml b/indra/newview/character/avatar_lad_tentacles.xml new file mode 100644 index 0000000000..9ec6428ee6 --- /dev/null +++ b/indra/newview/character/avatar_lad_tentacles.xml @@ -0,0 +1,12505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/character/avatar_lad_wings_tail.xml b/indra/newview/character/avatar_lad_wings_tail.xml new file mode 100644 index 0000000000..ac0b8b5704 --- /dev/null +++ b/indra/newview/character/avatar_lad_wings_tail.xml @@ -0,0 +1,12615 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/character/avatar_skeleton_tentacles.xml b/indra/newview/character/avatar_skeleton_tentacles.xml new file mode 100644 index 0000000000..c232169b70 --- /dev/null +++ b/indra/newview/character/avatar_skeleton_tentacles.xml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/character/avatar_skeleton_wings_tail.xml b/indra/newview/character/avatar_skeleton_wings_tail.xml new file mode 100644 index 0000000000..7a088484d8 --- /dev/null +++ b/indra/newview/character/avatar_skeleton_wings_tail.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From fbe58c1bdf565c95e01d67a98faa6f3d00b4df0c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 20 Aug 2015 16:45:02 -0400 Subject: SL-109 WIP - default av is wings+tail, others available with debug settings AvatarFileName and SkeletonFileName --- indra/newview/character/avatar_skeleton_tentacles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_skeleton_tentacles.xml b/indra/newview/character/avatar_skeleton_tentacles.xml index c232169b70..9863a5cbfd 100644 --- a/indra/newview/character/avatar_skeleton_tentacles.xml +++ b/indra/newview/character/avatar_skeleton_tentacles.xml @@ -1,5 +1,5 @@ - + -- cgit v1.2.3 From 2ea8df0593d520b86bcf958263622218f76ac113 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Aug 2015 10:49:02 -0400 Subject: SL-205 WIP - support for 152-joint rigged meshes with both hardware and software skinning. --- .../app_settings/shaders/class1/avatar/objectSkinV.glsl | 13 ++++++++----- indra/newview/lldrawpoolavatar.cpp | 3 ++- indra/newview/llvovolume.cpp | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 6cd38d8ef5..d3eed775bf 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -24,8 +24,11 @@ ATTRIBUTE vec4 weight4; -uniform mat3 matrixPalette[52]; -uniform vec3 translationPalette[52]; +/* BENTO JOINT COUNT LIMITS + * Note that the value in these two lines also needs to be updated to value-1 several places below. + */ +uniform mat3 matrixPalette[152]; +uniform vec3 translationPalette[152]; mat4 getObjectSkinnedTransform() { @@ -34,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(51.0)); + index = min(index, vec4(151.0)); index = max(index, vec4( 0.0)); float scale = 1.0/(w.x+w.y+w.z+w.w); @@ -68,8 +71,8 @@ mat4 getObjectSkinnedTransform() // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. mat3 dummy1 = matrixPalette[0]; vec3 dummy2 = translationPalette[0]; - mat3 dummy3 = matrixPalette[51]; - vec3 dummy4 = translationPalette[51]; + mat3 dummy3 = matrixPalette[151]; + vec3 dummy4 = translationPalette[151]; #endif } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f828b56f7f..6c9107cb76 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -55,7 +55,8 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; static U32 sShaderLevel = 0; -#define JOINT_COUNT 52 +// BENTO JOINT COUNT LIMIT +#define JOINT_COUNT 152 LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL; BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 267061b83d..7bbaf981ae 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4163,6 +4163,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } //build matrix palette + // BENTO JOINT COUNT LIMIT static const size_t kMaxJoints = 64; LLMatrix4a mp[kMaxJoints]; -- cgit v1.2.3 From 5cacd71c07cd4202784ebf2f826239b4529787ba Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 2 Sep 2015 15:42:22 -0400 Subject: SL-205 WIP - bumped up max joint count in software-skinning pass. --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f70280d8c1..25e61c259f 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4164,7 +4164,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons //build matrix palette // BENTO JOINT COUNT LIMIT - static const size_t kMaxJoints = 64; + static const size_t kMaxJoints = 152; LLMatrix4a mp[kMaxJoints]; LLMatrix4* mat = (LLMatrix4*) mp; -- cgit v1.2.3 From 9d44aaab46eff6d16ff50d8b6c12df821f637761 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 8 Sep 2015 12:56:44 -0400 Subject: SL-216 WIP, SL-220 WIP - stray triangles in hw skinning path --- indra/newview/lldrawpoolavatar.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 6c9107cb76..9dd4c2ce0d 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1639,7 +1639,21 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* scale += wght[k]; } - wght *= 1.f/scale; + if (scale > 0.f) + { + wght *= 1.f/scale; + } + else + { + // Complete weighting fail - all zeroes. Just + // pick some values that add up to 1.0 so we + // don't wind up with garbage vertices + // pointing off at (0,0,0) + wght[0] = 1.f; + wght[1] = 0.f; + wght[2] = 0.f; + wght[3] = 0.f; + } for (U32 k = 0; k < 4; k++) { -- cgit v1.2.3 From 2da22ad9fc92b255f9ec63dee11cf56342c2ac33 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 24 Sep 2015 11:35:19 -0400 Subject: SL-227 WIP - initial pass at consolidating skinning code. Less duplication of functionality, still needs more cleanup. --- indra/newview/lldrawpoolavatar.cpp | 191 +++++++++++++++++++------------- indra/newview/lldrawpoolavatar.h | 2 + indra/newview/llfloatermodelpreview.cpp | 59 +++------- indra/newview/llvovolume.cpp | 54 +-------- 4 files changed, 137 insertions(+), 169 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f1bfe4ecb2..7ccc779ba4 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -55,9 +55,6 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; static U32 sShaderLevel = 0; -// BENTO JOINT COUNT LIMIT -#define JOINT_COUNT 152 - LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL; BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE; BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE; @@ -1463,7 +1460,13 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) } } -void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer& buffer, U32 data_mask, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face) +void LLDrawPoolAvatar::getRiggedGeometry( + LLFace* face, + LLPointer& buffer, + U32 data_mask, + const LLMeshSkinInfo* skin, + LLVolume* volume, + const LLVolumeFace& vol_face) { face->setGeomIndex(0); face->setIndicesIndex(0); @@ -1472,7 +1475,8 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer face->setTextureIndex(255); if (buffer.isNull() || buffer->getTypeMask() != data_mask || !buffer->isWriteable()) - { //make a new buffer + { + // make a new buffer if (sShaderLevel > 0) { buffer = new LLVertexBuffer(data_mask, GL_DYNAMIC_DRAW_ARB); @@ -1484,7 +1488,8 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer buffer->allocateBuffer(vol_face.mNumVertices, vol_face.mNumIndices, true); } else - { //resize existing buffer + { + //resize existing buffer buffer->resizeBuffer(vol_face.mNumVertices, vol_face.mNumIndices); } @@ -1498,9 +1503,9 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer m = m.inverse().transpose(); F32 mat3[] = - { m.m[0], m.m[1], m.m[2], - m.m[4], m.m[5], m.m[6], - m.m[8], m.m[9], m.m[10] }; + { m.m[0], m.m[1], m.m[2], + m.m[4], m.m[5], m.m[6], + m.m[8], m.m[9], m.m[10] }; LLMatrix3 mat_normal(mat3); @@ -1527,14 +1532,98 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer { face->clearState(LLFace::TEXTURE_ANIM); } - - face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true); buffer->flush(); } -void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face) +// static +void LLDrawPoolAvatar::initSkinningMatrixPalette( + LLMatrix4* mat, + S32 count, + const LLMeshSkinInfo* skin, + LLVOAvatar *avatar) +{ + for (U32 j = 0; j < count; ++j) + { + LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); + if (!joint) + { + joint = avatar->getJoint("mPelvis"); + } + if (joint) + { + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } + } +} + +// static +void LLDrawPoolAvatar::getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat) +{ + final_mat.clear(); + + S32 idx[4]; + + LLVector4 wght; + + F32 scale = 0.f; + for (U32 k = 0; k < 4; k++) + { + F32 w = weights[k]; + + idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)LL_MAX_JOINTS_PER_MESH_OBJECT-1); + + wght[k] = w - floorf(w); + scale += wght[k]; + } + if (handle_bad_scale && scale <= 0.f) + { + wght = LLVector4(1.0f, 0.0f, 0.0f, 0.0f); + } + else + { + // This is enforced in unpackVolumeFaces() + llassert(scale>0.f); + wght *= 1.f/scale; + } + + for (U32 k = 0; k < 4; k++) + { + F32 w = wght[k]; + + LLMatrix4a src; + src.setMul(mat[idx[k]], w); + + final_mat.add(src); + } +} + +bool operator==(const LLMatrix4a& a, const LLMatrix4a& b) +{ + for (S32 i=0; i<4; i++) + for (S32 j=0; j<4; j++) + { + if (a.mMatrix[i][j] != b.mMatrix[i][j]) + { + return false; + } + } + return true; +} + +bool operator!=(const LLMatrix4a& a, const LLMatrix4a& b) +{ + return !(a==b); +} + +void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( + LLVOAvatar* avatar, + LLFace* face, + const LLMeshSkinInfo* skin, + LLVolume* volume, + const LLVolumeFace& vol_face) { LLVector4a* weight = vol_face.mWeights; if (!weight) @@ -1597,23 +1686,10 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; //build matrix palette - LLMatrix4a mp[JOINT_COUNT]; - LLMatrix4* mat = (LLMatrix4*) mp; + LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; + U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); - U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); - for (U32 j = 0; j < count; ++j) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); - if (!joint) - { - joint = avatar->getJoint("mPelvis"); - } - if (joint) - { - mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } + initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); @@ -1621,36 +1697,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; - final_mat.clear(); - - S32 idx[4]; - - LLVector4 wght; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j][k]; - - idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)JOINT_COUNT-1); - - wght[k] = w - floorf(w); - scale += wght[k]; - } - // This is enforced in unpackVolumeFaces() - llassert(scale>0.f); - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32 w = wght[k]; - - LLMatrix4a src; - src.setMul(mp[idx[k]], w); - - final_mat.add(src); - } - + LLMatrix4a final_mat2; + getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; @@ -1730,30 +1778,17 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (buff) { if (sShaderLevel > 0) - { //upload matrix palette to shader - LLMatrix4 mat[JOINT_COUNT]; - - U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); + { + // upload matrix palette to shader + LLMatrix4 mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; + U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + initSkinningMatrixPalette(mat, count, skin, avatar); - for (U32 i = 0; i < count; ++i) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[i]); - if (!joint) - { - joint = avatar->getJoint("mPelvis"); - } - if (joint) - { - mat[i] = skin->mInvBindMatrix[i]; - mat[i] *= joint->getWorldMatrix(); - } - } - stop_glerror(); - F32 mp[JOINT_COUNT*9]; + F32 mp[LL_MAX_JOINTS_PER_MESH_OBJECT*9]; - F32 transp[JOINT_COUNT*3]; + F32 transp[LL_MAX_JOINTS_PER_MESH_OBJECT*3]; for (U32 i = 0; i < count; ++i) { diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index b9d2204052..af063ee74e 100755 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -134,6 +134,8 @@ public: void endDeferredRiggedBump(); void getRiggedGeometry(LLFace* face, LLPointer& buffer, U32 data_mask, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face); + static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); + static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat); void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* facep, const LLMeshSkinInfo* skin, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 851e2d2eb7..7e5d3a9f29 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5026,6 +5026,7 @@ void LLModelPreview::addEmptyFace( LLModel* pTarget ) pTarget->setVolumeFaceData( faceCnt+1, pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices() ); } + //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- @@ -5571,50 +5572,19 @@ BOOL LLModelPreview::render() //quick 'n dirty software vertex skinning //build matrix palette - - LLMatrix4 mat[64]; - for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j) - { - LLJoint* joint = getPreviewAvatar()->getJoint(model->mSkinInfo.mJointNames[j]); - if (joint) - { - mat[j] = model->mSkinInfo.mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } + + LLMatrix4 mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; + U32 count = llmin((U32) model->mSkinInfo.mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + LLDrawPoolAvatar::initSkinningMatrixPalette(mat, count, &model->mSkinInfo, getPreviewAvatar()); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { - LLMatrix4 final_mat; - final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f; - - LLVector4 wght; - S32 idx[4]; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j].mV[k]; + LLMatrix4a final_mata; + LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].mV, (LLMatrix4a*)mat, true, final_mata); - idx[k] = (S32) floorf(w); - wght.mV[k] = w - floorf(w); - scale += wght.mV[k]; - } - - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32* src = (F32*) mat[idx[k]].mMatrix; - F32* dst = (F32*) final_mat.mMatrix; - - F32 w = wght.mV[k]; - - for (U32 l = 0; l < 16; l++) - { - dst[l] += src[l]*w; - } - } + // BENTO GROSS KLUDGERY + LLMatrix4 final_mat; + memcpy(&final_mat,&final_mata,sizeof(LLMatrix4a)); //VECTORIZE THIS LLVector3 v(face.mPositions[j].getF32ptr()); @@ -5792,7 +5762,14 @@ void LLFloaterModelPreview::refresh() } //static -void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ) +void LLModelPreview::textureLoadedCallback( + BOOL success, + LLViewerFetchedTexture *src_vi, + LLImageRaw* src, + LLImageRaw* src_aux, + S32 discard_level, + BOOL final, + void* userdata ) { LLModelPreview* preview = (LLModelPreview*) userdata; preview->refresh(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index eefe452c14..5e010a4712 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4164,27 +4164,11 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons //build matrix palette // BENTO JOINT COUNT LIMIT - static const size_t kMaxJoints = 152; + static const size_t kMaxJoints = LL_MAX_JOINTS_PER_MESH_OBJECT; - LLMatrix4a mp[kMaxJoints]; - LLMatrix4* mat = (LLMatrix4*) mp; - + LLMatrix4a mat[kMaxJoints]; U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints); - for (U32 j = 0; j < maxJoints; ++j) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); - if (!joint) - { - // Fall back to a point inside the avatar if mesh is - // rigged to an unknown joint. - joint = avatar->getJoint("mPelvis"); - } - if (joint) - { - mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } + LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, maxJoints, skin, avatar); for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { @@ -4208,37 +4192,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons for (U32 j = 0; j < dst_face.mNumVertices; ++j) { LLMatrix4a final_mat; - final_mat.clear(); - - S32 idx[4]; - - LLVector4 wght; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j][k]; - - idx[k] = (S32) floorf(w); - wght[k] = w - floorf(w); - scale += wght[k]; - } - // This is enforced in unpackVolumeFaces() - llassert(scale>0.f); - wght *= 1.f / scale; - - for (U32 k = 0; k < 4; k++) - { - F32 w = wght[k]; - - LLMatrix4a src; - // Insure ref'd bone is in our clamped array of mats - // clamp idx to maxJoints to avoid reading garbage off stack in release - S32 index = llclamp((S32)idx[k],(S32)0,(S32)kMaxJoints-1); - src.setMul(mp[index], w); - final_mat.add(src); - } - + LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; -- cgit v1.2.3 From 924e4292e7a2a11ef01a5703e52116037180aa06 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 24 Sep 2015 13:29:57 -0400 Subject: SL-227 WIP - trimmed unused code. --- indra/newview/lldrawpoolavatar.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 7ccc779ba4..76c89865a5 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1600,24 +1600,6 @@ void LLDrawPoolAvatar::getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, boo } } -bool operator==(const LLMatrix4a& a, const LLMatrix4a& b) -{ - for (S32 i=0; i<4; i++) - for (S32 j=0; j<4; j++) - { - if (a.mMatrix[i][j] != b.mMatrix[i][j]) - { - return false; - } - } - return true; -} - -bool operator!=(const LLMatrix4a& a, const LLMatrix4a& b) -{ - return !(a==b); -} - void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( LLVOAvatar* avatar, LLFace* face, @@ -1697,7 +1679,6 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; - LLMatrix4a final_mat2; getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat); LLVector4a& v = vol_face.mPositions[j]; -- cgit v1.2.3 From 5460c0f4c80660f93723a80d464c0a5ebd97921a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 28 Sep 2015 11:53:01 -0400 Subject: SL-227 WIP - standardize usage of shared skinning code and handle additional error case in weights. --- indra/newview/lldrawpoolavatar.cpp | 23 +++++++++++++++++++---- indra/newview/llfloatermodelpreview.cpp | 32 ++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 76c89865a5..b3821fda85 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1544,6 +1544,8 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( const LLMeshSkinInfo* skin, LLVOAvatar *avatar) { + // BENTO - switching to use Matrix4a and SSE might speed this up. + // Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted. for (U32 j = 0; j < count; ++j) { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); @@ -1557,6 +1559,14 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( mat[j] *= joint->getWorldMatrix(); } } + // This handles a bogus weights case that has turned up in + // practice, without the overhead of zeroing every matrix. We are + // doing this here instead of in getPerVertexSkinMatrix so the fix + // will also work in the HW skinning case. + if (count < LL_MAX_JOINTS_PER_MESH_OBJECT) + { + mat[count].setIdentity(); + } } // static @@ -1573,6 +1583,12 @@ void LLDrawPoolAvatar::getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, boo { F32 w = weights[k]; + // BENTO potential optimizations + // - Do clamping in unpackVolumeFaces() (once instead of every time) + // - int vs floor: if we know w is + // >= 0.0, we can use int instead of floorf; the latter + // allegedly has a lot of overhead due to ieeefp error + // checking which we should not need. idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)LL_MAX_JOINTS_PER_MESH_OBJECT-1); wght[k] = w - floorf(w); @@ -1670,7 +1686,6 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( //build matrix palette LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); - initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); LLMatrix4a bind_shape_matrix; @@ -1761,9 +1776,9 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (sShaderLevel > 0) { // upload matrix palette to shader - LLMatrix4 mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; + LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); - initSkinningMatrixPalette(mat, count, skin, avatar); + initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); stop_glerror(); @@ -1773,7 +1788,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) for (U32 i = 0; i < count; ++i) { - F32* m = (F32*) mat[i].mMatrix; + F32* m = (F32*) mat[i].mMatrix[0].getF32ptr(); U32 idx = i*9; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 7e5d3a9f29..0736f1eac4 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5573,26 +5573,30 @@ BOOL LLModelPreview::render() //build matrix palette - LLMatrix4 mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - U32 count = llmin((U32) model->mSkinInfo.mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); - LLDrawPoolAvatar::initSkinningMatrixPalette(mat, count, &model->mSkinInfo, getPreviewAvatar()); - + LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; + const LLMeshSkinInfo *skin = &model->mSkinInfo; + U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, count, + skin, getPreviewAvatar()); + LLMatrix4a bind_shape_matrix; + bind_shape_matrix.loadu(skin->mBindShapeMatrix); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { - LLMatrix4a final_mata; - LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].mV, (LLMatrix4a*)mat, true, final_mata); - - // BENTO GROSS KLUDGERY - LLMatrix4 final_mat; - memcpy(&final_mat,&final_mata,sizeof(LLMatrix4a)); + LLMatrix4a final_mat; + F32 *wptr = weight[j].mV; + LLDrawPoolAvatar::getPerVertexSkinMatrix(wptr, mat, true, final_mat); //VECTORIZE THIS - LLVector3 v(face.mPositions[j].getF32ptr()); + LLVector4a& v = face.mPositions[j]; - v = v * model->mSkinInfo.mBindShapeMatrix; - v = v * final_mat; + LLVector4a t; + LLVector4a dst; + bind_shape_matrix.affineTransform(v, t); + final_mat.affineTransform(t, dst); - position[j] = v; + position[j][0] = dst[0]; + position[j][1] = dst[1]; + position[j][2] = dst[2]; } llassert(model->mMaterialList.size() > i); -- cgit v1.2.3 From ebad0c6868b924ba607a1b2256ae7621cab62bf4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 1 Oct 2015 11:05:29 -0400 Subject: DRTVWR-412 WIP - more work for importer merge from viewer-release --- indra/newview/llfloatermodelpreview.cpp | 25 +++++++++++++++++++++++++ indra/newview/llfloatermodelpreview.h | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a64685f699..18a2729398 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -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; igetName()); + } + } +} + 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) diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 7a518c798b..25c650a725 100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -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 mPreviewAvatar; -- cgit v1.2.3 From 34e48fb2f28d8ca5ea8c42b1474135c1971bdf15 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Mon, 5 Oct 2015 15:11:06 -0700 Subject: SL-225: test with joints per mesh set to 72 --- .../app_settings/shaders/class1/avatar/objectSkinV.glsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index b342abb7c1..e58b19c0d0 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -27,8 +27,8 @@ ATTRIBUTE vec4 weight4; /* BENTO JOINT COUNT LIMITS * Note that the value in these two lines also needs to be updated to value-1 several places below. */ -uniform mat3 matrixPalette[152]; -uniform vec3 translationPalette[152]; +uniform mat3 matrixPalette[72]; +uniform vec3 translationPalette[72]; mat4 getObjectSkinnedTransform() { @@ -37,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(151.0)); + index = min(index, vec4(71.0)); index = max(index, vec4( 0.0)); w *= 1.0/(w.x+w.y+w.z+w.w); @@ -70,8 +70,8 @@ mat4 getObjectSkinnedTransform() // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. mat3 dummy1 = matrixPalette[0]; vec3 dummy2 = translationPalette[0]; - mat3 dummy3 = matrixPalette[151]; - vec3 dummy4 = translationPalette[151]; + mat3 dummy3 = matrixPalette[71]; + vec3 dummy4 = translationPalette[71]; #endif } -- cgit v1.2.3 From 3cc99a66e47f04e431f1431127c83e72edcea4ef Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Tue, 6 Oct 2015 07:20:56 -0700 Subject: SL-225: test with joints per mesh set to 92 --- .../app_settings/shaders/class1/avatar/objectSkinV.glsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index e58b19c0d0..c6fcc51395 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -27,8 +27,8 @@ ATTRIBUTE vec4 weight4; /* BENTO JOINT COUNT LIMITS * Note that the value in these two lines also needs to be updated to value-1 several places below. */ -uniform mat3 matrixPalette[72]; -uniform vec3 translationPalette[72]; +uniform mat3 matrixPalette[92]; +uniform vec3 translationPalette[92]; mat4 getObjectSkinnedTransform() { @@ -37,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(71.0)); + index = min(index, vec4(91.0)); index = max(index, vec4( 0.0)); w *= 1.0/(w.x+w.y+w.z+w.w); @@ -70,8 +70,8 @@ mat4 getObjectSkinnedTransform() // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. mat3 dummy1 = matrixPalette[0]; vec3 dummy2 = translationPalette[0]; - mat3 dummy3 = matrixPalette[71]; - vec3 dummy4 = translationPalette[71]; + mat3 dummy3 = matrixPalette[91]; + vec3 dummy4 = translationPalette[91]; #endif } -- cgit v1.2.3 From 389a0a8e39a04c413664802bb4471fe588790033 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Tue, 6 Oct 2015 12:51:36 -0700 Subject: SL-225: test with joints per mesh set to 112 --- .../app_settings/shaders/class1/avatar/objectSkinV.glsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index c6fcc51395..3d0b574234 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -27,8 +27,8 @@ ATTRIBUTE vec4 weight4; /* BENTO JOINT COUNT LIMITS * Note that the value in these two lines also needs to be updated to value-1 several places below. */ -uniform mat3 matrixPalette[92]; -uniform vec3 translationPalette[92]; +uniform mat3 matrixPalette[112]; +uniform vec3 translationPalette[112]; mat4 getObjectSkinnedTransform() { @@ -37,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(91.0)); + index = min(index, vec4(111.0)); index = max(index, vec4( 0.0)); w *= 1.0/(w.x+w.y+w.z+w.w); @@ -70,8 +70,8 @@ mat4 getObjectSkinnedTransform() // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. mat3 dummy1 = matrixPalette[0]; vec3 dummy2 = translationPalette[0]; - mat3 dummy3 = matrixPalette[91]; - vec3 dummy4 = translationPalette[91]; + mat3 dummy3 = matrixPalette[111]; + vec3 dummy4 = translationPalette[111]; #endif } -- cgit v1.2.3 From eebafb37dbb5f6d59459b68f9e88b476dc93b27a Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Tue, 6 Oct 2015 14:58:32 -0700 Subject: SL-225: test with joints per mesh set to 132 --- indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 3d0b574234..67d26c34a4 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -27,8 +27,8 @@ ATTRIBUTE vec4 weight4; /* BENTO JOINT COUNT LIMITS * Note that the value in these two lines also needs to be updated to value-1 several places below. */ -uniform mat3 matrixPalette[112]; -uniform vec3 translationPalette[112]; +uniform mat3 matrixPalette[132]; +uniform vec3 translationPalette[132]; mat4 getObjectSkinnedTransform() { @@ -37,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(111.0)); + index = min(index, vec4(131.0)); index = max(index, vec4( 0.0)); w *= 1.0/(w.x+w.y+w.z+w.w); -- cgit v1.2.3 From 74b8a487646cccb3260d02910ab5b16e274ec9ab Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Oct 2015 15:38:40 -0400 Subject: SL-234 WIP - adjust max mesh object joints at run-time, including rebuilding shaders --- indra/newview/app_settings/settings.xml | 11 +++++ .../shaders/class1/avatar/objectSkinV.glsl | 10 ++--- indra/newview/lldrawpoolavatar.cpp | 49 +++++++++++++++++++--- indra/newview/lldrawpoolavatar.h | 4 +- indra/newview/llfloatermodelpreview.cpp | 5 ++- indra/newview/llviewercontrol.cpp | 1 + indra/newview/llviewershadermgr.cpp | 8 +++- indra/newview/llvovolume.cpp | 5 ++- 8 files changed, 77 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6533344048..dcb2764fe7 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6112,6 +6112,17 @@ Value 1.6 + MaxJointsPerMeshObject + + Comment + Maximum joints per rigged mesh object + Persist + 1 + Type + U32 + Value + 999 + MaxPersistentNotifications Comment diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index b342abb7c1..8f754fe82b 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -27,8 +27,8 @@ ATTRIBUTE vec4 weight4; /* BENTO JOINT COUNT LIMITS * Note that the value in these two lines also needs to be updated to value-1 several places below. */ -uniform mat3 matrixPalette[152]; -uniform vec3 translationPalette[152]; +uniform mat3 matrixPalette[MAX_JOINTS_PER_MESH_OBJECT]; +uniform vec3 translationPalette[MAX_JOINTS_PER_MESH_OBJECT]; mat4 getObjectSkinnedTransform() { @@ -37,7 +37,7 @@ mat4 getObjectSkinnedTransform() vec4 w = fract(weight4); vec4 index = floor(weight4); - index = min(index, vec4(151.0)); + index = min(index, vec4(MAX_JOINTS_PER_MESH_OBJECT-1)); index = max(index, vec4( 0.0)); w *= 1.0/(w.x+w.y+w.z+w.w); @@ -70,8 +70,8 @@ mat4 getObjectSkinnedTransform() // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. mat3 dummy1 = matrixPalette[0]; vec3 dummy2 = translationPalette[0]; - mat3 dummy3 = matrixPalette[151]; - vec3 dummy4 = translationPalette[151]; + mat3 dummy3 = matrixPalette[MAX_JOINTS_PER_MESH_OBJECT-1]; + vec3 dummy4 = translationPalette[MAX_JOINTS_PER_MESH_OBJECT-1]; #endif } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index b3821fda85..5d78132f6d 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1537,6 +1537,18 @@ void LLDrawPoolAvatar::getRiggedGeometry( buffer->flush(); } +// static +U32 LLDrawPoolAvatar::getMaxJointCount() +{ + return llmin(LL_MAX_JOINTS_PER_MESH_OBJECT, gSavedSettings.getU32("MaxJointsPerMeshObject")); +} + +// static +U32 LLDrawPoolAvatar::getMeshJointCount(const LLMeshSkinInfo *skin) +{ + return llmin(getMaxJointCount(), skin->mJointNames.size()); +} + // static void LLDrawPoolAvatar::initSkinningMatrixPalette( LLMatrix4* mat, @@ -1555,6 +1567,26 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( } if (joint) { +#if 0 + // BENTO HACK - test of simple push-to-ancestor complexity reduction scheme. + const std::string& name = joint->getName(); + S32 digit = name.back()-'0'; + while (joint->getParent() && (digit<=9) && (digit>=5)) + { + joint = joint->getParent(); + const std::string& name = joint->getName(); + digit = name.back()-'0'; + } + U32 j_remap = 0; + std::vector::const_iterator find_it = + std::find(skin->mJointNames.begin(), skin->mJointNames.end(), joint->getName()); + if (find_it != skin->mJointNames.end()) + { + j_remap = find_it - skin->mJointNames.begin(); + } + // BENTO for hack, use invBindMatrix of up-casted joint + mat[j] = skin->mInvBindMatrix[j_remap]; +#endif mat[j] = skin->mInvBindMatrix[j]; mat[j] *= joint->getWorldMatrix(); } @@ -1570,8 +1602,14 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( } // static -void LLDrawPoolAvatar::getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat) +void LLDrawPoolAvatar::getPerVertexSkinMatrix( + F32* weights, + LLMatrix4a* mat, + bool handle_bad_scale, + LLMatrix4a& final_mat, + U32 max_joints) { + final_mat.clear(); S32 idx[4]; @@ -1589,7 +1627,7 @@ void LLDrawPoolAvatar::getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, boo // >= 0.0, we can use int instead of floorf; the latter // allegedly has a lot of overhead due to ieeefp error // checking which we should not need. - idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)LL_MAX_JOINTS_PER_MESH_OBJECT-1); + idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)max_joints-1); wght[k] = w - floorf(w); scale += wght[k]; @@ -1685,16 +1723,17 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( //build matrix palette LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + U32 count = getMeshJointCount(skin); initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); + const U32 max_joints = getMaxJointCount(); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; - getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat); + getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; @@ -1777,7 +1816,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) { // upload matrix palette to shader LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + U32 count = getMeshJointCount(skin); initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); stop_glerror(); diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index af063ee74e..79d16c26bc 100755 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -134,8 +134,10 @@ public: void endDeferredRiggedBump(); void getRiggedGeometry(LLFace* face, LLPointer& buffer, U32 data_mask, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face); + static U32 getMaxJointCount(); + static U32 getMeshJointCount(const LLMeshSkinInfo *skin); static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); - static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat); + static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints); void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* facep, const LLMeshSkinInfo* skin, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 18a2729398..4267d6371e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4028,16 +4028,17 @@ BOOL LLModelPreview::render() LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; const LLMeshSkinInfo *skin = &model->mSkinInfo; - U32 count = llmin((U32) skin->mJointNames.size(), (U32) LL_MAX_JOINTS_PER_MESH_OBJECT); + U32 count = LLDrawPoolAvatar::getMeshJointCount(skin); LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, getPreviewAvatar()); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); + U32 max_joints = LLDrawPoolAvatar::getMaxJointCount(); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; F32 *wptr = weight[j].mV; - LLDrawPoolAvatar::getPerVertexSkinMatrix(wptr, mat, true, final_mat); + LLDrawPoolAvatar::getPerVertexSkinMatrix(wptr, mat, true, final_mat, max_joints); //VECTORIZE THIS LLVector4a& v = face.mPositions[j]; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 5020518454..466edb19b2 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -761,6 +761,7 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); + gSavedSettings.getControl("MaxJointsPerMeshObject")->getCommitSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index dafe2cafec..b1e521f193 100755 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -27,6 +27,8 @@ #include "llviewerprecompiledheaders.h" +#include + #include "llfeaturemanager.h" #include "llviewershadermgr.h" @@ -41,6 +43,8 @@ #include "llsky.h" #include "llvosky.h" #include "llrender.h" +#include "lljoint.h" +#include "lldrawpoolavatar.h" #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") @@ -871,7 +875,9 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) ); boost::unordered_map attribs; - + attribs["MAX_JOINTS_PER_MESH_OBJECT"] = + boost::lexical_cast(LLDrawPoolAvatar::getMaxJointCount()); + // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now. for (U32 i = 0; i < shaders.size(); i++) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5e010a4712..dde0e2caa1 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4167,7 +4167,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons static const size_t kMaxJoints = LL_MAX_JOINTS_PER_MESH_OBJECT; LLMatrix4a mat[kMaxJoints]; - U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints); + U32 maxJoints = LLDrawPoolAvatar::getMeshJointCount(skin); LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, maxJoints, skin, avatar); for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) @@ -4189,10 +4189,11 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons { LL_RECORD_BLOCK_TIME(FTM_SKIN_RIGGED); + U32 max_joints = LLDrawPoolAvatar::getMaxJointCount(); for (U32 j = 0; j < dst_face.mNumVertices; ++j) { LLMatrix4a final_mat; - LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat); + LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; -- cgit v1.2.3 From 5b58bfb937f7f996c7f1b97f15b1c837aa23a463 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Oct 2015 18:50:33 -0400 Subject: SL-234 WIP - mac build fix --- indra/newview/lldrawpoolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 5d78132f6d..e8f53e0f3d 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1546,7 +1546,7 @@ U32 LLDrawPoolAvatar::getMaxJointCount() // static U32 LLDrawPoolAvatar::getMeshJointCount(const LLMeshSkinInfo *skin) { - return llmin(getMaxJointCount(), skin->mJointNames.size()); + return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size()); } // static -- cgit v1.2.3 From 58992e2cb4ae2787b85cff63c3ed680cd99fa8ce Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 16 Oct 2015 15:05:29 -0400 Subject: SL-234 WIP - Track which joints are part of base skeleton, remap non-base ones when not being rendered. --- indra/newview/app_settings/settings.xml | 11 + .../character/avatar_skeleton_tentacles.xml | 307 ++++++++++----------- indra/newview/lldrawpoolavatar.cpp | 201 ++++++++++++-- indra/newview/lldrawpoolavatar.h | 1 + 4 files changed, 350 insertions(+), 170 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 133e51b531..8bf91c0f1e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3492,6 +3492,17 @@ Value 0 + IncludeEnhancedSkeleton + + Comment + Include extended skeleton joints when rendering skinned meshes. + Persist + 1 + Type + Boolean + Value + 1 + MinObjectsForUnlinkConfirm Comment diff --git a/indra/newview/character/avatar_skeleton_tentacles.xml b/indra/newview/character/avatar_skeleton_tentacles.xml index 9863a5cbfd..929feaf25c 100644 --- a/indra/newview/character/avatar_skeleton_tentacles.xml +++ b/indra/newview/character/avatar_skeleton_tentacles.xml @@ -1,64 +1,63 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + @@ -69,16 +68,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -89,16 +88,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -109,16 +108,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -129,16 +128,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -149,16 +148,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -169,16 +168,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -189,16 +188,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -209,16 +208,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -229,16 +228,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -251,27 +250,27 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index e8f53e0f3d..987a15c72d 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1549,6 +1549,156 @@ U32 LLDrawPoolAvatar::getMeshJointCount(const LLMeshSkinInfo *skin) return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size()); } +bool getNameIndex(const std::string& name, std::vector& names, U32& result) +{ + std::vector::const_iterator find_it = + std::find(names.begin(), names.end(), name); + if (find_it != names.end()) + { + result = find_it - names.begin(); + return true; + } + else + { + return false; + } +} + +// Find a name table index that is also a valid joint on the +// avatar. Order of preference is: requested name, mPelvis, first +// valid match in names table. +U32 getValidJointIndex(const std::string& name, LLVOAvatar *avatar, std::vector& joint_names) +{ + U32 result; + if (avatar->getJoint(name) && getNameIndex(name,joint_names,result)) + { + return result; + } + if (getNameIndex("mPelvis",joint_names,result)) + { + return result; + } + for (U32 j=0; jgetJoint(joint_names[j])) + { + return j; + } + } + // BENTO how to handle? + LL_ERRS() << "no valid joints in joint_names" << LL_ENDL; + return 0; +} + +// Which joint will stand in for this joint? +U32 getProxyJointIndex(U32 joint_index, LLVOAvatar *avatar, std::vector& joint_names) +{ +#if 1 + bool include_enhanced = gSavedSettings.getBOOL("IncludeEnhancedSkeleton"); + U32 j_proxy = getValidJointIndex(joint_names[joint_index], avatar, joint_names); + LLJoint *joint = avatar->getJoint(joint_names[j_proxy]); + llassert(joint); + // BENTO - test of simple push-to-base-ancestor + // complexity reduction scheme. Find the first + // ancestor that's not flagged as extended, or the + // last ancestor that's rigged in this mesh, whichever + // comes first. + while (1) + { + if (include_enhanced || + joint->getSupport()==LLJoint::SUPPORT_BASE) + break; + LLJoint *parent = joint->getParent(); + if (!parent) + break; + if (!getNameIndex(parent->getName(), joint_names, j_proxy)) + { + break; + } + joint = parent; + } + return j_proxy; +#else + return 0; +#endif +} + +// static + +// Destructively remap the joints in skin info based on what joints +// are known in the avatar, and which are currently supported. This +// will also populate mJointRemap[] in the skin, which can be used to +// make the corresponding changes to the integer part of vertex +// weights. +// +// This will throw away joint info for any joints that are not known +// in the avatar, or not currently flagged to support based on the +// debug setting for IncludeEnhancedSkeleton. +void LLDrawPoolAvatar::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin) +{ + // skip if already done. + if (!skin->mJointRemap.empty()) + { + return; + } + + // Compute the remap + std::vector j_proxy(skin->mJointNames.size()); + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + U32 j_rep = getProxyJointIndex(j, avatar, skin->mJointNames); + j_proxy[j] = j_rep; + } + S32 top = 0; + std::vector j_remap(skin->mJointNames.size()); + // Fill in j_remap for all joints that will make the cut. + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] == j) + { + // Joint will be included + j_remap[j] = top++; + } + } + // Then use j_proxy to fill in j_remap for the joints that will be discarded + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] != j) + { + j_remap[j] = j_remap[j_proxy[j]]; + } + } + + + // Apply the remap to mJointNames, mInvBindMatrix, and mAlternateBindMatrix + std::vector new_joint_names; + std::vector new_inv_bind_matrix; + std::vector new_alternate_bind_matrix; + + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] == j) + { + new_joint_names.push_back(skin->mJointNames[j]); + new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]); + if (!skin->mAlternateBindMatrix.empty()) + { + new_alternate_bind_matrix.push_back(skin->mAlternateBindMatrix[j]); + } + } + } + + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + LL_INFOS() << "Starting joint[" << j << "] = " << skin->mJointNames[j] << " j_remap " << j_remap[j] << " ==> " << new_joint_names[j_remap[j]] << LL_ENDL; + } + + //skin->mJointNames = new_joint_names; + //skin->mInvBindMatrix = new_inv_bind_matrix; + //skin->mAlternateBindMatrix = new_alternate_bind_matrix; + skin->mJointRemap = j_remap; +} + // static void LLDrawPoolAvatar::initSkinningMatrixPalette( LLMatrix4* mat, @@ -1556,38 +1706,57 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( const LLMeshSkinInfo* skin, LLVOAvatar *avatar) { + // BENTO ugly const cast + remapSkinInfoJoints(avatar, const_cast(skin)); + // BENTO - switching to use Matrix4a and SSE might speed this up. // Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted. for (U32 j = 0; j < count; ++j) { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); +#if 1 // Don't need this stuff if we've already remapped/cleaned up above if (!joint) { joint = avatar->getJoint("mPelvis"); } if (joint) { -#if 0 - // BENTO HACK - test of simple push-to-ancestor complexity reduction scheme. - const std::string& name = joint->getName(); - S32 digit = name.back()-'0'; - while (joint->getParent() && (digit<=9) && (digit>=5)) + if (!gSavedSettings.getBOOL("IncludeEnhancedSkeleton")) { - joint = joint->getParent(); - const std::string& name = joint->getName(); - digit = name.back()-'0'; + // BENTO - test of simple push-to-base-ancestor + // complexity reduction scheme. Find the first + // ancestor that's not flagged as extended, or the + // last ancestor that's rigged in this mesh, whichever + // comes first. + U32 j_remap = 0; + while (1) + { + if (joint->getSupport()==LLJoint::SUPPORT_BASE) + break; + LLJoint *parent = joint->getParent(); + if (!parent) + break; + std::vector::const_iterator find_it = + std::find(skin->mJointNames.begin(), skin->mJointNames.end(), parent->getName()); + if (find_it != skin->mJointNames.end()) + { + j_remap = find_it - skin->mJointNames.begin(); + } + else + { + break; + } + joint = parent; + } + mat[j] = skin->mInvBindMatrix[j_remap]; } - U32 j_remap = 0; - std::vector::const_iterator find_it = - std::find(skin->mJointNames.begin(), skin->mJointNames.end(), joint->getName()); - if (find_it != skin->mJointNames.end()) + else { - j_remap = find_it - skin->mJointNames.begin(); + mat[j] = skin->mInvBindMatrix[j]; } - // BENTO for hack, use invBindMatrix of up-casted joint - mat[j] = skin->mInvBindMatrix[j_remap]; -#endif +#else mat[j] = skin->mInvBindMatrix[j]; +#endif mat[j] *= joint->getWorldMatrix(); } } diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 79d16c26bc..27d4c949fd 100755 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -136,6 +136,7 @@ public: void getRiggedGeometry(LLFace* face, LLPointer& buffer, U32 data_mask, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face); static U32 getMaxJointCount(); static U32 getMeshJointCount(const LLMeshSkinInfo *skin); + static void remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin); static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints); void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, -- cgit v1.2.3 From 6c6a95478ecd657c271354d93a6f98c90093bac5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 19 Oct 2015 16:32:49 -0400 Subject: SL-234 WIP - remap skin weights to match included-joint logic --- indra/newview/lldrawpoolavatar.cpp | 113 ++++++++++++++++++------------------- indra/newview/lldrawpoolavatar.h | 2 + indra/newview/llvovolume.cpp | 1 + 3 files changed, 59 insertions(+), 57 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 987a15c72d..dff6cada9a 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1593,7 +1593,6 @@ U32 getValidJointIndex(const std::string& name, LLVOAvatar *avatar, std::vector< // Which joint will stand in for this joint? U32 getProxyJointIndex(U32 joint_index, LLVOAvatar *avatar, std::vector& joint_names) { -#if 1 bool include_enhanced = gSavedSettings.getBOOL("IncludeEnhancedSkeleton"); U32 j_proxy = getValidJointIndex(joint_names[joint_index], avatar, joint_names); LLJoint *joint = avatar->getJoint(joint_names[j_proxy]); @@ -1618,9 +1617,6 @@ U32 getProxyJointIndex(U32 joint_index, LLVOAvatar *avatar, std::vector " << new_joint_names[j_remap[j]] << LL_ENDL; } - //skin->mJointNames = new_joint_names; - //skin->mInvBindMatrix = new_inv_bind_matrix; - //skin->mAlternateBindMatrix = new_alternate_bind_matrix; + skin->mJointNames = new_joint_names; + skin->mInvBindMatrix = new_inv_bind_matrix; + skin->mAlternateBindMatrix = new_alternate_bind_matrix; skin->mJointRemap = j_remap; } @@ -1706,67 +1704,59 @@ void LLDrawPoolAvatar::initSkinningMatrixPalette( const LLMeshSkinInfo* skin, LLVOAvatar *avatar) { - // BENTO ugly const cast - remapSkinInfoJoints(avatar, const_cast(skin)); - // BENTO - switching to use Matrix4a and SSE might speed this up. // Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted. for (U32 j = 0; j < count; ++j) { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); -#if 1 // Don't need this stuff if we've already remapped/cleaned up above - if (!joint) + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } +} + +// Transform the weights based on the remap info stored in skin. Note +// that this is destructive and non-idempotent, so we need to keep +// track of whether we've done it already. If the desired remapping +// changes, the viewer must be restarted. +// +// static +void LLDrawPoolAvatar::remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) +{ + llassert(skin->mJointRemap.size()>0); // Must call remapSkinInfoJoints() first, which this checks for. + const U32* remap = &skin->mJointRemap[0]; + const S32 max_joints = skin->mJointNames.size(); + for (U32 j=0; jgetJoint("mPelvis"); + S32 i = llfloor(w[k]); + F32 f = w[k]-i; + i = llclamp(i,0,max_joints-1); + w[k] = remap[i] + f; } - if (joint) + } +} + +// static +void LLDrawPoolAvatar::checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) +{ + if (skin->mJointRemap.size()>0) + { + // Check the weights are consistent with the current remap. + const S32 max_joints = skin->mJointNames.size(); + for (U32 j=0; jgetSupport()==LLJoint::SUPPORT_BASE) - break; - LLJoint *parent = joint->getParent(); - if (!parent) - break; - std::vector::const_iterator find_it = - std::find(skin->mJointNames.begin(), skin->mJointNames.end(), parent->getName()); - if (find_it != skin->mJointNames.end()) - { - j_remap = find_it - skin->mJointNames.begin(); - } - else - { - break; - } - joint = parent; - } - mat[j] = skin->mInvBindMatrix[j_remap]; - } - else + F32 *w = weights[j].getF32ptr(); + + for (U32 k=0; k<4; ++k) { - mat[j] = skin->mInvBindMatrix[j]; + S32 i = llfloor(w[k]); + llassert(i>=0); + llassert(imInvBindMatrix[j]; -#endif - mat[j] *= joint->getWorldMatrix(); - } } - // This handles a bogus weights case that has turned up in - // practice, without the overhead of zeroing every matrix. We are - // doing this here instead of in getPerVertexSkinMatrix so the fix - // will also work in the HW skinning case. - if (count < LL_MAX_JOINTS_PER_MESH_OBJECT) - { - mat[count].setIdentity(); } } @@ -1835,12 +1825,20 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( { return; } + // BENTO ugly const cast + remapSkinInfoJoints(avatar, const_cast(skin)); LLPointer buffer = face->getVertexBuffer(); LLDrawable* drawable = face->getDrawable(); U32 data_mask = face->getRiggedVertexBufferDataMask(); + if (!vol_face.mWeightsRemapped) + { + remapSkinWeights(weight, vol_face.mNumVertices, skin); + vol_face.mWeightsRemapped = TRUE; + } + if (buffer.isNull() || buffer->getTypeMask() != data_mask || buffer->getNumVerts() != vol_face.mNumVertices || @@ -1894,6 +1892,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; U32 count = getMeshJointCount(skin); initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); + checkSkinWeights(weight, buffer->getNumVerts(), skin); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 27d4c949fd..8d6e95ba1a 100755 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -138,6 +138,8 @@ public: static U32 getMeshJointCount(const LLMeshSkinInfo *skin); static void remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin); static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); + static void checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); + static void remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints); void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* facep, diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c09786b7c7..5d8558cb46 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4192,6 +4192,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons if ( weight ) { + LLDrawPoolAvatar::checkSkinWeights(weight, dst_face.mNumVertices, skin); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); -- cgit v1.2.3 From cb0031880d72cde1d129175276391e91ddadae66 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Tue, 20 Oct 2015 09:22:47 -0700 Subject: SL-113: viewer message from simulator on illegal attachment point --- indra/newview/skins/default/xui/en/notifications.xml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f847c73287..30e7caad76 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10258,6 +10258,14 @@ Not enough script resources available to attach object! Cannot attach object because it is already being removed. + + fail + The attachment point specified is not valid and the item has been attached to the default location: chest. + + Date: Wed, 21 Oct 2015 16:47:03 -0400 Subject: SL-234 WIP - moved LLSkinningUtil funcs to separate class/files. Remap weights where needed. Warn that related debug settings require restart to take effect. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llappviewer.cpp | 4 + indra/newview/lldrawpoolavatar.cpp | 295 +----------------- indra/newview/lldrawpoolavatar.h | 7 - indra/newview/llfloatermodelpreview.cpp | 10 +- indra/newview/llskinningutil.cpp | 329 +++++++++++++++++++++ indra/newview/llskinningutil.h | 51 ++++ indra/newview/llviewercontrol.cpp | 10 +- indra/newview/llviewershadermgr.cpp | 4 +- indra/newview/llvovolume.cpp | 11 +- .../newview/skins/default/xui/en/notifications.xml | 7 + 11 files changed, 425 insertions(+), 305 deletions(-) create mode 100644 indra/newview/llskinningutil.cpp create mode 100644 indra/newview/llskinningutil.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 16877c345e..4ba81047f5 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -541,6 +541,7 @@ set(viewer_SOURCE_FILES llsidepaneliteminfo.cpp llsidepaneltaskinfo.cpp llsidetraypanelcontainer.cpp + llskinningutil.cpp llsky.cpp llslurl.cpp llsnapshotlivepreview.cpp @@ -1147,6 +1148,7 @@ set(viewer_HEADER_FILES llsidepaneliteminfo.h llsidepaneltaskinfo.h llsidetraypanelcontainer.h + llskinningutil.h llsky.h llslurl.h llsnapshotlivepreview.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fbf2a04bcc..04758ef839 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -101,6 +101,7 @@ #include "llscenemonitor.h" #include "llavatarrenderinfoaccountant.h" #include "lllocalbitmaps.h" +#include "llskinningutil.h" // Linden library includes #include "llavatarnamecache.h" @@ -794,6 +795,9 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; + // initialize skinning util + LLSkinningUtil::initClass(); + //set the max heap size. initMaxHeapSize() ; LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize")); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index dff6cada9a..89233b8e32 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "lldrawpoolavatar.h" +#include "llskinningutil.h" #include "llrender.h" #include "llvoavatar.h" @@ -1537,282 +1538,6 @@ void LLDrawPoolAvatar::getRiggedGeometry( buffer->flush(); } -// static -U32 LLDrawPoolAvatar::getMaxJointCount() -{ - return llmin(LL_MAX_JOINTS_PER_MESH_OBJECT, gSavedSettings.getU32("MaxJointsPerMeshObject")); -} - -// static -U32 LLDrawPoolAvatar::getMeshJointCount(const LLMeshSkinInfo *skin) -{ - return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size()); -} - -bool getNameIndex(const std::string& name, std::vector& names, U32& result) -{ - std::vector::const_iterator find_it = - std::find(names.begin(), names.end(), name); - if (find_it != names.end()) - { - result = find_it - names.begin(); - return true; - } - else - { - return false; - } -} - -// Find a name table index that is also a valid joint on the -// avatar. Order of preference is: requested name, mPelvis, first -// valid match in names table. -U32 getValidJointIndex(const std::string& name, LLVOAvatar *avatar, std::vector& joint_names) -{ - U32 result; - if (avatar->getJoint(name) && getNameIndex(name,joint_names,result)) - { - return result; - } - if (getNameIndex("mPelvis",joint_names,result)) - { - return result; - } - for (U32 j=0; jgetJoint(joint_names[j])) - { - return j; - } - } - // BENTO how to handle? - LL_ERRS() << "no valid joints in joint_names" << LL_ENDL; - return 0; -} - -// Which joint will stand in for this joint? -U32 getProxyJointIndex(U32 joint_index, LLVOAvatar *avatar, std::vector& joint_names) -{ - bool include_enhanced = gSavedSettings.getBOOL("IncludeEnhancedSkeleton"); - U32 j_proxy = getValidJointIndex(joint_names[joint_index], avatar, joint_names); - LLJoint *joint = avatar->getJoint(joint_names[j_proxy]); - llassert(joint); - // BENTO - test of simple push-to-base-ancestor - // complexity reduction scheme. Find the first - // ancestor that's not flagged as extended, or the - // last ancestor that's rigged in this mesh, whichever - // comes first. - while (1) - { - if (include_enhanced || - joint->getSupport()==LLJoint::SUPPORT_BASE) - break; - LLJoint *parent = joint->getParent(); - if (!parent) - break; - if (!getNameIndex(parent->getName(), joint_names, j_proxy)) - { - break; - } - joint = parent; - } - return j_proxy; -} - -// static - -// Destructively remap the joints in skin info based on what joints -// are known in the avatar, and which are currently supported. This -// will also populate mJointRemap[] in the skin, which can be used to -// make the corresponding changes to the integer part of vertex -// weights. -// -// This will throw away joint info for any joints that are not known -// in the avatar, or not currently flagged to support based on the -// debug setting for IncludeEnhancedSkeleton. -// -// static -void LLDrawPoolAvatar::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin) -{ - // skip if already done. - if (!skin->mJointRemap.empty()) - { - return; - } - - // Compute the remap - std::vector j_proxy(skin->mJointNames.size()); - for (U32 j = 0; j < skin->mJointNames.size(); ++j) - { - U32 j_rep = getProxyJointIndex(j, avatar, skin->mJointNames); - j_proxy[j] = j_rep; - } - S32 top = 0; - std::vector j_remap(skin->mJointNames.size()); - // Fill in j_remap for all joints that will make the cut. - for (U32 j = 0; j < skin->mJointNames.size(); ++j) - { - if (j_proxy[j] == j) - { - // Joint will be included - j_remap[j] = top++; - } - } - // Then use j_proxy to fill in j_remap for the joints that will be discarded - for (U32 j = 0; j < skin->mJointNames.size(); ++j) - { - if (j_proxy[j] != j) - { - j_remap[j] = j_remap[j_proxy[j]]; - } - } - - - // Apply the remap to mJointNames, mInvBindMatrix, and mAlternateBindMatrix - std::vector new_joint_names; - std::vector new_inv_bind_matrix; - std::vector new_alternate_bind_matrix; - - for (U32 j = 0; j < skin->mJointNames.size(); ++j) - { - if (j_proxy[j] == j) - { - new_joint_names.push_back(skin->mJointNames[j]); - new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]); - if (!skin->mAlternateBindMatrix.empty()) - { - new_alternate_bind_matrix.push_back(skin->mAlternateBindMatrix[j]); - } - } - } - - for (U32 j = 0; j < skin->mJointNames.size(); ++j) - { - LL_INFOS() << "Starting joint[" << j << "] = " << skin->mJointNames[j] << " j_remap " << j_remap[j] << " ==> " << new_joint_names[j_remap[j]] << LL_ENDL; - } - - skin->mJointNames = new_joint_names; - skin->mInvBindMatrix = new_inv_bind_matrix; - skin->mAlternateBindMatrix = new_alternate_bind_matrix; - skin->mJointRemap = j_remap; -} - -// static -void LLDrawPoolAvatar::initSkinningMatrixPalette( - LLMatrix4* mat, - S32 count, - const LLMeshSkinInfo* skin, - LLVOAvatar *avatar) -{ - // BENTO - switching to use Matrix4a and SSE might speed this up. - // Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted. - for (U32 j = 0; j < count; ++j) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); - mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } -} - -// Transform the weights based on the remap info stored in skin. Note -// that this is destructive and non-idempotent, so we need to keep -// track of whether we've done it already. If the desired remapping -// changes, the viewer must be restarted. -// -// static -void LLDrawPoolAvatar::remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) -{ - llassert(skin->mJointRemap.size()>0); // Must call remapSkinInfoJoints() first, which this checks for. - const U32* remap = &skin->mJointRemap[0]; - const S32 max_joints = skin->mJointNames.size(); - for (U32 j=0; jmJointRemap.size()>0) - { - // Check the weights are consistent with the current remap. - const S32 max_joints = skin->mJointNames.size(); - for (U32 j=0; j=0); - llassert(i= 0.0, we can use int instead of floorf; the latter - // allegedly has a lot of overhead due to ieeefp error - // checking which we should not need. - idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)max_joints-1); - - wght[k] = w - floorf(w); - scale += wght[k]; - } - if (handle_bad_scale && scale <= 0.f) - { - wght = LLVector4(1.0f, 0.0f, 0.0f, 0.0f); - } - else - { - // This is enforced in unpackVolumeFaces() - llassert(scale>0.f); - wght *= 1.f/scale; - } - - for (U32 k = 0; k < 4; k++) - { - F32 w = wght[k]; - - LLMatrix4a src; - src.setMul(mat[idx[k]], w); - - final_mat.add(src); - } -} - void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( LLVOAvatar* avatar, LLFace* face, @@ -1826,7 +1551,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( return; } // BENTO ugly const cast - remapSkinInfoJoints(avatar, const_cast(skin)); + LLSkinningUtil::remapSkinInfoJoints(avatar, const_cast(skin)); LLPointer buffer = face->getVertexBuffer(); LLDrawable* drawable = face->getDrawable(); @@ -1835,7 +1560,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( if (!vol_face.mWeightsRemapped) { - remapSkinWeights(weight, vol_face.mNumVertices, skin); + LLSkinningUtil::remapSkinWeights(weight, vol_face.mNumVertices, skin); vol_face.mWeightsRemapped = TRUE; } @@ -1890,18 +1615,18 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( //build matrix palette LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - U32 count = getMeshJointCount(skin); - initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); - checkSkinWeights(weight, buffer->getNumVerts(), skin); + U32 count = LLSkinningUtil::getMeshJointCount(skin); + LLSkinningUtil::initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); + LLSkinningUtil::checkSkinWeights(weight, buffer->getNumVerts(), skin); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); - const U32 max_joints = getMaxJointCount(); + const U32 max_joints = LLSkinningUtil::getMaxJointCount(); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; - getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); + LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; @@ -1984,8 +1709,8 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) { // upload matrix palette to shader LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; - U32 count = getMeshJointCount(skin); - initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); + U32 count = LLSkinningUtil::getMeshJointCount(skin); + LLSkinningUtil::initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, avatar); stop_glerror(); diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 8d6e95ba1a..b9d2204052 100755 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -134,13 +134,6 @@ public: void endDeferredRiggedBump(); void getRiggedGeometry(LLFace* face, LLPointer& buffer, U32 data_mask, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face); - static U32 getMaxJointCount(); - static U32 getMeshJointCount(const LLMeshSkinInfo *skin); - static void remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin); - static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); - static void checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); - static void remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); - static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints); void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* facep, const LLMeshSkinInfo* skin, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c971faac5f..3cad7badad 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -42,7 +42,6 @@ #include "llcombobox.h" #include "lldatapacker.h" #include "lldrawable.h" -#include "lldrawpoolavatar.h" #include "llrender.h" #include "llface.h" #include "lleconomy.h" @@ -54,6 +53,7 @@ #include "llmeshrepository.h" #include "llnotificationsutil.h" #include "llsdutil_math.h" +#include "llskinningutil.h" #include "lltextbox.h" #include "lltoolmgr.h" #include "llui.h" @@ -4031,17 +4031,17 @@ BOOL LLModelPreview::render() LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT]; const LLMeshSkinInfo *skin = &model->mSkinInfo; - U32 count = LLDrawPoolAvatar::getMeshJointCount(skin); - LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, count, + U32 count = LLSkinningUtil::getMeshJointCount(skin); + LLSkinningUtil::initSkinningMatrixPalette((LLMatrix4*)mat, count, skin, getPreviewAvatar()); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); - U32 max_joints = LLDrawPoolAvatar::getMaxJointCount(); + U32 max_joints = LLSkinningUtil::getMaxJointCount(); for (U32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4a final_mat; F32 *wptr = weight[j].mV; - LLDrawPoolAvatar::getPerVertexSkinMatrix(wptr, mat, true, final_mat, max_joints); + LLSkinningUtil::getPerVertexSkinMatrix(wptr, mat, true, final_mat, max_joints); //VECTORIZE THIS LLVector4a& v = face.mPositions[j]; diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp new file mode 100644 index 0000000000..23bbbdcf90 --- /dev/null +++ b/indra/newview/llskinningutil.cpp @@ -0,0 +1,329 @@ +/** +* @file llskinningutil.cpp +* @brief Functions for mesh object skinning +* @author vir@lindenlab.com +* +* $LicenseInfo:firstyear=2015&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2015, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llskinningutil.h" +#include "llvoavatar.h" +#include "llviewercontrol.h" +#include "llmeshrepository.h" + +bool LLSkinningUtil::sIncludeEnhancedSkeleton = true; +U32 LLSkinningUtil::sMaxJointsPerMeshObject = LL_MAX_JOINTS_PER_MESH_OBJECT; + +namespace { + +bool get_name_index(const std::string& name, std::vector& names, U32& result) +{ + std::vector::const_iterator find_it = + std::find(names.begin(), names.end(), name); + if (find_it != names.end()) + { + result = find_it - names.begin(); + return true; + } + else + { + return false; + } +} + +// Find a name table index that is also a valid joint on the +// avatar. Order of preference is: requested name, mPelvis, first +// valid match in names table. +U32 get_valid_joint_index(const std::string& name, LLVOAvatar *avatar, std::vector& joint_names) +{ + U32 result; + if (avatar->getJoint(name) && get_name_index(name,joint_names,result)) + { + return result; + } + if (get_name_index("mPelvis",joint_names,result)) + { + return result; + } + for (U32 j=0; jgetJoint(joint_names[j])) + { + return j; + } + } + // BENTO how to handle? + LL_ERRS() << "no valid joints in joint_names" << LL_ENDL; + return 0; +} + +// Which joint will stand in for this joint? +U32 get_proxy_joint_index(U32 joint_index, LLVOAvatar *avatar, std::vector& joint_names) +{ + bool include_enhanced = LLSkinningUtil::sIncludeEnhancedSkeleton; + U32 j_proxy = get_valid_joint_index(joint_names[joint_index], avatar, joint_names); + LLJoint *joint = avatar->getJoint(joint_names[j_proxy]); + llassert(joint); + // BENTO - test of simple push-to-base-ancestor + // complexity reduction scheme. Find the first + // ancestor that's not flagged as extended, or the + // last ancestor that's rigged in this mesh, whichever + // comes first. + while (1) + { + if (include_enhanced || + joint->getSupport()==LLJoint::SUPPORT_BASE) + break; + LLJoint *parent = joint->getParent(); + if (!parent) + break; + if (!get_name_index(parent->getName(), joint_names, j_proxy)) + { + break; + } + joint = parent; + } + return j_proxy; +} + +} + +// static +void LLSkinningUtil::initClass() +{ + sIncludeEnhancedSkeleton = gSavedSettings.getBOOL("IncludeEnhancedSkeleton"); + sMaxJointsPerMeshObject = gSavedSettings.getU32("MaxJointsPerMeshObject"); +} + +// static +U32 LLSkinningUtil::getMaxJointCount() +{ + U32 result = llmin(LL_MAX_JOINTS_PER_MESH_OBJECT, sMaxJointsPerMeshObject); + if (!sIncludeEnhancedSkeleton) + { + result = llmin(result,(U32)52); // BENTO replace with LLAvatarAppearance::getBaseJointCount()) or equivalent + } + return result; +} + +// static +U32 LLSkinningUtil::getMeshJointCount(const LLMeshSkinInfo *skin) +{ + return llmin((U32)getMaxJointCount(), (U32)skin->mJointNames.size()); +} + +// static + +// Destructively remap the joints in skin info based on what joints +// are known in the avatar, and which are currently supported. This +// will also populate mJointRemap[] in the skin, which can be used to +// make the corresponding changes to the integer part of vertex +// weights. +// +// This will throw away joint info for any joints that are not known +// in the avatar, or not currently flagged to support based on the +// debug setting for IncludeEnhancedSkeleton. +// +// static +void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin) +{ + // skip if already done. + if (!skin->mJointRemap.empty()) + { + return; + } + + // Compute the remap + std::vector j_proxy(skin->mJointNames.size()); + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + U32 j_rep = get_proxy_joint_index(j, avatar, skin->mJointNames); + j_proxy[j] = j_rep; + } + S32 top = 0; + std::vector j_remap(skin->mJointNames.size()); + // Fill in j_remap for all joints that will make the cut. + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] == j) + { + // Joint will be included + j_remap[j] = top++; + } + } + // Then use j_proxy to fill in j_remap for the joints that will be discarded + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] != j) + { + j_remap[j] = j_remap[j_proxy[j]]; + } + } + + + // Apply the remap to mJointNames, mInvBindMatrix, and mAlternateBindMatrix + std::vector new_joint_names; + std::vector new_inv_bind_matrix; + std::vector new_alternate_bind_matrix; + + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + if (j_proxy[j] == j) + { + new_joint_names.push_back(skin->mJointNames[j]); + new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]); + if (!skin->mAlternateBindMatrix.empty()) + { + new_alternate_bind_matrix.push_back(skin->mAlternateBindMatrix[j]); + } + } + } + + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + LL_DEBUGS("Avatar") << "Starting joint[" << j << "] = " << skin->mJointNames[j] << " j_remap " << j_remap[j] << " ==> " << new_joint_names[j_remap[j]] << LL_ENDL; + } + + skin->mJointNames = new_joint_names; + skin->mInvBindMatrix = new_inv_bind_matrix; + skin->mAlternateBindMatrix = new_alternate_bind_matrix; + skin->mJointRemap = j_remap; +} + +// static +void LLSkinningUtil::initSkinningMatrixPalette( + LLMatrix4* mat, + S32 count, + const LLMeshSkinInfo* skin, + LLVOAvatar *avatar) +{ + // BENTO - switching to use Matrix4a and SSE might speed this up. + // Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted. + for (U32 j = 0; j < count; ++j) + { + LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } +} + +// Transform the weights based on the remap info stored in skin. Note +// that this is destructive and non-idempotent, so we need to keep +// track of whether we've done it already. If the desired remapping +// changes, the viewer must be restarted. +// +// static +void LLSkinningUtil::remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) +{ + llassert(skin->mJointRemap.size()>0); // Must call remapSkinInfoJoints() first, which this checks for. + const U32* remap = &skin->mJointRemap[0]; + const S32 max_joints = skin->mJointNames.size(); + for (U32 j=0; jmJointRemap.size()>0) + { + // Check the weights are consistent with the current remap. + const S32 max_joints = skin->mJointNames.size(); + for (U32 j=0; j=0); + llassert(i= 0.0, we can use int instead of floorf; the latter + // allegedly has a lot of overhead due to ieeefp error + // checking which we should not need. + idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)max_joints-1); + + wght[k] = w - floorf(w); + scale += wght[k]; + } + if (handle_bad_scale && scale <= 0.f) + { + wght = LLVector4(1.0f, 0.0f, 0.0f, 0.0f); + } + else + { + // This is enforced in unpackVolumeFaces() + llassert(scale>0.f); + wght *= 1.f/scale; + } + + for (U32 k = 0; k < 4; k++) + { + F32 w = wght[k]; + + LLMatrix4a src; + src.setMul(mat[idx[k]], w); + + final_mat.add(src); + } +} + diff --git a/indra/newview/llskinningutil.h b/indra/newview/llskinningutil.h new file mode 100644 index 0000000000..813d401535 --- /dev/null +++ b/indra/newview/llskinningutil.h @@ -0,0 +1,51 @@ +/** +* @file llskinningutil.h +* @brief Functions for mesh object skinning +* @author vir@lindenlab.com +* +* $LicenseInfo:firstyear=2015&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2015, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LLSKINNINGUTIL_H +#define LLSKINNINGUTIL_H + +class LLVOAvatar; +class LLMeshSkinInfo; +class LLMatrix4a; + +class LLSkinningUtil +{ +public: + static void initClass(); + static U32 getMaxJointCount(); + static U32 getMeshJointCount(const LLMeshSkinInfo *skin); + static void remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin); + static void initSkinningMatrixPalette(LLMatrix4* mat, S32 count, const LLMeshSkinInfo* skin, LLVOAvatar *avatar); + static void checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); + static void remapSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin); + static void getPerVertexSkinMatrix(F32* weights, LLMatrix4a* mat, bool handle_bad_scale, LLMatrix4a& final_mat, U32 max_joints); + + // This is initialized from gSavedSettings at startup and then left alone. + static bool sIncludeEnhancedSkeleton; + static U32 sMaxJointsPerMeshObject; +}; + +#endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 466edb19b2..4e4aaf5f8e 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -67,6 +67,7 @@ #include "llvowlsky.h" #include "llrender.h" #include "llnavigationbar.h" +#include "llnotificationsutil.h" #include "llfloatertools.h" #include "llpaneloutfitsinventory.h" #include "llpanellogin.h" @@ -119,6 +120,12 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) } +static bool handleDeferredDebugSettingChanged(const LLSD& newvalue) +{ + LLNotificationsUtil::add("ChangeDeferredDebugSetting"); + return true; +} + static bool handleSetShaderChanged(const LLSD& newvalue) { // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache @@ -761,7 +768,8 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); - gSavedSettings.getControl("MaxJointsPerMeshObject")->getCommitSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("MaxJointsPerMeshObject")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); + gSavedSettings.getControl("IncludeEnhancedSkeleton")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index b1e521f193..3e0cec0f09 100755 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -44,7 +44,7 @@ #include "llvosky.h" #include "llrender.h" #include "lljoint.h" -#include "lldrawpoolavatar.h" +#include "llskinningutil.h" #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") @@ -876,7 +876,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() boost::unordered_map attribs; attribs["MAX_JOINTS_PER_MESH_OBJECT"] = - boost::lexical_cast(LLDrawPoolAvatar::getMaxJointCount()); + boost::lexical_cast(LLSkinningUtil::getMaxJointCount()); // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now. for (U32 i = 0; i < shaders.size(); i++) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5d8558cb46..9b2e9db59a 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -54,6 +54,7 @@ #include "llspatialpartition.h" #include "llhudmanager.h" #include "llflexibleobject.h" +#include "llskinningutil.h" #include "llsky.h" #include "lltexturefetch.h" #include "llvector4a.h" @@ -4179,8 +4180,8 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons static const size_t kMaxJoints = LL_MAX_JOINTS_PER_MESH_OBJECT; LLMatrix4a mat[kMaxJoints]; - U32 maxJoints = LLDrawPoolAvatar::getMeshJointCount(skin); - LLDrawPoolAvatar::initSkinningMatrixPalette((LLMatrix4*)mat, maxJoints, skin, avatar); + U32 maxJoints = LLSkinningUtil::getMeshJointCount(skin); + LLSkinningUtil::initSkinningMatrixPalette((LLMatrix4*)mat, maxJoints, skin, avatar); for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { @@ -4192,7 +4193,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons if ( weight ) { - LLDrawPoolAvatar::checkSkinWeights(weight, dst_face.mNumVertices, skin); + LLSkinningUtil::checkSkinWeights(weight, dst_face.mNumVertices, skin); LLMatrix4a bind_shape_matrix; bind_shape_matrix.loadu(skin->mBindShapeMatrix); @@ -4202,11 +4203,11 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons { LL_RECORD_BLOCK_TIME(FTM_SKIN_RIGGED); - U32 max_joints = LLDrawPoolAvatar::getMaxJointCount(); + U32 max_joints = LLSkinningUtil::getMaxJointCount(); for (U32 j = 0; j < dst_face.mNumVertices; ++j) { LLMatrix4a final_mat; - LLDrawPoolAvatar::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); + LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); LLVector4a& v = vol_face.mPositions[j]; LLVector4a t; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 70ba4d5077..ab027ac600 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1422,6 +1422,13 @@ Note: This will clear the cache. Port settings take effect after you restart [APP_NAME]. + +This debug setting change will take effect after you restart [APP_NAME]. + + Date: Wed, 21 Oct 2015 19:20:28 -0400 Subject: SL-234 WIP - TC build fixes --- indra/newview/llskinningutil.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 23bbbdcf90..bcbeee6958 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -256,22 +256,24 @@ void LLSkinningUtil::remapSkinWeights(LLVector4a* weights, U32 num_vertices, con // static void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { +#ifndef LL_RELEASE_FOR_DOWNLOAD + const S32 max_joints = skin->mJointNames.size(); if (skin->mJointRemap.size()>0) { // Check the weights are consistent with the current remap. - const S32 max_joints = skin->mJointNames.size(); for (U32 j=0; j=0); llassert(i Date: Thu, 22 Oct 2015 11:23:36 -0400 Subject: SL-234 WIP - fix for enforcement of MaxJointsPerMeshObject limit --- indra/newview/llskinningutil.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index bcbeee6958..5fd2248060 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -154,6 +154,8 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski return; } + U32 max_joints = getMeshJointCount(skin); + // Compute the remap std::vector j_proxy(skin->mJointNames.size()); for (U32 j = 0; j < skin->mJointNames.size(); ++j) @@ -163,13 +165,19 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski } S32 top = 0; std::vector j_remap(skin->mJointNames.size()); - // Fill in j_remap for all joints that will make the cut. + // Fill in j_remap for all joints that will be kept. for (U32 j = 0; j < skin->mJointNames.size(); ++j) { if (j_proxy[j] == j) { // Joint will be included - j_remap[j] = top++; + j_remap[j] = top; + if (top < max_joints-1) + { + top++; + } + + } } // Then use j_proxy to fill in j_remap for the joints that will be discarded @@ -189,7 +197,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski for (U32 j = 0; j < skin->mJointNames.size(); ++j) { - if (j_proxy[j] == j) + if (j_proxy[j] == j && new_joint_names.size() < max_joints) { new_joint_names.push_back(skin->mJointNames[j]); new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]); @@ -199,6 +207,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski } } } + llassert(new_joint_names.size() <= max_joints); for (U32 j = 0; j < skin->mJointNames.size(); ++j) { -- cgit v1.2.3 From 3b702b6616854d19c9432e568197dc60fc772d9c Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Mon, 26 Oct 2015 11:05:58 -0700 Subject: SL-113: use product approved message string --- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 30e7caad76..bc051ca1ad 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10263,7 +10263,7 @@ Not enough script resources available to attach object! name="IllegalAttachment" type="notify"> fail - The attachment point specified is not valid and the item has been attached to the default location: chest. + The attachment has requested a nonexistent point on the avatar. It has been attached to the chest instead. Date: Tue, 27 Oct 2015 15:15:34 -0700 Subject: Fixes SL-202 joint offset and skin weight import. Race condition still exists. --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llfloatermodelpreview.cpp | 20 ++++------- indra/newview/llfloatermodelpreview.h | 2 -- indra/newview/llvoavatar.cpp | 63 +-------------------------------- indra/newview/llvoavatar.h | 5 +-- 5 files changed, 10 insertions(+), 82 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fbf2a04bcc..bf16c12ce0 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2784,7 +2784,7 @@ bool LLAppViewer::initConfiguration() // gWindowTitle = LLTrans::getString("APP_NAME"); #if LL_DEBUG - gWindowTitle += std::string(" [DEBUG]") + gWindowTitle += std::string(" [DEBUG]"); #endif if (!gArgs.empty()) { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c971faac5f..1926d76ce1 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1721,6 +1721,13 @@ void LLModelPreview::getLegalJointNames(JointNameSet& legal_joint_names) legal_joint_names.push_back(joint->getName()); } } + + std::stringstream cvstr; + for (S32 i = 0; i < av->mNumCollisionVolumes; i++) + { + legal_joint_names.push_back(av->mCollisionVolumes[i].getName()); + cvstr << legal_joint_names[i]; + } } void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable_slm) @@ -3351,19 +3358,6 @@ void LLModelPreview::update() } } -//----------------------------------------------------------------------------- -// getTranslationForJointOffset() -//----------------------------------------------------------------------------- -LLVector3 LLModelPreview::getTranslationForJointOffset( std::string joint ) -{ - LLMatrix4 jointTransform; - if ( mJointTransformMap.find( joint ) != mJointTransformMap.end() ) - { - jointTransform = mJointTransformMap[joint]; - return jointTransform.getTranslation(); - } - return LLVector3(0.0f,0.0f,0.0f); -} //----------------------------------------------------------------------------- // createPreviewAvatar //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 25c650a725..d9351029ec 100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -300,8 +300,6 @@ public: void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } - LLVector3 getTranslationForJointOffset( std::string joint ); - static bool sIgnoreLoadedCallback; protected: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 68bb39eb98..3b482e1bc0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -213,24 +213,6 @@ struct LLTextureMaskData ** **/ -//------------------------------------------------------------------------ -// LLVOAvatarBoneInfo -// Trans/Scale/Rot etc. info about each avatar bone. Used by LLVOAvatarSkeleton. -//------------------------------------------------------------------------ -struct LLVOAvatarCollisionVolumeInfo : public LLInitParam::Block -{ - LLVOAvatarCollisionVolumeInfo() - : name("name"), - pos("pos"), - rot("rot"), - scale("scale") - {} - - Mandatory name; - Mandatory pos, - rot, - scale; -}; struct LLAppearanceMessageContents { @@ -252,49 +234,6 @@ struct LLAppearanceMessageContents bool mHoverOffsetWasSet; }; -struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock - { - Alternative > bone; - Alternative collision_volume; - - LLVOAvatarChildJoint() - : bone("bone"), - collision_volume("collision_volume") - {} -}; - - - -struct LLVOAvatarBoneInfo : public LLInitParam::Block -{ - LLVOAvatarBoneInfo() - : pivot("pivot") - {} - - Mandatory pivot; - Multiple children; -}; - -//------------------------------------------------------------------------ -// LLVOAvatarSkeletonInfo -// Overall avatar skeleton -//------------------------------------------------------------------------ -struct LLVOAvatarSkeletonInfo : public LLInitParam::Block -{ - LLVOAvatarSkeletonInfo() - : skeleton_root(""), - num_bones("num_bones"), - num_collision_volumes("num_collision_volumes"), - version("version") - {} - - Mandatory version; - Mandatory num_bones, - num_collision_volumes; - Mandatory skeleton_root; -}; - - //----------------------------------------------------------------------------- // class LLBodyNoiseMotion @@ -1527,7 +1466,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& for (S32 i = 0; i < mNumCollisionVolumes; ++i) { mCollisionVolumes[i].updateWorldMatrix(); - + glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix); glh::matrix4f inverse = mat.inverse(); glh::matrix4f norm_mat = inverse.transpose(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5b4379165a..7a2355b447 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -68,11 +68,8 @@ class LLVoiceVisualizer; class LLHUDNameTag; class LLHUDEffectSpiral; class LLTexGlobalColor; -struct LLVOAvatarBoneInfo; -struct LLVOAvatarChildJoint; -//class LLViewerJoint; + struct LLAppearanceMessageContents; -struct LLVOAvatarSkeletonInfo; class LLViewerJointMesh; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From ded9b10d5dd60cb85934d0ab029e8c5a297d4123 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 29 Oct 2015 16:09:22 -0400 Subject: SL-114 WIP - constrain uploaded meshes based on max joints per mesh. Set max joints per mesh to 110. Also fixed some uninitialized members of LLModelLoader. --- indra/newview/llfloatermodelpreview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9c72238d87..a8069dd569 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1786,6 +1786,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable mJointTransformMap, mJointsFromNode, legal_joint_names, + LLSkinningUtil::getMaxJointCount(), gSavedSettings.getU32("ImporterModelLimit")); if (force_disable_slm) -- cgit v1.2.3 From 5601e4c4a10ca960aa86fb10d04937823173fc23 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 2 Nov 2015 15:31:38 -0500 Subject: SL-124 WIP - notes for pre-release cleanup. --- indra/newview/llskinningutil.cpp | 1 + indra/newview/llviewercontrol.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 5fd2248060..4f974d5912 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -113,6 +113,7 @@ U32 get_proxy_joint_index(U32 joint_index, LLVOAvatar *avatar, std::vectorgetSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); + // BENTO - remove MaxJointsPerMeshObject before release gSavedSettings.getControl("MaxJointsPerMeshObject")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); gSavedSettings.getControl("IncludeEnhancedSkeleton")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); } -- cgit v1.2.3 From 1a7b2d3d388d12a16fab5e585f06ab0574136f3d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 4 Nov 2015 09:33:43 -0500 Subject: SL-114 WIP - show skin weights checkbox can get out of sync with corresponding view option. --- indra/newview/llfloatermodelpreview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a8069dd569..dac49aa0b3 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3578,6 +3578,7 @@ BOOL LLModelPreview::render() fmp->enableViewOption("show_skin_weight"); fmp->setViewOptionEnabled("show_joint_positions", skin_weight); mFMP->childEnable("upload_skin"); + mFMP->childSetValue("show_skin_weight", skin_weight); } } else -- cgit v1.2.3 From 3cf938bcec9a4925a4f7d8becb9b89ff559eb2e3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 4 Nov 2015 16:41:37 -0500 Subject: SL-124 WIP - BENTO comments and related cleanup --- indra/newview/llskinningutil.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 4f974d5912..c32345cbe9 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -85,9 +85,7 @@ U32 get_proxy_joint_index(U32 joint_index, LLVOAvatar *avatar, std::vectorgetJoint(joint_names[j_proxy]); llassert(joint); - // BENTO - test of simple push-to-base-ancestor - // complexity reduction scheme. Find the first - // ancestor that's not flagged as extended, or the + // Find the first ancestor that's not flagged as extended, or the // last ancestor that's rigged in this mesh, whichever // comes first. while (1) -- cgit v1.2.3 From be11d020ca6b941ec86622718c9eeafd5fddb7b5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Nov 2015 14:57:00 -0500 Subject: SL-266 WIP - removed obsolete rigParityWithScene code, set legacy and joint offset upload based on AND-ing state of all meshes in file. --- indra/newview/llfloatermodelpreview.cpp | 1 - indra/newview/llfloatermodelpreview.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index dac49aa0b3..8c3c12291e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1184,7 +1184,6 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) , mPhysicsSearchLOD( LLModel::LOD_PHYSICS ) , mResetJoints( false ) , mModelNoErrors( true ) -, mRigParityWithScene( false ) , mLastJointUpdate( false ) { mNeedsUpdate = TRUE; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index d9351029ec..2a39f54e92 100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -297,8 +297,6 @@ public: void setLoadState( U32 state ) { mLoadState = state; } U32 getLoadState() { return mLoadState; } - void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } - const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } static bool sIgnoreLoadedCallback; @@ -346,7 +344,6 @@ private: bool mLoading; U32 mLoadState; bool mResetJoints; - bool mRigParityWithScene; bool mModelNoErrors; std::map mViewOption; -- cgit v1.2.3 From fcf2f235b763a4e1e2814685c3086da3933eac74 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Nov 2015 14:58:26 -0500 Subject: SL-263 FIX - fallback code to prevent crash, won't be invoked unless there's a bug somewhere upstream. --- indra/newview/llskinningutil.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index c32345cbe9..279035d769 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -232,7 +232,18 @@ void LLSkinningUtil::initSkinningMatrixPalette( { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); + if (joint) + { + mat[j] *= joint->getWorldMatrix(); + } + else + { + // This shouldn't happen - in mesh upload, skinned + // rendering should be disabled unless all joints are + // valid. In other cases of skinned rendering, invalid + // joints should already have been removed during remap. + LL_WARNS_ONCE("Avatar") << "Rigged to invalid joint name " << skin->mJointNames[j] << LL_ENDL; + } } } -- cgit v1.2.3 From 146919fa764bed09bfa5e27bc30d02ce2afb6188 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Wed, 11 Nov 2015 13:44:51 -0800 Subject: animations and meshes will recognize all joint names in joint_aliases.xml --- indra/newview/CMakeLists.txt | 2 +- indra/newview/app_settings/anim.ini | 87 ------------------------- indra/newview/app_settings/joint_aliases.xml | 97 ++++++++++++++++++++++++++++ indra/newview/llfloaterbvhpreview.cpp | 18 ++++-- indra/newview/llfloaterbvhpreview.h | 3 +- indra/newview/llfloatermodelpreview.cpp | 7 ++ indra/newview/llstartup.cpp | 2 +- indra/newview/llvoavatar.cpp | 23 +++++++ indra/newview/llvoavatar.h | 3 + 9 files changed, 148 insertions(+), 94 deletions(-) delete mode 100755 indra/newview/app_settings/anim.ini create mode 100755 indra/newview/app_settings/joint_aliases.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a006611a45..b371939fb5 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1600,12 +1600,12 @@ set_source_files_properties(${viewer_XUI_FILES} list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) set(viewer_APPSETTINGS_FILES - app_settings/anim.ini app_settings/cmd_line.xml app_settings/commands.xml app_settings/grass.xml app_settings/high_graphics.xml app_settings/ignorable_dialogs.xml + app_settings/joint_aliases.xml app_settings/keys.xml app_settings/keywords_lsl_default.xml app_settings/logcontrol.xml diff --git a/indra/newview/app_settings/anim.ini b/indra/newview/app_settings/anim.ini deleted file mode 100755 index 63c84e544d..0000000000 --- a/indra/newview/app_settings/anim.ini +++ /dev/null @@ -1,87 +0,0 @@ -Translations 1.0 - -[hip] - relativepos = firstkey - relativerot = firstkey - outname = mPelvis - frame = 0 1 0, 0 0 1, 1 0 0 - -[abdomen] - outname = mTorso - frame = 0 1 0, 0 0 1, 1 0 0 - -[chest] - outname = mChest - frame = 0 1 0, 0 0 1, 1 0 0 - -[neckDummy] - ignore = true - frame = 0 1 0, 0 0 1, 1 0 0 - -[neck] - outname = mNeck - frame = 0 1 0, 0 0 1, 1 0 0 - -[head] - outname = mHead - frame = 0 1 0, 0 0 1, 1 0 0 - -[figureHair] - ignore = true - frame = 0 1 0, 0 0 1, 1 0 0 - -[lCollar] - outname = mCollarLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[lShldr] - outname = mShoulderLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[lForeArm] - outname = mElbowLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[lHand] - outname = mWristLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[rCollar] - outname = mCollarRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[rShldr] - outname = mShoulderRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[rForeArm] - outname = mElbowRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[rHand] - outname = mWristRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[lThigh] - outname = mHipLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[lShin] - outname = mKneeLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[lFoot] - outname = mAnkleLeft - frame = 0 1 0, 0 0 1, 1 0 0 - -[rThigh] - outname = mHipRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[rShin] - outname = mKneeRight - frame = 0 1 0, 0 0 1, 1 0 0 - -[rFoot] - outname = mAnkleRight - frame = 0 1 0, 0 0 1, 1 0 0 \ No newline at end of file diff --git a/indra/newview/app_settings/joint_aliases.xml b/indra/newview/app_settings/joint_aliases.xml new file mode 100755 index 0000000000..1e4a233837 --- /dev/null +++ b/indra/newview/app_settings/joint_aliases.xml @@ -0,0 +1,97 @@ + + + + avatar_mPelvis + mPelvis + avatar_mTorso + mTorso + avatar_mChest + mChest + avatar_mNeck + mNeck + avatar_mHead + mHead + avatar_mSkull + mSkull + avatar_mEyeRight + mEyeRight + avatar_mEyeLeft + mEyeLeft + avatar_mCollarLeft + mCollarLeft + avatar_mShoulderLeft + mShoulderLeft + avatar_mElbowLeft + mElbowLeft + avatar_mWristLeft + mWristLeft + avatar_mCollarRight + mCollarRight + avatar_mShoulderRight + mShoulderRight + avatar_mElbowRight + mElbowRight + avatar_mWristRight + mWristRight + avatar_mHipRight + mHipRight + avatar_mKneeRight + mKneeRight + avatar_mAnkleRight + mAnkleRight + avatar_mFootRight + mFootRight + avatar_mToeRight + mToeRight + avatar_mHipLeft + mHipLeft + avatar_mKneeLeft + mKneeLeft + avatar_mAnkleLeft + mAnkleLeft + avatar_mFootLeft + mFootLeft + avatar_mToeLeft + mToeLeft + hip + mPelvis + abdomen + mTorso + chest + mChest + neck + mNeck + head + mHead + figureHair + mSkull + lCollar + mCollarLeft + lShldr + mShoulderLeft + lForeArm + mElbowLeft + lHand + mWristLeft + rCollar + mCollarRight + rShldr + mShoulderRight + rForeArm + mElbowRight + rHand + mWristRight + rThigh + mHipRight + rShin + mKneeRight + rFoot + mFootRight + lThigh + mHipLeft + lShin + mKneeLeft + lFoot + mFootLeft + + diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index a800a3ca14..97769838e8 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -178,6 +178,14 @@ void LLFloaterBvhPreview::setAnimCallbacks() getChild("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1)); } +void LLFloaterBvhPreview::getLegalJointNames(std::deque& legal_joint_names) +{ + // Get all standard skeleton joints from the preview avatar. + LLPointer av = (LLVOAvatar*)mAnimPreview->getDummyAvatar(); + av->getLegalJointNames(legal_joint_names, false); +} + + //----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- @@ -215,6 +223,8 @@ BOOL LLFloaterBvhPreview::postBuild() getChildView("bad_animation_text")->setVisible(FALSE); + mAnimPreview = new LLPreviewAnimation(256, 256); + std::string exten = gDirUtilp->getExtension(mFilename); if (exten == "bvh") { @@ -241,8 +251,10 @@ BOOL LLFloaterBvhPreview::postBuild() file_buffer[file_size] = '\0'; LL_INFOS() << "Loading BVH file " << mFilename << LL_ENDL; ELoadStatus load_status = E_ST_OK; - S32 line_number = 0; - loaderp = new LLBVHLoader(file_buffer, load_status, line_number); + S32 line_number = 0; + std::deque legal_joint_names; + getLegalJointNames(legal_joint_names); + loaderp = new LLBVHLoader(file_buffer, load_status, line_number, legal_joint_names); std::string status = getString(STATUS[load_status]); if(load_status == E_ST_NO_XLT_FILE) @@ -266,8 +278,6 @@ BOOL LLFloaterBvhPreview::postBuild() mTransactionID.generate(); mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); - mAnimPreview = new LLPreviewAnimation(256, 256); - // motion will be returned, but it will be in a load-pending state, as this is a new motion // this motion will not request an asset transfer until next update, so we have a chance to // load the keyframe data locally diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index b81cc6e3a5..74d77d0004 100755 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -109,7 +109,8 @@ public: S32 status, LLExtStat ext_status); private: void setAnimCallbacks() ; - + void getLegalJointNames(std::deque& legal_joint_names); + protected: void draw(); void resetMotion(); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9c72238d87..30051a79f1 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1712,6 +1712,8 @@ void LLModelPreview::getLegalJointNames(JointNameSet& legal_joint_names) { // Get all standard skeleton joints from the preview avatar. LLVOAvatar *av = getPreviewAvatar(); + + av->getLegalJointNames(legal_joint_names, true); const LLVOAvatar::avatar_joint_list_t &skel = av->getSkeleton(); for (S32 i=0; igetExpandedFilename(LL_PATH_APP_SETTINGS,"joint_aliases.xml"); + + mModelLoader = new LLDAELoader( filename, lod, @@ -1786,6 +1792,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable mJointTransformMap, mJointsFromNode, legal_joint_names, + joint_aliases_filename, gSavedSettings.getU32("ImporterModelLimit")); if (force_disable_slm) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 54ecc76867..6610330a56 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1258,7 +1258,7 @@ bool idle_startup() LLPostProcess::initClass(); display_startup(); - LLAvatarAppearance::initClass(gSavedSettings.getString("AvatarFileName"),gSavedSettings.getString("SkeletonFileName")); + LLAvatarAppearance::initClass(gSavedSettings.getString("AvatarFileName"),gSavedSettings.getString("SkeletonFileName")); display_startup(); LLViewerObject::initVOClasses(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3b482e1bc0..d14ec7e55b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -937,6 +937,29 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) return "unknown"; } +void LLVOAvatar::getLegalJointNames(std::deque& legal_joint_names, + bool include_collision_volumes) +{ + // Get all standard skeleton joints from the preview avatar. + const LLVOAvatar::avatar_joint_list_t &skel = getSkeleton(); + for (S32 i=0; igetName()); + } + } + + if (include_collision_volumes) + { + for (S32 i = 0; i < mNumCollisionVolumes; i++) + { + legal_joint_names.push_back(mCollisionVolumes[i].getName()); + } + } +} + // static void LLVOAvatar::dumpBakedStatus() { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 7a2355b447..29f70fca18 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -72,6 +72,7 @@ class LLTexGlobalColor; struct LLAppearanceMessageContents; class LLViewerJointMesh; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar // @@ -146,6 +147,8 @@ public: void collectBakedTextureUUIDs(std::set& ids) const; void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); + void getLegalJointNames(std::deque& legal_joint_names, + bool include_collision_volumes); /*virtual*/ void updateTextures(); LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. -- cgit v1.2.3 From cdb96f8044fd609f92b9009450454e356008ca1c Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Fri, 13 Nov 2015 14:31:21 -0800 Subject: Post review changes. --- indra/newview/CMakeLists.txt | 1 + indra/newview/app_settings/anim.ini | 2 ++ indra/newview/character/avatar_skeleton.xml | 40 ++++++++++++++--------------- indra/newview/llvoavatar.cpp | 21 --------------- indra/newview/llvoavatar.h | 2 -- 5 files changed, 23 insertions(+), 43 deletions(-) create mode 100755 indra/newview/app_settings/anim.ini (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3c6b1c7903..a006611a45 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1600,6 +1600,7 @@ set_source_files_properties(${viewer_XUI_FILES} list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) set(viewer_APPSETTINGS_FILES + app_settings/anim.ini app_settings/cmd_line.xml app_settings/commands.xml app_settings/grass.xml diff --git a/indra/newview/app_settings/anim.ini b/indra/newview/app_settings/anim.ini new file mode 100755 index 0000000000..c24d2749ef --- /dev/null +++ b/indra/newview/app_settings/anim.ini @@ -0,0 +1,2 @@ +Translations 1.0 + diff --git a/indra/newview/character/avatar_skeleton.xml b/indra/newview/character/avatar_skeleton.xml index 47182620d2..f3e845171f 100755 --- a/indra/newview/character/avatar_skeleton.xml +++ b/indra/newview/character/avatar_skeleton.xml @@ -1,6 +1,6 @@ - + @@ -11,12 +11,12 @@ - + - + @@ -37,11 +37,11 @@ - + - + - + @@ -49,25 +49,25 @@ - + - + - + - + - + - + - + - + @@ -75,26 +75,26 @@ - + - + - + - + - + - + diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b6924e5904..3b482e1bc0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -937,27 +937,6 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) return "unknown"; } -void LLVOAvatar::getLegalJointNames(std::deque& legal_joint_names, - bool include_collision_volumes) -{ - LLAvatarAppearance::joint_alias_map_t alias_map = getJointAliases(); - - std::map::iterator iter; - - for (iter = alias_map.begin(); iter != alias_map.end(); ++iter) - { - legal_joint_names.push_back(iter->first); - } - - if (include_collision_volumes) - { - for (S32 i = 0; i < mNumCollisionVolumes; i++) - { - legal_joint_names.push_back(mCollisionVolumes[i].getName()); - } - } -} - // static void LLVOAvatar::dumpBakedStatus() { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 29f70fca18..002359ebac 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -147,8 +147,6 @@ public: void collectBakedTextureUUIDs(std::set& ids) const; void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); - void getLegalJointNames(std::deque& legal_joint_names, - bool include_collision_volumes); /*virtual*/ void updateTextures(); LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. -- cgit v1.2.3 From 3bfc2564a685f87dda38d423ca3c32f96efeedf1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 16 Nov 2015 12:53:43 -0500 Subject: SL-201 WIP - avatar_skeleton.xml tweaks for aliases, removed wings and tail from default definition. --- indra/newview/character/avatar_lad.xml | 110 --------------------- indra/newview/character/avatar_skeleton.xml | 38 ++----- .../character/avatar_skeleton_wings_tail.xml | 40 ++++---- 3 files changed, 27 insertions(+), 161 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index ac0b8b5704..9ec6428ee6 100755 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -413,116 +413,6 @@ rotation="0 0 0" visible_in_first_person="true" /> - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - @@ -17,22 +9,6 @@ - - - - - - - - - - - - - - - - @@ -43,9 +19,9 @@ - + - + @@ -79,10 +55,10 @@ - + - + @@ -92,10 +68,10 @@ - + - + diff --git a/indra/newview/character/avatar_skeleton_wings_tail.xml b/indra/newview/character/avatar_skeleton_wings_tail.xml index 7a088484d8..f3e845171f 100644 --- a/indra/newview/character/avatar_skeleton_wings_tail.xml +++ b/indra/newview/character/avatar_skeleton_wings_tail.xml @@ -1,6 +1,6 @@ - + @@ -11,12 +11,12 @@ - + - + @@ -37,11 +37,11 @@ - + - + - + @@ -49,25 +49,25 @@ - + - + - + - + - + - + - + - + @@ -75,26 +75,26 @@ - + - + - + - + - + - + -- cgit v1.2.3 From 94d7d6a623d755424c2bd8c2526bff0d46101915 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Nov 2015 16:41:55 -0500 Subject: SL-271 WIP, SL-201 WIP - add support for end point to joints, use for debug rendering display to show bones. --- indra/newview/llspatialpartition.cpp | 11 +++++ indra/newview/llvoavatar.cpp | 48 ++++++++++++++++++++++ indra/newview/llvoavatar.h | 1 + .../xui/en/floater_notifications_tabbed.xml | 6 +-- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 +++++ .../xui/en/panel_notification_list_item.xml | 13 +++--- 6 files changed, 79 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5e342099d7..28e038b828 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3216,6 +3216,11 @@ void renderAvatarCollisionVolumes(LLVOAvatar* avatar) avatar->renderCollisionVolumes(); } +void renderAvatarBones(LLVOAvatar* avatar) +{ + avatar->renderBones(); +} + void renderAgentTarget(LLVOAvatar* avatar) { // render these for self only (why, i don't know) @@ -3374,6 +3379,11 @@ public: renderAvatarCollisionVolumes(avatar); } + if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_JOINTS)) + { + renderAvatarBones(avatar); + } + if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AGENT_TARGET)) { renderAgentTarget(avatar); @@ -3664,6 +3674,7 @@ void LLSpatialPartition::renderDebug() LLPipeline::RENDER_DEBUG_TEXTURE_ANIM | LLPipeline::RENDER_DEBUG_RAYCAST | LLPipeline::RENDER_DEBUG_AVATAR_VOLUME | + LLPipeline::RENDER_DEBUG_AVATAR_JOINTS | LLPipeline::RENDER_DEBUG_AGENT_TARGET | //LLPipeline::RENDER_DEBUG_BUILD_QUEUE | LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA | diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3b482e1bc0..5fed8ce938 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1360,6 +1360,54 @@ void LLVOAvatar::renderCollisionVolumes() addDebugText(ostr.str()); } +void LLVOAvatar::renderBones() +{ + std::ostringstream ostr; + std::ostringstream nullstr; + + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + + for (; iter != end; ++iter) + { + LLJoint* jointp = *iter; + if (!jointp) + { + continue; + } + + ostr << jointp->getName() << ", "; + + jointp->updateWorldMatrix(); + + gGL.pushMatrix(); + gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] ); + + gGL.diffuseColor3f( 1.f, 0.f, 1.f ); + + gGL.begin(LLRender::LINES); + + LLVector3 v[] = + { + LLVector3(0,0,0), + LLVector3(0,0,0), + }; + v[1] = jointp->getEnd(); + + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[1].mV); + + gGL.end(); + + gGL.popMatrix(); + } + + mDebugText.clear(); + addDebugText(ostr.str()); + addDebugText(nullstr.str()); +} + + void LLVOAvatar::renderJoints() { std::ostringstream ostr; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 002359ebac..f6879c4b78 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -399,6 +399,7 @@ public: F32 getLastSkinTime() { return mLastSkinTime; } U32 renderTransparent(BOOL first_pass); void renderCollisionVolumes(); + void renderBones(); void renderJoints(); static void deleteCachedImages(bool clearAll=true); static void destroyGL(); diff --git a/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml b/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml index afc609de52..c17d2a1f37 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml @@ -136,15 +136,15 @@ - + - + - + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 3f557d0d0f..3b5f3a3184 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3554,6 +3554,16 @@ function="Advanced.ToggleInfoDisplay" parameter="collision skeleton" /> + + + + diff --git a/indra/newview/skins/default/xui/en/panel_notification_list_item.xml b/indra/newview/skins/default/xui/en/panel_notification_list_item.xml index a909028f9f..efaaefd0e4 100644 --- a/indra/newview/skins/default/xui/en/panel_notification_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_notification_list_item.xml @@ -9,7 +9,6 @@ left="0" width="331" height="202" - can_resize="true" layout="topleft" follows="left|top|right|bottom" > @@ -45,12 +44,12 @@ - + - + - +