aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lldrawpoolterrain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lldrawpoolterrain.cpp')
-rw-r--r--linden/indra/newview/lldrawpoolterrain.cpp98
1 files changed, 36 insertions, 62 deletions
diff --git a/linden/indra/newview/lldrawpoolterrain.cpp b/linden/indra/newview/lldrawpoolterrain.cpp
index 1390fc9..8ac053c 100644
--- a/linden/indra/newview/lldrawpoolterrain.cpp
+++ b/linden/indra/newview/lldrawpoolterrain.cpp
@@ -32,7 +32,6 @@
32#include "llfasttimer.h" 32#include "llfasttimer.h"
33 33
34#include "llagent.h" 34#include "llagent.h"
35#include "llagparray.h"
36#include "llviewercontrol.h" 35#include "llviewercontrol.h"
37#include "lldrawable.h" 36#include "lldrawable.h"
38#include "llface.h" 37#include "llface.h"
@@ -56,7 +55,7 @@ S32 LLDrawPoolTerrain::sDetailMode = 1;
56F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE; 55F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE;
57 56
58LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : 57LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) :
59 LLDrawPool(POOL_TERRAIN, DATA_SIMPLE_IL_MASK | DATA_COLORS_MASK | DATA_TEX_COORDS1_MASK, DATA_SIMPLE_NIL_MASK), 58 LLFacePool(POOL_TERRAIN),
60 mTexturep(texturep) 59 mTexturep(texturep)
61{ 60{
62 // Hack! 61 // Hack!
@@ -94,6 +93,13 @@ void LLDrawPoolTerrain::prerender()
94#if 0 // 1.9.2 93#if 0 // 1.9.2
95 mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT); 94 mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT);
96#endif 95#endif
96 sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
97}
98
99//static
100S32 LLDrawPoolTerrain::getDetailMode()
101{
102 return sDetailMode;
97} 103}
98 104
99void LLDrawPoolTerrain::render(S32 pass) 105void LLDrawPoolTerrain::render(S32 pass)
@@ -105,6 +111,15 @@ void LLDrawPoolTerrain::render(S32 pass)
105 return; 111 return;
106 } 112 }
107 113
114 // Hack! Get the region that this draw pool is rendering from!
115 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
116 LLVLComposition *compp = regionp->getComposition();
117 for (S32 i = 0; i < 4; i++)
118 {
119 compp->mDetailTextures[i]->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
120 compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
121 }
122
108 if (!gGLManager.mHasMultitexture) 123 if (!gGLManager.mHasMultitexture)
109 { 124 {
110 // No mulititexture, render simple land. 125 // No mulititexture, render simple land.
@@ -171,25 +186,16 @@ void LLDrawPoolTerrain::renderFull4TUShader()
171 glEnableClientState(GL_VERTEX_ARRAY); 186 glEnableClientState(GL_VERTEX_ARRAY);
172 glEnableClientState(GL_NORMAL_ARRAY); 187 glEnableClientState(GL_NORMAL_ARRAY);
173 188
174 bindGLVertexPointer();
175 bindGLNormalPointer();
176 if (gPipeline.getLightingDetail() >= 2) 189 if (gPipeline.getLightingDetail() >= 2)
177 { 190 {
178 glEnableClientState(GL_COLOR_ARRAY); 191 glEnableClientState(GL_COLOR_ARRAY);
179 bindGLColorPointer();
180 } 192 }
181 193
182 glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA); 194 glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
183 195
184 // Hack! Get the region that this draw pool is rendering from! 196 // Hack! Get the region that this draw pool is rendering from!
185 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); 197 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
186 LLVLComposition *compp = regionp->getComposition(); 198 LLVLComposition *compp = regionp->getComposition();
187 for (S32 i = 0; i < 4; i++)
188 {
189 compp->mDetailTextures[i]->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
190 compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
191 }
192
193 LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; 199 LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
194 LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; 200 LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
195 LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; 201 LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
@@ -219,8 +225,7 @@ void LLDrawPoolTerrain::renderFull4TUShader()
219 S32 detailTex0 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0); 225 S32 detailTex0 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0);
220 S32 detailTex1 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1); 226 S32 detailTex1 = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1);
221 S32 rampTex = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP); 227 S32 rampTex = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP);
222 S32 scatterTex = gPipeline.mTerrainProgram.enableTexture(LLPipeline::GLSL_SCATTER_MAP); 228
223
224 LLViewerImage::bindTexture(detail_texture0p,detailTex0); 229 LLViewerImage::bindTexture(detail_texture0p,detailTex0);
225 230
226 glClientActiveTextureARB(GL_TEXTURE0_ARB); 231 glClientActiveTextureARB(GL_TEXTURE0_ARB);
@@ -241,7 +246,6 @@ void LLDrawPoolTerrain::renderFull4TUShader()
241 246
242 glClientActiveTextureARB(GL_TEXTURE1_ARB); 247 glClientActiveTextureARB(GL_TEXTURE1_ARB);
243 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 248 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
244 bindGLTexCoordPointer(1);
245 249
246 // 250 //
247 // Stage 2: Interpolate detail1 with existing based on ramp 251 // Stage 2: Interpolate detail1 with existing based on ramp
@@ -258,9 +262,6 @@ void LLDrawPoolTerrain::renderFull4TUShader()
258 glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); 262 glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
259 glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); 263 glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
260 264
261 // Stage 4: Haze
262 LLViewerImage::bindTexture(gSky.mVOSkyp->getScatterMap(), scatterTex);
263
264 // 265 //
265 // Stage 3: Modulate with primary color for lighting 266 // Stage 3: Modulate with primary color for lighting
266 // 267 //
@@ -297,7 +298,6 @@ void LLDrawPoolTerrain::renderFull4TUShader()
297 glClientActiveTextureARB(GL_TEXTURE1_ARB); 298 glClientActiveTextureARB(GL_TEXTURE1_ARB);
298 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 299 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
299 glActiveTextureARB(GL_TEXTURE1_ARB); 300 glActiveTextureARB(GL_TEXTURE1_ARB);
300 bindGLTexCoordPointer(1);
301 301
302 // Set the texture matrix 302 // Set the texture matrix
303 glMatrixMode(GL_TEXTURE); 303 glMatrixMode(GL_TEXTURE);
@@ -329,7 +329,6 @@ void LLDrawPoolTerrain::renderFull4TUShader()
329 glClientActiveTextureARB(GL_TEXTURE3_ARB); 329 glClientActiveTextureARB(GL_TEXTURE3_ARB);
330 glActiveTextureARB(GL_TEXTURE3_ARB); 330 glActiveTextureARB(GL_TEXTURE3_ARB);
331 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 331 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
332 bindGLTexCoordPointer(1);
333 332
334 // Set the texture matrix 333 // Set the texture matrix
335 glMatrixMode(GL_TEXTURE); 334 glMatrixMode(GL_TEXTURE);
@@ -342,7 +341,6 @@ void LLDrawPoolTerrain::renderFull4TUShader()
342 } 341 }
343 342
344 // Disable multitexture 343 // Disable multitexture
345 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_SCATTER_MAP);
346 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP); 344 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_ALPHARAMP);
347 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0); 345 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL0);
348 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1); 346 gPipeline.mTerrainProgram.disableTexture(LLPipeline::GLSL_TERRAIN_DETAIL1);
@@ -396,18 +394,9 @@ void LLDrawPoolTerrain::renderFull4TU()
396 glEnableClientState(GL_VERTEX_ARRAY); 394 glEnableClientState(GL_VERTEX_ARRAY);
397 glEnableClientState(GL_NORMAL_ARRAY); 395 glEnableClientState(GL_NORMAL_ARRAY);
398 396
399 bindGLVertexPointer();
400 bindGLNormalPointer();
401
402 // Hack! Get the region that this draw pool is rendering from! 397 // Hack! Get the region that this draw pool is rendering from!
403 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); 398 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
404 LLVLComposition *compp = regionp->getComposition(); 399 LLVLComposition *compp = regionp->getComposition();
405 for (S32 i = 0; i < 4; i++)
406 {
407 compp->mDetailTextures[i]->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
408 compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
409 }
410
411 LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; 400 LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
412 LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; 401 LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
413 LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; 402 LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
@@ -430,6 +419,7 @@ void LLDrawPoolTerrain::renderFull4TU()
430 // 419 //
431 // Stage 0: detail texture 0 420 // Stage 0: detail texture 0
432 // 421 //
422 glActiveTextureARB(GL_TEXTURE0_ARB);
433 LLViewerImage::bindTexture(detail_texture0p,0); 423 LLViewerImage::bindTexture(detail_texture0p,0);
434 glClientActiveTextureARB(GL_TEXTURE0_ARB); 424 glClientActiveTextureARB(GL_TEXTURE0_ARB);
435 425
@@ -451,12 +441,12 @@ void LLDrawPoolTerrain::renderFull4TU()
451 // 441 //
452 // Stage 1: Generate alpha ramp for detail0/detail1 transition 442 // Stage 1: Generate alpha ramp for detail0/detail1 transition
453 // 443 //
444 glActiveTextureARB(GL_TEXTURE1_ARB);
454 LLViewerImage::bindTexture(m2DAlphaRampImagep,1); 445 LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
455 446
456 glEnable(GL_TEXTURE_2D); // Texture unit 1 447 glEnable(GL_TEXTURE_2D); // Texture unit 1
457 glClientActiveTextureARB(GL_TEXTURE1_ARB); 448 glClientActiveTextureARB(GL_TEXTURE1_ARB);
458 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 449 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
459 bindGLTexCoordPointer(1);
460 450
461 // Care about alpha only 451 // Care about alpha only
462 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 452 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
@@ -471,6 +461,7 @@ void LLDrawPoolTerrain::renderFull4TU()
471 // 461 //
472 // Stage 2: Interpolate detail1 with existing based on ramp 462 // Stage 2: Interpolate detail1 with existing based on ramp
473 // 463 //
464 glActiveTextureARB(GL_TEXTURE2_ARB);
474 LLViewerImage::bindTexture(detail_texture1p,2); 465 LLViewerImage::bindTexture(detail_texture1p,2);
475 glEnable(GL_TEXTURE_2D); // Texture unit 2 466 glEnable(GL_TEXTURE_2D); // Texture unit 2
476 glClientActiveTextureARB(GL_TEXTURE2_ARB); 467 glClientActiveTextureARB(GL_TEXTURE2_ARB);
@@ -496,6 +487,7 @@ void LLDrawPoolTerrain::renderFull4TU()
496 // 487 //
497 // Stage 3: Modulate with primary (vertex) color for lighting 488 // Stage 3: Modulate with primary (vertex) color for lighting
498 // 489 //
490 glActiveTextureARB(GL_TEXTURE3_ARB);
499 LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture 491 LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture
500 glEnable(GL_TEXTURE_2D); // Texture unit 3 492 glEnable(GL_TEXTURE_2D); // Texture unit 3
501 glClientActiveTextureARB(GL_TEXTURE3_ARB); 493 glClientActiveTextureARB(GL_TEXTURE3_ARB);
@@ -517,6 +509,7 @@ void LLDrawPoolTerrain::renderFull4TU()
517 509
518 // Stage 0: Write detail3 into base 510 // Stage 0: Write detail3 into base
519 // 511 //
512 glActiveTextureARB(GL_TEXTURE0_ARB);
520 LLViewerImage::bindTexture(detail_texture3p,0); 513 LLViewerImage::bindTexture(detail_texture3p,0);
521 glClientActiveTextureARB(GL_TEXTURE0_ARB); 514 glClientActiveTextureARB(GL_TEXTURE0_ARB);
522 515
@@ -538,14 +531,13 @@ void LLDrawPoolTerrain::renderFull4TU()
538 // 531 //
539 // Stage 1: Generate alpha ramp for detail2/detail3 transition 532 // Stage 1: Generate alpha ramp for detail2/detail3 transition
540 // 533 //
534 glActiveTextureARB(GL_TEXTURE1_ARB);
541 LLViewerImage::bindTexture(m2DAlphaRampImagep,1); 535 LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
542 536
543 glEnable(GL_TEXTURE_2D); // Texture unit 1 537 glEnable(GL_TEXTURE_2D); // Texture unit 1
544 glClientActiveTextureARB(GL_TEXTURE1_ARB); 538 glClientActiveTextureARB(GL_TEXTURE1_ARB);
545 539
546 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 540 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
547 bindGLTexCoordPointer(1);
548
549 541
550 // Set the texture matrix 542 // Set the texture matrix
551 glMatrixMode(GL_TEXTURE); 543 glMatrixMode(GL_TEXTURE);
@@ -566,6 +558,7 @@ void LLDrawPoolTerrain::renderFull4TU()
566 // 558 //
567 // Stage 2: Interpolate detail2 with existing based on ramp 559 // Stage 2: Interpolate detail2 with existing based on ramp
568 // 560 //
561 glActiveTextureARB(GL_TEXTURE2_ARB);
569 LLViewerImage::bindTexture(detail_texture2p,2); 562 LLViewerImage::bindTexture(detail_texture2p,2);
570 glEnable(GL_TEXTURE_2D); // Texture unit 2 563 glEnable(GL_TEXTURE_2D); // Texture unit 2
571 glClientActiveTextureARB(GL_TEXTURE2_ARB); 564 glClientActiveTextureARB(GL_TEXTURE2_ARB);
@@ -592,19 +585,19 @@ void LLDrawPoolTerrain::renderFull4TU()
592 // 585 //
593 // Stage 3: Generate alpha ramp for detail1/detail2 transition 586 // Stage 3: Generate alpha ramp for detail1/detail2 transition
594 // 587 //
588 glActiveTextureARB(GL_TEXTURE3_ARB);
595 LLViewerImage::bindTexture(m2DAlphaRampImagep,3); 589 LLViewerImage::bindTexture(m2DAlphaRampImagep,3);
596 590
597 glEnable(GL_TEXTURE_2D); // Texture unit 3 591 glEnable(GL_TEXTURE_2D); // Texture unit 3
598 glClientActiveTextureARB(GL_TEXTURE3_ARB); 592 glClientActiveTextureARB(GL_TEXTURE3_ARB);
599 593
600 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 594 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
601 bindGLTexCoordPointer(1);
602 595
603 // Set the texture matrix 596 // Set the texture matrix
604 glMatrixMode(GL_TEXTURE); 597 glMatrixMode(GL_TEXTURE);
605 glLoadIdentity(); 598 glLoadIdentity();
606 glTranslatef(-1.f, 0.f, 0.f); 599 glTranslatef(-1.f, 0.f, 0.f);
607 600
608 // Set alpha texture and do lighting modulation 601 // Set alpha texture and do lighting modulation
609 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 602 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
610 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); 603 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
@@ -675,18 +668,9 @@ void LLDrawPoolTerrain::renderFull2TU()
675 glEnableClientState(GL_VERTEX_ARRAY); 668 glEnableClientState(GL_VERTEX_ARRAY);
676 glEnableClientState(GL_NORMAL_ARRAY); 669 glEnableClientState(GL_NORMAL_ARRAY);
677 670
678 bindGLVertexPointer();
679 bindGLNormalPointer();
680
681 // Hack! Get the region that this draw pool is rendering from! 671 // Hack! Get the region that this draw pool is rendering from!
682 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); 672 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
683 LLVLComposition *compp = regionp->getComposition(); 673 LLVLComposition *compp = regionp->getComposition();
684 for (S32 i = 0; i < 4; i++)
685 {
686 compp->mDetailTextures[i]->setBoostLevel(LLViewerImage::BOOST_TERRAIN);
687 compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
688 }
689
690 LLViewerImage *detail_texture0p = compp->mDetailTextures[0]; 674 LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
691 LLViewerImage *detail_texture1p = compp->mDetailTextures[1]; 675 LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
692 LLViewerImage *detail_texture2p = compp->mDetailTextures[2]; 676 LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
@@ -743,7 +727,6 @@ void LLDrawPoolTerrain::renderFull2TU()
743 glDisable(GL_TEXTURE_GEN_S); 727 glDisable(GL_TEXTURE_GEN_S);
744 glDisable(GL_TEXTURE_GEN_T); 728 glDisable(GL_TEXTURE_GEN_T);
745 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 729 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
746 bindGLTexCoordPointer(1);
747 730
748 // Care about alpha only 731 // Care about alpha only
749 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 732 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
@@ -800,7 +783,6 @@ void LLDrawPoolTerrain::renderFull2TU()
800 glTranslatef(-1.f, 0.f, 0.f); 783 glTranslatef(-1.f, 0.f, 0.f);
801 784
802 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 785 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
803 bindGLTexCoordPointer(1);
804 786
805 // Care about alpha only 787 // Care about alpha only
806 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 788 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
@@ -858,7 +840,6 @@ void LLDrawPoolTerrain::renderFull2TU()
858 glTranslatef(-2.f, 0.f, 0.f); 840 glTranslatef(-2.f, 0.f, 0.f);
859 841
860 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 842 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
861 bindGLTexCoordPointer(1);
862 843
863 // Care about alpha only 844 // Care about alpha only
864 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 845 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
@@ -938,9 +919,6 @@ void LLDrawPoolTerrain::renderSimple()
938 glEnableClientState(GL_VERTEX_ARRAY); 919 glEnableClientState(GL_VERTEX_ARRAY);
939 glEnableClientState(GL_NORMAL_ARRAY); 920 glEnableClientState(GL_NORMAL_ARRAY);
940 921
941 bindGLVertexPointer();
942 bindGLNormalPointer();
943
944 LLVector4 tp0, tp1; 922 LLVector4 tp0, tp1;
945 923
946 //---------------------------------------------------------------------------- 924 //----------------------------------------------------------------------------
@@ -1018,9 +996,6 @@ void LLDrawPoolTerrain::renderOwnership()
1018 glEnableClientState(GL_VERTEX_ARRAY); 996 glEnableClientState(GL_VERTEX_ARRAY);
1019 glDisableClientState(GL_NORMAL_ARRAY); 997 glDisableClientState(GL_NORMAL_ARRAY);
1020 998
1021 bindGLVertexPointer();
1022 bindGLTexCoordPointer(0);
1023
1024 LLViewerImage::bindTexture(texturep); 999 LLViewerImage::bindTexture(texturep);
1025 1000
1026 glClientActiveTextureARB(GL_TEXTURE0_ARB); 1001 glClientActiveTextureARB(GL_TEXTURE0_ARB);
@@ -1036,12 +1011,12 @@ void LLDrawPoolTerrain::renderOwnership()
1036 const F32 TEXTURE_FUDGE = 257.f / 256.f; 1011 const F32 TEXTURE_FUDGE = 257.f / 256.f;
1037 glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f ); 1012 glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
1038 1013
1039 const U32* index_array = getRawIndices();
1040 for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); 1014 for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
1041 iter != mDrawFace.end(); iter++) 1015 iter != mDrawFace.end(); iter++)
1042 { 1016 {
1043 LLFace *facep = *iter; 1017 LLFace *facep = *iter;
1044 facep->renderIndexed(index_array); 1018 facep->renderIndexed(LLVertexBuffer::MAP_VERTEX |
1019 LLVertexBuffer::MAP_TEXCOORD);
1045 } 1020 }
1046 1021
1047 glMatrixMode(GL_TEXTURE); 1022 glMatrixMode(GL_TEXTURE);
@@ -1055,14 +1030,13 @@ void LLDrawPoolTerrain::renderOwnership()
1055 1030
1056void LLDrawPoolTerrain::renderForSelect() 1031void LLDrawPoolTerrain::renderForSelect()
1057{ 1032{
1058 if (mDrawFace.empty() || !mMemory.count()) 1033 if (mDrawFace.empty())
1059 { 1034 {
1060 return; 1035 return;
1061 } 1036 }
1062 1037
1063 glEnableClientState ( GL_VERTEX_ARRAY ); 1038
1064 1039 LLImageGL::unbindTexture(0);
1065 bindGLVertexPointer();
1066 1040
1067 for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); 1041 for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
1068 iter != mDrawFace.end(); iter++) 1042 iter != mDrawFace.end(); iter++)
@@ -1070,14 +1044,14 @@ void LLDrawPoolTerrain::renderForSelect()
1070 LLFace *facep = *iter; 1044 LLFace *facep = *iter;
1071 if (!facep->getDrawable()->isDead() && (facep->getDrawable()->getVObj()->mGLName)) 1045 if (!facep->getDrawable()->isDead() && (facep->getDrawable()->getVObj()->mGLName))
1072 { 1046 {
1073 facep->renderForSelect(); 1047 facep->renderForSelect(LLVertexBuffer::MAP_VERTEX);
1074 } 1048 }
1075 } 1049 }
1076} 1050}
1077 1051
1078void LLDrawPoolTerrain::dirtyTexture(const LLViewerImage *texturep) 1052void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerImage*>& textures)
1079{ 1053{
1080 if (mTexturep == texturep) 1054 if (textures.find(mTexturep) != textures.end())
1081 { 1055 {
1082 for (std::vector<LLFace*>::iterator iter = mReferences.begin(); 1056 for (std::vector<LLFace*>::iterator iter = mReferences.begin();
1083 iter != mReferences.end(); iter++) 1057 iter != mReferences.end(); iter++)