00001
00032 #ifndef LL_LLVIEWERJOINTMESH_H
00033 #define LL_LLVIEWERJOINTMESH_H
00034
00035 #include "llviewerjoint.h"
00036 #include "llviewerimage.h"
00037 #include "llpolymesh.h"
00038 #include "v4color.h"
00039 #include "llapr.h"
00040
00041 class LLDrawable;
00042 class LLFace;
00043 class LLCharacter;
00044 class LLTexLayerSet;
00045
00046 typedef enum e_avatar_render_pass
00047 {
00048 AVATAR_RENDER_PASS_SINGLE,
00049 AVATAR_RENDER_PASS_CLOTHING_INNER,
00050 AVATAR_RENDER_PASS_CLOTHING_OUTER
00051 } EAvatarRenderPass;
00052
00053 class LLSkinJoint
00054 {
00055 public:
00056 LLSkinJoint();
00057 ~LLSkinJoint();
00058 BOOL setupSkinJoint( LLViewerJoint *joint);
00059
00060 LLViewerJoint *mJoint;
00061 LLVector3 mRootToJointSkinOffset;
00062 LLVector3 mRootToParentJointSkinOffset;
00063 };
00064
00065
00066
00067
00068 class LLViewerJointMesh : public LLViewerJoint
00069 {
00070 protected:
00071 LLColor4 mColor;
00072
00073 F32 mShiny;
00074 LLPointer<LLViewerImage> mTexture;
00075 LLTexLayerSet* mLayerSet;
00076 U32 mTestImageName;
00077 LLPolyMesh* mMesh;
00078 BOOL mCullBackFaces;
00079 LLFace* mFace;
00080
00081 U32 mFaceIndexCount;
00082 BOOL mIsTransparent;
00083
00084 U32 mNumSkinJoints;
00085 LLSkinJoint* mSkinJoints;
00086 S32 mMeshID;
00087
00088 public:
00089 static BOOL sPipelineRender;
00090
00091 static U32 sClothingMaskImageName;
00092 static EAvatarRenderPass sRenderPass;
00093 static LLColor4 sClothingInnerColor;
00094
00095 public:
00096
00097 LLViewerJointMesh();
00098
00099
00100 virtual ~LLViewerJointMesh();
00101
00102
00103 void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
00104
00105
00106 void setColor( F32 red, F32 green, F32 blue, F32 alpha );
00107
00108
00109 void setSpecular( const LLColor4& color, F32 shiny ) { mShiny = shiny; };
00110
00111
00112 void setTexture( LLViewerImage *texture );
00113
00114 void setTestTexture( U32 name ) { mTestImageName = name; }
00115
00116
00117 void setLayerSet( LLTexLayerSet* layer_set );
00118
00119
00120 LLPolyMesh *getMesh();
00121
00122
00123 void setMesh( LLPolyMesh *mesh );
00124
00125
00126 void setupJoint(LLViewerJoint* current_joint);
00127
00128
00129 void uploadJointMatrices();
00130
00131
00132 void setMeshID( S32 id ) {mMeshID = id;}
00133
00134
00135 S32 getMeshID() { return mMeshID; }
00136
00137
00138 void drawBone();
00139 BOOL isTransparent();
00140 U32 drawShape( F32 pixelArea, BOOL first_pass );
00141
00142 void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
00143 void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE);
00144 BOOL updateLOD(F32 pixel_area, BOOL activate);
00145 void updateGeometry();
00146 void dump();
00147
00148 void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
00149
00150 BOOL isAnimatable() { return FALSE; }
00151 void writeCAL3D(apr_file_t* fp, S32 material_num, LLCharacter* characterp);
00152
00153
00154
00155
00156
00157
00158
00159 static void updateGeometryOriginal(LLFace* face, LLPolyMesh* mesh);
00160
00161 static void updateGeometryVectorized(LLFace* face, LLPolyMesh* mesh);
00162 static void updateGeometrySSE(LLFace* face, LLPolyMesh* mesh);
00163 static void updateGeometrySSE2(LLFace* face, LLPolyMesh* mesh);
00164
00165
00166 static void (*sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh);
00167
00168 private:
00169
00170 BOOL allocateSkinData( U32 numSkinJoints );
00171
00172 S32 getBoundJointsByIndex(S32 index, S32 &joint_a, S32& joint_b);
00173
00174
00175 void freeSkinData();
00176 };
00177
00178 #endif // LL_LLVIEWERJOINTMESH_H