aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:56 -0500
committerJacek Antonelli2008-08-15 23:44:56 -0500
commitc07901e29ed545bbb02e3bddf148fe1104b94e9f (patch)
treef1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/llrender
parentSecond Life viewer sources 1.15.0.2 (diff)
downloadmeta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.zip
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.gz
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.bz2
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.xz
Second Life viewer sources 1.15.1.3
Diffstat (limited to 'linden/indra/llrender')
-rw-r--r--linden/indra/llrender/llfontgl.cpp32
-rw-r--r--linden/indra/llrender/llfontgl.h3
-rw-r--r--linden/indra/llrender/llimagegl.cpp24
3 files changed, 44 insertions, 15 deletions
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp
index 7ee89c7..23f02c2 100644
--- a/linden/indra/llrender/llfontgl.cpp
+++ b/linden/indra/llrender/llfontgl.cpp
@@ -70,7 +70,7 @@ const F32 PIXEL_BORDER_THRESHOLD = 0.0001f;
70const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; 70const F32 PIXEL_CORRECTION_DISTANCE = 0.01f;
71 71
72const F32 PAD_AMT = 0.5f; 72const F32 PAD_AMT = 0.5f;
73const F32 DROP_SHADOW_STRENGTH = 0.3f; 73const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f;
74 74
75F32 llfont_round_x(F32 x) 75F32 llfont_round_x(F32 x)
76{ 76{
@@ -106,6 +106,14 @@ U8 LLFontGL::getStyleFromString(const LLString &style)
106 { 106 {
107 ret |= UNDERLINE; 107 ret |= UNDERLINE;
108 } 108 }
109 if (style.find("SHADOW") != style.npos)
110 {
111 ret |= DROP_SHADOW;
112 }
113 if (style.find("SOFT_SHADOW") != style.npos)
114 {
115 ret |= DROP_SHADOW_SOFT;
116 }
109 return ret; 117 return ret;
110} 118}
111 119
@@ -571,14 +579,14 @@ S32 LLFontGL::render(const LLWString &wstr,
571 } 579 }
572 580
573 F32 drop_shadow_strength = 0.f; 581 F32 drop_shadow_strength = 0.f;
574 if (style & DROP_SHADOW) 582 if (style & (DROP_SHADOW | DROP_SHADOW_SOFT))
575 { 583 {
576 F32 luminance; 584 F32 luminance;
577 color.calcHSL(NULL, NULL, &luminance); 585 color.calcHSL(NULL, NULL, &luminance);
578 drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, DROP_SHADOW_STRENGTH); 586 drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, 1.f);
579 if (luminance < 0.35f) 587 if (luminance < 0.35f)
580 { 588 {
581 style = style & ~DROP_SHADOW; 589 style = style & ~(DROP_SHADOW | DROP_SHADOW_SOFT);
582 } 590 }
583 } 591 }
584 592
@@ -769,6 +777,7 @@ S32 LLFontGL::render(const LLWString &wstr,
769 if (!fgi) 777 if (!fgi)
770 { 778 {
771 llerrs << "Missing Glyph Info" << llendl; 779 llerrs << "Missing Glyph Info" << llendl;
780 break;
772 } 781 }
773 if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth)) 782 if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
774 { 783 {
@@ -1334,10 +1343,10 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con
1334 renderQuad(screen_rect_offset, uv_rect, slant_offset); 1343 renderQuad(screen_rect_offset, uv_rect, slant_offset);
1335 } 1344 }
1336 } 1345 }
1337 else if (style & DROP_SHADOW) 1346 else if (style & DROP_SHADOW_SOFT)
1338 { 1347 {
1339 LLColor4 shadow_color = LLFontGL::sShadowColor; 1348 LLColor4 shadow_color = LLFontGL::sShadowColor;
1340 shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength; 1349 shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH;
1341 glColor4fv(shadow_color.mV); 1350 glColor4fv(shadow_color.mV);
1342 for (S32 pass = 0; pass < 5; pass++) 1351 for (S32 pass = 0; pass < 5; pass++)
1343 { 1352 {
@@ -1367,6 +1376,17 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con
1367 glColor4fv(color.mV); 1376 glColor4fv(color.mV);
1368 renderQuad(screen_rect, uv_rect, slant_offset); 1377 renderQuad(screen_rect, uv_rect, slant_offset);
1369 } 1378 }
1379 else if (style & DROP_SHADOW)
1380 {
1381 LLColor4 shadow_color = LLFontGL::sShadowColor;
1382 shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength;
1383 glColor4fv(shadow_color.mV);
1384 LLRectf screen_rect_shadow = screen_rect;
1385 screen_rect_shadow.translate(1.f, -1.f);
1386 renderQuad(screen_rect_shadow, uv_rect, slant_offset);
1387 glColor4fv(color.mV);
1388 renderQuad(screen_rect, uv_rect, slant_offset);
1389 }
1370 else // normal rendering 1390 else // normal rendering
1371 { 1391 {
1372 glColor4fv(color.mV); 1392 glColor4fv(color.mV);
diff --git a/linden/indra/llrender/llfontgl.h b/linden/indra/llrender/llfontgl.h
index 98a7a55..2cd62c6 100644
--- a/linden/indra/llrender/llfontgl.h
+++ b/linden/indra/llrender/llfontgl.h
@@ -65,7 +65,8 @@ public:
65 BOLD = 1, 65 BOLD = 1,
66 ITALIC = 2, 66 ITALIC = 2,
67 UNDERLINE = 4, 67 UNDERLINE = 4,
68 DROP_SHADOW = 8 68 DROP_SHADOW = 8,
69 DROP_SHADOW_SOFT = 16
69 }; 70 };
70 71
71 // Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC" 72 // Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp
index 464507e..e2c4a59 100644
--- a/linden/indra/llrender/llimagegl.cpp
+++ b/linden/indra/llrender/llimagegl.cpp
@@ -129,19 +129,27 @@ void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_t
129// static 129// static
130void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target) 130void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target)
131{ 131{
132 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 132 // LLGLSLShader can return -1
133 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); 133 if (stage >= 0)
134 glBindTexture(bind_target, 0); 134 {
135 sCurrentBoundTextures[stage] = 0; 135 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
136 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage);
137 glBindTexture(bind_target, 0);
138 sCurrentBoundTextures[stage] = 0;
139 }
136} 140}
137 141
138// static (duplicated for speed and to avoid GL_TEXTURE_2D default argument which requires GL header dependency) 142// static (duplicated for speed and to avoid GL_TEXTURE_2D default argument which requires GL header dependency)
139void LLImageGL::unbindTexture(S32 stage) 143void LLImageGL::unbindTexture(S32 stage)
140{ 144{
141 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 145 // LLGLSLShader can return -1
142 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); 146 if (stage >= 0)
143 glBindTexture(GL_TEXTURE_2D, 0); 147 {
144 sCurrentBoundTextures[stage] = 0; 148 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
149 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage);
150 glBindTexture(GL_TEXTURE_2D, 0);
151 sCurrentBoundTextures[stage] = 0;
152 }
145} 153}
146 154
147// static 155// static