/indra/newview/llviewerjointattachment.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 112 lines · 47 code · 19 blank · 46 comment · 0 complexity · d1e07d191cbeefc4c4dea8cde630cdc0 MD5 · raw file

  1. /**
  2. * @file llviewerjointattachment.h
  3. * @brief Implementation of LLViewerJointAttachment class
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLVIEWERJOINTATTACHMENT_H
  27. #define LL_LLVIEWERJOINTATTACHMENT_H
  28. //-----------------------------------------------------------------------------
  29. // Header Files
  30. //-----------------------------------------------------------------------------
  31. #include "llviewerjoint.h"
  32. #include "llstring.h"
  33. #include "lluuid.h"
  34. class LLDrawable;
  35. class LLViewerObject;
  36. //-----------------------------------------------------------------------------
  37. // class LLViewerJointAttachment
  38. //-----------------------------------------------------------------------------
  39. class LLViewerJointAttachment :
  40. public LLViewerJoint
  41. {
  42. public:
  43. LLViewerJointAttachment();
  44. virtual ~LLViewerJointAttachment();
  45. //virtual U32 render( F32 pixelArea ); // Returns triangle count
  46. // Returns true if this object is transparent.
  47. // This is used to determine in which order to draw objects.
  48. /*virtual*/ BOOL isTransparent();
  49. // Draws the shape attached to a joint.
  50. // Called by render().
  51. /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
  52. /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
  53. //
  54. // accessors
  55. //
  56. void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; }
  57. void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; }
  58. BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; }
  59. void setGroup(S32 group) { mGroup = group; }
  60. void setOriginalPosition(LLVector3 &position);
  61. void setAttachmentVisibility(BOOL visible);
  62. void setIsHUDAttachment(BOOL is_hud) { mIsHUDAttachment = is_hud; }
  63. BOOL getIsHUDAttachment() const { return mIsHUDAttachment; }
  64. BOOL isAnimatable() const { return FALSE; }
  65. S32 getGroup() const { return mGroup; }
  66. S32 getPieSlice() const { return mPieSlice; }
  67. S32 getNumObjects() const { return mAttachedObjects.size(); }
  68. void clampObjectPosition();
  69. //
  70. // unique methods
  71. //
  72. BOOL addObject(LLViewerObject* object);
  73. void removeObject(LLViewerObject *object);
  74. //
  75. // attachments operations
  76. //
  77. BOOL isObjectAttached(const LLViewerObject *viewer_object) const;
  78. const LLViewerObject *getAttachedObject(const LLUUID &object_id) const;
  79. LLViewerObject *getAttachedObject(const LLUUID &object_id);
  80. // list of attachments for this joint
  81. typedef std::vector<LLViewerObject *> attachedobjs_vec_t;
  82. attachedobjs_vec_t mAttachedObjects;
  83. protected:
  84. void calcLOD();
  85. void setupDrawable(LLViewerObject *object);
  86. private:
  87. BOOL mVisibleInFirst;
  88. LLVector3 mOriginalPos;
  89. S32 mGroup;
  90. BOOL mIsHUDAttachment;
  91. S32 mPieSlice;
  92. };
  93. #endif // LL_LLVIEWERJOINTATTACHMENT_H