Permalink
Browse files

V3 mesh, texture, and hover merge.

  • Loading branch information...
Shyotl committed Apr 26, 2016
1 parent be5d2f2 commit 55b5f60b688c0413ac3d64a98d553605e3ec0a31
Showing with 6,950 additions and 4,216 deletions.
  1. +36 −2 indra/llappearance/llavatarappearance.cpp
  2. +7 −1 indra/llappearance/llavatarappearance.h
  3. +3 −2 indra/llappearance/llavatarjointmesh.cpp
  4. +4 −0 indra/llcharacter/CMakeLists.txt
  5. +145 −24 indra/llcharacter/lljoint.cpp
  6. +24 −14 indra/llcharacter/lljoint.h
  7. +2 −0 indra/llcommon/CMakeLists.txt
  8. +230 −0 indra/llcommon/llcallbacklist.cpp
  9. +15 −7 indra/{newview → llcommon}/llcallbacklist.h
  10. +1 −2 indra/llcommon/llerrorlegacy.h
  11. +4 −0 indra/llcommon/llstl.h
  12. +139 −171 indra/llmath/llvolume.cpp
  13. +8 −0 indra/llmath/llvolume.h
  14. +11 −2 indra/llprimitive/CMakeLists.txt
  15. +2,605 −0 indra/llprimitive/lldaeloader.cpp
  16. +111 −0 indra/llprimitive/lldaeloader.h
  17. +340 −975 indra/llprimitive/llmodel.cpp
  18. +113 −5 indra/llprimitive/llmodel.h
  19. +644 −0 indra/llprimitive/llmodelloader.cpp
  20. +212 −0 indra/llprimitive/llmodelloader.h
  21. +0 −1 indra/newview/CMakeLists.txt
  22. +2 −2 indra/newview/llcallbacklist.cpp
  23. +33 −1 indra/newview/llface.cpp
  24. +3 −0 indra/newview/llface.h
  25. +1,097 −2,342 indra/newview/llfloatermodelpreview.cpp
  26. +74 −140 indra/newview/llfloatermodelpreview.h
  27. +209 −103 indra/newview/llmeshrepository.cpp
  28. +1 −48 indra/newview/llmeshrepository.h
  29. +23 −0 indra/newview/llviewerobject.cpp
  30. +2 −0 indra/newview/llviewerobject.h
  31. +0 −1 indra/newview/llviewerstats.cpp
  32. +193 −26 indra/newview/llviewertexture.cpp
  33. +19 −3 indra/newview/llviewertexture.h
  34. +291 −118 indra/newview/llvoavatar.cpp
  35. +10 −9 indra/newview/llvoavatar.h
  36. +3 −87 indra/newview/llvoavatarself.cpp
  37. +1 −12 indra/newview/llvoavatarself.h
  38. +311 −118 indra/newview/llvovolume.cpp
  39. +24 −0 indra/newview/llvovolume.h
@@ -576,8 +576,6 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
info->mRot.mV[VZ], LLQuaternion::XYZ));
joint->setScale(info->mScale);
- joint->setDefaultFromCurrentXform();
-
if (info->mIsJoint)
{
joint->setSkinOffset( info->mPivot );
@@ -677,6 +675,42 @@ void LLAvatarAppearance::clearSkeleton()
mSkeleton.clear();
}
+//------------------------------------------------------------------------
+// addPelvisFixup
+//------------------------------------------------------------------------
+void LLAvatarAppearance::addPelvisFixup( F32 fixup, const LLUUID& mesh_id )
+{
+ LLVector3 pos(0.0,0.0,fixup);
+ mPelvisFixups.add(mesh_id,pos);
+}
+
+//------------------------------------------------------------------------
+// addPelvisFixup
+//------------------------------------------------------------------------
+void LLAvatarAppearance::removePelvisFixup( const LLUUID& mesh_id )
+{
+ mPelvisFixups.remove(mesh_id);
+}
+
+//------------------------------------------------------------------------
+// hasPelvisFixup
+//------------------------------------------------------------------------
+bool LLAvatarAppearance::hasPelvisFixup( F32& fixup, LLUUID& mesh_id ) const
+{
+ LLVector3 pos;
+ if (mPelvisFixups.findActiveOverride(mesh_id,pos))
+ {
+ fixup = pos[2];
+ return true;
+ }
+ return false;
+}
+
+bool LLAvatarAppearance::hasPelvisFixup( F32& fixup ) const
+{
+ LLUUID mesh_id;
+ return hasPelvisFixup( fixup, mesh_id );
+}
//-----------------------------------------------------------------------------
// LLAvatarAppearance::buildCharacter()
// Deferred initialization and rebuild of the avatar.
@@ -159,11 +159,17 @@ class LLAvatarAppearance : public LLCharacter
BOOL mIsBuilt; // state of deferred character building
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
avatar_joint_list_t mSkeleton;
-
+ LLPosOverrideMap mPelvisFixups;
+
//--------------------------------------------------------------------
// Pelvis height adjustment members.
//--------------------------------------------------------------------
public:
+ void addPelvisFixup( F32 fixup, const LLUUID& mesh_id );
+ void removePelvisFixup( const LLUUID& mesh_id );
+ bool hasPelvisFixup( F32& fixup, LLUUID& mesh_id ) const;
+ bool hasPelvisFixup( F32& fixup ) const;
+
LLVector3 mBodySize;
LLVector3 mAvatarOffset;
protected:
@@ -85,8 +85,6 @@ LLSkinJoint::~LLSkinJoint()
//-----------------------------------------------------------------------------
void LLSkinJoint::setupSkinJoint( LLJoint *joint)
{
- mRootToJointSkinOffset.clearVec();
- mRootToParentJointSkinOffset.clearVec();
// find the named joint
if (!(mJoint = joint))
@@ -96,6 +94,9 @@ void LLSkinJoint::setupSkinJoint( LLJoint *joint)
}
// compute the inverse root skin matrix
+ mRootToJointSkinOffset.clearVec();
+ mRootToParentJointSkinOffset.clearVec();
+
do
{
mRootToJointSkinOffset -= joint->getSkinOffset();
@@ -16,6 +16,10 @@ include_directories(
${LLVFS_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
)
+include_directories(SYSTEM
+ ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
+ ${LLXML_SYSTEM_INCLUDE_DIRS}
+ )
set(llcharacter_SOURCE_FILES
llanimationstates.cpp
@@ -36,6 +36,63 @@
S32 LLJoint::sNumUpdates = 0;
S32 LLJoint::sNumTouches = 0;
+template <class T>
+bool attachment_map_iter_compare_key(const T& a, const T& b)
+{
+ return a.first < b.first;
+}
+
+bool LLPosOverrideMap::findActiveOverride(LLUUID& mesh_id, LLVector3& pos) const
+{
+ pos = LLVector3(0,0,0);
+ mesh_id = LLUUID();
+ bool found = false;
+
+ map_type::const_iterator it = std::max_element(m_map.begin(),
+ m_map.end(),
+ attachment_map_iter_compare_key<map_type::value_type>);
+ if (it != m_map.end())
+ {
+ found = true;
+ pos = it->second;
+ mesh_id = it->first;
+ }
+ return found;
+}
+
+void LLPosOverrideMap::showJointPosOverrides( std::ostringstream& os ) const
+{
+ map_type::const_iterator max_it = std::max_element(m_map.begin(),
+ m_map.end(),
+ attachment_map_iter_compare_key<map_type::value_type>);
+ for (map_type::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it)
+ {
+ const LLVector3& pos = it->second;
+ os << " " << "[" << it->first <<": " << pos << "]" << ((it==max_it) ? "*" : "");
+ }
+}
+
+U32 LLPosOverrideMap::count() const
+{
+ return m_map.size();
+}
+
+void LLPosOverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos)
+{
+ m_map[mesh_id] = pos;
+}
+
+bool LLPosOverrideMap::remove(const LLUUID& mesh_id)
+{
+ U32 remove_count = m_map.erase(mesh_id);
+ return (remove_count > 0);
+}
+
+void LLPosOverrideMap::clear()
+{
+ m_map.clear();
+}
//-----------------------------------------------------------------------------
// LLJoint()
// Class Constructor
@@ -57,15 +114,13 @@ LLJoint::LLJoint() :
{
init();
touch();
- mResetAfterRestoreOldXform = false;
}
LLJoint::LLJoint(S32 joint_num) :
mJointNum(joint_num)
{
init();
touch();
- mResetAfterRestoreOldXform = false;
}
@@ -233,54 +288,120 @@ const LLVector3& LLJoint::getPosition()
return mXform.getPosition();
}
+bool do_debug_joint(const std::string& name)
+{
+ return false;
+}
//--------------------------------------------------------------------
// setPosition()
//--------------------------------------------------------------------
void LLJoint::setPosition( const LLVector3& pos )
{
-// if (mXform.getPosition() != pos)
+ if (pos != getPosition())
{
- mXform.setPosition(pos);
- touch(MATRIX_DIRTY | POSITION_DIRTY);
+ if (do_debug_joint(getName()))
+ {
+ LL_DEBUGS("Avatar") << " joint " << getName() << " set pos " << pos << LL_ENDL;
+ }
}
+ mXform.setPosition(pos);
+ touch(MATRIX_DIRTY | POSITION_DIRTY);
}
+void showJointPosOverrides( const LLJoint& joint, const std::string& note, const std::string& av_info )
+{
+ std::ostringstream os;
+ os << joint.m_posBeforeOverrides;
+ joint.m_attachmentOverrides.showJointPosOverrides(os);
+ LL_DEBUGS("Avatar") << av_info << " joint " << joint.getName() << " " << note << " " << os.str() << LL_ENDL;
+}
//--------------------------------------------------------------------
-// setPosition()
+// addAttachmentPosOverride()
//--------------------------------------------------------------------
-void LLJoint::setDefaultFromCurrentXform( void )
+void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info )
{
- mDefaultXform = mXform;
- touch(MATRIX_DIRTY | POSITION_DIRTY);
-
+ if (mesh_id.isNull())
+ {
+ return;
+ }
+ if (!m_attachmentOverrides.count())
+ {
+ if (do_debug_joint(getName()))
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " saving m_posBeforeOverrides " << getPosition() << LL_ENDL;
+ }
+ m_posBeforeOverrides = getPosition();
+ }
+ m_attachmentOverrides.add(mesh_id,pos);
+ if (do_debug_joint(getName()))
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " addAttachmentPosOverride for mesh " << mesh_id << " pos " << pos << LL_ENDL;
+ }
+ updatePos(av_info);
}
//--------------------------------------------------------------------
-// storeCurrentXform()
+// removeAttachmentPosOverride()
//--------------------------------------------------------------------
-void LLJoint::storeCurrentXform( const LLVector3& pos )
+void LLJoint::removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info )
{
- mOldXform = mXform;
- mResetAfterRestoreOldXform = true;
- setPosition( pos );
+ if (mesh_id.isNull())
+ {
+ return;
+ }
+ if (m_attachmentOverrides.remove(mesh_id))
+ {
+ if (do_debug_joint(getName()))
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName()
+ << " removeAttachmentPosOverride for " << mesh_id << LL_ENDL;
+ showJointPosOverrides(*this, "remove", av_info);
+ }
+ updatePos(av_info);
+ }
+}
+
+//--------------------------------------------------------------------
+ // hasAttachmentPosOverride()
+ //--------------------------------------------------------------------
+bool LLJoint::hasAttachmentPosOverride( LLVector3& pos, LLUUID& mesh_id ) const
+{
+ return m_attachmentOverrides.findActiveOverride(mesh_id,pos);
}
+
//--------------------------------------------------------------------
-// restoreOldXform()
+// clearAttachmentPosOverrides()
//--------------------------------------------------------------------
-void LLJoint::restoreOldXform( void )
+void LLJoint::clearAttachmentPosOverrides()
{
- mResetAfterRestoreOldXform = false;
- mXform = mOldXform;
+ if (m_attachmentOverrides.count())
+ {
+ m_attachmentOverrides.clear();
+ setPosition(m_posBeforeOverrides);
+ setId( LLUUID::null );
+ }
}
+
//--------------------------------------------------------------------
-// restoreOldXform()
+// updatePos()
//--------------------------------------------------------------------
-void LLJoint::restoreToDefaultXform( void )
-{
- mXform = mDefaultXform;
- setPosition( mXform.getPosition() );
+void LLJoint::updatePos(const std::string& av_info)
+{
+ LLVector3 pos, found_pos;
+ LLUUID mesh_id;
+ if (m_attachmentOverrides.findActiveOverride(mesh_id,found_pos))
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner of " << m_attachmentOverrides.count() << " is mesh " << mesh_id << " pos " << found_pos << LL_ENDL;
+ pos = found_pos;
+ }
+ else
+ {
+ LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
+ pos = m_posBeforeOverrides;
+ }
+ setPosition(pos);
}
//--------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit 55b5f60

Please sign in to comment.