diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/llcharacter/llmotioncontroller.h | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/llcharacter/llmotioncontroller.h')
-rw-r--r-- | indra/llcharacter/llmotioncontroller.h | 482 |
1 files changed, 241 insertions, 241 deletions
diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index dea470cbd3..422a038da7 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -1,241 +1,241 @@ -/** - * @file llmotioncontroller.h - * @brief Implementation of LLMotionController 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$ - */ - -#ifndef LL_LLMOTIONCONTROLLER_H -#define LL_LLMOTIONCONTROLLER_H - -//----------------------------------------------------------------------------- -// Header files -//----------------------------------------------------------------------------- -#include <string> -#include <map> -#include <deque> - -#include "llmotion.h" -#include "llpose.h" -#include "llframetimer.h" -#include "llstatemachine.h" -#include "llstring.h" - -//----------------------------------------------------------------------------- -// Class predeclaration -// This is necessary because llcharacter.h includes this file. -//----------------------------------------------------------------------------- -class LLCharacter; - -//----------------------------------------------------------------------------- -// LLMotionRegistry -//----------------------------------------------------------------------------- -typedef LLMotion*(*LLMotionConstructor)(const LLUUID &id); - -class LLMotionRegistry -{ -public: - // Constructor - LLMotionRegistry(); - - // Destructor - ~LLMotionRegistry(); - - // adds motion classes to the registry - // returns true if successfull - bool registerMotion( const LLUUID& id, LLMotionConstructor create); - - // creates a new instance of a named motion - // returns NULL motion is not registered - LLMotion *createMotion( const LLUUID &id ); - - // initialization of motion failed, don't try to create this motion again - void markBad( const LLUUID& id ); - - -protected: - typedef std::map<LLUUID, LLMotionConstructor> motion_map_t; - motion_map_t mMotionTable; -}; - -//----------------------------------------------------------------------------- -// class LLMotionController -//----------------------------------------------------------------------------- -class LLMotionController -{ -public: - typedef std::list<LLMotion*> motion_list_t; - typedef std::set<LLMotion*> motion_set_t; - bool mIsSelf; - -public: - // Constructor - LLMotionController(); - - // Destructor - virtual ~LLMotionController(); - - // set associated character - // this must be called exactly once by the containing character class. - // this is generally done in the Character constructor - void setCharacter( LLCharacter *character ); - - // registers a motion with the controller - // (actually just forwards call to motion registry) - // returns true if successfull - bool registerMotion( const LLUUID& id, LLMotionConstructor create ); - - // creates a motion from the registry - LLMotion *createMotion( const LLUUID &id ); - - // unregisters a motion with the controller - // (actually just forwards call to motion registry) - // returns true if successfull - void removeMotion( const LLUUID& id ); - - // start motion - // begins playing the specified motion - // returns true if successful - bool startMotion( const LLUUID &id, F32 start_offset ); - - // stop motion - // stops a playing motion - // in reality, it begins the ease out transition phase - // returns true if successful - bool stopMotionLocally( const LLUUID &id, bool stop_immediate ); - - // Move motions from loading to loaded - void updateLoadingMotions(); - - // update motions - // invokes the update handlers for each active motion - // activates sequenced motions - // deactivates terminated motions` - void updateMotions(bool force_update = false); - - // minimal update (e.g. while hidden) - void updateMotionsMinimal(); - - void clearBlenders() { mPoseBlender.clearBlenders(); } - - // flush motions - // releases all motion instances - void flushAllMotions(); - - //Flush is a liar. - void deactivateAllMotions(); - - // pause and continue all motions - void pauseAllMotions(); - void unpauseAllMotions(); - bool isPaused() const { return mPaused; } - S32 getPausedFrame() const { return mPausedFrame; } - - void setTimeStep(F32 step); - F32 getTimeStep() const { return mTimeStep; } - - void setTimeFactor(F32 time_factor); - F32 getTimeFactor() const { return mTimeFactor; } - - F32 getAnimTime() const { return mAnimTime; } - - motion_list_t& getActiveMotions() { return mActiveMotions; } - - void incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions); - -//protected: - bool isMotionActive( LLMotion *motion ); - bool isMotionLoading( LLMotion *motion ); - LLMotion *findMotion( const LLUUID& id ) const; - - void dumpMotions(); - - const LLFrameTimer& getFrameTimer() { return mTimer; } - - static F32 getCurrentTimeFactor() { return sCurrentTimeFactor; }; - static void setCurrentTimeFactor(F32 factor) { sCurrentTimeFactor = factor; }; - -protected: - // internal operations act on motion instances directly - // as there can be duplicate motions per id during blending overlap - void deleteAllMotions(); - bool activateMotionInstance(LLMotion *motion, F32 time); - bool deactivateMotionInstance(LLMotion *motion); - void deprecateMotionInstance(LLMotion* motion); - bool stopMotionInstance(LLMotion *motion, bool stop_imemdiate); - void removeMotionInstance(LLMotion* motion); - void updateRegularMotions(); - void updateAdditiveMotions(); - void resetJointSignatures(); - void updateMotionsByType(LLMotion::LLMotionBlendType motion_type); - void updateIdleMotion(LLMotion* motionp); - void updateIdleActiveMotions(); - void purgeExcessMotions(); - void deactivateStoppedMotions(); - -protected: - F32 mTimeFactor; // 1.f for normal speed - static F32 sCurrentTimeFactor; // Value to use for initialization - static LLMotionRegistry sRegistry; - LLPoseBlender mPoseBlender; - - LLCharacter *mCharacter; - -// Life cycle of an animation: -// -// Animations are instantiated and immediately put in the mAllMotions map for their entire lifetime. -// If the animations depend on any asset data, the appropriate data is fetched from the data server, -// and the animation is put on the mLoadingMotions list. -// Once an animations is loaded, it will be initialized and put on the mLoadedMotions list. -// Any animation that is currently playing also sits in the mActiveMotions list. - - typedef std::map<LLUUID, LLMotion*> motion_map_t; - motion_map_t mAllMotions; - - motion_set_t mLoadingMotions; - motion_set_t mLoadedMotions; - motion_list_t mActiveMotions; - motion_set_t mDeprecatedMotions; - - LLFrameTimer mTimer; - F32 mPrevTimerElapsed; - F32 mAnimTime; - F32 mLastTime; - bool mHasRunOnce; - bool mPaused; - S32 mPausedFrame; - F32 mTimeStep; - S32 mTimeStepCount; - F32 mLastInterp; - - U8 mJointSignature[2][LL_CHARACTER_MAX_ANIMATED_JOINTS]; -private: - U32 mLastCountAfterPurge; //for logging and debugging purposes -}; - -//----------------------------------------------------------------------------- -// Class declaractions -//----------------------------------------------------------------------------- -#include "llcharacter.h" - -#endif // LL_LLMOTIONCONTROLLER_H - +/**
+ * @file llmotioncontroller.h
+ * @brief Implementation of LLMotionController 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$
+ */
+
+#ifndef LL_LLMOTIONCONTROLLER_H
+#define LL_LLMOTIONCONTROLLER_H
+
+//-----------------------------------------------------------------------------
+// Header files
+//-----------------------------------------------------------------------------
+#include <string>
+#include <map>
+#include <deque>
+
+#include "llmotion.h"
+#include "llpose.h"
+#include "llframetimer.h"
+#include "llstatemachine.h"
+#include "llstring.h"
+
+//-----------------------------------------------------------------------------
+// Class predeclaration
+// This is necessary because llcharacter.h includes this file.
+//-----------------------------------------------------------------------------
+class LLCharacter;
+
+//-----------------------------------------------------------------------------
+// LLMotionRegistry
+//-----------------------------------------------------------------------------
+typedef LLMotion*(*LLMotionConstructor)(const LLUUID &id);
+
+class LLMotionRegistry
+{
+public:
+ // Constructor
+ LLMotionRegistry();
+
+ // Destructor
+ ~LLMotionRegistry();
+
+ // adds motion classes to the registry
+ // returns true if successfull
+ bool registerMotion( const LLUUID& id, LLMotionConstructor create);
+
+ // creates a new instance of a named motion
+ // returns NULL motion is not registered
+ LLMotion *createMotion( const LLUUID &id );
+
+ // initialization of motion failed, don't try to create this motion again
+ void markBad( const LLUUID& id );
+
+
+protected:
+ typedef std::map<LLUUID, LLMotionConstructor> motion_map_t;
+ motion_map_t mMotionTable;
+};
+
+//-----------------------------------------------------------------------------
+// class LLMotionController
+//-----------------------------------------------------------------------------
+class LLMotionController
+{
+public:
+ typedef std::list<LLMotion*> motion_list_t;
+ typedef std::set<LLMotion*> motion_set_t;
+ bool mIsSelf;
+
+public:
+ // Constructor
+ LLMotionController();
+
+ // Destructor
+ virtual ~LLMotionController();
+
+ // set associated character
+ // this must be called exactly once by the containing character class.
+ // this is generally done in the Character constructor
+ void setCharacter( LLCharacter *character );
+
+ // registers a motion with the controller
+ // (actually just forwards call to motion registry)
+ // returns true if successfull
+ bool registerMotion( const LLUUID& id, LLMotionConstructor create );
+
+ // creates a motion from the registry
+ LLMotion *createMotion( const LLUUID &id );
+
+ // unregisters a motion with the controller
+ // (actually just forwards call to motion registry)
+ // returns true if successfull
+ void removeMotion( const LLUUID& id );
+
+ // start motion
+ // begins playing the specified motion
+ // returns true if successful
+ bool startMotion( const LLUUID &id, F32 start_offset );
+
+ // stop motion
+ // stops a playing motion
+ // in reality, it begins the ease out transition phase
+ // returns true if successful
+ bool stopMotionLocally( const LLUUID &id, bool stop_immediate );
+
+ // Move motions from loading to loaded
+ void updateLoadingMotions();
+
+ // update motions
+ // invokes the update handlers for each active motion
+ // activates sequenced motions
+ // deactivates terminated motions`
+ void updateMotions(bool force_update = false);
+
+ // minimal update (e.g. while hidden)
+ void updateMotionsMinimal();
+
+ void clearBlenders() { mPoseBlender.clearBlenders(); }
+
+ // flush motions
+ // releases all motion instances
+ void flushAllMotions();
+
+ //Flush is a liar.
+ void deactivateAllMotions();
+
+ // pause and continue all motions
+ void pauseAllMotions();
+ void unpauseAllMotions();
+ bool isPaused() const { return mPaused; }
+ S32 getPausedFrame() const { return mPausedFrame; }
+
+ void setTimeStep(F32 step);
+ F32 getTimeStep() const { return mTimeStep; }
+
+ void setTimeFactor(F32 time_factor);
+ F32 getTimeFactor() const { return mTimeFactor; }
+
+ F32 getAnimTime() const { return mAnimTime; }
+
+ motion_list_t& getActiveMotions() { return mActiveMotions; }
+
+ void incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions);
+
+//protected:
+ bool isMotionActive( LLMotion *motion );
+ bool isMotionLoading( LLMotion *motion );
+ LLMotion *findMotion( const LLUUID& id ) const;
+
+ void dumpMotions();
+
+ const LLFrameTimer& getFrameTimer() { return mTimer; }
+
+ static F32 getCurrentTimeFactor() { return sCurrentTimeFactor; };
+ static void setCurrentTimeFactor(F32 factor) { sCurrentTimeFactor = factor; };
+
+protected:
+ // internal operations act on motion instances directly
+ // as there can be duplicate motions per id during blending overlap
+ void deleteAllMotions();
+ bool activateMotionInstance(LLMotion *motion, F32 time);
+ bool deactivateMotionInstance(LLMotion *motion);
+ void deprecateMotionInstance(LLMotion* motion);
+ bool stopMotionInstance(LLMotion *motion, bool stop_imemdiate);
+ void removeMotionInstance(LLMotion* motion);
+ void updateRegularMotions();
+ void updateAdditiveMotions();
+ void resetJointSignatures();
+ void updateMotionsByType(LLMotion::LLMotionBlendType motion_type);
+ void updateIdleMotion(LLMotion* motionp);
+ void updateIdleActiveMotions();
+ void purgeExcessMotions();
+ void deactivateStoppedMotions();
+
+protected:
+ F32 mTimeFactor; // 1.f for normal speed
+ static F32 sCurrentTimeFactor; // Value to use for initialization
+ static LLMotionRegistry sRegistry;
+ LLPoseBlender mPoseBlender;
+
+ LLCharacter *mCharacter;
+
+// Life cycle of an animation:
+//
+// Animations are instantiated and immediately put in the mAllMotions map for their entire lifetime.
+// If the animations depend on any asset data, the appropriate data is fetched from the data server,
+// and the animation is put on the mLoadingMotions list.
+// Once an animations is loaded, it will be initialized and put on the mLoadedMotions list.
+// Any animation that is currently playing also sits in the mActiveMotions list.
+
+ typedef std::map<LLUUID, LLMotion*> motion_map_t;
+ motion_map_t mAllMotions;
+
+ motion_set_t mLoadingMotions;
+ motion_set_t mLoadedMotions;
+ motion_list_t mActiveMotions;
+ motion_set_t mDeprecatedMotions;
+
+ LLFrameTimer mTimer;
+ F32 mPrevTimerElapsed;
+ F32 mAnimTime;
+ F32 mLastTime;
+ bool mHasRunOnce;
+ bool mPaused;
+ S32 mPausedFrame;
+ F32 mTimeStep;
+ S32 mTimeStepCount;
+ F32 mLastInterp;
+
+ U8 mJointSignature[2][LL_CHARACTER_MAX_ANIMATED_JOINTS];
+private:
+ U32 mLastCountAfterPurge; //for logging and debugging purposes
+};
+
+//-----------------------------------------------------------------------------
+// Class declaractions
+//-----------------------------------------------------------------------------
+#include "llcharacter.h"
+
+#endif // LL_LLMOTIONCONTROLLER_H
+
|