summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolbump.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-05-14 16:36:39 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-05-14 16:36:39 +0100
commitb27ed1f58e1d7d278a7110392b741bb98083381f (patch)
tree2996893a5de57e05623adedddff4752023638bea /indra/newview/lldrawpoolbump.cpp
parent696249e731bcc78aa30624b478b5ea0581456c63 (diff)
EXT-7154 FIXED revisted: darkness bumpmap looks like lightness bumpmap when deferred rendering is enabled
In addition to the previous bugs, the normal-map for *all* bumpmaps was also getting generated with its Y-gradient flipped, causing some odd and inconsistent results. (transplanted from 3620b7690b1de428e8bada86124566157ea674a5)
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r--indra/newview/lldrawpoolbump.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index ac8bd4dc41..1fae8e518c 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -94,6 +94,12 @@ void LLStandardBumpmap::shutdown()
// static
void LLStandardBumpmap::restoreGL()
{
+ addstandard();
+}
+
+// static
+void LLStandardBumpmap::addstandard()
+{
llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS
@@ -156,7 +162,7 @@ void LLStandardBumpmap::restoreGL()
}
// static
-void LLStandardBumpmap::destroyGL()
+void LLStandardBumpmap::clear()
{
for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ )
{
@@ -166,6 +172,12 @@ void LLStandardBumpmap::destroyGL()
sStandardBumpmapCount = 0;
}
+// static
+void LLStandardBumpmap::destroyGL()
+{
+ clear();
+}
+
////////////////////////////////////////////////////////////////
@@ -1085,8 +1097,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr
LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH);
LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH);
- LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
- LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
+ LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
+ LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
LLVector3 norm = right%down + down%left + left%up + up%right;
@@ -1196,11 +1208,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
F32 twice_one_over_range = 2.f / (maximum - minimum);
S32 i;
- bool bump_polarity_negative = LLPipeline::sRenderDeferred ?
- (BE_BRIGHTNESS == bump_code) : (BE_DARKNESS == bump_code); // deferred mode likes its normal map values inverted
-
const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes.
- if (bump_polarity_negative)
+ if (BE_DARKNESS == bump_code)
{
for( i = minimum; i <= maximum; i++ )
{