PageRenderTime 81ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llviewerjoint.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 164 lines | 74 code | 29 blank | 61 comment | 0 complexity | 18c28ebab7d4ff1036d38c617f701ff9 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewerjoint.h
  3. * @brief Implementation of LLViewerJoint class
  4. *
  5. * $LicenseInfo:firstyear=2001&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_LLVIEWERJOINT_H
  27. #define LL_LLVIEWERJOINT_H
  28. //-----------------------------------------------------------------------------
  29. // Header Files
  30. //-----------------------------------------------------------------------------
  31. #include "lljoint.h"
  32. class LLFace;
  33. class LLViewerJointMesh;
  34. //-----------------------------------------------------------------------------
  35. // class LLViewerJoint
  36. //-----------------------------------------------------------------------------
  37. class LLViewerJoint :
  38. public LLJoint
  39. {
  40. public:
  41. LLViewerJoint();
  42. LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
  43. virtual ~LLViewerJoint();
  44. // Gets the validity of this joint
  45. BOOL getValid() { return mValid; }
  46. // Sets the validity of this joint
  47. virtual void setValid( BOOL valid, BOOL recursive=FALSE );
  48. // Primarily for debugging and character setup
  49. // Derived classes may add text/graphic output.
  50. // Draw skeleton graphic for debugging and character setup
  51. void renderSkeleton(BOOL recursive=TRUE); // debug only (unused)
  52. // Draws a bone graphic to the parent joint.
  53. // Derived classes may add text/graphic output.
  54. // Called by renderSkeleton().
  55. void drawBone(); // debug only (unused)
  56. // Render character hierarchy.
  57. // Traverses the entire joint hierarchy, setting up
  58. // transforms and calling the drawShape().
  59. // Derived classes may add text/graphic output.
  60. virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ); // Returns triangle count
  61. // Returns true if this object is transparent.
  62. // This is used to determine in which order to draw objects.
  63. virtual BOOL isTransparent();
  64. // Returns true if this object should inherit scale modifiers from its immediate parent
  65. virtual BOOL inheritScale() { return FALSE; }
  66. // Draws the shape attached to a joint.
  67. // Called by render().
  68. virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
  69. virtual void drawNormals() {}
  70. enum Components
  71. {
  72. SC_BONE = 1,
  73. SC_JOINT = 2,
  74. SC_AXES = 4
  75. };
  76. // Selects which skeleton components to draw
  77. void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
  78. // Returns which skeleton components are enables for drawing
  79. U32 getSkeletonComponents() { return mComponents; }
  80. // Sets the level of detail for this node as a minimum
  81. // pixel area threshold. If the current pixel area for this
  82. // object is less than the specified threshold, the node is
  83. // not traversed. In addition, if a value is specified (not
  84. // default of 0.0), and the pixel area is larger than the
  85. // specified minimum, the node is rendered, but no other siblings
  86. // of this node under the same parent will be.
  87. F32 getLOD() { return mMinPixelArea; }
  88. void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
  89. // Sets the OpenGL selection stack name that is pushed and popped
  90. // with this joint state. The default value indicates that no name
  91. // should be pushed/popped.
  92. enum PickName
  93. {
  94. PN_DEFAULT = -1,
  95. PN_0 = 0,
  96. PN_1 = 1,
  97. PN_2 = 2,
  98. PN_3 = 3,
  99. PN_4 = 4,
  100. PN_5 = 5
  101. };
  102. void setPickName(PickName name) { mPickName = name; }
  103. PickName getPickName() { return mPickName; }
  104. virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
  105. virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
  106. virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
  107. virtual void updateJointGeometry();
  108. virtual void dump();
  109. void setVisible( BOOL visible, BOOL recursive );
  110. // Takes meshes in mMeshParts and sets each one as a child joint
  111. void setMeshesToChildren();
  112. public:
  113. static BOOL sDisableLOD;
  114. std::vector<LLViewerJointMesh*> mMeshParts;
  115. void setMeshID( S32 id ) {mMeshID = id;}
  116. protected:
  117. void init();
  118. BOOL mValid;
  119. U32 mComponents;
  120. F32 mMinPixelArea;
  121. PickName mPickName;
  122. BOOL mVisible;
  123. S32 mMeshID;
  124. };
  125. class LLViewerJointCollisionVolume : public LLViewerJoint
  126. {
  127. public:
  128. LLViewerJointCollisionVolume();
  129. LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL);
  130. virtual ~LLViewerJointCollisionVolume() {};
  131. virtual BOOL inheritScale() { return TRUE; }
  132. void renderCollision();
  133. LLVector3 getVolumePos(LLVector3 &offset);
  134. };
  135. #endif // LL_LLVIEWERJOINT_H