llavatarjointmesh.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /**
  2. * @file llavatarjointmesh.h
  3. * @brief Declaration of LLAvatarJointMesh class
  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. #ifndef LL_LLAVATARJOINTMESH_H
  33. #define LL_LLAVATARJOINTMESH_H
  34. #include "llavatarjoint.h"
  35. #include "llgltexture.h"
  36. #include "llpolymesh.h"
  37. #include "llpreprocessor.h"
  38. #include "llcolor4.h"
  39. class LLCharacter;
  40. class LLDrawable;
  41. class LLFace;
  42. class LLTexLayerSet;
  43. typedef enum e_avatar_render_pass
  44. {
  45. AVATAR_RENDER_PASS_SINGLE,
  46. AVATAR_RENDER_PASS_CLOTHING_INNER,
  47. AVATAR_RENDER_PASS_CLOTHING_OUTER
  48. } EAvatarRenderPass;
  49. //-----------------------------------------------------------------------------
  50. // class LLSkinJoint
  51. //-----------------------------------------------------------------------------
  52. class LLSkinJoint
  53. {
  54. protected:
  55. LOG_CLASS(LLSkinJoint);
  56. public:
  57. LLSkinJoint();
  58. ~LLSkinJoint();
  59. bool setupSkinJoint(LLAvatarJoint* joint);
  60. static LLAvatarJoint* getBaseSkeletonAncestor(LLAvatarJoint* joint);
  61. private:
  62. static LLVector3 totalSkinOffset(LLAvatarJoint* joint);
  63. public:
  64. LLAvatarJoint* mJoint;
  65. LLVector3 mRootToJointSkinOffset;
  66. LLVector3 mRootToParentJointSkinOffset;
  67. };
  68. //-----------------------------------------------------------------------------
  69. // class LLAvatarJointMesh
  70. //-----------------------------------------------------------------------------
  71. class LLAvatarJointMesh : public virtual LLAvatarJoint
  72. {
  73. public:
  74. LLAvatarJointMesh();
  75. virtual ~LLAvatarJointMesh();
  76. // Gets the shape color
  77. void getColor(F32* red, F32* green, F32* blue, F32* alpha);
  78. // Sets the shape color
  79. void setColor(F32 red, F32 green, F32 blue, F32 alpha);
  80. void setColor(const LLColor4& color);
  81. // Sets the shininess
  82. LL_INLINE void setSpecular(const LLColor4& color, F32 shiny)
  83. {
  84. #if 0
  85. mSpecular = color;
  86. #endif
  87. mShiny = shiny;
  88. }
  89. // Sets the shape texture
  90. void setTexture(LLGLTexture* texture);
  91. bool hasGLTexture() const;
  92. LL_INLINE void setTestTexture(U32 name) { mTestImageName = name; }
  93. // Sets layer set responsible for a dynamic shape texture (takes precedence
  94. // over normal texture)
  95. void setLayerSet(LLTexLayerSet* layer_set);
  96. bool hasComposite() const;
  97. // Gets the poly mesh
  98. LL_INLINE LLPolyMesh* getMesh() { return mMesh; }
  99. // Sets the poly mesh
  100. void setMesh(LLPolyMesh* mesh);
  101. LL_INLINE LLFace* getFace() { return mFace; }
  102. // Sets up joint matrix data for rendering
  103. void setupJoint(LLAvatarJoint* current_joint);
  104. // Render time method to upload batches of joint matrices
  105. void uploadJointMatrices();
  106. // Sets ID for picking
  107. LL_INLINE void setMeshID(S32 id) { mMeshID = id; }
  108. // Gets ID for picking
  109. LL_INLINE S32 getMeshID() { return mMeshID; }
  110. LL_INLINE void setIsTransparent(bool b) { mIsTransparent = b; }
  111. private:
  112. // Allocate skin data
  113. bool allocateSkinData(U32 numSkinJoints);
  114. // Free skin data
  115. void freeSkinData();
  116. protected:
  117. LLPointer<LLGLTexture> mTexture; // ptr to a global texture
  118. LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
  119. LLFace* mFace; // ptr to a face w/ AGP copy of mesh
  120. LLSkinJoint* mSkinJoints;
  121. LLPolyMesh* mMesh; // ptr to a global polymesh
  122. LLColor4 mColor; // color value
  123. F32 mShiny; // shiny value
  124. S32 mMeshID;
  125. U32 mTestImageName; // handle to a temporary texture for previewing uploads
  126. U32 mFaceIndexCount;
  127. U32 mNumSkinJoints;
  128. #if 0 // Not used
  129. LLColor4 mSpecular; // specular color (always white for now)
  130. bool mCullBackFaces; // true by default
  131. #endif
  132. public:
  133. // RN: this is here for testing purposes
  134. static U32 sClothingMaskImageName;
  135. static LLColor4 sClothingInnerColor;
  136. };
  137. #endif // LL_LLAVATARJOINTMESH_H