diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llcubemap.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llcubemap.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/linden/indra/newview/llcubemap.cpp b/linden/indra/newview/llcubemap.cpp index c8e0d50..baa33ac 100644 --- a/linden/indra/newview/llcubemap.cpp +++ b/linden/indra/newview/llcubemap.cpp | |||
@@ -57,6 +57,7 @@ const BOOL use_cube_mipmaps = FALSE; //current build works best without cube mi | |||
57 | 57 | ||
58 | LLCubeMap::LLCubeMap() | 58 | LLCubeMap::LLCubeMap() |
59 | : mTextureStage(0), | 59 | : mTextureStage(0), |
60 | mTextureCoordStage(0), | ||
60 | mMatrixStage(0) | 61 | mMatrixStage(0) |
61 | { | 62 | { |
62 | } | 63 | } |
@@ -184,6 +185,7 @@ void LLCubeMap::bind() | |||
184 | ) | 185 | ) |
185 | { | 186 | { |
186 | // We assume that if they have cube mapping, they have multitexturing. | 187 | // We assume that if they have cube mapping, they have multitexturing. |
188 | glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); | ||
187 | glEnable(GL_TEXTURE_CUBE_MAP_ARB); | 189 | glEnable(GL_TEXTURE_CUBE_MAP_ARB); |
188 | glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName()); | 190 | glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName()); |
189 | 191 | ||
@@ -198,6 +200,12 @@ void LLCubeMap::bind() | |||
198 | 200 | ||
199 | void LLCubeMap::enable(S32 stage) | 201 | void LLCubeMap::enable(S32 stage) |
200 | { | 202 | { |
203 | enableTexture(stage); | ||
204 | enableTextureCoords(stage); | ||
205 | } | ||
206 | |||
207 | void LLCubeMap::enableTexture(S32 stage) | ||
208 | { | ||
201 | mTextureStage = stage; | 209 | mTextureStage = stage; |
202 | if (gGLManager.mHasCubeMap && | 210 | if (gGLManager.mHasCubeMap && |
203 | stage >= 0 | 211 | stage >= 0 |
@@ -207,6 +215,16 @@ void LLCubeMap::enable(S32 stage) | |||
207 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); // NOTE: leaves texture stage set | 215 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); // NOTE: leaves texture stage set |
208 | 216 | ||
209 | glEnable(GL_TEXTURE_CUBE_MAP_ARB); | 217 | glEnable(GL_TEXTURE_CUBE_MAP_ARB); |
218 | } | ||
219 | } | ||
220 | |||
221 | void LLCubeMap::enableTextureCoords(S32 stage) | ||
222 | { | ||
223 | mTextureCoordStage = stage; | ||
224 | if (gGLManager.mHasCubeMap && stage >= 0) | ||
225 | { | ||
226 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); // NOTE: leaves texture stage set | ||
227 | |||
210 | glEnable(GL_TEXTURE_GEN_R); | 228 | glEnable(GL_TEXTURE_GEN_R); |
211 | glEnable(GL_TEXTURE_GEN_S); | 229 | glEnable(GL_TEXTURE_GEN_S); |
212 | glEnable(GL_TEXTURE_GEN_T); | 230 | glEnable(GL_TEXTURE_GEN_T); |
@@ -214,10 +232,18 @@ void LLCubeMap::enable(S32 stage) | |||
214 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); | 232 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); |
215 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); | 233 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); |
216 | glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); | 234 | glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); |
235 | |||
236 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
217 | } | 237 | } |
218 | } | 238 | } |
219 | 239 | ||
220 | void LLCubeMap::disable() | 240 | void LLCubeMap::disable(void) |
241 | { | ||
242 | disableTexture(); | ||
243 | disableTextureCoords(); | ||
244 | } | ||
245 | |||
246 | void LLCubeMap::disableTexture(void) | ||
221 | { | 247 | { |
222 | if (gGLManager.mHasCubeMap && mTextureStage >= 0 | 248 | if (gGLManager.mHasCubeMap && mTextureStage >= 0 |
223 | //&& gFeatureManagerp->isFeatureAvailable("RenderCubeMap") | 249 | //&& gFeatureManagerp->isFeatureAvailable("RenderCubeMap") |
@@ -225,10 +251,18 @@ void LLCubeMap::disable() | |||
225 | { | 251 | { |
226 | glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); | 252 | glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); |
227 | glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); | 253 | glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); |
254 | glDisable(GL_TEXTURE_CUBE_MAP_ARB); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | void LLCubeMap::disableTextureCoords(void) | ||
259 | { | ||
260 | if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0) | ||
261 | { | ||
262 | glActiveTextureARB(GL_TEXTURE0_ARB + mTextureCoordStage); | ||
228 | glDisable(GL_TEXTURE_GEN_S); | 263 | glDisable(GL_TEXTURE_GEN_S); |
229 | glDisable(GL_TEXTURE_GEN_T); | 264 | glDisable(GL_TEXTURE_GEN_T); |
230 | glDisable(GL_TEXTURE_GEN_R); | 265 | glDisable(GL_TEXTURE_GEN_R); |
231 | glDisable(GL_TEXTURE_CUBE_MAP_ARB); | ||
232 | } | 266 | } |
233 | } | 267 | } |
234 | 268 | ||
@@ -250,6 +284,7 @@ void LLCubeMap::setMatrix(S32 stage) | |||
250 | glPushMatrix(); | 284 | glPushMatrix(); |
251 | glLoadMatrixf((F32 *)trans.mMatrix); | 285 | glLoadMatrixf((F32 *)trans.mMatrix); |
252 | glMatrixMode(GL_MODELVIEW); | 286 | glMatrixMode(GL_MODELVIEW); |
287 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
253 | } | 288 | } |
254 | 289 | ||
255 | void LLCubeMap::restoreMatrix() | 290 | void LLCubeMap::restoreMatrix() |
@@ -258,6 +293,7 @@ void LLCubeMap::restoreMatrix() | |||
258 | glMatrixMode(GL_TEXTURE); | 293 | glMatrixMode(GL_TEXTURE); |
259 | glPopMatrix(); | 294 | glPopMatrix(); |
260 | glMatrixMode(GL_MODELVIEW); | 295 | glMatrixMode(GL_MODELVIEW); |
296 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
261 | } | 297 | } |
262 | 298 | ||
263 | LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const | 299 | LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const |