llvoavatarpuppet.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /**
  2. * @file llvoavatarpuppet.h
  3. * @brief Special dummy avatar used to drive rigged meshes.
  4. *
  5. * $LicenseInfo:firstyear=2017&license=viewergpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2017, 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_VOAVATARPUPPET_H
  33. #define LL_VOAVATARPUPPET_H
  34. #include "boost/signals2.hpp"
  35. #include "llvoavatar.h"
  36. #include "llvovolume.h"
  37. class LLVOAvatarPuppet final : public LLVOAvatar
  38. {
  39. LOG_CLASS(LLVOAvatarPuppet);
  40. public:
  41. LLVOAvatarPuppet(const LLUUID& id, LLViewerRegion* regionp);
  42. void initInstance() override;
  43. bool isImpostor() override;
  44. void matchVolumeTransform();
  45. void updateVolumeGeom();
  46. void setGlobalScale(F32 scale);
  47. void recursiveScaleJoint(LLJoint* joint, F32 factor);
  48. static LLVOAvatarPuppet* createAvatarPuppet(LLVOVolume* obj);
  49. // Delayed kill so we do not make graphics pipeline unhappy calling
  50. // markDead() inside other graphics pipeline operations.
  51. LL_INLINE void markForDeath()
  52. {
  53. mMarkedForDeath = true;
  54. mRootVolp = NULL;
  55. }
  56. void markDead() override;
  57. bool isPuppetAvatar() const override { return true; }
  58. LLVOAvatar* getAttachedAvatar() override;
  59. LLVOAvatar* getAttachedAvatar() const override;
  60. void idleUpdate(F64 time) override;
  61. U32 getPartitionType() const override;
  62. LL_INLINE bool useImpostors() override { return sUsePuppetImpostors; }
  63. LL_INLINE U32 getMaxNonImpostors() override { return sMaxNonImpostorsPuppets; }
  64. bool isTooComplex() const override;
  65. void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes);
  66. void updateAnimations();
  67. LLViewerObject* lineSegmentIntersectRiggedAttachments(
  68. const LLVector4a& start,
  69. const LLVector4a& end,
  70. S32 face = -1,
  71. bool pick_transparent = false,
  72. bool pick_rigged = false,
  73. S32* face_hit = NULL,
  74. LLVector4a* intersection = NULL,
  75. LLVector2* tex_coord = NULL,
  76. LLVector4a* normal = NULL,
  77. LLVector4a* tangent = NULL) override;
  78. #if 0 // *TODO ?
  79. void updateDebugText() override;
  80. #endif
  81. bool shouldRenderRigged() const override;
  82. static void onRegionChanged();
  83. // NOTE: DO NOT convert to safe_hmap: it would crash when using anything
  84. // else than std or boost containers... HB
  85. typedef boost::unordered_map<LLUUID,
  86. LLVOAvatar::anim_map_t> signaled_anim_map_t;
  87. LL_INLINE static signaled_anim_map_t& getSignaledAnimMap()
  88. {
  89. return sSignaledAnimMap;
  90. }
  91. private:
  92. void getNewConstraintFixups(LLVector3& pos_fixup, F32& scale_fixup) const;
  93. public:
  94. LLVOVolume* mRootVolp;
  95. bool mPlaying;
  96. static boost::signals2::connection sRegionChangedSlot;
  97. private:
  98. bool mMarkedForDeath;
  99. bool mRegionChanged;
  100. F32 mGlobalScale;
  101. F32 mScaleConstraintFixup;
  102. LLVector3 mPositionConstraintFixup;
  103. // Stores information about previously requested animations, by object Id.
  104. // Pointlessly implemented as a LLSingleton (LLObjectSignaledAnimationMap)
  105. // in LL's viewer; the motto at LL is "why making things simple and fast,
  106. // when you can make them complicated and slow ?"... HB
  107. static signaled_anim_map_t sSignaledAnimMap;
  108. };
  109. #endif //LL_VOAVATARPUPPET_H