Annotation of /trunk/indra/llcharacter/lljointstate.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file lljointstate.h | ||
| 3 : | * @brief Implementation of LLJointState class. | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2001-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 17 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 18 : | * it is applied to this Source Code. View the full text of the exception | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLJOINTSTATE_H | ||
| 34 : | #define LL_LLJOINTSTATE_H | ||
| 35 : | |||
| 36 : | //----------------------------------------------------------------------------- | ||
| 37 : | // Header Files | ||
| 38 : | //----------------------------------------------------------------------------- | ||
| 39 : | #include "lljoint.h" | ||
| 40 : | #include "llmemory.h" | ||
| 41 : | |||
| 42 : | //----------------------------------------------------------------------------- | ||
| 43 : | // class LLJointState | ||
| 44 : | //----------------------------------------------------------------------------- | ||
| 45 : | class LLJointState : public LLRefCount | ||
| 46 : | { | ||
| 47 : | public: | ||
| 48 : | enum BlendPhase | ||
| 49 : | { | ||
| 50 : | INACTIVE, | ||
| 51 : | EASE_IN, | ||
| 52 : | ACTIVE, | ||
| 53 : | EASE_OUT | ||
| 54 : | }; | ||
| 55 : | protected: | ||
| 56 : | // associated joint | ||
| 57 : | LLJoint *mJoint; | ||
| 58 : | |||
| 59 : | // indicates which members are used | ||
| 60 : | U32 mUsage; | ||
| 61 : | |||
| 62 : | // indicates weighted effect of this joint | ||
| 63 : | F32 mWeight; | ||
| 64 : | |||
| 65 : | // transformation members | ||
| 66 : | LLVector3 mPosition; // position relative to parent joint | ||
| 67 : | LLQuaternion mRotation; // joint rotation relative to parent joint | ||
| 68 : | LLVector3 mScale; // scale relative to rotated frame | ||
| 69 : | LLJoint::JointPriority mPriority; // how important this joint state is relative to others | ||
| 70 : | public: | ||
| 71 : | // Constructor | ||
| 72 : | LLJointState() | ||
| 73 : | { | ||
| 74 : | mUsage = 0; | ||
| 75 : | mJoint = NULL; | ||
| 76 : | mUsage = 0; | ||
| 77 : | mWeight = 0.f; | ||
| 78 : | mPriority = LLJoint::USE_MOTION_PRIORITY; | ||
| 79 : | } | ||
| 80 : | |||
| 81 : | LLJointState(LLJoint* joint) | ||
| 82 : | { | ||
| 83 : | mUsage = 0; | ||
| 84 : | mJoint = joint; | ||
| 85 : | mUsage = 0; | ||
| 86 : | mWeight = 0.f; | ||
| 87 : | mPriority = LLJoint::USE_MOTION_PRIORITY; | ||
| 88 : | } | ||
| 89 : | |||
| 90 : | // joint that this state is applied to | ||
| 91 : | LLJoint* getJoint() { return mJoint; } | ||
| 92 : | const LLJoint* getJoint() const { return mJoint; } | ||
| 93 : | BOOL setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } | ||
| 94 : | |||
| 95 : | // transform type (bitwise flags can be combined) | ||
| 96 : | // Note that these are set automatically when various | ||
| 97 : | // member setPos/setRot/setScale functions are called. | ||
| 98 : | enum Usage | ||
| 99 : | { | ||
| 100 : | POS = 1, | ||
| 101 : | ROT = 2, | ||
| 102 : | SCALE = 4, | ||
| 103 : | }; | ||
| 104 : | U32 getUsage() const { return mUsage; } | ||
| 105 : | void setUsage( U32 usage ) { mUsage = usage; } | ||
| 106 : | F32 getWeight() const { return mWeight; } | ||
| 107 : | void setWeight( F32 weight ) { mWeight = weight; } | ||
| 108 : | |||
| 109 : | // get/set position | ||
| 110 : | const LLVector3& getPosition() const { return mPosition; } | ||
| 111 : | void setPosition( const LLVector3& pos ) { llassert(mUsage & POS); mPosition = pos; } | ||
| 112 : | |||
| 113 : | // get/set rotation | ||
| 114 : | const LLQuaternion& getRotation() const { return mRotation; } | ||
| 115 : | void setRotation( const LLQuaternion& rot ) { llassert(mUsage & ROT); mRotation = rot; } | ||
| 116 : | |||
| 117 : | // get/set scale | ||
| 118 : | const LLVector3& getScale() const { return mScale; } | ||
| 119 : | void setScale( const LLVector3& scale ) { llassert(mUsage & SCALE); mScale = scale; } | ||
| 120 : | |||
| 121 : | // get/set priority | ||
| 122 : | LLJoint::JointPriority getPriority() const { return mPriority; } | ||
| 123 : | void setPriority( LLJoint::JointPriority priority ) { mPriority = priority; } | ||
| 124 : | |||
| 125 : | protected: | ||
| 126 : | // Destructor | ||
| 127 : | virtual ~LLJointState() | ||
| 128 : | { | ||
| 129 : | } | ||
| 130 : | |||
| 131 : | }; | ||
| 132 : | |||
| 133 : | #endif // LL_LLJOINTSTATE_H | ||
| 134 : |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

