00001
00032 #ifndef LL_LLTEXTUREENTRY_H
00033 #define LL_LLTEXTUREENTRY_H
00034
00035 #include "lluuid.h"
00036 #include "v4color.h"
00037 #include "llsd.h"
00038
00039 const S32 TEM_CHANGE_COLOR = 0x1;
00040 const S32 TEM_CHANGE_TEXTURE = 0x2;
00041 const S32 TEM_INVALID = 0x4;
00042
00043 const S32 TEM_BUMPMAP_COUNT = 32;
00044
00045
00046
00047
00048
00049
00050 const S32 TEM_BUMP_MASK = 0x1f;
00051 const S32 TEM_FULLBRIGHT_MASK = 0x01;
00052 const S32 TEM_SHINY_MASK = 0x03;
00053 const S32 TEM_BUMP_SHINY_MASK = (0xc0 | 0x1f);
00054 const S32 TEM_FULLBRIGHT_SHIFT = 5;
00055 const S32 TEM_SHINY_SHIFT = 6;
00056
00057
00058
00059
00060
00061
00062 const S32 TEM_MEDIA_MASK = 0x01;
00063 const S32 TEM_TEX_GEN_MASK = 0x06;
00064 const S32 TEM_TEX_GEN_SHIFT = 1;
00065
00066
00067 class LLTextureEntry
00068 {
00069 public:
00070
00071 typedef enum e_texgen
00072 {
00073 TEX_GEN_DEFAULT = 0x00,
00074 TEX_GEN_PLANAR = 0x02,
00075 TEX_GEN_SPHERICAL = 0x04,
00076 TEX_GEN_CYLINDRICAL = 0x06
00077 } eTexGen;
00078
00079 LLTextureEntry();
00080 LLTextureEntry(const LLUUID& tex_id);
00081 LLTextureEntry(const LLTextureEntry &rhs);
00082
00083 LLTextureEntry &operator=(const LLTextureEntry &rhs);
00084 ~LLTextureEntry();
00085
00086 bool operator==(const LLTextureEntry &rhs) const;
00087 bool operator!=(const LLTextureEntry &rhs) const;
00088
00089 LLSD asLLSD() const;
00090 operator LLSD() const { return asLLSD(); }
00091 bool fromLLSD(LLSD& sd);
00092
00093 void init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump);
00094
00095
00096 S32 setID (const LLUUID &tex_id);
00097 S32 setColor(const LLColor4 &color);
00098 S32 setColor(const LLColor3 &color);
00099 S32 setAlpha(const F32 alpha);
00100 S32 setScale(F32 s, F32 t);
00101 S32 setOffset(F32 s, F32 t);
00102 S32 setRotation(F32 theta);
00103
00104 S32 setBumpmap(U8 bump);
00105 S32 setFullbright(U8 bump);
00106 S32 setShiny(U8 bump);
00107 S32 setBumpShiny(U8 bump);
00108 S32 setBumpShinyFullbright(U8 bump);
00109
00110 S32 setMediaFlags(U8 media_flags);
00111 S32 setTexGen(U8 texGen);
00112 S32 setMediaTexGen(U8 media);
00113 S32 setGlow(F32 glow);
00114
00115 const LLUUID &getID() const { return mID; }
00116 const LLColor4 &getColor() const { return mColor; }
00117 void getScale(F32 *s, F32 *t) const { *s = mScaleS; *t = mScaleT; }
00118 void getOffset(F32 *s, F32 *t) const { *s = mOffsetS; *t = mOffsetT; }
00119 F32 getRotation() const { return mRotation; }
00120 void getRotation(F32 *theta) const { *theta = mRotation; }
00121
00122 U8 getBumpmap() const { return mBump & TEM_BUMP_MASK; }
00123 U8 getFullbright() const { return (mBump>>TEM_FULLBRIGHT_SHIFT) & TEM_FULLBRIGHT_MASK; }
00124 U8 getShiny() const { return (mBump>>TEM_SHINY_SHIFT) & TEM_SHINY_MASK; }
00125 U8 getBumpShiny() const { return mBump & TEM_BUMP_SHINY_MASK; }
00126 U8 getBumpShinyFullbright() const { return mBump; }
00127
00128 U8 getMediaFlags() const { return mMediaFlags & TEM_MEDIA_MASK; }
00129 U8 getTexGen() const { return mMediaFlags & TEM_TEX_GEN_MASK; }
00130 U8 getMediaTexGen() const { return mMediaFlags; }
00131 F32 getGlow() const { return mGlow; }
00132
00133
00134 enum { MF_NONE = 0x0, MF_WEB_PAGE = 0x1 };
00135
00136 public:
00137 F32 mScaleS;
00138 F32 mScaleT;
00139 F32 mOffsetS;
00140 F32 mOffsetT;
00141 F32 mRotation;
00142
00143 static const LLTextureEntry null;
00144 protected:
00145 LLUUID mID;
00146 LLColor4 mColor;
00147 U8 mBump;
00148 U8 mMediaFlags;
00149 F32 mGlow;
00150
00151
00152
00153
00154
00155 };
00156
00157 #endif