diff options
47 files changed, 1038 insertions, 318 deletions
@@ -457,3 +457,4 @@ a314f1c94374ab1f6633dd2983f7090a68663eb2 3.5.2-beta4 9013c07bfe1c51107233f1924dccdcc5057dd909 3.5.2-beta6 9b1b6f33aa5394b27bb652b31b5cb81ef6060370 3.5.2-release a277b841729f2a62ba1e34acacc964bc13c1ad6f 3.5.3-release +fb1630153bac5552046ea914af3f14deabc1def8 3.6.0-materials-beta1 diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 0e789f9011..e9b74b8f41 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -67,7 +67,7 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if(result == FMOD_OK) return false; - llwarns << string << " Error: " << FMOD_ErrorString(result) << llendl; + lldebugs << string << " Error: " << FMOD_ErrorString(result) << llendl; return true; } @@ -258,19 +258,29 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata) int r_numbuffers, r_samplerate, r_channels, r_bits; unsigned int r_bufferlength; - char r_name[256]; mSystem->getDSPBufferSize(&r_bufferlength, &r_numbuffers); + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_bufferlength=" << r_bufferlength << " bytes" << LL_ENDL; + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_numbuffers=" << r_numbuffers << LL_ENDL; + mSystem->getSoftwareFormat(&r_samplerate, NULL, &r_channels, NULL, NULL, &r_bits); - mSystem->getDriverInfo(0, r_name, 255, 0); - r_name[255] = '\0'; - int latency = (int)(1000.0f * r_bufferlength * r_numbuffers / r_samplerate); + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_samplerate=" << r_samplerate << "Hz" << LL_ENDL; + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_channels=" << r_channels << LL_ENDL; + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_bits =" << r_bits << LL_ENDL; + + char r_name[512]; + mSystem->getDriverInfo(0, r_name, 511, 0); + r_name[511] = '\0'; + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): r_name=\"" << r_name << "\"" << LL_ENDL; - LL_INFOS("AppInit") << "FMOD device: "<< r_name << "\n" - << "FMOD Ex parameters: " << r_samplerate << " Hz * " << r_channels << " * " <<r_bits <<" bit\n" - << "\tbuffer " << r_bufferlength << " * " << r_numbuffers << " (" << latency <<"ms)" << LL_ENDL; + int latency = 100; // optimistic default - i suspect if sample rate is 0, everything breaks. + if ( r_samplerate != 0 ) + latency = (int)(1000.0f * r_bufferlength * r_numbuffers / r_samplerate); + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): latency=" << latency << "ms" << LL_ENDL; mInited = true; + LL_INFOS("AppInit") << "LLAudioEngine_FMODEX::init(): initialization complete." << LL_ENDL; + return true; } diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index c6da205815..b66fc82250 100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -378,7 +378,7 @@ void LLApp::startErrorThread() // if(!mThreadErrorp) { - llinfos << "Starting error thread" << llendl; +// llinfos << "Starting error thread" << llendl; mThreadErrorp = new LLErrorThread(); mThreadErrorp->setUserData((void *) this); mThreadErrorp->start(); diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index 950fcd6e83..4a0c8ef342 100755 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp @@ -106,7 +106,7 @@ void LLErrorThread::run() // This thread sits and waits for the sole purpose // of waiting for the signal/exception handlers to flag the // application state as APP_STATUS_ERROR. - llinfos << "thread_error - Waiting for an error" << llendl; + //llinfos << "thread_error - Waiting for an error" << llendl; S32 counter = 0; #if !LL_WINDOWS diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 57a6de9060..b8e8125e68 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1032,9 +1032,9 @@ LLMemoryInfo& LLMemoryInfo::refresh() { mStatsMap = loadStatsMap(); - LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; - LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); - LL_ENDL; +// LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; +// LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); +// LL_ENDL; return *this; } diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index 5a67035ed1..7f74247a13 100755 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -99,8 +99,7 @@ void LLAres::QueryResponder::queryError(int code) LLAres::LLAres() : chan_(NULL), - mInitSuccess(false), - mListener(new LLAresListener(this)) + mInitSuccess(false) { if (ares_library_init( ARES_LIB_INIT_ALL ) != ARES_SUCCESS || ares_init(&chan_) != ARES_SUCCESS) @@ -109,6 +108,8 @@ LLAres::LLAres() : return; } + mListener = boost::shared_ptr< LLAresListener >(new LLAresListener(this)); + mInitSuccess = true; } @@ -161,12 +162,26 @@ void LLAres::getSrvRecords(const std::string &name, SrvResponder *resp) } void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) -{ - llinfos << "Rewriting " << uri << llendl; +{ + if (resp && uri.size()) + { + LLURI* pURI = new LLURI(uri); + + resp->mUri = *pURI; + + delete pURI; + + if (!resp->mUri.scheme().size() || !resp->mUri.hostName().size()) + { + return; + } + + //llinfos << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << llendl; - resp->mUri = LLURI(uri); - search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), - RES_SRV, resp); + search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), RES_SRV, resp); + + + } } LLQueryResponder::LLQueryResponder() diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp index 58b8a05a9e..0a4effac19 100755 --- a/indra/llmessage/llareslistener.cpp +++ b/indra/llmessage/llareslistener.cpp @@ -93,5 +93,12 @@ private: void LLAresListener::rewriteURI(const LLSD& data) { - mAres->rewriteURI(data["uri"], new UriRewriteResponder(data)); + if (mAres) + { + mAres->rewriteURI(data["uri"], new UriRewriteResponder(data)); + } + else + { + llinfos << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << llendl; + } } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ef78d43665..37b9c0e0e0 100755 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -695,6 +695,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } */ + text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 1\n"); + //uniform declartion for (S32 i = 0; i < texture_index_channels; ++i) { @@ -752,6 +754,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade llerrs << "Indexed texture rendering requires GLSL 1.30 or later." << llendl; } } + else + { + text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n"); + } //copy file into memory while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(text) ) @@ -1068,6 +1074,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("minimum_alpha"); + mReservedUniforms.push_back("emissive_brightness"); mReservedUniforms.push_back("shadow_matrix"); mReservedUniforms.push_back("env_mat"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index a33eca4448..c049e935b8 100755 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -109,6 +109,7 @@ public: GLOW_DELTA, MINIMUM_ALPHA, + EMISSIVE_BRIGHTNESS, DEFERRED_SHADOW_MATRIX, DEFERRED_ENV_MAT, diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 462d1cce06..6184095957 100755 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -131,7 +131,7 @@ LLDir_Win32::LLDir_Win32() mAppRODataDir = mExecutableDir; } - llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; +// llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2d4ae5ea55..12ca902c59 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13491,7 +13491,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <integer>-1.0</integer> + <real>-1.0</real> </map> <key>ForcePeriodicRenderingTime</key> <map> @@ -13502,7 +13502,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <integer>-1.0</integer> + <real>-1.0</real> </map> <key>ZoomDirect</key> <map> diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 975180606a..5c164f7759 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -31,6 +31,10 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif +#if !HAS_DIFFUSE_LOOKUP +uniform sampler2D diffuseMap; +#endif + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; @@ -40,9 +44,12 @@ vec3 fullbrightScaleSoftClip(vec3 light); void main() { - float shadow = 1.0; - +#if HAS_DIFFUSE_LOOKUP vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; +#else + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy)*vertex_color; +#endif + color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f)); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl new file mode 100644 index 0000000000..f3d04a22f2 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -0,0 +1,70 @@ +/** + * @file fullbrightShinyF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +#ifndef diffuseLookup +uniform sampler2D diffuseMap; +#endif + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; + +uniform samplerCube environmentMap; + +vec3 fullbrightShinyAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +void main() +{ +#if HAS_DIFFUSE_LOOKUP + vec4 color = diffuseLookup(vary_texcoord0.xy); +#else + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); +#endif + + + color.rgb *= vertex_color.rgb; + + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); + + color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f)); + + color.rgb = fullbrightShinyAtmosTransport(color.rgb); + color.rgb = fullbrightScaleSoftClip(color.rgb); + + color.a = 1.0; + + frag_color = color; +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl new file mode 100644 index 0000000000..34bd8d445a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl @@ -0,0 +1,67 @@ +/** + * @file fullbrightShinyV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; + + +void calcAtmospherics(vec3 inPositionEye); + +uniform vec4 origin; + + + +ATTRIBUTE vec3 position; +void passTextureIndex(); +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; + + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + passTextureIndex(); + vec4 pos = (modelview_matrix * vert); + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + + vec3 norm = normalize(normal_matrix * normal); + vec3 ref = reflect(pos.xyz, -norm); + + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; + + calcAtmospherics(pos.xyz); + + vertex_color = diffuse_color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index fc4b8b33f8..17aa0e32a7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -28,6 +28,7 @@ #define DIFFUSE_ALPHA_MODE_MASK 2 #define DIFFUSE_ALPHA_MODE_EMISSIVE 3 +uniform float emissive_brightness; #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) @@ -37,7 +38,6 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif - #if HAS_SUN_SHADOW uniform sampler2DShadow shadowMap0; @@ -386,6 +386,18 @@ vec3 scaleSoftClip(vec3 light) return light; } +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + +vec3 fullbrightScaleSoftClip(vec3 light) +{ + //soft clip effect: + return light; +} + #else #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; @@ -444,6 +456,7 @@ void main() #endif #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + vec3 old_diffcol = diffcol.rgb; diffcol.rgb = pow(diffcol.rgb, vec3(2.2)); #endif @@ -472,7 +485,9 @@ void main() vec4 final_color = diffcol; #if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) - final_color.a = 0; + final_color.a = emissive_brightness; +#else + final_color.a = max(final_color.a, emissive_brightness); #endif vec4 final_specular = spec; @@ -611,24 +626,33 @@ void main() col += spec_contrib; } + col = mix(col.rgb, old_diffcol.rgb, diffuse.a); + if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; - vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2; + float exponent = mix(2.2, 1.0, diffuse.a); + + vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent; col = mix(col.rgb, refcol, - max(envIntensity-diffuse.a*2.0, 0.0)); - + envIntensity); + float cur_glare = max(refcol.r, refcol.g); cur_glare = max(cur_glare, refcol.b); cur_glare *= envIntensity*4.0; glare += cur_glare; } + + float exponent = mix(1.0, 2.2, diffuse.a); + col = pow(col, vec3(exponent)); + - col = atmosLighting(col); - col = scaleSoftClip(col); + col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); + vec3 npos = normalize(-pos.xyz); #define LIGHT_LOOP(i) col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare); @@ -644,8 +668,8 @@ void main() frag_color.rgb = col.rgb; glare = min(glare, 1.0); frag_color.a = max(diffcol.a*vertex_color.a, glare); - #else + frag_data[0] = final_color; #ifdef UGLY_MAC_HACK diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 49ad064364..22f4729e2e 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -61,6 +61,6 @@ void main() /// Gamma correct for WL (soft clip effect). frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0.5,0.5,0.0,0); + frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 9197df2628..45d672c290 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -231,9 +231,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + tmpAmbient))); //brightness of surface both sunlight and ambient - setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * 2.2); - setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * 2.2); - setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * 2.2); + setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma); + setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma); + setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma); } vec3 atmosLighting(vec3 light) @@ -248,6 +248,15 @@ vec3 atmosTransport(vec3 light) { light += getAdditiveColor() * 2.0; return light; } + +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + + + vec3 atmosGetDiffuseSunlightColor() { return getSunlitColor(); @@ -282,6 +291,13 @@ vec3 scaleSoftClip(vec3 light) return light; } + +vec3 fullbrightScaleSoftClip(vec3 light) +{ + //soft clip effect: + return light; +} + void main() { vec2 tc = vary_fragcoord.xy; @@ -308,7 +324,7 @@ void main() col.rgb *= ambient; - col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, diffuse.a)); + col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, 0.0)); col *= diffuse.rgb; @@ -328,21 +344,36 @@ void main() col += spec_contrib; } + + col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a); + + if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2, - envIntensity); + + float exponent = mix(2.2, 1.0, diffuse.a); + vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent; + + col = mix(col.rgb, refcol, + envIntensity); + } - col = atmosLighting(col); - col = scaleSoftClip(col); + float exponent = mix(1.0, 2.2, diffuse.a); + col = pow(col, vec3(exponent)); + + if (norm.w < 0.5) + { + col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); + } - col = mix(col.rgb, diffuse.rgb, diffuse.a); + //col = vec3(1,0,1); + //col.g = envIntensity; } frag_color.rgb = col; - //frag_color.a = bloom; - frag_color.a = 0.0; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl index cf29939cb2..eaaa7b208d 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskF.glsl @@ -39,13 +39,15 @@ VARYING vec2 vary_texcoord0; void default_lighting() { - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + vec4 color = diffuseLookup(vary_texcoord0.xy); if (color.a < minimum_alpha) { discard; } + color.rgb *= vertex_color.rgb; + color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl index 4070d41f47..b9ddbc8e1c 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightAlphaMaskNonIndexedF.glsl @@ -41,13 +41,15 @@ VARYING vec2 vary_texcoord0; void default_lighting() { - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); if (color.a < minimum_alpha) { discard; } + color.rgb *= vertex_color.rgb; + color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl index e130ef5d91..5740987ab1 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl @@ -40,12 +40,15 @@ VARYING vec2 vary_texcoord0; void fullbright_lighting() { - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + vec4 color = diffuseLookup(vary_texcoord0.xy); if (color.a < minimum_alpha) { discard; } + + color.rgb *= vertex_color.rgb; + color.rgb = pow(color.rgb, vec3(texture_gamma)); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl index 2ff7f795b0..361f316065 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl @@ -32,6 +32,8 @@ out vec4 frag_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +uniform float texture_gamma; + vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -39,6 +41,8 @@ void fullbright_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + color.rgb = pow(color.rgb, vec3(texture_gamma)); + color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl index 56ad658696..d64584c015 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl @@ -42,12 +42,15 @@ VARYING vec2 vary_texcoord0; void fullbright_lighting() { - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); if (color.a < minimum_alpha) { discard; } + + color.rgb *= vertex_color.rgb; + color.rgb = pow(color.rgb, vec3(texture_gamma)); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl index 9c82056fd7..6dd3bb937f 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl @@ -41,7 +41,9 @@ VARYING vec2 vary_texcoord0; void fullbright_lighting_water() { - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + vec4 color = diffuseLookup(vary_texcoord0.xy); + + color.rgb *= vertex_color.rgb; if (color.a < minimum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl index b68240ba0d..3426fea52f 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl @@ -39,7 +39,9 @@ VARYING vec2 vary_texcoord0; void default_lighting_water() { - vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + vec4 color = diffuseLookup(vary_texcoord0.xy); + + color.rgb *= vertex_color.rgb; if (color.a < minimum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl index da3b20012d..d9faa9b314 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl @@ -41,7 +41,9 @@ VARYING vec2 vary_texcoord0; void default_lighting_water() { - vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); + + color.rgb *= vertex_color.rgb; if (color.a < minimum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index ee6aaddb00..31b2a32f7f 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -38,7 +38,6 @@ uniform sampler2DRect lightMap; uniform sampler2DRect depthMap; uniform samplerCube environmentMap; uniform sampler2D lightFunc; -uniform vec3 gi_quad; uniform float blur_size; uniform float blur_fidelity; @@ -66,11 +65,7 @@ uniform mat3 env_mat; uniform vec4 shadow_clip; uniform mat3 ssao_effect_mat; -uniform mat4 inv_proj; -uniform vec2 screen_res; - uniform vec3 sun_dir; - VARYING vec2 vary_fragcoord; vec3 vary_PositionEye; @@ -80,6 +75,9 @@ vec3 vary_AmblitColor; vec3 vary_AdditiveColor; vec3 vary_AtmosAttenuation; +uniform mat4 inv_proj; +uniform vec2 screen_res; + vec3 decode_normal (vec2 enc) { vec2 fenc = enc*4-2; @@ -130,7 +128,6 @@ vec3 getAtmosAttenuation() return vary_AtmosAttenuation; } - void setPositionEye(vec3 v) { vary_PositionEye = v; @@ -251,6 +248,15 @@ vec3 atmosTransport(vec3 light) { light += getAdditiveColor() * 2.0; return light; } + +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + + + vec3 atmosGetDiffuseSunlightColor() { return getSunlitColor(); @@ -285,6 +291,13 @@ vec3 scaleSoftClip(vec3 light) return light; } + +vec3 fullbrightScaleSoftClip(vec3 light) +{ + //soft clip effect: + return light; +} + void main() { vec2 tc = vary_fragcoord.xy; @@ -292,14 +305,14 @@ void main() vec3 pos = getPosition_d(tc, depth).xyz; vec4 norm = texture2DRect(normalMap, tc); float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); + norm.xyz = decode_normal(norm.xy); // unpack norm + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); vec3 col; float bloom = 0.0; - { vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); @@ -310,15 +323,14 @@ void main() calcAtmospherics(pos.xyz, ambocc); col = atmosAmbient(vec3(0)); - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; ambient = (1.0-ambient); - col *= ambient; + col.rgb *= ambient; - col += atmosAffectDirectionalLight(max(min(da, scol) * 2.6, diffuse.a)); + col += atmosAffectDirectionalLight(max(min(da, scol) * 2.6, 0.0)); col *= diffuse.rgb; @@ -331,27 +343,42 @@ void main() float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r); - + // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; bloom = dot(spec_contrib, spec_contrib) / 6; col += spec_contrib; } - + + + col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a); + + if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2, - envIntensity); - } - col = atmosLighting(col); - col = scaleSoftClip(col); + float exponent = mix(2.2, 1.0, diffuse.a); + vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent; + + col = mix(col.rgb, refcol, + envIntensity); + + } - col = mix(col.rgb, diffuse.rgb, diffuse.a); + float exponent = mix(1.0, 2.2, diffuse.a); + col = pow(col, vec3(exponent)); + + if (norm.w < 0.5) + { + col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); + } + + //col = vec3(1,0,1); + //col.g = envIntensity; } - frag_color.rgb = col; frag_color.a = bloom; } diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 0ba3669487..2a7656ae0a 100755 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -490,7 +490,7 @@ bool LLAppViewerWin32::init() // (Don't send our data to Microsoft--at least until we are Logo approved and have a way // of getting the data back from them.) // - llinfos << "Turning off Windows error reporting." << llendl; + // llinfos << "Turning off Windows error reporting." << llendl; disableWinErrorReporting(); #ifndef LL_RELEASE_FOR_DOWNLOAD diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index fc5571aa58..04e31e6486 100755 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -48,6 +48,7 @@ #include "llspatialpartition.h" #include "llviewercamera.h" #include "lldrawpoolwlsky.h" +#include "llglslshader.h" S32 LLDrawPool::sNumDrawPools = 0; @@ -65,6 +66,12 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) case POOL_GRASS: poolp = new LLDrawPoolGrass(); break; + case POOL_ALPHA_MASK: + poolp = new LLDrawPoolAlphaMask(); + break; + case POOL_FULLBRIGHT_ALPHA_MASK: + poolp = new LLDrawPoolFullbrightAlphaMask(); + break; case POOL_FULLBRIGHT: poolp = new LLDrawPoolFullbright(); break; @@ -415,6 +422,27 @@ void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_text } } +void LLRenderPass::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) +{ + for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) + { + LLDrawInfo* pparams = *i; + if (pparams) + { + if (LLGLSLShader::sCurBoundShaderPtr) + { + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); + } + else + { + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); + } + + pushBatch(*pparams, mask, texture, batch_textures); + } + } +} + void LLRenderPass::applyModelMatrix(LLDrawInfo& params) { if (params.mModelMatrix != gGLLastMatrix) diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 93656c34e4..3bde0d29be 100755 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -55,6 +55,8 @@ public: POOL_SKY, POOL_WL_SKY, POOL_TREE, + POOL_ALPHA_MASK, + POOL_FULLBRIGHT_ALPHA_MASK, POOL_GRASS, POOL_INVISIBLE, // see below * POOL_AVATAR, @@ -168,6 +170,7 @@ public: static void applyModelMatrix(LLDrawInfo& params); virtual void pushBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE); + virtual void pushMaskBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE); virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE); virtual void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); virtual void renderGroups(U32 type, U32 mask, BOOL texture = TRUE); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index bfb66fce22..5ed8bbca50 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -71,52 +71,6 @@ void LLDrawPoolAlpha::prerender() mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } -S32 LLDrawPoolAlpha::getNumDeferredPasses() -{ - return 1; -} - -void LLDrawPoolAlpha::beginDeferredPass(S32 pass) -{ - -} - -void LLDrawPoolAlpha::endDeferredPass(S32 pass) -{ - -} - -void LLDrawPoolAlpha::renderDeferred(S32 pass) -{ - LLFastTimer t(FTM_RENDER_GRASS); - gDeferredDiffuseAlphaMaskProgram.bind(); - gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - gDeferredDiffuseAlphaMaskProgram.unbind(); -} - -void LLDrawPoolAlpha::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) -{ - for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) - { - LLDrawInfo* pparams = *i; - if (pparams) - { - if (LLGLSLShader::sCurBoundShaderPtr) - { - LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); - } - else - { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); - } - - pushBatch(*pparams, mask, texture, batch_textures); - } - } -} - - S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { if (LLPipeline::sImpostorRender) @@ -140,8 +94,10 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) if (pass == 0) { simple_shader = &gDeferredAlphaProgram; - fullbright_shader = &gObjectFullbrightAlphaMaskProgram; - + fullbright_shader = &gObjectFullbrightProgram; + fullbright_shader->bind(); + fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + fullbright_shader->unbind(); //prime simple shader (loads shadow relevant uniforms) gPipeline.bindDeferredShader(*simple_shader); } @@ -190,14 +146,14 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass) if (LLPipeline::sUnderWaterRender) { - simple_shader = &gObjectSimpleWaterAlphaMaskProgram; - fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram; + simple_shader = &gObjectSimpleWaterProgram; + fullbright_shader = &gObjectFullbrightWaterProgram; emissive_shader = &gObjectEmissiveWaterProgram; } else { - simple_shader = &gObjectSimpleAlphaMaskProgram; - fullbright_shader = &gObjectFullbrightAlphaMaskProgram; + simple_shader = &gObjectSimpleProgram; + fullbright_shader = &gObjectFullbrightProgram; emissive_shader = &gObjectEmissiveProgram; } @@ -235,53 +191,7 @@ void LLDrawPoolAlpha::render(S32 pass) { gGL.setColorMask(true, true); } - - if (LLPipeline::sAutoMaskAlphaNonDeferred) - { - mColorSFactor = LLRender::BF_ONE; // } - mColorDFactor = LLRender::BF_ZERO; // } these are like disabling blend on the color channels, but we're still blending on the alpha channel so that we can suppress glow - mAlphaSFactor = LLRender::BF_ZERO; - mAlphaDFactor = LLRender::BF_ZERO; // block (zero-out) glow where the alpha test succeeds - gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor); - - if (mVertexShaderLevel > 0) - { - if (!LLPipeline::sRenderDeferred || !deferred_render) - { - simple_shader->bind(); - simple_shader->setMinimumAlpha(0.33f); - - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - } - if (fullbright_shader) - { - fullbright_shader->bind(); - fullbright_shader->setMinimumAlpha(0.33f); - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } else { - fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } - } - pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - //LLGLSLShader::bindNoShader(); - } - else - { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f); //OK - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); - gPipeline.enableLightsDynamic(); - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK - } - } - + LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy || (deferred_render && pass == 1) ? GL_TRUE : GL_FALSE); @@ -442,7 +352,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) LLMaterial* mat = NULL; - if (!params.mFullbright && deferred_render && !LLPipeline::sUnderWaterRender) + if (deferred_render && !LLPipeline::sUnderWaterRender) { mat = params.mMaterial; } @@ -479,7 +389,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) light_enabled = TRUE; } - if (!params.mFullbright && deferred_render && mat) + if (deferred_render && mat) { U32 mask = params.mShaderMask; @@ -512,32 +422,26 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader = NULL; } - if (use_shaders && mat && !params.mFullbright) + if (use_shaders && mat) { - // I apologize in advance for not giving this its own shader. // We have a material. Supply the appropriate data here. if (LLPipeline::sRenderDeferred) { current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); - + current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, params.mFullbright ? 1.f : 0.f); + if (params.mNormalMap) { params.mNormalMap->addTextureStats(params.mVSize); current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); - } else { - LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); - } + } if (params.mSpecularMap) { params.mSpecularMap->addTextureStats(params.mVSize); current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); - } else { - LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); - } + } } } else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader)) diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index 46c17f3b99..43122218ed 100755 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -50,11 +50,6 @@ public: LLDrawPoolAlpha(U32 type = LLDrawPool::POOL_ALPHA); /*virtual*/ ~LLDrawPoolAlpha(); - /*virtual*/ S32 getNumDeferredPasses(); - /*virtual*/ void beginDeferredPass(S32 pass); - /*virtual*/ void endDeferredPass(S32 pass); - /*virtual*/ void renderDeferred(S32 pass); - /*virtual*/ S32 getNumPostDeferredPasses(); /*virtual*/ void beginPostDeferredPass(S32 pass); /*virtual*/ void endPostDeferredPass(S32 pass); @@ -70,9 +65,7 @@ public: void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); void renderAlpha(U32 mask); void renderAlphaHighlight(U32 mask); - void pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures); - - + static BOOL sShowDebugAlpha; private: diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index b4ebee064e..7e8bdfba2c 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -894,7 +894,14 @@ void LLDrawPoolAvatar::beginRiggedFullbright() } else { - sVertexProgram = &gSkinnedObjectFullbrightProgram; + if (LLPipeline::sRenderDeferred) + { + sVertexProgram = &gDeferredSkinnedFullbrightProgram; + } + else + { + sVertexProgram = &gSkinnedObjectFullbrightProgram; + } } } else @@ -913,6 +920,15 @@ void LLDrawPoolAvatar::beginRiggedFullbright() { sDiffuseChannel = 0; sVertexProgram->bind(); + + if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + { + sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + else + { + sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } } } @@ -979,7 +995,14 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny() } else { - sVertexProgram = &gSkinnedObjectFullbrightShinyProgram; + if (LLPipeline::sRenderDeferred) + { + sVertexProgram = &gDeferredSkinnedFullbrightShinyProgram; + } + else + { + sVertexProgram = &gSkinnedObjectFullbrightShinyProgram; + } } } else @@ -994,11 +1017,19 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny() } } - if (sShaderLevel > 0 || gPipeline.canUseVertexShaders()) { sVertexProgram->bind(); LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false); + + if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + { + sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + else + { + sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } } } @@ -1625,7 +1656,8 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow()); }*/ - LLMaterial* mat = face->getTextureEntry()->getMaterialParams().get(); + const LLTextureEntry* te = face->getTextureEntry(); + LLMaterial* mat = te->getMaterialParams().get(); if (mat) { @@ -1633,16 +1665,32 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) gGL.getTexUnit(normal_channel)->bind(face->getTexture(LLRender::NORMAL_MAP)); gGL.getTexUnit(specular_channel)->bind(face->getTexture(LLRender::SPECULAR_MAP)); - LLColor4U col = mat->getSpecularLightColor(); - U8 spec = mat->getSpecularLightExponent(); - - U8 env = mat->getEnvironmentIntensity(); + LLColor4 col = mat->getSpecularLightColor(); + F32 spec = mat->getSpecularLightExponent()/255.f; - sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0]/255.f, col.mV[1]/255.f, col.mV[2]/255.f, spec/255.f); + F32 env = mat->getEnvironmentIntensity()/255.f; - sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env/255.f); + if (mat->getSpecularID().isNull()) + { + env = te->getShiny()*0.25f; + col.set(env,env,env,0); + spec = env; + } - sVertexProgram->setMinimumAlpha(mat->getAlphaMaskCutoff()/255.f); + BOOL fullbright = te->getFullbright(); + + sVertexProgram->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, fullbright ? 1.f : 0.f); + sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec); + sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env); + + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + sVertexProgram->setMinimumAlpha(mat->getAlphaMaskCutoff()/255.f); + } + else + { + sVertexProgram->setMinimumAlpha(0.f); + } for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) { @@ -1656,6 +1704,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) else { gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture()); + sVertexProgram->setMinimumAlpha(0.f); if (normal_channel > -1) { LLDrawPoolBump::bindBumpMap(face, normal_channel); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index cb40cf2039..29076de54b 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; @@ -914,6 +921,8 @@ void LLBumpImageList::init() llassert( mDarknessEntries.size() == 0 ); LLStandardBumpmap::init(); + + LLStandardBumpmap::restoreGL(); } void LLBumpImageList::clear() diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 3e0f9c9d4d..08a36bddf1 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -139,6 +139,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) } mShader->setMinimumAlpha(params.mAlphaMaskCutoff); + mShader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, params.mFullbright ? 1.f : 0.f); pushBatch(params, mask, TRUE); } diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 1a6293c010..7ca87d3858 100755 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -214,6 +214,167 @@ void LLDrawPoolSimple::render(S32 pass) } } + + + + + + + + + +static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK("Alpha Mask"); + +LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : + LLRenderPass(POOL_ALPHA_MASK) +{ +} + +void LLDrawPoolAlphaMask::prerender() +{ + mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); +} + +void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + + if (LLPipeline::sUnderWaterRender) + { + simple_shader = &gObjectSimpleWaterAlphaMaskProgram; + } + else + { + simple_shader = &gObjectSimpleAlphaMaskProgram; + } + + if (mVertexShaderLevel > 0) + { + simple_shader->bind(); + } + else + { + // don't use shaders! + if (gGLManager.mHasShaderObjects) + { + LLGLSLShader::bindNoShader(); + } + } +} + +void LLDrawPoolAlphaMask::endRenderPass(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + stop_glerror(); + LLRenderPass::endRenderPass(pass); + stop_glerror(); + if (mVertexShaderLevel > 0) + { + simple_shader->unbind(); + } +} + +void LLDrawPoolAlphaMask::render(S32 pass) +{ + LLGLDisable blend(GL_BLEND); + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + + if (mVertexShaderLevel > 0) + { + simple_shader->bind(); + simple_shader->setMinimumAlpha(0.33f); + + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + } + else + { + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); + gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK + } +} + +LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() : + LLRenderPass(POOL_FULLBRIGHT_ALPHA_MASK) +{ +} + +void LLDrawPoolFullbrightAlphaMask::prerender() +{ + mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); +} + +void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + + if (LLPipeline::sUnderWaterRender) + { + simple_shader = &gObjectFullbrightWaterAlphaMaskProgram; + } + else + { + simple_shader = &gObjectFullbrightAlphaMaskProgram; + } + + if (mVertexShaderLevel > 0) + { + simple_shader->bind(); + } + else + { + // don't use shaders! + if (gGLManager.mHasShaderObjects) + { + LLGLSLShader::bindNoShader(); + } + } +} + +void LLDrawPoolFullbrightAlphaMask::endRenderPass(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + stop_glerror(); + LLRenderPass::endRenderPass(pass); + stop_glerror(); + if (mVertexShaderLevel > 0) + { + simple_shader->unbind(); + } +} + +void LLDrawPoolFullbrightAlphaMask::render(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK); + + if (mVertexShaderLevel > 0) + { + if (simple_shader) + { + simple_shader->bind(); + simple_shader->setMinimumAlpha(0.33f); + if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + { + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } else { + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } + } + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + //LLGLSLShader::bindNoShader(); + } + else + { + gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); + gPipeline.enableLightsDynamic(); + gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK + } +} + //=============================== //DEFERRED IMPLEMENTATION //=============================== @@ -243,6 +404,28 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) } } +static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask"); + +void LLDrawPoolAlphaMask::beginDeferredPass(S32 pass) +{ + +} + +void LLDrawPoolAlphaMask::endDeferredPass(S32 pass) +{ + +} + +void LLDrawPoolAlphaMask::renderDeferred(S32 pass) +{ + LLFastTimer t(FTM_RENDER_ALPHA_MASK_DEFERRED); + gDeferredDiffuseAlphaMaskProgram.bind(); + gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + gDeferredDiffuseAlphaMaskProgram.unbind(); +} + + // grass drawpool LLDrawPoolGrass::LLDrawPoolGrass() : LLRenderPass(POOL_GRASS) @@ -407,6 +590,8 @@ void LLDrawPoolFullbright::render(S32 pass) { fullbright_shader->bind(); fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); + fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f); + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE); @@ -433,3 +618,32 @@ S32 LLDrawPoolFullbright::getNumPasses() return 1; } + +void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) +{ + gObjectFullbrightAlphaMaskProgram.bind(); + if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + { + gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + else + { + gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } +} + +void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) +{ + LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LLGLDisable blend(GL_BLEND); + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, fullbright_mask, TRUE, TRUE); +} + +void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass) +{ + gObjectFullbrightAlphaMaskProgram.unbind(); + LLRenderPass::endRenderPass(pass); +} + + diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h index bd62bc7502..608ad9e1eb 100755 --- a/indra/newview/lldrawpoolsimple.h +++ b/indra/newview/lldrawpoolsimple.h @@ -84,6 +84,59 @@ public: /*virtual*/ void prerender(); }; +class LLDrawPoolAlphaMask : public LLRenderPass +{ +public: + enum + { + VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_NORMAL | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR + }; + virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + + LLDrawPoolAlphaMask(); + + /*virtual*/ S32 getNumDeferredPasses() { return 1; } + /*virtual*/ void beginDeferredPass(S32 pass); + /*virtual*/ void endDeferredPass(S32 pass); + /*virtual*/ void renderDeferred(S32 pass); + + /*virtual*/ S32 getNumPasses() { return 1; } + /*virtual*/ void beginRenderPass(S32 pass); + /*virtual*/ void endRenderPass(S32 pass); + /*virtual*/ void render(S32 pass = 0); + /*virtual*/ void prerender(); + +}; + +class LLDrawPoolFullbrightAlphaMask : public LLRenderPass +{ +public: + enum + { + VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR + }; + virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } + + LLDrawPoolFullbrightAlphaMask(); + + /*virtual*/ S32 getNumPostDeferredPasses() { return 1; } + /*virtual*/ void beginPostDeferredPass(S32 pass); + /*virtual*/ void endPostDeferredPass(S32 pass); + /*virtual*/ void renderPostDeferred(S32 pass); + + /*virtual*/ S32 getNumPasses() { return 1; } + /*virtual*/ void beginRenderPass(S32 pass); + /*virtual*/ void endRenderPass(S32 pass); + /*virtual*/ void render(S32 pass = 0); + /*virtual*/ void prerender(); +}; + + class LLDrawPoolFullbright : public LLRenderPass { public: diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index eb78d42c35..63919630fc 100755 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1316,28 +1316,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLColor4U color = tep->getColor(); if (rebuild_color) - { - if (tep) + { //decide if shiny goes in alpha channel of color + if (tep && + getPoolType() != LLDrawPool::POOL_ALPHA) // <--- alpha channel MUST contain transparency, not shiny { LLMaterial* mat = tep->getMaterialParams().get(); + + bool shiny_in_alpha = false; + + if (LLPipeline::sRenderDeferred) + { //store shiny in alpha if we don't have a specular map + if (!mat || mat->getSpecularID().isNull()) + { + shiny_in_alpha = true; + } + } + else + { + if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + shiny_in_alpha = true; + } + } - GLfloat alpha[4] = + if (shiny_in_alpha) { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; + + GLfloat alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; - if ((!LLPipeline::sRenderDeferred || !mat || mat->getSpecularID().isNull()) && - getPoolType() != LLDrawPool::POOL_ALPHA && - (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) - { llassert(tep->getShiny() <= 3); color.mV[3] = U8 (alpha[tep->getShiny()] * 255); } } - } // INDICES @@ -2117,11 +2133,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a src; - U32 glow32 = glow | - (glow << 8) | - (glow << 16) | - (glow << 24); + LLColor4U glow4u = LLColor4U(0,0,0,glow); + U32 glow32 = glow4u.mAll; + U32 vec[4]; vec[0] = vec[1] = vec[2] = vec[3] = glow32; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 977c50682f..f681c12747 100755 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -642,6 +642,8 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) void LLLoginInstance::handleLoginFailure(const LLSD& event) { + + // Login has failed. // Figure out why and respond... LLSD response = event["data"]; @@ -654,10 +656,13 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) // to reconnect or to end the attempt in failure. if(reason_response == "tos") { + llinfos << "LLLoginInstance::handleLoginFailure ToS" << llendl; + LLSD data(LLSD::emptyMap()); data["message"] = message_response; data["reply_pump"] = TOS_REPLY_PUMP; - gViewerWindow->setShowProgress(FALSE); + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); LLFloaterReg::showInstance("message_tos", data); LLEventPumps::instance().obtain(TOS_REPLY_PUMP) .listen(TOS_LISTENER_NAME, @@ -666,6 +671,8 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else if(reason_response == "critical") { + llinfos << "LLLoginInstance::handleLoginFailure Crit" << llendl; + LLSD data(LLSD::emptyMap()); data["message"] = message_response; data["reply_pump"] = TOS_REPLY_PUMP; @@ -678,7 +685,9 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) data["certificate"] = response["certificate"]; } - gViewerWindow->setShowProgress(FALSE); + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); + LLFloaterReg::showInstance("message_critical", data); LLEventPumps::instance().obtain(TOS_REPLY_PUMP) .listen(TOS_LISTENER_NAME, @@ -687,21 +696,28 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate")) { + llinfos << "LLLoginInstance::handleLoginFailure update" << llendl; + gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); updateApp(true, message_response); } else if(reason_response == "optional") { + llinfos << "LLLoginInstance::handleLoginFailure optional" << llendl; + updateApp(false, message_response); } else { + llinfos << "LLLoginInstance::handleLoginFailure attemptComplete" << llendl; attemptComplete(); } } void LLLoginInstance::handleLoginSuccess(const LLSD& event) { + llinfos << "LLLoginInstance::handleLoginSuccess" << llendl; + if(gSavedSettings.getBOOL("ForceMandatoryUpdate")) { LLSD response = event["data"]; @@ -723,6 +739,8 @@ void LLLoginInstance::handleLoginSuccess(const LLSD& event) void LLLoginInstance::handleDisconnect(const LLSD& event) { // placeholder + + llinfos << "LLLoginInstance::handleDisconnect placeholder " << llendl; } void LLLoginInstance::handleIndeterminate(const LLSD& event) @@ -731,10 +749,13 @@ void LLLoginInstance::handleIndeterminate(const LLSD& event) // gave the viewer a new url and params to try. // The login module handles the retry, but it gives us the // server response so that we may show - // the user some status. + // the user some status. + LLSD message = event.get("data").get("message"); if(message.isDefined()) { + llinfos << "LLLoginInstance::handleIndeterminate " << message.asString() << llendl; + LLSD progress_update; progress_update["desc"] = message; LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update); @@ -745,12 +766,16 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) { if(accepted) { + llinfos << "LLLoginInstance::handleTOSResponse: accepted" << llendl; + // Set the request data to true and retry login. mRequestData["params"][key] = true; reconnect(); } else { + llinfos << "LLLoginInstance::handleTOSResponse: attemptComplete" << llendl; + attemptComplete(); } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b7dc838601..dcedbba81b 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -960,11 +960,11 @@ void LLPanelFace::updateUI() } } - if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) + if (shinytexture_ctrl) { // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* // - if (identical_spec /*&& (shiny == SHINY_TEXTURE)*/) + if (identical_spec && (shiny == SHINY_TEXTURE)) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 372dfb0f0c..37c11bd027 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2502,9 +2502,12 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) } LLVector3 object_scale = object->getScale(); - LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[LLRender::DIFFUSE_MAP][te_num]; - LLVector3 normal_scale_ratio = selectNode->mTextureScaleRatios[LLRender::NORMAL_MAP][te_num]; - LLVector3 specular_scale_ratio = selectNode->mTextureScaleRatios[LLRender::SPECULAR_MAP][te_num]; + LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[te_num]; + + // We like these to track together. NORSPEC-96 + // + LLVector3 normal_scale_ratio = diffuse_scale_ratio; + LLVector3 specular_scale_ratio = diffuse_scale_ratio; // Apply new scale to face if (planar) @@ -2518,7 +2521,6 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis]; F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis]; - object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t); LLTextureEntry* tep = object->getTE(te_num); @@ -2534,8 +2536,28 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) } else { - object->setTEScale(te_num, diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis], - diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]); + + F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis]; + F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]; + + F32 normal_scale_s = normal_scale_ratio.mV[s_axis]*object_scale.mV[s_axis]; + F32 normal_scale_t = normal_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]; + + F32 specular_scale_s = specular_scale_ratio.mV[s_axis]*object_scale.mV[s_axis]; + F32 specular_scale_t = specular_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]; + + object->setTEScale(te_num, diffuse_scale_s,diffuse_scale_t); + + LLTextureEntry* tep = object->getTE(te_num); + + if (tep && !tep->getMaterialParams().isNull()) + { + LLMaterialPtr orig = tep->getMaterialParams(); + LLMaterialPtr p = new LLMaterial(orig->asLLSD()); + p->setNormalRepeat(normal_scale_s, normal_scale_t); + p->setSpecularRepeat(specular_scale_s, specular_scale_t); + selectionSetMaterial( p ); + } } send = send_to_sim; } @@ -5860,9 +5882,7 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures) void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) { - mTextureScaleRatios[LLRender::DIFFUSE_MAP].clear(); - mTextureScaleRatios[LLRender::NORMAL_MAP].clear(); - mTextureScaleRatios[LLRender::SPECULAR_MAP].clear(); + mTextureScaleRatios.clear(); if (mObject.notNull()) { @@ -5874,71 +5894,28 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) F32 diffuse_s = 1.0f; F32 diffuse_t = 1.0f; - F32 normal_s = 1.0f; - F32 normal_t = 1.0f; - - F32 specular_s = 1.0f; - F32 specular_t = 1.0f; - LLVector3 v; - const LLTextureEntry* tep = mObject->getTE(i); if (!tep) continue; - LLMaterialPtr mat = tep->getMaterialParams(); - U32 s_axis = VX; U32 t_axis = VY; LLPrimitive::getTESTAxes(i, &s_axis, &t_axis); tep->getScale(&diffuse_s,&diffuse_t); - if (mat) - { - mat->getNormalRepeat(normal_s, normal_t); - } - else - { - tep->getScale(&normal_s,&normal_t); - } - - if (mat) - { - mat->getSpecularRepeat(specular_s, specular_t); - } - else - { - tep->getScale(&specular_s,&specular_t); - } - if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR) { v.mV[s_axis] = diffuse_s*scale.mV[s_axis]; v.mV[t_axis] = diffuse_t*scale.mV[t_axis]; - mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v); - - v.mV[s_axis] = diffuse_s*scale.mV[s_axis]; - v.mV[t_axis] = diffuse_t*scale.mV[t_axis]; - mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v); - - v.mV[s_axis] = diffuse_s*scale.mV[s_axis]; - v.mV[t_axis] = diffuse_t*scale.mV[t_axis]; - mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v); + mTextureScaleRatios.push_back(v); } else { v.mV[s_axis] = diffuse_s/scale.mV[s_axis]; v.mV[t_axis] = diffuse_t/scale.mV[t_axis]; - mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v); - - v.mV[s_axis] = normal_s/scale.mV[s_axis]; - v.mV[t_axis] = normal_t/scale.mV[t_axis]; - mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v); - - v.mV[s_axis] = specular_s/scale.mV[s_axis]; - v.mV[t_axis] = specular_t/scale.mV[t_axis]; - mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v); + mTextureScaleRatios.push_back(v); } } } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index a750d8ce72..f9b97cebdd 100755 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -183,7 +183,7 @@ public: U64 mCreationDate; std::vector<LLColor4> mSavedColors; uuid_vec_t mSavedTextures; - std::vector<LLVector3> mTextureScaleRatios[LLRender::NUM_TEXTURE_CHANNELS]; + std::vector<LLVector3> mTextureScaleRatios; std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object BOOL mSilhouetteExists; // need to generate silhouette? diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 37c579bdf5..9117bf1c01 100755 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1095,6 +1095,8 @@ void render_hud_attachments() gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); + gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA_MASK); + gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 14d98d9a5a..5f08e8ca2e 100755 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -209,6 +209,9 @@ LLGLSLShader gDeferredPostNoDoFProgram; LLGLSLShader gDeferredWLSkyProgram; LLGLSLShader gDeferredWLCloudProgram; LLGLSLShader gDeferredStarProgram; +LLGLSLShader gDeferredFullbrightShinyProgram; +LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; +LLGLSLShader gDeferredSkinnedFullbrightProgram; LLGLSLShader gNormalMapGenProgram; // Deferred materials shaders @@ -289,6 +292,9 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); mShaderList.push_back(&gDeferredFullbrightProgram); + mShaderList.push_back(&gDeferredFullbrightShinyProgram); + mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram); + mShaderList.push_back(&gDeferredSkinnedFullbrightProgram); mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); mShaderList.push_back(&gDeferredWaterProgram); @@ -1132,6 +1138,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.unload(); gDeferredWLCloudProgram.unload(); gDeferredStarProgram.unload(); + gDeferredFullbrightShinyProgram.unload(); + gDeferredSkinnedFullbrightShinyProgram.unload(); + gDeferredSkinnedFullbrightProgram.unload(); + gNormalMapGenProgram.unload(); for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i) { @@ -1481,6 +1491,50 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { + gDeferredFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader"; + gDeferredFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true; + gDeferredFullbrightShinyProgram.mFeatures.hasGamma = true; + gDeferredFullbrightShinyProgram.mFeatures.hasTransport = true; + gDeferredFullbrightShinyProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels-1; + gDeferredFullbrightShinyProgram.mShaderFiles.clear(); + gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + success = gDeferredFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); + } + + if (success) + { + gDeferredSkinnedFullbrightProgram.mName = "Skinned Fullbright Shader"; + gDeferredSkinnedFullbrightProgram.mFeatures.calculatesAtmospherics = true; + gDeferredSkinnedFullbrightProgram.mFeatures.hasGamma = true; + gDeferredSkinnedFullbrightProgram.mFeatures.hasTransport = true; + gDeferredSkinnedFullbrightProgram.mFeatures.hasObjectSkinning = true; + gDeferredSkinnedFullbrightProgram.mFeatures.disableTextureIndex = true; + gDeferredSkinnedFullbrightProgram.mShaderFiles.clear(); + gDeferredSkinnedFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredSkinnedFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSkinnedFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gDeferredSkinnedFullbrightProgram.createShader(NULL, NULL); + } + + if (success) + { + gDeferredSkinnedFullbrightShinyProgram.mName = "Skinned Fullbright Shiny Shader"; + gDeferredSkinnedFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true; + gDeferredSkinnedFullbrightShinyProgram.mFeatures.hasGamma = true; + gDeferredSkinnedFullbrightShinyProgram.mFeatures.hasTransport = true; + gDeferredSkinnedFullbrightShinyProgram.mFeatures.hasObjectSkinning = true; + gDeferredSkinnedFullbrightShinyProgram.mFeatures.disableTextureIndex = true; + gDeferredSkinnedFullbrightShinyProgram.mShaderFiles.clear(); + gDeferredSkinnedFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredSkinnedFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSkinnedFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; + success = gDeferredSkinnedFullbrightShinyProgram.createShader(NULL, &mShinyUniforms); + } + + if (success) + { gDeferredEmissiveProgram.mName = "Deferred Emissive Shader"; gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true; gDeferredEmissiveProgram.mFeatures.hasGamma = true; @@ -2420,6 +2474,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectSimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectSimpleProgram.mFeatures.hasLighting = true; gSkinnedObjectSimpleProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectSimpleProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectSimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleProgram.mShaderFiles.clear(); gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2436,6 +2491,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true; gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2452,6 +2508,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectEmissiveProgram.mFeatures.hasTransport = true; gSkinnedObjectEmissiveProgram.mFeatures.isFullbright = true; gSkinnedObjectEmissiveProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectEmissiveProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectEmissiveProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectEmissiveProgram.mShaderFiles.clear(); gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2468,6 +2525,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectEmissiveWaterProgram.mFeatures.hasTransport = true; gSkinnedObjectEmissiveWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectEmissiveWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectEmissiveWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectEmissiveWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectEmissiveWaterProgram.mShaderFiles.clear(); @@ -2486,6 +2544,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyProgram.mFeatures.isShiny = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightShinyProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightShinyProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyProgram.mShaderFiles.clear(); gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2502,6 +2561,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleProgram.mFeatures.hasGamma = true; gSkinnedObjectShinySimpleProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectShinySimpleProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectShinySimpleProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectShinySimpleProgram.mFeatures.isShiny = true; gSkinnedObjectShinySimpleProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectShinySimpleProgram.mShaderFiles.clear(); @@ -2523,6 +2583,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectSimpleWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gSkinnedObjectSimpleWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectSimpleWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectSimpleWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectSimpleWaterProgram.mShaderFiles.clear(); gSkinnedObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -2539,6 +2600,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightWaterProgram.mFeatures.hasTransport = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectFullbrightWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; @@ -2558,6 +2620,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isShiny = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.disableTextureIndex = true; gSkinnedObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; @@ -2576,6 +2639,7 @@ BOOL LLViewerShaderMgr::loadShadersObject() gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasGamma = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAtmospherics = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasObjectSkinning = true; + gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAlphaMask = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.isShiny = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasWaterFog = true; gSkinnedObjectShinySimpleWaterProgram.mFeatures.disableTextureIndex = true; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index a24427a7bb..702a92c69c 100755 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -364,8 +364,12 @@ extern LLGLSLShader gDeferredAvatarAlphaProgram; extern LLGLSLShader gDeferredWLSkyProgram; extern LLGLSLShader gDeferredWLCloudProgram; extern LLGLSLShader gDeferredStarProgram; +extern LLGLSLShader gDeferredFullbrightShinyProgram; +extern LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; +extern LLGLSLShader gDeferredSkinnedFullbrightProgram; extern LLGLSLShader gNormalMapGenProgram; + // Deferred materials shaders extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5b69f80dc1..b107f43e4c 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4056,7 +4056,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) || - (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)); + (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) || + (facep->getTextureEntry()->getFullbright()); if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) { @@ -4530,34 +4531,46 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLMaterial* mat = te->getMaterialParams().get(); - if (mat) + if (mat && LLPipeline::sRenderDeferred) { - if (te->getFullbright()) + U8 alpha_mode = mat->getDiffuseAlphaMode(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA && + (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || + te->getColor().mV[3] < 0.999f); + + if (is_alpha) + { //this face needs alpha blending, override alpha mode + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + U32 mask = mat->getShaderMask(alpha_mode); + pool->addRiggedFace(facep, mask); + } + else if (mat) + { + bool fullbright = te->getFullbright(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA; + U8 mode = mat->getDiffuseAlphaMode(); + bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || + mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); - } - else if (type == LLDrawPool::POOL_ALPHA) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); - } + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); + } + else if (is_alpha || (te->getColor().mV[3] < 0.999f)) + { + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA); } - else if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + else if (gPipeline.canUseVertexShaders() + && LLPipeline::sRenderBump + && te->getShiny() + && can_be_shiny) { - // This feels unclean, but is the only way to get alpha masked rigged stuff to show up - // with masking correctly in both deferred and non-deferred paths. NORSPEC-191 - // - pool->addRiggedFace(facep, LLPipeline::sRenderDeferred ? LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_MASK : LLDrawPoolAvatar::RIGGED_ALPHA); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY : LLDrawPoolAvatar::RIGGED_SHINY); } else { - U32 mask = mat->getShaderMask(); - pool->addRiggedFace(facep, mask); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); } } else @@ -5315,11 +5328,20 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (mat && LLPipeline::sRenderDeferred && !hud_group) { + bool material_pass = false; + if (fullbright) { if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + if (te->getColor().mV[3] >= 0.999f) + { + material_pass = true; + } + else + { + registerFace(group, facep, LLRenderPass::PASS_ALPHA); + } } else if (is_alpha) { @@ -5327,7 +5349,15 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + if (mat->getEnvironmentIntensity() > 0 || + te->getShiny() > 0) + { + material_pass = true; + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + } } } else if (no_materials) @@ -5340,6 +5370,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { + material_pass = true; + } + + if (material_pass) + { U32 pass[] = { LLRenderPass::PASS_MATERIAL, @@ -5371,7 +5406,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else if (mat) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + U8 mode = mat->getDiffuseAlphaMode(); + if (te->getColor().mV[3] < 0.999f) + { + mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK); } @@ -5510,7 +5551,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); - if (!force_simple && te->getBumpmap() && LLPipeline::sRenderBump) + if (!force_simple && te->getBumpmap() && !mat && LLPipeline::sRenderBump) { registerFace(group, facep, LLRenderPass::PASS_BUMP); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 984ea446fe..6dc89742ec 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -268,6 +268,8 @@ std::string gPoolNames[] = "POOL_SKY", "POOL_WL_SKY", "POOL_TREE", + "POOL_ALPHA_MASK", + "POOL_FULLBRIGHT_ALPHA_MASK", "POOL_GRASS", "POOL_INVISIBLE", "POOL_AVATAR", @@ -439,10 +441,14 @@ LLPipeline::LLPipeline() : mWaterPool(NULL), mGroundPool(NULL), mSimplePool(NULL), + mGrassPool(NULL), + mAlphaMaskPool(NULL), + mFullbrightAlphaMaskPool(NULL), mFullbrightPool(NULL), mInvisiblePool(NULL), mGlowPool(NULL), mBumpPool(NULL), + mMaterialsPool(NULL), mWLSkyPool(NULL), mLightMask(0), mLightMovingMask(0), @@ -489,6 +495,8 @@ void LLPipeline::init() //create render pass pools getPool(LLDrawPool::POOL_ALPHA); getPool(LLDrawPool::POOL_SIMPLE); + getPool(LLDrawPool::POOL_ALPHA_MASK); + getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK); getPool(LLDrawPool::POOL_GRASS); getPool(LLDrawPool::POOL_FULLBRIGHT); getPool(LLDrawPool::POOL_INVISIBLE); @@ -1591,6 +1599,14 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) poolp = mGrassPool; break; + case LLDrawPool::POOL_ALPHA_MASK: + poolp = mAlphaMaskPool; + break; + + case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK: + poolp = mFullbrightAlphaMaskPool; + break; + case LLDrawPool::POOL_FULLBRIGHT: poolp = mFullbrightPool; break; @@ -1699,14 +1715,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima alpha = color_alpha; break; default: //alpha mode set to "mask", go to alpha pool if fullbright - if (te->getFullbright()) - { - alpha = true; - } - else - { - alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool. - } + alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool. break; } } @@ -5487,6 +5496,32 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; + case LLDrawPool::POOL_ALPHA_MASK: + if (mAlphaMaskPool) + { + llassert(0); + llwarns << "Ignoring duplicate alpha mask pool." << llendl; + break; + } + else + { + mAlphaMaskPool = (LLRenderPass*) new_poolp; + } + break; + + case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK: + if (mFullbrightAlphaMaskPool) + { + llassert(0); + llwarns << "Ignoring duplicate alpha mask pool." << llendl; + break; + } + else + { + mFullbrightAlphaMaskPool = (LLRenderPass*) new_poolp; + } + break; + case LLDrawPool::POOL_GRASS: if (mGrassPool) { @@ -5653,6 +5688,16 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mSimplePool = NULL; break; + case LLDrawPool::POOL_ALPHA_MASK: + llassert(mAlphaMaskPool == poolp); + mAlphaMaskPool = NULL; + break; + + case LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK: + llassert(mFullbrightAlphaMaskPool == poolp); + mFullbrightAlphaMaskPool = NULL; + break; + case LLDrawPool::POOL_GRASS: llassert(mGrassPool == poolp); mGrassPool = NULL; @@ -7145,7 +7190,7 @@ void LLPipeline::renderMaskedObjects(U32 type, U32 mask, BOOL texture, BOOL batc assertInitialized(); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; - mAlphaPool->pushMaskBatches(type, mask, texture, batch_texture); + mAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; } @@ -8663,6 +8708,8 @@ void LLPipeline::renderDeferredLighting() LLPipeline::RENDER_TYPE_PASS_INVISIBLE, LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY, LLPipeline::RENDER_TYPE_AVATAR, + LLPipeline::RENDER_TYPE_ALPHA_MASK, + LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK, END_RENDER_TYPES); renderGeomPostDeferred(*LLViewerCamera::getInstance()); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 4aee8f14d6..a8362953b4 100755 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -434,6 +434,8 @@ public: RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN, RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE, RENDER_TYPE_GRASS = LLDrawPool::POOL_GRASS, + RENDER_TYPE_ALPHA_MASK = LLDrawPool::POOL_ALPHA_MASK, + RENDER_TYPE_FULLBRIGHT_ALPHA_MASK = LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK, RENDER_TYPE_FULLBRIGHT = LLDrawPool::POOL_FULLBRIGHT, RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP, RENDER_TYPE_MATERIALS = LLDrawPool::POOL_MATERIALS, @@ -807,6 +809,8 @@ protected: LLDrawPool* mGroundPool; LLRenderPass* mSimplePool; LLRenderPass* mGrassPool; + LLRenderPass* mAlphaMaskPool; + LLRenderPass* mFullbrightAlphaMaskPool; LLRenderPass* mFullbrightPool; LLDrawPool* mInvisiblePool; LLDrawPool* mGlowPool; |