00001 00032 #ifndef LL_LLANIMALCONTROLS_H 00033 #define LL_LLANIMALCONTROLS_H 00034 00035 #include "llhudobject.h" 00036 #include "llflexibleobject.h" 00037 00038 //----------------------------------------------------------------------------------- 00039 // Default setting for the attributes of a animalControls object... 00040 //----------------------------------------------------------------------------------- 00041 //const LLVector3 ANIMAL_CONTROLS_DEFAULT_ANCHOR_DIRECTION = LLVector3::z_axis; 00042 //const LLVector3 ANIMAL_CONTROLS_DEFAULT_ANCHOR_POSITION_OFFSET = LLVector3::zero; 00043 //const LLColor4 ANIMAL_CONTROLS_DEFAULT_COLOR = LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ); 00044 //const F32 ANIMAL_CONTROLS_DEFAULT_GRAVITY = 0.3f; 00045 //const F32 ANIMAL_CONTROLS_DEFAULT_TENSION = 10.0f; 00046 //const F32 ANIMAL_CONTROLS_DEFAULT_AIR_FRICTION = 10.0f; 00047 //const F32 ANIMAL_CONTROLS_DEFAULT_LENGTH = 1.0f; 00048 //const int ANIMAL_CONTROLS_DEFAULT_NUM_SECTIONS = 4; 00049 //const F32 ANIMAL_CONTROLS_DEFAULT_ANCHOR_RADIUS = 0.05f; 00050 //const F32 ANIMAL_CONTROLS_DEFAULT_RADIUS_CHANGE = -0.01f; 00051 00052 class LLViewerObject; 00053 00054 /*struct LLAnimalControlsBodyBehavior 00055 { 00056 LLVector3 mPosition; 00057 LLQuaternion mHipRotation; 00058 }; 00059 00060 class LLAnimalControlsHeadBehavior 00061 { 00062 private: 00063 LLVector3 mBodyPosition; 00064 LLQuaternion mBodyRotation; 00065 LLHUDFlexibleObject mFeather; 00066 LLVector3 mPosition; 00067 LLQuaternion mRotation; 00068 LLVector3 mFocusPosition; 00069 bool mEyesBlinking; 00070 F32 mEyeBlinkRate; 00071 00072 public: 00073 LLAnimalControlsHeadBehavior(); 00074 void setBodyPositionAndRotation( LLVector3 p, LLQuaternion r ); 00075 void setFocusPosition( LLVector3 focusPosition ); 00076 void update(); 00077 void render(); 00078 }; 00079 00080 00081 class LLAnimalControlsLegBehavior 00082 { 00083 private: 00084 LLVector3 mBodyPosition; 00085 LLQuaternion mBodyRotation; 00086 LLVector3 mHipAnchorPosition; 00087 bool mWalking; 00088 bool mIsLeft; 00089 00090 public: 00091 LLAnimalControlsLegBehavior(); 00092 void setBodyPositionAndRotation( LLVector3 p, LLQuaternion r ); 00093 void update(); 00094 void render(); 00095 }; 00096 00097 00098 class LLAnimalControlsVirtualServer 00099 { 00100 private: 00101 int fakeClock; 00102 LLVector3 focusPosition; 00103 bool settingFocusPosition; 00104 LLVector3 animalPosition; 00105 LLQuaternion animalRotation; 00106 00107 public: 00108 LLAnimalControlsVirtualServer(); 00109 bool getSettingFocusPosition(); 00110 LLVector3 getFocusPosition(); 00111 void update(); 00112 void setParentPositionAndRotation( LLVector3 p, LLQuaternion q ); 00113 }; 00114 00115 00116 //------------------------------------------------- 00117 // This structure is also used in the part of the 00118 // code that creates new animalControls objects. 00119 //------------------------------------------------- 00120 struct LLAnimalControlsAttributes 00121 { 00122 //LLVector3 mAnchorPositionOffset; 00123 //LLVector3 mAnchorDirection; 00124 //LLColor4 mColor; 00125 //F32 mAnchorRadius; 00126 //S32 mNumSections; 00127 //F32 mLength; 00128 //F32 mGravity; 00129 //F32 mAirFriction; 00130 //F32 mTension; 00131 //F32 mRadiusChange; 00132 bool mUsingBodyControls; 00133 bool mUsingHeadControls; 00134 bool mUsingTailControls; 00135 bool mUsingLegControls; 00136 00137 //------ the constructor for the structure ------------ 00138 LLAnimalControlsAttributes() 00139 { 00140 //mAnchorPositionOffset = ANIMAL_CONTROLS_DEFAULT_ANCHOR_DIRECTION; 00141 //mAnchorDirection = ANIMAL_CONTROLS_DEFAULT_ANCHOR_POSITION_OFFSET; 00142 //mAnchorRadius = ANIMAL_CONTROLS_DEFAULT_ANCHOR_RADIUS; 00143 //mColor = ANIMAL_CONTROLS_DEFAULT_COLOR; 00144 //mNumSections = ANIMAL_CONTROLS_DEFAULT_NUM_SECTIONS; 00145 //mLength = ANIMAL_CONTROLS_DEFAULT_LENGTH; 00146 //mGravity = ANIMAL_CONTROLS_DEFAULT_GRAVITY; 00147 //mAirFriction = ANIMAL_CONTROLS_DEFAULT_AIR_FRICTION; 00148 //mTension = ANIMAL_CONTROLS_DEFAULT_TENSION; 00149 //mRadiusChange = ANIMAL_CONTROLS_DEFAULT_RADIUS_CHANGE; 00150 } 00151 };// end of attributes structure 00152 00153 00154 00155 //--------------------------------------------------------- 00156 // The LLHUDAnimalControls class 00157 //--------------------------------------------------------- 00158 class LLHUDAnimalControls : public LLHUDObject 00159 { 00160 public: 00161 LLHUDAnimalControls(); 00162 void setParentObject( LLViewerObject * ); 00163 void setAttributes( LLAnimalControlsAttributes ); 00164 void markAsDead(); 00165 void update(); 00166 LLViewerObject * getParentObject(); 00167 void render(); 00168 00169 private: 00170 //-------------------------------------- 00171 // private members 00172 //-------------------------------------- 00173 LLViewerObject* mParentObject; 00174 LLAnimalControlsAttributes mAttributes; 00175 LLAnimalControlsHeadBehavior mHeadBehavior; 00176 LLAnimalControlsLegBehavior mLeftLegBehavior; 00177 LLAnimalControlsLegBehavior mRightLegBehavior; 00178 LLAnimalControlsVirtualServer mVirtualServer; 00179 00180 //-------------------------------------- 00181 // private methods 00182 //-------------------------------------- 00183 void updateVirtualServer(); 00184 void updateBodyBehavior(); 00185 void renderBodyBehavior(); 00186 //void updateLegBehavior(); 00187 //void renderLegBehavior(); 00188 //void updateHeadBehavior(); 00189 //void renderHeadBehavior(); 00190 00191 friend class LLHUDObject; 00192 00193 };// end of class definition 00194 00195 */ 00196 #endif // LL_LLANIMALCONTROLS_H