123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- /**
- * @file lltexlayerparams.h
- * @brief Texture layer parameters, used by lltexlayer.
- *
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2010, Linden Research, Inc.
- *
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- *
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- *
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- *
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
- #ifndef LL_LLTEXLAYERPARAMS_H
- #define LL_LLTEXLAYERPARAMS_H
- #include "llpointer.h"
- #include "llviewervisualparam.h"
- #include "llcolor4.h"
- class LLAvatarAppearance;
- class LLGLTexture;
- class LLImageRaw;
- class LLImageTGA;
- class LLTexLayer;
- class LLTexLayerInterface;
- class LLWearable;
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // LLTexLayerParam
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class alignas(16) LLTexLayerParam : public LLViewerVisualParam
- {
- protected:
- LOG_CLASS(LLTexLayerParam);
- LLTexLayerParam(const LLTexLayerParam& other);
- public:
- LLTexLayerParam(LLTexLayerInterface* layer);
- LLTexLayerParam(LLAvatarAppearance* appearance);
- bool setInfo(LLViewerVisualParamInfo* info, bool add_to_app);
- LLViewerVisualParam* cloneParam(LLWearable* wearable) const override = 0;
- protected:
- LLTexLayerInterface* mTexLayer;
- LLAvatarAppearance* mAvatarAppearance;
- };
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // LLTexLayerParamAlpha
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class alignas(16) LLTexLayerParamAlpha final : public LLTexLayerParam
- {
- protected:
- LOG_CLASS(LLTexLayerParamAlpha);
- LLTexLayerParamAlpha(const LLTexLayerParamAlpha& other);
- public:
- LLTexLayerParamAlpha(LLTexLayerInterface* layer);
- LLTexLayerParamAlpha(LLAvatarAppearance* appearance);
- ~LLTexLayerParamAlpha() override;
- LLViewerVisualParam* cloneParam(LLWearable* wearp = NULL) const override;
- // LLVisualParam Virtual functions
- void apply(ESex avatar_sex) override {}
- void setWeight(F32 weight, bool upload_bake) override;
- void setAnimationTarget(F32 target_value, bool upload_bake) override;
- void animate(F32 delta, bool upload_bake) override;
- #if 0 // Unused methods
- // LLViewerVisualParam Virtual functions
- LL_INLINE F32 getTotalDistortion() override { return 1.f; }
- LL_INLINE const LLVector4a& getAvgDistortion() override { return mAvgDistortionVec; }
- LL_INLINE F32 getMaxDistortion() override { return 3.f; }
- LL_INLINE LLVector4a getVertexDistortion(S32, LLPolyMesh*) override
- {
- return LLVector4a(1.f, 1.f, 1.f);
- }
- LL_INLINE const LLVector4a* getFirstDistortion(U32* index,
- LLPolyMesh** pmesh) override
- {
- index = 0;
- pmesh = NULL;
- return &mAvgDistortionVec;
- }
- LL_INLINE const LLVector4a* getNextDistortion(U32* index,
- LLPolyMesh** pmesh) override
- {
- index = 0;
- pmesh = NULL;
- return NULL;
- }
- #endif
- // New functions
- bool render(S32 x, S32 y, S32 width, S32 height);
- bool getSkip() const;
- void deleteCaches();
- bool getMultiplyBlend() const;
- private:
- LLVector4a mAvgDistortionVec;
- LLPointer<LLGLTexture> mCachedProcessedTexture;
- LLPointer<LLImageTGA> mStaticImageTGA;
- LLPointer<LLImageRaw> mStaticImageRaw;
- bool mNeedsCreateTexture;
- bool mStaticImageInvalid;
- F32 mCachedEffectiveWeight;
- public:
- // Global list of instances for gathering statistics
- static void dumpCacheByteCount();
- static void getCacheByteCount(S32* gl_bytes);
- typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
- static param_alpha_ptr_list_t sInstances;
- };
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // LLTexLayerParamAlphaInfo
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class LLTexLayerParamAlphaInfo final : public LLViewerVisualParamInfo
- {
- friend class LLTexLayerParamAlpha;
- public:
- LLTexLayerParamAlphaInfo();
- bool parseXml(LLXmlTreeNode* node) override;
- private:
- F32 mDomain;
- bool mMultiplyBlend;
- bool mSkipIfZeroWeight;
- std::string mStaticImageFileName;
- };
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // LLTexLayerParamColor
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class alignas(16) LLTexLayerParamColor : public LLTexLayerParam
- {
- protected:
- LOG_CLASS(LLTexLayerParamColor);
- LLTexLayerParamColor(const LLTexLayerParamColor& other);
- public:
- enum EColorOperation
- {
- OP_ADD = 0,
- OP_MULTIPLY = 1,
- OP_BLEND = 2,
- OP_COUNT = 3 // Number of operations
- };
- LLTexLayerParamColor(LLTexLayerInterface* layer);
- LLTexLayerParamColor(LLAvatarAppearance* appearance);
- LLViewerVisualParam* cloneParam(LLWearable* wearp = NULL) const override;
- // LLVisualParam Virtual functions
- LL_INLINE void apply(ESex avatar_sex) override {}
- void setWeight(F32 weight, bool upload_bake) override;
- void setAnimationTarget(F32 target_value, bool upload_bake) override;
- void animate(F32 delta, bool upload_bake) override;
- #if 0 // Unused methods
- // LLViewerVisualParam Virtual functions
- LL_INLINE F32 getTotalDistortion() override { return 1.f; }
- LL_INLINE const LLVector4a& getAvgDistortion() override { return mAvgDistortionVec; }
- LL_INLINE F32 getMaxDistortion() override { return 3.f; }
- LL_INLINE LLVector4a getVertexDistortion(S32, LLPolyMesh*) override
- {
- return LLVector4a(1.f, 1.f, 1.f);
- }
- LL_INLINE const LLVector4a* getFirstDistortion(U32* index,
- LLPolyMesh** pmesh) override
- {
- index = 0;
- pmesh = NULL;
- return &mAvgDistortionVec;
- }
- LL_INLINE const LLVector4a* getNextDistortion(U32* index,
- LLPolyMesh** pmesh) override
- {
- index = 0;
- pmesh = NULL;
- return NULL;
- }
- #endif
- // New functions
- LLColor4 getNetColor() const;
- protected:
- LL_INLINE virtual void onGlobalColorChanged(bool upload_bake) {}
- private:
- LLVector4a mAvgDistortionVec;
- };
- class LLTexLayerParamColorInfo final : public LLViewerVisualParamInfo
- {
- friend class LLTexLayerParamColor;
- protected:
- LOG_CLASS(LLTexLayerParamColorInfo);
- public:
- LLTexLayerParamColorInfo();
- bool parseXml(LLXmlTreeNode* node);
- LL_INLINE LLTexLayerParamColor::EColorOperation getOperation() const
- {
- return mOperation;
- }
- private:
- enum { MAX_COLOR_VALUES = 20 };
- LLTexLayerParamColor::EColorOperation mOperation;
- LLColor4 mColors[MAX_COLOR_VALUES];
- S32 mNumColors;
- };
- typedef std::vector<LLTexLayerParamColor*> param_color_list_t;
- typedef std::vector<LLTexLayerParamAlpha*> param_alpha_list_t;
- typedef std::vector<LLTexLayerParamColorInfo*> param_color_info_list_t;
- typedef std::vector<LLTexLayerParamAlphaInfo*> param_alpha_info_list_t;
- #endif
|