llemote.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * @file llemote.h
  3. * @brief Definition of LLEmote class
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  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. #ifndef LL_LLEMOTE_H
  33. #define LL_LLEMOTE_H
  34. #include "llmotion.h"
  35. #define MIN_REQUIRED_PIXEL_AREA_EMOTE 2000.f
  36. #define EMOTE_MORPH_FADEIN_TIME 0.3f
  37. #define EMOTE_MORPH_IN_TIME 1.1f
  38. #define EMOTE_MORPH_FADEOUT_TIME 1.4f
  39. class LLVisualParam;
  40. class LLEmote final : public LLMotion
  41. {
  42. protected:
  43. LOG_CLASS(LLEmote);
  44. public:
  45. LLEmote(const LLUUID& id);
  46. LL_INLINE static LLMotion* create(const LLUUID& id) { return new LLEmote(id); }
  47. // Motions must specify whether or not they loop
  48. LL_INLINE bool getLoop() override { return false; }
  49. // Motions must report their total duration
  50. LL_INLINE F32 getDuration() override { return EMOTE_MORPH_FADEIN_TIME +
  51. EMOTE_MORPH_IN_TIME +
  52. EMOTE_MORPH_FADEOUT_TIME; }
  53. // Motions must report their "ease in" duration
  54. LL_INLINE F32 getEaseInDuration() override { return EMOTE_MORPH_FADEIN_TIME; }
  55. // Motions must report their "ease out" duration.
  56. LL_INLINE F32 getEaseOutDuration() override { return EMOTE_MORPH_FADEOUT_TIME; }
  57. // Called to determine when a motion should be activated/deactivated based
  58. // on avatar pixel coverage.
  59. LL_INLINE F32 getMinPixelArea() override { return MIN_REQUIRED_PIXEL_AREA_EMOTE; }
  60. // Motions must report their priority
  61. LL_INLINE LLJoint::JointPriority getPriority() override { return LLJoint::MEDIUM_PRIORITY; }
  62. LL_INLINE LLMotionBlendType getBlendType() override { return NORMAL_BLEND; }
  63. // Run-time (post constructor) initialization, called after parameters have
  64. // been set. Must return true to indicate success and be available for
  65. // activation.
  66. LLMotionInitStatus onInitialize(LLCharacter* character) override;
  67. // Called when a motion is activated must return true to indicate success,
  68. // or else it will be deactivated.
  69. bool onActivate() override;
  70. // Called per time step. Must return true while it is active, and must
  71. // return false when the motion is completed.
  72. bool onUpdate(F32 time, U8* joint_mask) override;
  73. // Called when a motion is deactivated
  74. void onDeactivate() override;
  75. LL_INLINE bool canDeprecate() override { return false; }
  76. protected:
  77. LLCharacter* mCharacter;
  78. LLVisualParam* mParam;
  79. };
  80. #endif // LL_LLEMOTE_H