aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexlayer.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/lltexlayer.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/lltexlayer.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp
index 66d9a33..0e4c9c2 100644
--- a/linden/indra/newview/lltexlayer.cpp
+++ b/linden/indra/newview/lltexlayer.cpp
@@ -52,7 +52,7 @@
52#include "llxmltree.h" 52#include "llxmltree.h"
53#include "pipeline.h" 53#include "pipeline.h"
54#include "v4coloru.h" 54#include "v4coloru.h"
55#include "llglimmediate.h" 55#include "llrender.h"
56 56
57//#include "../tools/imdebug/imdebug.h" 57//#include "../tools/imdebug/imdebug.h"
58 58
@@ -239,6 +239,9 @@ BOOL LLTexLayerSetBuffer::render()
239{ 239{
240 U8* baked_bump_data = NULL; 240 U8* baked_bump_data = NULL;
241 241
242 // Default color mask for tex layer render
243 gGL.setColorMask(true, true);
244
242 // do we need to upload, and do we have sufficient data to create an uploadable composite? 245 // do we need to upload, and do we have sufficient data to create an uploadable composite?
243 // When do we upload the texture if gAgent.mNumPendingQueries is non-zero? 246 // When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
244 BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); 247 BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal());
@@ -292,8 +295,8 @@ BOOL LLTexLayerSetBuffer::render()
292 } 295 }
293 296
294 // reset GL state 297 // reset GL state
295 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 298 gGL.setColorMask(true, true);
296 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 299 gGL.setSceneBlendType(LLRender::BT_ALPHA);
297 300
298 // we have valid texture data now 301 // we have valid texture data now
299 mInitialized = TRUE; 302 mInitialized = TRUE;
@@ -756,6 +759,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
756 759
757 LLGLSUIDefault gls_ui; 760 LLGLSUIDefault gls_ui;
758 LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); 761 LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
762 gGL.setColorMask(true, true);
759 763
760 // composite color layers 764 // composite color layers
761 for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) 765 for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
@@ -774,8 +778,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
774 { 778 {
775 LLGLSNoAlphaTest gls_no_alpha_test; 779 LLGLSNoAlphaTest gls_no_alpha_test;
776 gGL.flush(); 780 gGL.flush();
777 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 781 gGL.setColorMask(false, true);
778 gGL.blendFunc( GL_ONE, GL_ZERO ); 782 gGL.setSceneBlendType(LLRender::BT_REPLACE);
779 783
780 { 784 {
781 LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE ); 785 LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE );
@@ -793,8 +797,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
793 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 797 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
794 798
795 gGL.flush(); 799 gGL.flush();
796 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 800 gGL.setColorMask(true, true);
797 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 801 gGL.setSceneBlendType(LLRender::BT_ALPHA);
798 } 802 }
799 else 803 else
800 if( getInfo()->mClearAlpha ) 804 if( getInfo()->mClearAlpha )
@@ -803,12 +807,12 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
803 LLGLSNoTextureNoAlphaTest gls_no_alpha; 807 LLGLSNoTextureNoAlphaTest gls_no_alpha;
804 gGL.color4f( 0.f, 0.f, 0.f, 1.f ); 808 gGL.color4f( 0.f, 0.f, 0.f, 1.f );
805 gGL.flush(); 809 gGL.flush();
806 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 810 gGL.setColorMask(false, true);
807 811
808 gl_rect_2d_simple( width, height ); 812 gl_rect_2d_simple( width, height );
809 813
810 gGL.flush(); 814 gGL.flush();
811 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 815 gGL.setColorMask(true, true);
812 } 816 }
813 stop_glerror(); 817 stop_glerror();
814 818
@@ -836,11 +840,11 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height )
836 // Set the alpha channel to one (clean up after previous blending) 840 // Set the alpha channel to one (clean up after previous blending)
837 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha; 841 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha;
838 gGL.color4f( 0.f, 0.f, 0.f, 1.f ); 842 gGL.color4f( 0.f, 0.f, 0.f, 1.f );
839 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 843 gGL.setColorMask(false, true);
840 844
841 gl_rect_2d_simple( width, height ); 845 gl_rect_2d_simple( width, height );
842 846
843 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 847 gGL.setColorMask(true, true);
844 stop_glerror(); 848 stop_glerror();
845 849
846 return success; 850 return success;
@@ -1330,7 +1334,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
1330 renderAlphaMasks( x, y, width, height, &net_color ); 1334 renderAlphaMasks( x, y, width, height, &net_color );
1331 alpha_mask_specified = TRUE; 1335 alpha_mask_specified = TRUE;
1332 gGL.flush(); 1336 gGL.flush();
1333 gGL.blendFunc( GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA ); 1337 gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA);
1334 } 1338 }
1335 1339
1336 gGL.color4fv( net_color.mV); 1340 gGL.color4fv( net_color.mV);
@@ -1338,7 +1342,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
1338 if( getInfo()->mWriteAllChannels ) 1342 if( getInfo()->mWriteAllChannels )
1339 { 1343 {
1340 gGL.flush(); 1344 gGL.flush();
1341 gGL.blendFunc( GL_ONE, GL_ZERO ); 1345 gGL.setSceneBlendType(LLRender::BT_REPLACE);
1342 } 1346 }
1343 1347
1344 if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) 1348 if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
@@ -1401,7 +1405,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
1401 { 1405 {
1402 // Restore standard blend func value 1406 // Restore standard blend func value
1403 gGL.flush(); 1407 gGL.flush();
1404 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 1408 gGL.setSceneBlendType(LLRender::BT_ALPHA);
1405 stop_glerror(); 1409 stop_glerror();
1406 } 1410 }
1407 1411
@@ -1506,7 +1510,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1506 1510
1507 llassert( !mParamAlphaList.empty() ); 1511 llassert( !mParamAlphaList.empty() );
1508 1512
1509 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 1513 gGL.setColorMask(false, true);
1510 1514
1511 alpha_list_t::iterator iter = mParamAlphaList.begin(); 1515 alpha_list_t::iterator iter = mParamAlphaList.begin();
1512 LLTexLayerParamAlpha* first_param = *iter; 1516 LLTexLayerParamAlpha* first_param = *iter;
@@ -1518,7 +1522,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1518 1522
1519 // Clear the alpha 1523 // Clear the alpha
1520 gGL.flush(); 1524 gGL.flush();
1521 gGL.blendFunc( GL_ONE, GL_ZERO ); 1525 gGL.setSceneBlendType(LLRender::BT_REPLACE);
1522 1526
1523 gGL.color4f( 0.f, 0.f, 0.f, 0.f ); 1527 gGL.color4f( 0.f, 0.f, 0.f, 0.f );
1524 gl_rect_2d_simple( width, height ); 1528 gl_rect_2d_simple( width, height );
@@ -1536,7 +1540,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1536 1540
1537 // Approximates a min() function 1541 // Approximates a min() function
1538 gGL.flush(); 1542 gGL.flush();
1539 gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); 1543 gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO);
1540 1544
1541 // Accumulate the alpha component of the texture 1545 // Accumulate the alpha component of the texture
1542 if( getInfo()->mLocalTexture != -1 ) 1546 if( getInfo()->mLocalTexture != -1 )
@@ -1601,7 +1605,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1601 1605
1602 LLGLSUIDefault gls_ui; 1606 LLGLSUIDefault gls_ui;
1603 1607
1604 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 1608 gGL.setColorMask(true, true);
1605 1609
1606 if (!mMorphMasksValid && !mMaskedMorphs.empty()) 1610 if (!mMorphMasksValid && !mMaskedMorphs.empty())
1607 { 1611 {
@@ -1963,11 +1967,11 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height )
1963 gGL.flush(); 1967 gGL.flush();
1964 if( getInfo()->mMultiplyBlend ) 1968 if( getInfo()->mMultiplyBlend )
1965 { 1969 {
1966 gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); // Multiplication: approximates a min() function 1970 gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function
1967 } 1971 }
1968 else 1972 else
1969 { 1973 {
1970 gGL.blendFunc( GL_ONE, GL_ONE ); // Addition: approximates a max() function 1974 gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function
1971 } 1975 }
1972 1976
1973 if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid) 1977 if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid)