summaryrefslogtreecommitdiff
path: root/indra/llcharacter/lljoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcharacter/lljoint.h')
-rw-r--r--indra/llcharacter/lljoint.h252
1 files changed, 126 insertions, 126 deletions
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 63d99b9209..1f08c9c91c 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -1,25 +1,25 @@
-/**
+/**
* @file lljoint.h
* @brief Implementation of LLJoint class.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, 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$
*/
@@ -59,18 +59,18 @@ const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm
class LLVector3OverrideMap
{
public:
- LLVector3OverrideMap() {}
- bool findActiveOverride(LLUUID& mesh_id, LLVector3& pos) const;
- void showJointVector3Overrides(std::ostringstream& os) const;
- U32 count() const;
- void add(const LLUUID& mesh_id, const LLVector3& pos);
- bool remove(const LLUUID& mesh_id);
- void clear();
-
- typedef std::map<LLUUID,LLVector3> map_type;
+ LLVector3OverrideMap() {}
+ bool findActiveOverride(LLUUID& mesh_id, LLVector3& pos) const;
+ void showJointVector3Overrides(std::ostringstream& os) const;
+ U32 count() const;
+ void add(const LLUUID& mesh_id, const LLVector3& pos);
+ bool remove(const LLUUID& mesh_id);
+ void clear();
+
+ typedef std::map<LLUUID,LLVector3> map_type;
const map_type& getMap() const { return m_map; }
private:
- map_type m_map;
+ map_type m_map;
};
inline bool operator==(const LLVector3OverrideMap& a, const LLVector3OverrideMap& b)
@@ -91,25 +91,25 @@ class LLJoint
{
LL_ALIGN_NEW
public:
- // priority levels, from highest to lowest
- enum JointPriority
- {
- USE_MOTION_PRIORITY = -1,
- LOW_PRIORITY = 0,
- MEDIUM_PRIORITY,
- HIGH_PRIORITY,
- HIGHER_PRIORITY,
- HIGHEST_PRIORITY,
- ADDITIVE_PRIORITY = LL_CHARACTER_MAX_PRIORITY
- };
-
- enum DirtyFlags
- {
- MATRIX_DIRTY = 0x1 << 0,
- ROTATION_DIRTY = 0x1 << 1,
- POSITION_DIRTY = 0x1 << 2,
- ALL_DIRTY = 0x7
- };
+ // priority levels, from highest to lowest
+ enum JointPriority
+ {
+ USE_MOTION_PRIORITY = -1,
+ LOW_PRIORITY = 0,
+ MEDIUM_PRIORITY,
+ HIGH_PRIORITY,
+ HIGHER_PRIORITY,
+ HIGHEST_PRIORITY,
+ ADDITIVE_PRIORITY = LL_CHARACTER_MAX_PRIORITY
+ };
+
+ enum DirtyFlags
+ {
+ MATRIX_DIRTY = 0x1 << 0,
+ ROTATION_DIRTY = 0x1 << 1,
+ POSITION_DIRTY = 0x1 << 2,
+ ALL_DIRTY = 0x7
+ };
public:
enum SupportCategory
{
@@ -120,55 +120,55 @@ protected:
// explicit transformation members
LL_ALIGN_16(LLMatrix4a mWorldMatrix);
LLXformMatrix mXform;
-
- std::string mName;
- SupportCategory mSupport;
+ std::string mName;
- // parent joint
- LLJoint *mParent;
+ SupportCategory mSupport;
+
+ // parent joint
+ LLJoint *mParent;
LLVector3 mDefaultPosition;
LLVector3 mDefaultScale;
-
+
public:
- U32 mDirtyFlags;
- BOOL mUpdateXform;
+ U32 mDirtyFlags;
+ BOOL mUpdateXform;
- // describes the skin binding pose
- LLVector3 mSkinOffset;
+ // describes the skin binding pose
+ LLVector3 mSkinOffset;
// Endpoint of the bone, if applicable. This is only relevant for
// external programs like Blender, and for diagnostic display.
- LLVector3 mEnd;
+ LLVector3 mEnd;
- S32 mJointNum;
+ S32 mJointNum;
- // child joints
- typedef std::vector<LLJoint*> joints_t;
- joints_t mChildren;
+ // child joints
+ typedef std::vector<LLJoint*> joints_t;
+ joints_t mChildren;
- // debug statics
- static S32 sNumTouches;
- static S32 sNumUpdates;
+ // debug statics
+ static S32 sNumTouches;
+ static S32 sNumUpdates;
typedef std::set<std::string> debug_joint_name_t;
static debug_joint_name_t s_debugJointNames;
static void setDebugJointNames(const debug_joint_name_t& names);
static void setDebugJointNames(const std::string& names_string);
// Position overrides
- LLVector3OverrideMap m_attachmentPosOverrides;
- LLVector3 m_posBeforeOverrides;
+ LLVector3OverrideMap m_attachmentPosOverrides;
+ LLVector3 m_posBeforeOverrides;
// Scale overrides
- LLVector3OverrideMap m_attachmentScaleOverrides;
- LLVector3 m_scaleBeforeOverrides;
+ LLVector3OverrideMap m_attachmentScaleOverrides;
+ LLVector3 m_scaleBeforeOverrides;
- void updatePos(const std::string& av_info);
- void updateScale(const std::string& av_info);
+ void updatePos(const std::string& av_info);
+ void updateScale(const std::string& av_info);
public:
- LLJoint();
+ LLJoint();
// Note: these joint_num constructors are a bad idea because there
// are only a couple of places in the code where it is useful to
@@ -184,27 +184,27 @@ public:
// constructors from LLJoint, LLViewerJoint, LLAvatarJoint, and
// createAvatarJoint.
LLJoint(S32 joint_num);
-
- // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
- LLJoint( const std::string &name, LLJoint *parent=NULL );
- virtual ~LLJoint();
+
+ // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
+ LLJoint( const std::string &name, LLJoint *parent=NULL );
+ virtual ~LLJoint();
private:
- void init();
+ void init();
public:
- // set name and parent
- void setup( const std::string &name, LLJoint *parent=NULL );
+ // set name and parent
+ void setup( const std::string &name, LLJoint *parent=NULL );
- void touch(U32 flags = ALL_DIRTY);
+ void touch(U32 flags = ALL_DIRTY);
- // get/set name
- const std::string& getName() const { return mName; }
- void setName( const std::string &name ) { mName = name; }
+ // get/set name
+ const std::string& getName() const { return mName; }
+ void setName( const std::string &name ) { mName = name; }
// joint num
- S32 getJointNum() const { return mJointNum; }
- void setJointNum(S32 joint_num);
+ S32 getJointNum() const { return mJointNum; }
+ void setJointNum(S32 joint_num);
// get/set support
SupportCategory getSupport() const { return mSupport; }
@@ -214,91 +214,91 @@ public:
// get/set end point
void setEnd( const LLVector3& end) { mEnd = end; }
const LLVector3& getEnd() const { return mEnd; }
-
- // getParent
- LLJoint *getParent() { return mParent; }
- // getRoot
- LLJoint *getRoot();
+ // getParent
+ LLJoint *getParent() { return mParent; }
+
+ // getRoot
+ LLJoint *getRoot();
- // search for child joints by name
- LLJoint *findJoint( const std::string &name );
+ // search for child joints by name
+ LLJoint *findJoint( const std::string &name );
- // add/remove children
- void addChild( LLJoint *joint );
- void removeChild( LLJoint *joint );
- void removeAllChildren();
+ // add/remove children
+ void addChild( LLJoint *joint );
+ void removeChild( LLJoint *joint );
+ void removeAllChildren();
- // get/set local position
- const LLVector3& getPosition();
- void setPosition( const LLVector3& pos, bool apply_attachment_overrides = false );
+ // get/set local position
+ const LLVector3& getPosition();
+ void setPosition( const LLVector3& pos, bool apply_attachment_overrides = false );
// Tracks the default position defined by the skeleton
- void setDefaultPosition( const LLVector3& pos );
- const LLVector3& getDefaultPosition() const;
+ void setDefaultPosition( const LLVector3& pos );
+ const LLVector3& getDefaultPosition() const;
// Tracks the default scale defined by the skeleton
- void setDefaultScale( const LLVector3& scale );
- const LLVector3& getDefaultScale() const;
+ void setDefaultScale( const LLVector3& scale );
+ const LLVector3& getDefaultScale() const;
- // get/set world position
- LLVector3 getWorldPosition();
- LLVector3 getLastWorldPosition();
- void setWorldPosition( const LLVector3& pos );
+ // get/set world position
+ LLVector3 getWorldPosition();
+ LLVector3 getLastWorldPosition();
+ void setWorldPosition( const LLVector3& pos );
- // get/set local rotation
- const LLQuaternion& getRotation();
- void setRotation( const LLQuaternion& rot );
+ // get/set local rotation
+ const LLQuaternion& getRotation();
+ void setRotation( const LLQuaternion& rot );
- // get/set world rotation
- LLQuaternion getWorldRotation();
- LLQuaternion getLastWorldRotation();
- void setWorldRotation( const LLQuaternion& rot );
+ // get/set world rotation
+ LLQuaternion getWorldRotation();
+ LLQuaternion getLastWorldRotation();
+ void setWorldRotation( const LLQuaternion& rot );
- // get/set local scale
- const LLVector3& getScale();
- void setScale( const LLVector3& scale, bool apply_attachment_overrides = false );
+ // get/set local scale
+ const LLVector3& getScale();
+ void setScale( const LLVector3& scale, bool apply_attachment_overrides = false );
- // get/set world matrix
- const LLMatrix4 &getWorldMatrix();
- void setWorldMatrix( const LLMatrix4& mat );
+ // get/set world matrix
+ const LLMatrix4 &getWorldMatrix();
+ void setWorldMatrix( const LLMatrix4& mat );
const LLMatrix4a& getWorldMatrix4a();
- void updateWorldMatrixChildren();
- void updateWorldMatrixParent();
+ void updateWorldMatrixChildren();
+ void updateWorldMatrixParent();
- void updateWorldPRSParent();
+ void updateWorldPRSParent();
- void updateWorldMatrix();
+ void updateWorldMatrix();
- // get/set skin offset
- const LLVector3 &getSkinOffset();
- void setSkinOffset( const LLVector3 &offset);
+ // get/set skin offset
+ const LLVector3 &getSkinOffset();
+ void setSkinOffset( const LLVector3 &offset);
- LLXformMatrix *getXform() { return &mXform; }
+ LLXformMatrix *getXform() { return &mXform; }
- void clampRotation(LLQuaternion old_rot, LLQuaternion new_rot);
+ void clampRotation(LLQuaternion old_rot, LLQuaternion new_rot);
- virtual BOOL isAnimatable() const { return TRUE; }
+ virtual BOOL isAnimatable() const { return TRUE; }
- void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
- void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
- bool hasAttachmentPosOverride( LLVector3& pos, LLUUID& mesh_id ) const;
- void clearAttachmentPosOverrides();
+ void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
+ void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed );
+ bool hasAttachmentPosOverride( LLVector3& pos, LLUUID& mesh_id ) const;
+ void clearAttachmentPosOverrides();
void showAttachmentPosOverrides(const std::string& av_info) const;
- void addAttachmentScaleOverride( const LLVector3& scale, const LLUUID& mesh_id, const std::string& av_info );
- void removeAttachmentScaleOverride( const LLUUID& mesh_id, const std::string& av_info );
- bool hasAttachmentScaleOverride( LLVector3& scale, LLUUID& mesh_id ) const;
- void clearAttachmentScaleOverrides();
+ void addAttachmentScaleOverride( const LLVector3& scale, const LLUUID& mesh_id, const std::string& av_info );
+ void removeAttachmentScaleOverride( const LLUUID& mesh_id, const std::string& av_info );
+ bool hasAttachmentScaleOverride( LLVector3& scale, LLUUID& mesh_id ) const;
+ void clearAttachmentScaleOverrides();
void showAttachmentScaleOverrides(const std::string& av_info) const;
void getAllAttachmentPosOverrides(S32& num_pos_overrides,
std::set<LLVector3>& distinct_pos_overrides) const;
void getAllAttachmentScaleOverrides(S32& num_scale_overrides,
std::set<LLVector3>& distinct_scale_overrides) const;
-
+
// These are used in checks of whether a pos/scale override is considered significant.
bool aboveJointPosThreshold(const LLVector3& pos) const;
bool aboveJointScaleThreshold(const LLVector3& scale) const;