aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llcubemap.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:50 -0500
committerJacek Antonelli2008-08-15 23:45:50 -0500
commit2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch)
tree95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llcubemap.cpp
parentSecond Life viewer sources 1.20.6 (diff)
downloadmeta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz
Second Life viewer sources 1.20.7
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llcubemap.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/linden/indra/newview/llcubemap.cpp b/linden/indra/newview/llcubemap.cpp
index 31937ba..f79fd0f 100644
--- a/linden/indra/newview/llcubemap.cpp
+++ b/linden/indra/newview/llcubemap.cpp
@@ -38,6 +38,8 @@
38#include "v4coloru.h" 38#include "v4coloru.h"
39#include "v3math.h" 39#include "v3math.h"
40 40
41#include "llrender.h"
42
41#include "llviewercamera.h" 43#include "llviewercamera.h"
42#include "llviewerimage.h" 44#include "llviewerimage.h"
43#include "llviewerimagelist.h" 45#include "llviewerimagelist.h"
@@ -95,9 +97,7 @@ void LLCubeMap::initGL()
95 mImages[i]->createGLTexture(0, mRawImages[i], texname); 97 mImages[i]->createGLTexture(0, mRawImages[i], texname);
96 98
97 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texname); 99 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texname);
98 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 100 mImages[i]->setClampCubemap (TRUE, TRUE, TRUE);
99 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
100 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
101 stop_glerror(); 101 stop_glerror();
102 } 102 }
103 } 103 }
@@ -187,16 +187,15 @@ void LLCubeMap::bind()
187 // We assume that if they have cube mapping, they have multitexturing. 187 // We assume that if they have cube mapping, they have multitexturing.
188 if (mTextureStage > 0) 188 if (mTextureStage > 0)
189 { 189 {
190 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); 190 gGL.getTexUnit(mTextureStage)->activate();
191 } 191 }
192 glEnable(GL_TEXTURE_CUBE_MAP_ARB); 192 glEnable(GL_TEXTURE_CUBE_MAP_ARB);
193 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName()); 193 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName());
194 194
195 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 195 mImages[0]->setMipFilterNearest (FALSE, FALSE);
196 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, (use_cube_mipmaps? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR));
197 if (mTextureStage > 0) 196 if (mTextureStage > 0)
198 { 197 {
199 glActiveTextureARB(GL_TEXTURE0_ARB); 198 gGL.getTexUnit(0)->activate();
200 } 199 }
201 } 200 }
202 else 201 else
@@ -221,14 +220,14 @@ void LLCubeMap::enableTexture(S32 stage)
221 { 220 {
222 if (stage > 0) 221 if (stage > 0)
223 { 222 {
224 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 223 gGL.getTexUnit(stage)->activate();
225 } 224 }
226 225
227 glEnable(GL_TEXTURE_CUBE_MAP_ARB); 226 glEnable(GL_TEXTURE_CUBE_MAP_ARB);
228 227
229 if (stage > 0) 228 if (stage > 0)
230 { 229 {
231 glActiveTextureARB(GL_TEXTURE0_ARB); 230 gGL.getTexUnit(0)->activate();
232 } 231 }
233 } 232 }
234} 233}
@@ -240,7 +239,7 @@ void LLCubeMap::enableTextureCoords(S32 stage)
240 { 239 {
241 if (stage > 0) 240 if (stage > 0)
242 { 241 {
243 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 242 gGL.getTexUnit(stage)->activate();
244 } 243 }
245 244
246 glEnable(GL_TEXTURE_GEN_R); 245 glEnable(GL_TEXTURE_GEN_R);
@@ -253,7 +252,7 @@ void LLCubeMap::enableTextureCoords(S32 stage)
253 252
254 if (stage > 0) 253 if (stage > 0)
255 { 254 {
256 glActiveTextureARB(GL_TEXTURE0_ARB); 255 gGL.getTexUnit(0)->activate();
257 } 256 }
258 } 257 }
259} 258}
@@ -272,13 +271,13 @@ void LLCubeMap::disableTexture(void)
272 { 271 {
273 if (mTextureStage > 0) 272 if (mTextureStage > 0)
274 { 273 {
275 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); 274 gGL.getTexUnit(mTextureStage)->activate();
276 } 275 }
277 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); 276 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);
278 glDisable(GL_TEXTURE_CUBE_MAP_ARB); 277 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
279 if (mTextureStage > 0) 278 if (mTextureStage > 0)
280 { 279 {
281 glActiveTextureARB(GL_TEXTURE0_ARB); 280 gGL.getTexUnit(0)->activate();
282 } 281 }
283 } 282 }
284} 283}
@@ -289,14 +288,14 @@ void LLCubeMap::disableTextureCoords(void)
289 { 288 {
290 if (mTextureCoordStage > 0) 289 if (mTextureCoordStage > 0)
291 { 290 {
292 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureCoordStage); 291 gGL.getTexUnit(mTextureCoordStage)->activate();
293 } 292 }
294 glDisable(GL_TEXTURE_GEN_S); 293 glDisable(GL_TEXTURE_GEN_S);
295 glDisable(GL_TEXTURE_GEN_T); 294 glDisable(GL_TEXTURE_GEN_T);
296 glDisable(GL_TEXTURE_GEN_R); 295 glDisable(GL_TEXTURE_GEN_R);
297 if (mTextureCoordStage > 0) 296 if (mTextureCoordStage > 0)
298 { 297 {
299 glActiveTextureARB(GL_TEXTURE0_ARB); 298 gGL.getTexUnit(0)->activate();
300 } 299 }
301 } 300 }
302} 301}
@@ -307,7 +306,7 @@ void LLCubeMap::setMatrix(S32 stage)
307 306
308 if (stage > 0) 307 if (stage > 0)
309 { 308 {
310 glActiveTextureARB(GL_TEXTURE0_ARB+stage); 309 gGL.getTexUnit(stage)->activate();
311 } 310 }
312 311
313 LLVector3 x(LLVector3d(gGLModelView+0)); 312 LLVector3 x(LLVector3d(gGLModelView+0));
@@ -326,7 +325,7 @@ void LLCubeMap::setMatrix(S32 stage)
326 325
327 if (stage > 0) 326 if (stage > 0)
328 { 327 {
329 glActiveTextureARB(GL_TEXTURE0_ARB); 328 gGL.getTexUnit(0)->activate();
330 } 329 }
331} 330}
332 331
@@ -334,7 +333,7 @@ void LLCubeMap::restoreMatrix()
334{ 333{
335 if (mMatrixStage > 0) 334 if (mMatrixStage > 0)
336 { 335 {
337 glActiveTextureARB(GL_TEXTURE0_ARB+mMatrixStage); 336 gGL.getTexUnit(mMatrixStage)->activate();
338 } 337 }
339 glMatrixMode(GL_TEXTURE); 338 glMatrixMode(GL_TEXTURE);
340 glPopMatrix(); 339 glPopMatrix();
@@ -342,10 +341,17 @@ void LLCubeMap::restoreMatrix()
342 341
343 if (mMatrixStage > 0) 342 if (mMatrixStage > 0)
344 { 343 {
345 glActiveTextureARB(GL_TEXTURE0_ARB); 344 gGL.getTexUnit(0)->activate();
346 } 345 }
347} 346}
348 347
348void LLCubeMap::setReflection (void)
349{
350 glBindTexture (GL_TEXTURE_CUBE_MAP_ARB, getGLName());
351 mImages[0]->setMipFilterNearest (FALSE, FALSE);
352 mImages[0]->setClampCubemap (TRUE, TRUE);
353}
354
349LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const 355LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const
350{ 356{
351 LLVector3 dir; 357 LLVector3 dir;