aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llimagegl.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llrender/llimagegl.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/linden/indra/llrender/llimagegl.h b/linden/indra/llrender/llimagegl.h
index 3f231ee..dbe11da 100644
--- a/linden/indra/llrender/llimagegl.h
+++ b/linden/indra/llrender/llimagegl.h
@@ -37,6 +37,9 @@
37 37
38#include "llgltypes.h" 38#include "llgltypes.h"
39#include "llmemory.h" 39#include "llmemory.h"
40#include "v2math.h"
41
42#include "llrender.h"
40 43
41//============================================================================ 44//============================================================================
42 45
@@ -48,11 +51,7 @@ public:
48 static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); 51 static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height);
49 static S32 dataFormatComponents(S32 dataformat); 52 static S32 dataFormatComponents(S32 dataformat);
50 53
51 // Wrapper for glBindTexture that keeps LLImageGL in sync. 54 void updateBindStats(void) const;
52 // Usually you want stage = 0 and bind_target = GL_TEXTURE_2D
53 static void bindExternalTexture( LLGLuint gl_name, S32 stage, LLGLenum bind_target);
54 static void unbindTexture(S32 stage, LLGLenum target);
55 static void unbindTexture(S32 stage); // Uses GL_TEXTURE_2D (not a default arg to avoid gl.h dependency)
56 55
57 // needs to be called every frame 56 // needs to be called every frame
58 static void updateStats(F32 current_time); 57 static void updateStats(F32 current_time);
@@ -79,7 +78,6 @@ public:
79 78
80protected: 79protected:
81 virtual ~LLImageGL(); 80 virtual ~LLImageGL();
82 BOOL bindTextureInternal(const S32 stage = 0) const;
83 81
84private: 82private:
85 void glClamp (BOOL clamps, BOOL clampt); 83 void glClamp (BOOL clamps, BOOL clampt);
@@ -87,7 +85,8 @@ private:
87 85
88public: 86public:
89 virtual void dump(); // debugging info to llinfos 87 virtual void dump(); // debugging info to llinfos
90 virtual BOOL bind(const S32 stage = 0) const; 88 virtual bool bindError(const S32 stage = 0) const;
89 virtual bool bindDefaultImage(const S32 stage = 0) const;
91 90
92 void setSize(S32 width, S32 height, S32 ncomponents); 91 void setSize(S32 width, S32 height, S32 ncomponents);
93 92
@@ -132,7 +131,11 @@ public:
132 131
133 BOOL getIsResident(BOOL test_now = FALSE); // not const 132 BOOL getIsResident(BOOL test_now = FALSE); // not const
134 133
135 void setTarget(const LLGLenum target, const LLGLenum bind_target); 134 void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target);
135
136 LLTexUnit::eTextureType getTarget(void) const { return mBindTarget; }
137 bool isInitialized(void) const { return mInitialized; }
138 void setInitialized (bool initialized) { mInitialized = initialized; }
136 139
137 BOOL getUseMipMaps() const { return mUseMipMaps; } 140 BOOL getUseMipMaps() const { return mUseMipMaps; }
138 void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; } 141 void setUseMipMaps(BOOL usemips) { mUseMipMaps = usemips; }
@@ -141,6 +144,9 @@ public:
141 144
142 BOOL isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents) ; 145 BOOL isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents) ;
143 146
147 void updatePickMask(S32 width, S32 height, const U8* data_in);
148 BOOL getMask(const LLVector2 &tc);
149
144protected: 150protected:
145 void init(BOOL usemipmaps); 151 void init(BOOL usemipmaps);
146 virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors 152 virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
@@ -152,6 +158,7 @@ public:
152 158
153private: 159private:
154 LLPointer<LLImageRaw> mSaveData; // used for destroyGL/restoreGL 160 LLPointer<LLImageRaw> mSaveData; // used for destroyGL/restoreGL
161 U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel
155 S8 mUseMipMaps; 162 S8 mUseMipMaps;
156 S8 mHasMipMaps; 163 S8 mHasMipMaps;
157 S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents) 164 S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents)
@@ -159,7 +166,8 @@ private:
159 166
160protected: 167protected:
161 LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps) 168 LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps)
162 LLGLenum mBindTarget; // NOrmally GL_TEXTURE2D, sometimes something else (ex. cube maps) 169 LLTexUnit::eTextureType mBindTarget; // Normally TT_TEXTURE, sometimes something else (ex. cube maps)
170 bool mInitialized;
163 171
164 LLGLuint mTexName; 172 LLGLuint mTexName;
165 173