diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llrender.h | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/linden/indra/llrender/llrender.h b/linden/indra/llrender/llrender.h index e949190..437c715 100644 --- a/linden/indra/llrender/llrender.h +++ b/linden/indra/llrender/llrender.h | |||
@@ -22,7 +22,8 @@ | |||
22 | * There are special exceptions to the terms and conditions of the GPL as | 22 | * There are special exceptions to the terms and conditions of the GPL as |
23 | * it is applied to this Source Code. View the full text of the exception | 23 | * it is applied to this Source Code. View the full text of the exception |
24 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 24 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
25 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 25 | * online at |
26 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
26 | * | 27 | * |
27 | * By copying, modifying or distributing this software, you acknowledge | 28 | * By copying, modifying or distributing this software, you acknowledge |
28 | * that you have read and understood your obligations described above, | 29 | * that you have read and understood your obligations described above, |
@@ -70,6 +71,14 @@ public: | |||
70 | TAM_CLAMP // No texture type is currently enabled | 71 | TAM_CLAMP // No texture type is currently enabled |
71 | } eTextureAddressMode; | 72 | } eTextureAddressMode; |
72 | 73 | ||
74 | typedef enum | ||
75 | { // Note: If mipmapping or anisotropic are not enabled or supported it should fall back gracefully | ||
76 | TFO_POINT = 0, // Equal to: min=point, mag=point, mip=none. | ||
77 | TFO_BILINEAR, // Equal to: min=linear, mag=linear, mip=point. | ||
78 | TFO_TRILINEAR, // Equal to: min=linear, mag=linear, mip=linear. | ||
79 | TFO_ANISOTROPIC // Equal to: min=anisotropic, max=anisotropic, mip=linear. | ||
80 | } eTextureFilterOptions; | ||
81 | |||
73 | typedef enum | 82 | typedef enum |
74 | { | 83 | { |
75 | TB_REPLACE = 0, | 84 | TB_REPLACE = 0, |
@@ -130,30 +139,43 @@ public: | |||
130 | // Sets this tex unit to be the currently active one | 139 | // Sets this tex unit to be the currently active one |
131 | void activate(void); | 140 | void activate(void); |
132 | 141 | ||
133 | // Enables this texture unit for the given texture type (automatically disables any previously enabled texture type) | 142 | // Enables this texture unit for the given texture type |
143 | // (automatically disables any previously enabled texture type) | ||
134 | void enable(eTextureType type); | 144 | void enable(eTextureType type); |
145 | |||
135 | // Disables the current texture unit | 146 | // Disables the current texture unit |
136 | void disable(void); | 147 | void disable(void); |
137 | 148 | ||
138 | // Binds the LLImageGL to this texture unit | 149 | // Binds the LLImageGL to this texture unit |
139 | // (automatically enables the unit for the LLImageGL's texture type) | 150 | // (automatically enables the unit for the LLImageGL's texture type) |
140 | bool bind(const LLImageGL* texture, bool forceBind = false); | 151 | bool bind(LLImageGL* texture, bool forceBind = false); |
141 | 152 | ||
142 | // Binds a cubemap to this texture unit | 153 | // Binds a cubemap to this texture unit |
143 | // (automatically enables the texture unit for cubemaps) | 154 | // (automatically enables the texture unit for cubemaps) |
144 | bool bind(LLCubeMap* cubeMap); | 155 | bool bind(LLCubeMap* cubeMap); |
145 | 156 | ||
146 | // Binds a render target to this texture unit (automatically enables the texture unit for the RT's texture type) | 157 | // Binds a render target to this texture unit |
158 | // (automatically enables the texture unit for the RT's texture type) | ||
147 | bool bind(LLRenderTarget * renderTarget, bool bindDepth = false); | 159 | bool bind(LLRenderTarget * renderTarget, bool bindDepth = false); |
148 | 160 | ||
149 | // Manually binds a texture to the texture unit (automatically enables the tex unit for the given texture type) | 161 | // Manually binds a texture to the texture unit |
150 | bool bindManual(eTextureType type, U32 texture); | 162 | // (automatically enables the tex unit for the given texture type) |
163 | bool bindManual(eTextureType type, U32 texture, bool hasMips = false); | ||
151 | 164 | ||
152 | // Unbinds the currently bound texture of the given type (only if there's a texture of the given type currently bound) | 165 | // Unbinds the currently bound texture of the given type |
166 | // (only if there's a texture of the given type currently bound) | ||
153 | void unbind(eTextureType type); | 167 | void unbind(eTextureType type); |
154 | 168 | ||
169 | // Sets the addressing mode used to sample the texture | ||
170 | // Warning: this stays set for the bound texture forever, | ||
171 | // make sure you want to permanently change the address mode for the bound texture. | ||
155 | void setTextureAddressMode(eTextureAddressMode mode); | 172 | void setTextureAddressMode(eTextureAddressMode mode); |
156 | 173 | ||
174 | // Sets the filtering options used to sample the texture | ||
175 | // Warning: this stays set for the bound texture forever, | ||
176 | // make sure you want to permanently change the filtering for the bound texture. | ||
177 | void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); | ||
178 | |||
157 | void setTextureBlendType(eTextureBlendType type); | 179 | void setTextureBlendType(eTextureBlendType type); |
158 | 180 | ||
159 | inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR) | 181 | inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR) |
@@ -165,6 +187,12 @@ public: | |||
165 | 187 | ||
166 | static U32 getInternalType(eTextureType type); | 188 | static U32 getInternalType(eTextureType type); |
167 | 189 | ||
190 | U32 getCurrTexture(void) { return mCurrTexture; } | ||
191 | |||
192 | eTextureType getCurrType(void) { return mCurrTexType; } | ||
193 | |||
194 | void setHasMipMaps(bool hasMips) { mHasMipMaps = hasMips; } | ||
195 | |||
168 | protected: | 196 | protected: |
169 | S32 mIndex; | 197 | S32 mIndex; |
170 | U32 mCurrTexture; | 198 | U32 mCurrTexture; |
@@ -178,6 +206,7 @@ protected: | |||
178 | eTextureBlendSrc mCurrAlphaSrc2; | 206 | eTextureBlendSrc mCurrAlphaSrc2; |
179 | S32 mCurrColorScale; | 207 | S32 mCurrColorScale; |
180 | S32 mCurrAlphaScale; | 208 | S32 mCurrAlphaScale; |
209 | bool mHasMipMaps; | ||
181 | 210 | ||
182 | void debugTextureUnit(void); | 211 | void debugTextureUnit(void); |
183 | void setColorScale(S32 scale); | 212 | void setColorScale(S32 scale); |
@@ -291,6 +320,8 @@ public: | |||
291 | 320 | ||
292 | void debugTexUnits(void); | 321 | void debugTexUnits(void); |
293 | 322 | ||
323 | void clearErrors(); | ||
324 | |||
294 | struct Vertex | 325 | struct Vertex |
295 | { | 326 | { |
296 | GLfloat v[3]; | 327 | GLfloat v[3]; |
@@ -315,6 +346,8 @@ private: | |||
315 | LLStrider<LLColor4U> mColorsp; | 346 | LLStrider<LLColor4U> mColorsp; |
316 | std::vector<LLTexUnit*> mTexUnits; | 347 | std::vector<LLTexUnit*> mTexUnits; |
317 | LLTexUnit* mDummyTexUnit; | 348 | LLTexUnit* mDummyTexUnit; |
349 | |||
350 | F32 mMaxAnisotropy; | ||
318 | }; | 351 | }; |
319 | 352 | ||
320 | extern F64 gGLModelView[16]; | 353 | extern F64 gGLModelView[16]; |