PageRenderTime 61ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llviewerjointmesh.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 159 lines | 79 code | 33 blank | 47 comment | 0 complexity | 5eddae55fc47a36f7fcd31494046b03e MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewerjointmesh.h
  3. * @brief Implementation of LLViewerJointMesh 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_LLVIEWERJOINTMESH_H
  27. #define LL_LLVIEWERJOINTMESH_H
  28. #include "llviewerjoint.h"
  29. #include "llviewertexture.h"
  30. #include "llpolymesh.h"
  31. #include "v4color.h"
  32. class LLDrawable;
  33. class LLFace;
  34. class LLCharacter;
  35. class LLTexLayerSet;
  36. typedef enum e_avatar_render_pass
  37. {
  38. AVATAR_RENDER_PASS_SINGLE,
  39. AVATAR_RENDER_PASS_CLOTHING_INNER,
  40. AVATAR_RENDER_PASS_CLOTHING_OUTER
  41. } EAvatarRenderPass;
  42. class LLSkinJoint
  43. {
  44. public:
  45. LLSkinJoint();
  46. ~LLSkinJoint();
  47. BOOL setupSkinJoint( LLViewerJoint *joint);
  48. LLViewerJoint *mJoint;
  49. LLVector3 mRootToJointSkinOffset;
  50. LLVector3 mRootToParentJointSkinOffset;
  51. };
  52. //-----------------------------------------------------------------------------
  53. // class LLViewerJointMesh
  54. //-----------------------------------------------------------------------------
  55. class LLViewerJointMesh : public LLViewerJoint
  56. {
  57. protected:
  58. LLColor4 mColor; // color value
  59. // LLColor4 mSpecular; // specular color (always white for now)
  60. F32 mShiny; // shiny value
  61. LLPointer<LLViewerTexture> mTexture; // ptr to a global texture
  62. LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
  63. U32 mTestImageName; // handle to a temporary texture for previewing uploads
  64. LLPolyMesh* mMesh; // ptr to a global polymesh
  65. BOOL mCullBackFaces; // true by default
  66. LLFace* mFace; // ptr to a face w/ AGP copy of mesh
  67. U32 mFaceIndexCount;
  68. BOOL mIsTransparent;
  69. U32 mNumSkinJoints;
  70. LLSkinJoint* mSkinJoints;
  71. S32 mMeshID;
  72. public:
  73. static BOOL sPipelineRender;
  74. //RN: this is here for testing purposes
  75. static U32 sClothingMaskImageName;
  76. static EAvatarRenderPass sRenderPass;
  77. static LLColor4 sClothingInnerColor;
  78. public:
  79. // Constructor
  80. LLViewerJointMesh();
  81. // Destructor
  82. virtual ~LLViewerJointMesh();
  83. // Gets the shape color
  84. void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
  85. // Sets the shape color
  86. void setColor( F32 red, F32 green, F32 blue, F32 alpha );
  87. // Sets the shininess
  88. void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
  89. // Sets the shape texture
  90. void setTexture( LLViewerTexture *texture );
  91. void setTestTexture( U32 name ) { mTestImageName = name; }
  92. // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
  93. void setLayerSet( LLTexLayerSet* layer_set );
  94. // Gets the poly mesh
  95. LLPolyMesh *getMesh();
  96. // Sets the poly mesh
  97. void setMesh( LLPolyMesh *mesh );
  98. // Sets up joint matrix data for rendering
  99. void setupJoint(LLViewerJoint* current_joint);
  100. // Render time method to upload batches of joint matrices
  101. void uploadJointMatrices();
  102. // Sets ID for picking
  103. void setMeshID( S32 id ) {mMeshID = id;}
  104. // Gets ID for picking
  105. S32 getMeshID() { return mMeshID; }
  106. // overloaded from base class
  107. /*virtual*/ void drawBone();
  108. /*virtual*/ BOOL isTransparent();
  109. /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
  110. /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
  111. /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
  112. /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
  113. /*virtual*/ void updateJointGeometry();
  114. /*virtual*/ void dump();
  115. void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
  116. /*virtual*/ BOOL isAnimatable() const { return FALSE; }
  117. private:
  118. //copy mesh into given face's vertex buffer, applying current animation pose
  119. static void updateGeometry(LLFace* face, LLPolyMesh* mesh);
  120. private:
  121. // Allocate skin data
  122. BOOL allocateSkinData( U32 numSkinJoints );
  123. // Free skin data
  124. void freeSkinData();
  125. };
  126. #endif // LL_LLVIEWERJOINTMESH_H