diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llfontgl.cpp | 32 |
1 files changed, 26 insertions, 6 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; | |||
70 | const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; | 70 | const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; |
71 | 71 | ||
72 | const F32 PAD_AMT = 0.5f; | 72 | const F32 PAD_AMT = 0.5f; |
73 | const F32 DROP_SHADOW_STRENGTH = 0.3f; | 73 | const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f; |
74 | 74 | ||
75 | F32 llfont_round_x(F32 x) | 75 | F32 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); |