llvisualparamhint.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * @file llvisualparamhint.h
  3. * @brief A dynamic texture class for displaying avatar visual params effects
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-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. // Note: probably because of obscure pre-historical reasons, this file is
  33. // named "lltoolmorph.h" in LL's viewer sources. I renamed it based on the
  34. // class it declares instead. HB
  35. #ifndef LL_LLVISUALPARAMHINT_H
  36. #define LL_LLVISUALPARAMHINT_H
  37. #include "llui.h"
  38. #include "llviewervisualparam.h"
  39. #include "lldynamictexture.h"
  40. class LLJoint;
  41. class LLPolyMesh;
  42. class LLViewerJointMesh;
  43. class LLViewerObject;
  44. class LLVisualParamHint final : public LLViewerDynamicTexture
  45. {
  46. protected:
  47. LOG_CLASS(LLVisualParamHint);
  48. protected:
  49. ~LLVisualParamHint() override;
  50. public:
  51. LLVisualParamHint(S32 pos_x, S32 pos_y, S32 width, S32 height,
  52. LLViewerJointMesh* meshp, LLViewerVisualParam* paramp,
  53. LLWearable* wearablep, F32 param_weight,
  54. LLJoint* jointp);
  55. S8 getType() const override;
  56. bool needsRender() override;
  57. void preRender(bool clear_depth) override;
  58. bool render() override;
  59. void setWearable(LLWearable* wearablep, LLViewerVisualParam* paramp);
  60. LL_INLINE void requestUpdate(S32 delay_frames)
  61. {
  62. mNeedsUpdate = true;
  63. mDelayFrames = delay_frames;
  64. }
  65. LL_INLINE void setUpdateDelayFrames(S32 delay) { mDelayFrames = delay; }
  66. void draw();
  67. LL_INLINE LLViewerVisualParam* getVisualParam() { return mVisualParam; }
  68. LL_INLINE F32 getVisualParamWeight() { return mVisualParamWeight; }
  69. LL_INLINE bool getVisible() { return mIsVisible; }
  70. LL_INLINE void setAllowsUpdates(bool b) { mAllowsUpdates = b; }
  71. LL_INLINE const LLRect& getRect() { return mRect; }
  72. // Requests updates for all instances (excluding two possible exceptions)
  73. // Grungy but efficient.
  74. static void requestHintUpdates(LLVisualParamHint* exception1 = NULL,
  75. LLVisualParamHint* exception2 = NULL);
  76. protected:
  77. LLViewerJointMesh* mJointMesh; // mesh that this distortion applies to
  78. LLViewerVisualParam* mVisualParam; // visual param applied by this hint
  79. LLWearable* mWearablePtr; // wearable we're editing
  80. LLJoint* mCamTargetJoint; // joint to target with preview camera
  81. LLUIImagePtr mBackgroundp;
  82. LLRect mRect;
  83. S32 mDelayFrames; // updates are blocked for this many frames
  84. F32 mVisualParamWeight; // weight for this visual parameter
  85. F32 mLastParamWeight;
  86. bool mNeedsUpdate; // does this texture need to be re-rendered?
  87. bool mAllowsUpdates; // updates are blocked unless this is true
  88. bool mIsVisible; // is this distortion hint visible ?
  89. typedef std::set<LLVisualParamHint*> instance_list_t;
  90. static instance_list_t sInstances;
  91. };
  92. // This class resets avatar data at the end of an update cycle
  93. class LLVisualParamReset final : public LLViewerDynamicTexture
  94. {
  95. public:
  96. LLVisualParamReset();
  97. bool render() override;
  98. S8 getType() const override;
  99. public:
  100. static bool sDirty;
  101. };
  102. #endif // LL_LLVISUALPARAMHINT_H