Annotation of /trunk/indra/newview/lltexlayer.h
Parent Directory
|
Revision Log
Revision 138 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file lltexlayer.h | ||
| 3 : | * @brief A texture layer. Used for avatars. | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2002-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 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 : | |||
| 33 : | #ifndef LL_LLTEXLAYER_H | ||
| 34 : | #define LL_LLTEXLAYER_H | ||
| 35 : | |||
| 36 : | #include <deque> | ||
| 37 : | #include "llassetstorage.h" | ||
| 38 : | #include "lldynamictexture.h" | ||
| 39 : | #include "llrect.h" | ||
| 40 : | #include "llstring.h" | ||
| 41 : | #include "lluuid.h" | ||
| 42 : | #include "llviewerimage.h" | ||
| 43 : | #include "llviewervisualparam.h" | ||
| 44 : | mjm | 137 | #include "llvoavatardefines.h" |
| 45 : | mjm | 135 | #include "llwearable.h" |
| 46 : | #include "v4color.h" | ||
| 47 : | #include "llfloater.h" | ||
| 48 : | |||
| 49 : | class LLTexLayerSetInfo; | ||
| 50 : | class LLTexLayerSet; | ||
| 51 : | class LLTexLayerInfo; | ||
| 52 : | class LLTexLayer; | ||
| 53 : | class LLImageGL; | ||
| 54 : | class LLImageTGA; | ||
| 55 : | class LLTexGlobalColorInfo; | ||
| 56 : | class LLTexLayerParamAlphaInfo; | ||
| 57 : | class LLTexLayerParamAlpha; | ||
| 58 : | class LLTexParamColorInfo; | ||
| 59 : | class LLTexParamColor; | ||
| 60 : | class LLPolyMesh; | ||
| 61 : | class LLXmlTreeNode; | ||
| 62 : | class LLImageRaw; | ||
| 63 : | class LLPolyMorphTarget; | ||
| 64 : | |||
| 65 : | class LLTextureCtrl; | ||
| 66 : | class LLVOAvatar; | ||
| 67 : | |||
| 68 : | |||
| 69 : | enum EColorOperation | ||
| 70 : | { | ||
| 71 : | OP_ADD = 0, | ||
| 72 : | OP_MULTIPLY = 1, | ||
| 73 : | OP_BLEND = 2, | ||
| 74 : | OP_COUNT = 3 // Number of operations | ||
| 75 : | }; | ||
| 76 : | |||
| 77 : | |||
| 78 : | //----------------------------------------------------------------------------- | ||
| 79 : | // LLTexLayerParamAlphaInfo | ||
| 80 : | //----------------------------------------------------------------------------- | ||
| 81 : | class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo | ||
| 82 : | { | ||
| 83 : | friend class LLTexLayerParamAlpha; | ||
| 84 : | public: | ||
| 85 : | LLTexLayerParamAlphaInfo(); | ||
| 86 : | /*virtual*/ ~LLTexLayerParamAlphaInfo() {}; | ||
| 87 : | |||
| 88 : | /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); | ||
| 89 : | |||
| 90 : | protected: | ||
| 91 : | std::string mStaticImageFileName; | ||
| 92 : | BOOL mMultiplyBlend; | ||
| 93 : | BOOL mSkipIfZeroWeight; | ||
| 94 : | F32 mDomain; | ||
| 95 : | }; | ||
| 96 : | |||
| 97 : | //----------------------------------------------------------------------------- | ||
| 98 : | // LLTexParamColorInfo | ||
| 99 : | //----------------------------------------------------------------------------- | ||
| 100 : | class LLTexParamColorInfo : public LLViewerVisualParamInfo | ||
| 101 : | { | ||
| 102 : | friend class LLTexParamColor; | ||
| 103 : | |||
| 104 : | public: | ||
| 105 : | LLTexParamColorInfo(); | ||
| 106 : | virtual ~LLTexParamColorInfo() {}; | ||
| 107 : | BOOL parseXml( LLXmlTreeNode* node ); | ||
| 108 : | |||
| 109 : | protected: | ||
| 110 : | enum { MAX_COLOR_VALUES = 20 }; | ||
| 111 : | EColorOperation mOperation; | ||
| 112 : | LLColor4 mColors[MAX_COLOR_VALUES]; | ||
| 113 : | S32 mNumColors; | ||
| 114 : | }; | ||
| 115 : | |||
| 116 : | //----------------------------------------------------------------------------- | ||
| 117 : | // LLTexGlobalColorInfo | ||
| 118 : | //----------------------------------------------------------------------------- | ||
| 119 : | class LLTexGlobalColorInfo | ||
| 120 : | { | ||
| 121 : | friend class LLTexGlobalColor; | ||
| 122 : | public: | ||
| 123 : | LLTexGlobalColorInfo(); | ||
| 124 : | ~LLTexGlobalColorInfo(); | ||
| 125 : | |||
| 126 : | BOOL parseXml(LLXmlTreeNode* node); | ||
| 127 : | |||
| 128 : | protected: | ||
| 129 : | typedef std::vector<LLTexParamColorInfo *> color_info_list_t; | ||
| 130 : | color_info_list_t mColorInfoList; | ||
| 131 : | std::string mName; | ||
| 132 : | }; | ||
| 133 : | |||
| 134 : | //----------------------------------------------------------------------------- | ||
| 135 : | // LLTexLayerSetInfo | ||
| 136 : | // Containes shared layer set data | ||
| 137 : | //----------------------------------------------------------------------------- | ||
| 138 : | class LLTexLayerSetInfo | ||
| 139 : | { | ||
| 140 : | friend class LLTexLayerSet; | ||
| 141 : | public: | ||
| 142 : | LLTexLayerSetInfo(); | ||
| 143 : | ~LLTexLayerSetInfo(); | ||
| 144 : | |||
| 145 : | BOOL parseXml(LLXmlTreeNode* node); | ||
| 146 : | |||
| 147 : | protected: | ||
| 148 : | std::string mBodyRegion; | ||
| 149 : | S32 mWidth; | ||
| 150 : | S32 mHeight; | ||
| 151 : | std::string mStaticAlphaFileName; | ||
| 152 : | BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) | ||
| 153 : | |||
| 154 : | typedef std::vector<LLTexLayerInfo*> layer_info_list_t; | ||
| 155 : | layer_info_list_t mLayerInfoList; | ||
| 156 : | }; | ||
| 157 : | |||
| 158 : | //----------------------------------------------------------------------------- | ||
| 159 : | // LLTexLayerInfo | ||
| 160 : | //----------------------------------------------------------------------------- | ||
| 161 : | enum ERenderPass | ||
| 162 : | { | ||
| 163 : | RP_COLOR, | ||
| 164 : | RP_BUMP, | ||
| 165 : | RP_SHINE | ||
| 166 : | }; | ||
| 167 : | |||
| 168 : | class LLTexLayerInfo | ||
| 169 : | { | ||
| 170 : | friend class LLTexLayer; | ||
| 171 : | public: | ||
| 172 : | LLTexLayerInfo(); | ||
| 173 : | ~LLTexLayerInfo(); | ||
| 174 : | |||
| 175 : | BOOL parseXml(LLXmlTreeNode* node); | ||
| 176 : | |||
| 177 : | protected: | ||
| 178 : | std::string mName; | ||
| 179 : | |||
| 180 : | BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, | ||
| 181 : | ERenderPass mRenderPass; | ||
| 182 : | |||
| 183 : | std::string mGlobalColor; | ||
| 184 : | LLColor4 mFixedColor; | ||
| 185 : | |||
| 186 : | S32 mLocalTexture; | ||
| 187 : | std::string mStaticImageFileName; | ||
| 188 : | BOOL mStaticImageIsMask; | ||
| 189 : | BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask | ||
| 190 : | mjm | 137 | BOOL mIsVisibilityMask; |
| 191 : | mjm | 135 | |
| 192 : | typedef std::vector<std::pair<std::string,BOOL> > morph_name_list_t; | ||
| 193 : | morph_name_list_t mMorphNameList; | ||
| 194 : | |||
| 195 : | typedef std::vector<LLTexParamColorInfo*> color_info_list_t; | ||
| 196 : | color_info_list_t mColorInfoList; | ||
| 197 : | |||
| 198 : | typedef std::vector<LLTexLayerParamAlphaInfo*> alpha_info_list_t; | ||
| 199 : | alpha_info_list_t mAlphaInfoList; | ||
| 200 : | |||
| 201 : | }; | ||
| 202 : | |||
| 203 : | //----------------------------------------------------------------------------- | ||
| 204 : | // LLTexLayerSetBuffer | ||
| 205 : | // The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. | ||
| 206 : | //----------------------------------------------------------------------------- | ||
| 207 : | class LLTexLayerSetBuffer : public LLDynamicTexture | ||
| 208 : | { | ||
| 209 : | public: | ||
| 210 : | mjm | 137 | LLTexLayerSetBuffer(LLTexLayerSet* owner, S32 width, S32 height); |
| 211 : | mjm | 135 | virtual ~LLTexLayerSetBuffer(); |
| 212 : | |||
| 213 : | virtual void preRender(BOOL clear_depth); | ||
| 214 : | virtual void postRender(BOOL success); | ||
| 215 : | virtual BOOL render(); | ||
| 216 : | BOOL updateImmediate(); | ||
| 217 : | bool isInitialized(void) const; | ||
| 218 : | BOOL needsRender(); | ||
| 219 : | void requestUpdate(); | ||
| 220 : | void requestUpload(); | ||
| 221 : | void cancelUpload(); | ||
| 222 : | BOOL uploadPending() { return mUploadPending; } | ||
| 223 : | BOOL render( S32 x, S32 y, S32 width, S32 height ); | ||
| 224 : | mjm | 137 | void readBackAndUpload(); |
| 225 : | mjm | 135 | |
| 226 : | static void onTextureUploadComplete( const LLUUID& uuid, | ||
| 227 : | void* userdata, | ||
| 228 : | S32 result, LLExtStat ext_status); | ||
| 229 : | static void dumpTotalByteCount(); | ||
| 230 : | |||
| 231 : | virtual void restoreGLTexture() ; | ||
| 232 : | virtual void destroyGLTexture() ; | ||
| 233 : | |||
| 234 : | private: | ||
| 235 : | void pushProjection(); | ||
| 236 : | void popProjection(); | ||
| 237 : | |||
| 238 : | private: | ||
| 239 : | BOOL mNeedsUpdate; | ||
| 240 : | BOOL mNeedsUpload; | ||
| 241 : | BOOL mUploadPending; | ||
| 242 : | LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) | ||
| 243 : | LLTexLayerSet* mTexLayerSet; | ||
| 244 : | |||
| 245 : | static S32 sGLByteCount; | ||
| 246 : | }; | ||
| 247 : | |||
| 248 : | //----------------------------------------------------------------------------- | ||
| 249 : | // LLTexLayerSet | ||
| 250 : | // An ordered set of texture layers that get composited into a single texture. | ||
| 251 : | //----------------------------------------------------------------------------- | ||
| 252 : | class LLTexLayerSet | ||
| 253 : | { | ||
| 254 : | mjm | 138 | friend class LLTexLayerSetBuffer; |
| 255 : | mjm | 135 | public: |
| 256 : | LLTexLayerSet( LLVOAvatar* avatar ); | ||
| 257 : | ~LLTexLayerSet(); | ||
| 258 : | |||
| 259 : | //BOOL parseData(LLXmlTreeNode* node); | ||
| 260 : | LLTexLayerSetInfo* getInfo() const { return mInfo; } | ||
| 261 : | // This sets mInfo and calls initialization functions | ||
| 262 : | BOOL setInfo(LLTexLayerSetInfo *info); | ||
| 263 : | |||
| 264 : | BOOL render( S32 x, S32 y, S32 width, S32 height ); | ||
| 265 : | mjm | 137 | void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false); |
| 266 : | mjm | 135 | BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; } |
| 267 : | LLTexLayerSetBuffer* getComposite(); | ||
| 268 : | void requestUpdate(); | ||
| 269 : | void requestUpload(); | ||
| 270 : | void cancelUpload(); | ||
| 271 : | LLVOAvatar* getAvatar() { return mAvatar; } | ||
| 272 : | void updateComposite(); | ||
| 273 : | BOOL isLocalTextureDataAvailable(); | ||
| 274 : | BOOL isLocalTextureDataFinal(); | ||
| 275 : | void createComposite(); | ||
| 276 : | void destroyComposite(); | ||
| 277 : | void setUpdatesEnabled( BOOL b ); | ||
| 278 : | BOOL getUpdatesEnabled() { return mUpdatesEnabled; } | ||
| 279 : | void deleteCaches(); | ||
| 280 : | void gatherAlphaMasks(U8 *data, S32 width, S32 height); | ||
| 281 : | void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); | ||
| 282 : | const std::string getBodyRegion() { return mInfo->mBodyRegion; } | ||
| 283 : | BOOL hasComposite() { return (mComposite != NULL); } | ||
| 284 : | mjm | 137 | LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } |
| 285 : | void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } | ||
| 286 : | BOOL isVisible() const { return mIsVisible; } | ||
| 287 : | mjm | 135 | |
| 288 : | public: | ||
| 289 : | static BOOL sHasCaches; | ||
| 290 : | |||
| 291 : | protected: | ||
| 292 : | typedef std::vector<LLTexLayer *> layer_list_t; | ||
| 293 : | layer_list_t mLayerList; | ||
| 294 : | mjm | 137 | layer_list_t mMaskLayerList; |
| 295 : | mjm | 135 | LLTexLayerSetBuffer* mComposite; |
| 296 : | // Backlink only; don't make this an LLPointer. | ||
| 297 : | LLVOAvatar* mAvatar; | ||
| 298 : | BOOL mUpdatesEnabled; | ||
| 299 : | mjm | 137 | BOOL mIsVisible; |
| 300 : | mjm | 135 | |
| 301 : | mjm | 137 | LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex; |
| 302 : | |||
| 303 : | mjm | 135 | LLTexLayerSetInfo *mInfo; |
| 304 : | }; | ||
| 305 : | |||
| 306 : | //----------------------------------------------------------------------------- | ||
| 307 : | // LLMaskedMorph | ||
| 308 : | //----------------------------------------------------------------------------- | ||
| 309 : | |||
| 310 : | class LLMaskedMorph | ||
| 311 : | { | ||
| 312 : | public: | ||
| 313 : | LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ); | ||
| 314 : | |||
| 315 : | public: | ||
| 316 : | LLPolyMorphTarget *mMorphTarget; | ||
| 317 : | BOOL mInvert; | ||
| 318 : | }; | ||
| 319 : | |||
| 320 : | //----------------------------------------------------------------------------- | ||
| 321 : | // LLTexLayer | ||
| 322 : | // A single texture layer | ||
| 323 : | //----------------------------------------------------------------------------- | ||
| 324 : | class LLTexLayer | ||
| 325 : | { | ||
| 326 : | public: | ||
| 327 : | LLTexLayer( LLTexLayerSet* layer_set ); | ||
| 328 : | ~LLTexLayer(); | ||
| 329 : | |||
| 330 : | //BOOL parseData(LLXmlTreeNode* node); | ||
| 331 : | LLTexLayerInfo* getInfo() const { return mInfo; } | ||
| 332 : | // This sets mInfo and calls initialization functions | ||
| 333 : | BOOL setInfo(LLTexLayerInfo *info); | ||
| 334 : | |||
| 335 : | BOOL render( S32 x, S32 y, S32 width, S32 height ); | ||
| 336 : | void requestUpdate(); | ||
| 337 : | LLTexLayerSet* getTexLayerSet() { return mTexLayerSet; } | ||
| 338 : | |||
| 339 : | const std::string& getName() { return mInfo->mName; } | ||
| 340 : | |||
| 341 : | void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert); | ||
| 342 : | void deleteCaches(); | ||
| 343 : | U8* getAlphaData(); | ||
| 344 : | void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); | ||
| 345 : | |||
| 346 : | void invalidateMorphMasks(); | ||
| 347 : | ERenderPass getRenderPass() { return mInfo->mRenderPass; } | ||
| 348 : | const std::string& getGlobalColor() { return mInfo->mGlobalColor; } | ||
| 349 : | BOOL findNetColor( LLColor4* color ); | ||
| 350 : | BOOL renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask ); | ||
| 351 : | BOOL renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp ); | ||
| 352 : | BOOL hasAlphaParams() { return (!mParamAlphaList.empty());} | ||
| 353 : | mjm | 137 | BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); |
| 354 : | BOOL isVisibilityMask() const; | ||
| 355 : | BOOL isInvisibleAlphaMask(); | ||
| 356 : | mjm | 135 | |
| 357 : | protected: | ||
| 358 : | LLTexLayerSet* mTexLayerSet; | ||
| 359 : | LLPointer<LLImageRaw> mStaticImageRaw; | ||
| 360 : | |||
| 361 : | // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order. | ||
| 362 : | typedef std::vector<LLTexParamColor *> color_list_t; | ||
| 363 : | color_list_t mParamColorList; | ||
| 364 : | // mGlobalColor name stored in mInfo | ||
| 365 : | // mFixedColor value stored in mInfo | ||
| 366 : | |||
| 367 : | typedef std::vector<LLTexLayerParamAlpha *> alpha_list_t; | ||
| 368 : | alpha_list_t mParamAlphaList; | ||
| 369 : | |||
| 370 : | |||
| 371 : | typedef std::deque<LLMaskedMorph> morph_list_t; | ||
| 372 : | morph_list_t mMaskedMorphs; | ||
| 373 : | typedef std::map<U32, U8*> alpha_cache_t; | ||
| 374 : | alpha_cache_t mAlphaCache; | ||
| 375 : | BOOL mMorphMasksValid; | ||
| 376 : | BOOL mStaticImageInvalid; | ||
| 377 : | |||
| 378 : | LLTexLayerInfo *mInfo; | ||
| 379 : | }; | ||
| 380 : | |||
| 381 : | //----------------------------------------------------------------------------- | ||
| 382 : | // LLTexLayerParamAlpha | ||
| 383 : | //----------------------------------------------------------------------------- | ||
| 384 : | class LLTexLayerParamAlpha : public LLViewerVisualParam | ||
| 385 : | { | ||
| 386 : | public: | ||
| 387 : | LLTexLayerParamAlpha( LLTexLayer* layer ); | ||
| 388 : | /*virtual*/ ~LLTexLayerParamAlpha(); | ||
| 389 : | |||
| 390 : | // Special: These functions are overridden by child classes | ||
| 391 : | LLTexLayerParamAlphaInfo* getInfo() const { return (LLTexLayerParamAlphaInfo*)mInfo; } | ||
| 392 : | // This sets mInfo and calls initialization functions | ||
| 393 : | BOOL setInfo(LLTexLayerParamAlphaInfo *info); | ||
| 394 : | |||
| 395 : | // LLVisualParam Virtual functions | ||
| 396 : | ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); | ||
| 397 : | /*virtual*/ void apply( ESex avatar_sex ) {} | ||
| 398 : | /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); | ||
| 399 : | /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); | ||
| 400 : | /*virtual*/ void animate(F32 delta, BOOL set_by_user); | ||
| 401 : | |||
| 402 : | // LLViewerVisualParam Virtual functions | ||
| 403 : | /*virtual*/ F32 getTotalDistortion() { return 1.f; } | ||
| 404 : | /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } | ||
| 405 : | /*virtual*/ F32 getMaxDistortion() { return 3.f; } | ||
| 406 : | /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);} | ||
| 407 : | /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; | ||
| 408 : | /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; | ||
| 409 : | |||
| 410 : | // New functions | ||
| 411 : | BOOL render( S32 x, S32 y, S32 width, S32 height ); | ||
| 412 : | BOOL getSkip(); | ||
| 413 : | void deleteCaches(); | ||
| 414 : | LLTexLayer* getTexLayer() { return mTexLayer; } | ||
| 415 : | BOOL getMultiplyBlend() { return getInfo()->mMultiplyBlend; } | ||
| 416 : | |||
| 417 : | protected: | ||
| 418 : | LLPointer<LLImageGL> mCachedProcessedImageGL; | ||
| 419 : | LLTexLayer* mTexLayer; | ||
| 420 : | LLPointer<LLImageTGA> mStaticImageTGA; | ||
| 421 : | LLPointer<LLImageRaw> mStaticImageRaw; | ||
| 422 : | BOOL mNeedsCreateTexture; | ||
| 423 : | BOOL mStaticImageInvalid; | ||
| 424 : | LLVector3 mAvgDistortionVec; | ||
| 425 : | F32 mCachedEffectiveWeight; | ||
| 426 : | |||
| 427 : | public: | ||
| 428 : | // Global list of instances for gathering statistics | ||
| 429 : | static void dumpCacheByteCount(); | ||
| 430 : | static void getCacheByteCount( S32* gl_bytes ); | ||
| 431 : | |||
| 432 : | typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t; | ||
| 433 : | static param_alpha_ptr_list_t sInstances; | ||
| 434 : | }; | ||
| 435 : | |||
| 436 : | |||
| 437 : | //----------------------------------------------------------------------------- | ||
| 438 : | // LLTexGlobalColor | ||
| 439 : | //----------------------------------------------------------------------------- | ||
| 440 : | class LLTexGlobalColor | ||
| 441 : | { | ||
| 442 : | public: | ||
| 443 : | LLTexGlobalColor( LLVOAvatar* avatar ); | ||
| 444 : | ~LLTexGlobalColor(); | ||
| 445 : | |||
| 446 : | //BOOL parseData(LLXmlTreeNode* node); | ||
| 447 : | LLTexGlobalColorInfo* getInfo() const { return mInfo; } | ||
| 448 : | // This sets mInfo and calls initialization functions | ||
| 449 : | BOOL setInfo(LLTexGlobalColorInfo *info); | ||
| 450 : | |||
| 451 : | void requstUpdate(); | ||
| 452 : | LLVOAvatar* getAvatar() { return mAvatar; } | ||
| 453 : | LLColor4 getColor(); | ||
| 454 : | const std::string& getName() { return mInfo->mName; } | ||
| 455 : | |||
| 456 : | protected: | ||
| 457 : | typedef std::vector<LLTexParamColor *> param_list_t; | ||
| 458 : | param_list_t mParamList; | ||
| 459 : | LLVOAvatar* mAvatar; // just backlink, don't LLPointer | ||
| 460 : | |||
| 461 : | LLTexGlobalColorInfo *mInfo; | ||
| 462 : | }; | ||
| 463 : | |||
| 464 : | |||
| 465 : | //----------------------------------------------------------------------------- | ||
| 466 : | // LLTexParamColor | ||
| 467 : | //----------------------------------------------------------------------------- | ||
| 468 : | class LLTexParamColor : public LLViewerVisualParam | ||
| 469 : | { | ||
| 470 : | public: | ||
| 471 : | LLTexParamColor( LLTexGlobalColor* tex_color ); | ||
| 472 : | LLTexParamColor( LLTexLayer* layer ); | ||
| 473 : | /* virtual */ ~LLTexParamColor(); | ||
| 474 : | |||
| 475 : | // Special: These functions are overridden by child classes | ||
| 476 : | LLTexParamColorInfo* getInfo() const { return (LLTexParamColorInfo*)mInfo; } | ||
| 477 : | // This sets mInfo and calls initialization functions | ||
| 478 : | BOOL setInfo(LLTexParamColorInfo *info); | ||
| 479 : | |||
| 480 : | // LLVisualParam Virtual functions | ||
| 481 : | ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); | ||
| 482 : | /*virtual*/ void apply( ESex avatar_sex ) {} | ||
| 483 : | /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); | ||
| 484 : | /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); | ||
| 485 : | /*virtual*/ void animate(F32 delta, BOOL set_by_user); | ||
| 486 : | |||
| 487 : | |||
| 488 : | // LLViewerVisualParam Virtual functions | ||
| 489 : | /*virtual*/ F32 getTotalDistortion() { return 1.f; } | ||
| 490 : | /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } | ||
| 491 : | /*virtual*/ F32 getMaxDistortion() { return 3.f; } | ||
| 492 : | /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); } | ||
| 493 : | /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; | ||
| 494 : | /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; | ||
| 495 : | |||
| 496 : | // New functions | ||
| 497 : | LLColor4 getNetColor(); | ||
| 498 : | EColorOperation getOperation() const { return getInfo()->mOperation; } | ||
| 499 : | |||
| 500 : | |||
| 501 : | protected: | ||
| 502 : | LLVector3 mAvgDistortionVec; | ||
| 503 : | LLTexGlobalColor* mTexGlobalColor; // either has mTexGlobalColor or mTexLayer as its parent | ||
| 504 : | LLTexLayer* mTexLayer; | ||
| 505 : | LLVOAvatar* mAvatar; // redundant, but simplifies the code (don't LLPointer) | ||
| 506 : | }; | ||
| 507 : | |||
| 508 : | //----------------------------------------------------------------------------- | ||
| 509 : | // LLTexStaticImageList | ||
| 510 : | //----------------------------------------------------------------------------- | ||
| 511 : | |||
| 512 : | class LLTexStaticImageList | ||
| 513 : | { | ||
| 514 : | public: | ||
| 515 : | LLTexStaticImageList(); | ||
| 516 : | ~LLTexStaticImageList(); | ||
| 517 : | |||
| 518 : | LLImageRaw* getImageRaw( const std::string& file_name ); | ||
| 519 : | LLImageGL* getImageGL( const std::string& file_name, BOOL is_mask ); | ||
| 520 : | LLImageTGA* getImageTGA( const std::string& file_name ); | ||
| 521 : | |||
| 522 : | void deleteCachedImages(); | ||
| 523 : | void dumpByteCount(); | ||
| 524 : | |||
| 525 : | private: | ||
| 526 : | BOOL loadImageRaw( const std::string& file_name, LLImageRaw* image_raw ); | ||
| 527 : | |||
| 528 : | private: | ||
| 529 : | static LLStringTable sImageNames; | ||
| 530 : | |||
| 531 : | typedef std::map< const char *, LLPointer<LLImageGL> > image_gl_map_t; | ||
| 532 : | typedef std::map< const char *, LLPointer<LLImageTGA> > image_tga_map_t; | ||
| 533 : | image_gl_map_t mStaticImageListGL; | ||
| 534 : | image_tga_map_t mStaticImageListTGA; | ||
| 535 : | |||
| 536 : | public: | ||
| 537 : | S32 mGLBytes; | ||
| 538 : | S32 mTGABytes; | ||
| 539 : | }; | ||
| 540 : | |||
| 541 : | // Used by LLTexLayerSetBuffer for a callback. | ||
| 542 : | |||
| 543 : | // For DEV-DEV-31590, "Heap corruption and crash after outfit | ||
| 544 : | // changes", added the mLayerSet member. The current | ||
| 545 : | // LLTexLayerSetBuffer can be found by querying mLayerSet->mComposite, | ||
| 546 : | // but we still store the original mLayerSetBuffer here so we can | ||
| 547 : | // detect when an upload is out of date. This prevents a memory | ||
| 548 : | // stomp. See LLTexLayerSetBuffer::onTextureUploadComplete() for usage. | ||
| 549 : | class LLBakedUploadData | ||
| 550 : | { | ||
| 551 : | public: | ||
| 552 : | LLBakedUploadData( LLVOAvatar* avatar, LLTexLayerSet* layerset, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id); | ||
| 553 : | ~LLBakedUploadData() {} | ||
| 554 : | |||
| 555 : | LLUUID mID; | ||
| 556 : | LLVOAvatar* mAvatar; // just backlink, don't LLPointer | ||
| 557 : | LLTexLayerSet* mLayerSet; | ||
| 558 : | LLTexLayerSetBuffer* mLayerSetBuffer; | ||
| 559 : | LLUUID mWearableAssets[WT_COUNT]; | ||
| 560 : | U64 mStartTime; // Used to measure time baked texture upload requires | ||
| 561 : | }; | ||
| 562 : | |||
| 563 : | extern LLTexStaticImageList gTexStaticImageList; | ||
| 564 : | |||
| 565 : | |||
| 566 : | #endif // LL_LLTEXLAYER_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

