From f14edd06695c33db6272e057a3be3843e723df65 Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 7 Dec 2012 10:10:50 -0500 Subject: Doing a bit of prep work for gamma correction. Set all bump and normal maps to be loaded with the BOOST_BUMP boost level. --- indra/newview/lldrawpoolbump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a264eae302..718133ba29 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ; LLStandardBumpmap::sStandardBumpmapCount++; -- cgit v1.2.3 From 5f03e197f4cfb43de93dc42b16b54beafccd376a Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 25 Jan 2013 17:54:38 -0500 Subject: Trying to set materials up for rendering! Yay! --- indra/newview/lldrawpoolbump.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 718133ba29..d613def1bd 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -632,6 +632,11 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) { U8 bump_code = params.mBump; + if (params.mNormalMap.notNull()) + { + bump_code = BE_CUSTOM; + return bindBumpMap(bump_code, params.mNormalMap, params.mVSize, channel); + } return bindBumpMap(bump_code, params.mTexture, params.mVSize, channel); } @@ -670,7 +675,9 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi case BE_DARKNESS: bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code ); break; - + case BE_CUSTOM: + bump = tex; + break; default: if( bump_code < LLStandardBumpmap::sStandardBumpmapCount ) { @@ -855,7 +862,9 @@ void LLDrawPoolBump::renderDeferred(S32 pass) for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; - + + gDeferredBumpProgram.uniform4fv(LLShaderMgr::SPECULAR_COLOR, 4, (GLfloat*)params.mSpecColor.mV); + LLDrawPoolBump::bindBumpMap(params, bump_channel); pushBatch(params, mask, TRUE); } -- cgit v1.2.3 From 66a01ba4c581d79227b0e67f5f75dc248fcaf7ab Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 28 Jan 2013 19:56:18 -0500 Subject: Basic normal mapping support. --- indra/newview/lldrawpoolbump.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index d613def1bd..fcc81dc723 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -677,6 +677,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi break; case BE_CUSTOM: bump = tex; + bump->addTextureStats(vsize); break; default: if( bump_code < LLStandardBumpmap::sStandardBumpmapCount ) -- cgit v1.2.3 From aa1befd689703d9fea50399201911e0f8fca6ac6 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 30 Jan 2013 12:17:04 -0500 Subject: Specular map support. This is the vast majority of the material parameters implemented at this point for opaque geometry. --- indra/newview/lldrawpoolbump.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index fcc81dc723..07384a136a 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -72,7 +72,7 @@ static LLGLSLShader* shader = NULL; static S32 cube_channel = -1; static S32 diffuse_channel = -1; static S32 bump_channel = -1; - +static S32 spec_channel = -1; // static void LLStandardBumpmap::init() { @@ -634,7 +634,7 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) U8 bump_code = params.mBump; if (params.mNormalMap.notNull()) { - bump_code = BE_CUSTOM; + bump_code = 99; return bindBumpMap(bump_code, params.mNormalMap, params.mVSize, channel); } @@ -675,7 +675,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi case BE_DARKNESS: bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code ); break; - case BE_CUSTOM: + case 99: bump = tex; bump->addTextureStats(vsize); break; @@ -828,6 +828,7 @@ void LLDrawPoolBump::beginDeferredPass(S32 pass) gDeferredBumpProgram.bind(); diffuse_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); bump_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::BUMP_MAP); + spec_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::SPECULAR_MAP); gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(bump_channel)->unbind(LLTexUnit::TT_TEXTURE); } @@ -842,6 +843,7 @@ void LLDrawPoolBump::endDeferredPass(S32 pass) mShiny = FALSE; gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::BUMP_MAP); + gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::SPECULAR_MAP); gDeferredBumpProgram.unbind(); gGL.getTexUnit(0)->activate(); } @@ -864,7 +866,16 @@ void LLDrawPoolBump::renderDeferred(S32 pass) { LLDrawInfo& params = **i; - gDeferredBumpProgram.uniform4fv(LLShaderMgr::SPECULAR_COLOR, 4, (GLfloat*)params.mSpecColor.mV); + gDeferredBumpProgram.uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); + gDeferredBumpProgram.uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); + + if (params.mSpecularMap) + { + params.mSpecularMap->addTextureStats(params.mVSize); + gGL.getTexUnit(spec_channel)->bind(params.mSpecularMap); + } else { + gGL.getTexUnit(spec_channel)->bind(LLViewerFetchedTexture::sWhiteImagep); + } LLDrawPoolBump::bindBumpMap(params, bump_channel); pushBatch(params, mask, TRUE); -- cgit v1.2.3 From 2ae4b6976baf0556066d5a3b43b8f6148f18c1d8 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 4 Feb 2013 11:32:05 -0500 Subject: Added a new draw pool specifically for faces with materials applied to them. Removed materials rendering from the bump draw pool, and reverted it to its previous state. --- indra/newview/lldrawpoolbump.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 07384a136a..a264eae302 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -72,7 +72,7 @@ static LLGLSLShader* shader = NULL; static S32 cube_channel = -1; static S32 diffuse_channel = -1; static S32 bump_channel = -1; -static S32 spec_channel = -1; + // static void LLStandardBumpmap::init() { @@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ; LLStandardBumpmap::sStandardBumpmapCount++; @@ -632,11 +632,6 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) { U8 bump_code = params.mBump; - if (params.mNormalMap.notNull()) - { - bump_code = 99; - return bindBumpMap(bump_code, params.mNormalMap, params.mVSize, channel); - } return bindBumpMap(bump_code, params.mTexture, params.mVSize, channel); } @@ -675,10 +670,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi case BE_DARKNESS: bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code ); break; - case 99: - bump = tex; - bump->addTextureStats(vsize); - break; + default: if( bump_code < LLStandardBumpmap::sStandardBumpmapCount ) { @@ -828,7 +820,6 @@ void LLDrawPoolBump::beginDeferredPass(S32 pass) gDeferredBumpProgram.bind(); diffuse_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); bump_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::BUMP_MAP); - spec_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::SPECULAR_MAP); gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(bump_channel)->unbind(LLTexUnit::TT_TEXTURE); } @@ -843,7 +834,6 @@ void LLDrawPoolBump::endDeferredPass(S32 pass) mShiny = FALSE; gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::BUMP_MAP); - gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::SPECULAR_MAP); gDeferredBumpProgram.unbind(); gGL.getTexUnit(0)->activate(); } @@ -865,18 +855,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; - - gDeferredBumpProgram.uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); - gDeferredBumpProgram.uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); - - if (params.mSpecularMap) - { - params.mSpecularMap->addTextureStats(params.mVSize); - gGL.getTexUnit(spec_channel)->bind(params.mSpecularMap); - } else { - gGL.getTexUnit(spec_channel)->bind(LLViewerFetchedTexture::sWhiteImagep); - } - + LLDrawPoolBump::bindBumpMap(params, bump_channel); pushBatch(params, mask, TRUE); } -- cgit v1.2.3 From 7c242dae7349f8a5857b1bde33320f6f37987acf Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Mon, 1 Apr 2013 13:27:25 -0700 Subject: Fix Mac startup crash on unbind cube map if RenderDebugGL is on --- indra/newview/lldrawpoolbump.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 1b0b11298c..8d1db7b9ad 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -449,9 +449,6 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if( cube_map ) { - cube_map->disable(); - cube_map->restoreMatrix(); - if (!invisible && shader_level > 1) { shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); @@ -464,6 +461,8 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& } } } + cube_map->disable(); + cube_map->restoreMatrix(); } if (!LLGLSLShader::sNoFixedFunction) -- cgit v1.2.3 From 933d4c40f42babf74320dca70ac08009b8577fa1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 May 2013 12:47:52 -0500 Subject: NORSPEC-198, NORSPEC-176, NORSPEC-106 WIP Fix for various fullbright/shiny descrepencies. --- indra/newview/lldrawpoolbump.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index cb40cf2039..cbd65a88e7 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -513,7 +513,14 @@ void LLDrawPoolBump::beginFullbrightShiny() } else { - shader = &gObjectFullbrightShinyProgram; + if (LLPipeline::sRenderDeferred) + { + shader = &gDeferredFullbrightShinyProgram; + } + else + { + shader = &gObjectFullbrightShinyProgram; + } } LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; -- cgit v1.2.3 From 7c722228230e9075c158fc2d0a8b286908223736 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 30 May 2013 17:43:14 -0700 Subject: NORSPEC-158 fix issues with loading of bumpmaps on clean install --- indra/newview/lldrawpoolbump.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index cbd65a88e7..29076de54b 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -921,6 +921,8 @@ void LLBumpImageList::init() llassert( mDarknessEntries.size() == 0 ); LLStandardBumpmap::init(); + + LLStandardBumpmap::restoreGL(); } void LLBumpImageList::clear() -- cgit v1.2.3 From c3f14b915c38a4978745f12f1f816572cce4b5a0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 3 Jun 2013 12:50:48 -0500 Subject: NORSPEC-229 Fix for bad binormals on mirrored surfaces (use tangent calculator instead of binormal calculator, convert binormal centric code to tangent centric) --- indra/newview/lldrawpoolbump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 29076de54b..7152a34094 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -856,7 +856,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); - U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; + U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { -- cgit v1.2.3 From 0a61606b79765d011be8299754cd77c299855879 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Jun 2013 14:39:18 -0700 Subject: NORSPEC-251 fix issues with binding unloaded standard bumpmaps --- indra/newview/lldrawpoolbump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 7152a34094..155e289c9d 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::BOOST_BUMP) ; + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ; LLStandardBumpmap::sStandardBumpmapCount++; -- cgit v1.2.3