00001
00032 #ifndef LL_LLPOLYMORPH_H
00033 #define LL_LLPOLYMORPH_H
00034
00035 #include <string>
00036 #include <vector>
00037
00038 #include "llviewervisualparam.h"
00039
00040 class LLPolyMeshSharedData;
00041 class LLVOAvatar;
00042 class LLVector2;
00043 class LLViewerJointCollisionVolume;
00044
00045
00046
00047
00048 class LLPolyMorphData
00049 {
00050 public:
00051 LLPolyMorphData(char *morph_name);
00052 ~LLPolyMorphData();
00053
00054 BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
00055 char* loadASCII(char* text, LLPolyMeshSharedData *mesh);
00056 char* getName() { return mName; }
00057
00058 public:
00059 char* mName;
00060
00061
00062 U32 mNumIndices;
00063 U32* mVertexIndices;
00064 U32 mCurrentIndex;
00065 LLVector3* mCoords;
00066 LLVector3* mNormals;
00067 LLVector3* mBinormals;
00068 LLVector2* mTexCoords;
00069
00070 F32 mTotalDistortion;
00071 F32 mMaxDistortion;
00072 LLVector3 mAvgDistortion;
00073 LLPolyMeshSharedData* mMesh;
00074 };
00075
00076
00077
00078
00079 class LLPolyVertexMask
00080 {
00081 public:
00082 LLPolyVertexMask(LLPolyMorphData* morph_data);
00083 ~LLPolyVertexMask();
00084
00085 void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights);
00086 F32* getMorphMaskWeights();
00087
00088
00089 protected:
00090 F32* mWeights;
00091 LLPolyMorphData *mMorphData;
00092 BOOL mWeightsGenerated;
00093
00094 };
00095
00096
00097
00098
00099 struct LLPolyVolumeMorphInfo
00100 {
00101 LLPolyVolumeMorphInfo(LLString &name, LLVector3 &scale, LLVector3 &pos)
00102 : mName(name), mScale(scale), mPos(pos) {};
00103
00104 LLString mName;
00105 LLVector3 mScale;
00106 LLVector3 mPos;
00107 };
00108
00109 struct LLPolyVolumeMorph
00110 {
00111 LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
00112 : mVolume(volume), mScale(scale), mPos(pos) {};
00113
00114 LLViewerJointCollisionVolume* mVolume;
00115 LLVector3 mScale;
00116 LLVector3 mPos;
00117 };
00118
00119
00120
00121
00122
00123 class LLPolyMorphTargetInfo : public LLViewerVisualParamInfo
00124 {
00125 friend class LLPolyMorphTarget;
00126 public:
00127 LLPolyMorphTargetInfo();
00128 ~LLPolyMorphTargetInfo() {};
00129
00130 BOOL parseXml(LLXmlTreeNode* node);
00131
00132 protected:
00133 LLString mMorphName;
00134 BOOL mIsClothingMorph;
00135 typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t;
00136 volume_info_list_t mVolumeInfoList;
00137 };
00138
00139
00140
00141
00142
00143
00144
00145 class LLPolyMorphTarget : public LLViewerVisualParam
00146 {
00147 public:
00148 LLPolyMorphTarget(LLPolyMesh *poly_mesh);
00149 ~LLPolyMorphTarget();
00150
00151
00152 LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; }
00153
00154 BOOL setInfo(LLPolyMorphTargetInfo *info);
00155
00156
00158 void apply( ESex sex );
00159
00160
00161 F32 getTotalDistortion();
00162 const LLVector3& getAvgDistortion();
00163 F32 getMaxDistortion();
00164 LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
00165 const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
00166 const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
00167
00168 void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);
00169 void addPendingMorphMask() { mNumMorphMasksPending++; }
00170
00171 protected:
00172 LLPolyMorphData* mMorphData;
00173 LLPolyMesh* mMesh;
00174 LLPolyVertexMask * mVertMask;
00175 ESex mLastSex;
00176
00177 BOOL mNumMorphMasksPending;
00178
00179 typedef std::vector<LLPolyVolumeMorph> volume_list_t;
00180 volume_list_t mVolumeMorphs;
00181
00182 };
00183
00184 #endif // LL_LLPOLYMORPH_H