diff options
Diffstat (limited to 'indra/newview')
25 files changed, 451 insertions, 97 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index dd87ddb330..ef04ef5ce6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -59,6 +59,7 @@ void main() vec4 pos = vec4(vary_position, 1.0); vec4 diff= diffuseLookup(vary_texcoord0.xy); + diff.rgb = pow(diff.rgb, vec3(2.2)); vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 36433a5827..b6a9417fe7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -43,6 +43,7 @@ void main() float shadow = 1.0; vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; + color.rgb = pow(color.rgb, vec3(2.2)); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index bff87cb6aa..53e5a228fa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -70,6 +70,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float det = max(1.0-lod/(proj_lod*0.5), 0.0); @@ -85,6 +87,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -102,6 +106,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 6e5ac8317b..fa1572e692 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -108,6 +108,7 @@ void main() if (spec.a > 0.0) { float sa = dot(normalize(lv-normalize(pos)),norm); + spec.rgb += pow(1 - dot(-normalize(pos), norm), 2) * da * 3; if (sa > 0.0) { sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index bf362e21a4..3f57b006cd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -37,6 +37,7 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform float max_cof; uniform float res_scale; +uniform float global_gamma; VARYING vec2 vary_fragcoord; @@ -123,6 +124,6 @@ void main() diff /= w; } - + diff.rgb = pow(diff.rgb, vec3(1.0/global_gamma)); frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index eb5beeef39..c891c4e445 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -35,12 +35,13 @@ uniform sampler2DRect diffuseRect; uniform sampler2D bloomMap; uniform vec2 screen_res; +uniform float global_gamma; VARYING vec2 vary_fragcoord; void main() { vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); - + diff.rgb = pow(diff.rgb, vec3(1.0/global_gamma)); vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); frag_color = diff + bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 14eaafeb68..87cdf1026f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -77,6 +77,11 @@ vec3 vary_AtmosAttenuation; uniform mat4 inv_proj; uniform vec2 screen_res; +vec3 samplesRGB(vec3 color) +{ + return pow(color, vec3(2.2)); +} + vec4 getPosition_d(vec2 pos_screen, float depth) { vec2 sc = pos_screen.xy*2.0; @@ -101,22 +106,21 @@ vec3 getPositionEye() } vec3 getSunlitColor() { - return vary_SunlitColor; + return samplesRGB(vary_SunlitColor) * 4.4; } vec3 getAmblitColor() { - return vary_AmblitColor; + return samplesRGB((vary_AmblitColor)) * 2.2; } vec3 getAdditiveColor() { - return vary_AdditiveColor; + return samplesRGB(vary_AdditiveColor) * 2.2; } vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; } - void setPositionEye(vec3 v) { vary_PositionEye = v; @@ -310,7 +314,7 @@ void main() //add environmentmap vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2, max(spec.a-diffuse.a*2.0, 0.0)); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index cca63872de..9bdf87678f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -72,6 +72,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float det = max(1.0-lod/(proj_lod*0.5), 0.0); @@ -87,6 +89,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -104,6 +108,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl index 6c34643aab..9543be562b 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl @@ -37,6 +37,8 @@ vec3 fullbrightScaleSoftClip(vec3 light); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +uniform float texture_gamma; + void fullbright_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; @@ -45,7 +47,7 @@ void fullbright_lighting() { discard; } - + 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/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 12706f130b..359864556d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -149,6 +149,7 @@ void main() } vec4 diff = diffuseLookup(vary_texcoord0.xy); + diff.rgb = pow(diff.rgb, vec3(2.2)); vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 5621e47ab7..695887c5ff 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -71,6 +71,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float det = max(1.0-lod/(proj_lod*0.5), 0.0); @@ -86,6 +88,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -103,6 +107,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 457189b48e..bf4c476138 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -79,6 +79,11 @@ vec3 vary_AmblitColor; vec3 vary_AdditiveColor; vec3 vary_AtmosAttenuation; +vec3 samplesRGB(vec3 color) +{ + return pow(color, vec3(2.2)); +} + vec4 getPosition_d(vec2 pos_screen, float depth) { vec2 sc = pos_screen.xy*2.0; @@ -103,15 +108,15 @@ vec3 getPositionEye() } vec3 getSunlitColor() { - return vary_SunlitColor; + return samplesRGB(vary_SunlitColor) * 4.4; } vec3 getAmblitColor() { - return vary_AmblitColor; + return samplesRGB(vary_AmblitColor) * 2.2; } vec3 getAdditiveColor() { - return vary_AdditiveColor; + return samplesRGB(vary_AdditiveColor) * 2.2; } vec3 getAtmosAttenuation() { @@ -318,7 +323,7 @@ void main() //add environmentmap vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2, max(spec.a-diffuse.a*2.0, 0.0)); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 6d6ad6d565..525dd32106 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -71,6 +71,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float det = max(1.0-lod/(proj_lod*0.5), 0.0); @@ -86,6 +88,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -103,6 +107,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret.rgb = pow(ret.rgb, vec3(2.2)); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 765b0927c3..dd7de9f123 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -27,7 +27,7 @@ VARYING vec3 vary_SunlitColor; VARYING vec3 vary_AdditiveColor; VARYING vec3 vary_AtmosAttenuation; - +uniform float global_gamma; vec3 getSunlitColor() { return vec3(0,0,0); @@ -38,7 +38,7 @@ vec3 getAmblitColor() } vec3 getAdditiveColor() { - return vary_AdditiveColor; + return pow(vary_AdditiveColor, vec3(global_gamma)) * global_gamma; } vec3 getAtmosAttenuation() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 99dbee15ee..61f3088648 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -33,18 +33,20 @@ vec3 sunlit_color; vec3 amblit_color; vec3 position_eye; +uniform float global_gamma; + vec3 getSunlitColor() { - return sunlit_color; + return pow(sunlit_color, vec3(global_gamma)) * global_gamma; } vec3 getAmblitColor() { - return amblit_color; + return pow(amblit_color, vec3(global_gamma)) * global_gamma; } vec3 getAdditiveColor() { - return additive_color; + return pow(additive_color, vec3(global_gamma)) * global_gamma; } vec3 getAtmosAttenuation() { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 313b310e1e..33615eb075 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -240,6 +240,12 @@ void LLDrawPoolAlpha::render(S32 pass) { 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); + } } pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); @@ -423,6 +429,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (use_shaders) { target_shader = fullbright_shader; + if (LLPipeline::sRenderDeferred) + { + if (params.mFace->getViewerObject()->isHUDAttachment()) + { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + } else { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2); + } + } else { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + } } else { 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++; diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 4f6eaa5a5b..9dfd69583e 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -80,7 +80,7 @@ LLDrawPoolWater::LLDrawPoolWater() : mWaterImagep->setNoDelete(); mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE); llassert(mOpaqueWaterImagep); - mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL); + mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, TRUE, LLViewerTexture::BOOST_BUMP); mWaterNormp->setNoDelete(); restoreGL(); @@ -563,7 +563,7 @@ void LLDrawPoolWater::shade() // change mWaterNormp if needed if (mWaterNormp->getID() != param_mgr->getNormalMapID()) { - mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID()); + mWaterNormp = LLViewerTextureManager::getFetchedTexture(param_mgr->getNormalMapID(), TRUE, LLViewerTexture::BOOST_BUMP); } mWaterNormp->addTextureStats(1024.f*1024.f); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e74c8509ce..51bda4141d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -66,15 +66,28 @@ #include "llviewertexturelist.h" // +// Constant definitions for comboboxes +// Must match the commbobox definitions in panel_tools_texture.xml +// +const S32 MATMEDIA_MATERIAL = 0; // Material +const S32 MATMEDIA_MEDIA = 1; // Media +const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture +const S32 MATTYPE_NORMAL = 1; // Normal map +const S32 MATTYPE_SPECULAR = 2; // Specular map +const S32 ALPHAMODE_NONE = 0; // No alpha mask applied +const S32 ALPHAMODE_MASK = 2; // Alpha masking mode +const S32 BUMPY_TEXTURE = 18; // use supplied normal map +const S32 SHINY_TEXTURE = 4; // use supplied specular map + +// // Methods // BOOL LLPanelFace::postBuild() { - childSetCommitCallback("combobox matmedia",&LLPanelFace::onCommitMaterialsMedia,this); - childSetCommitCallback("combobox mattype",&LLPanelFace::onCommitMaterialType,this); childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); + childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); @@ -89,6 +102,8 @@ BOOL LLPanelFace::postBuild() LLColorSwatchCtrl* mColorSwatch; LLComboBox* mComboTexGen; + LLComboBox* mComboMatMedia; + LLComboBox* mComboMatType; LLCheckBoxCtrl *mCheckFullbright; @@ -154,6 +169,20 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } + mComboMatMedia = getChild<LLComboBox>("combobox matmedia"); + if(mComboMatMedia) + { + mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } + + mComboMatType = getChild<LLComboBox>("combobox mattype"); + if(mComboMatType) + { + mComboMatType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); + mComboMatType->selectNthItem(MATTYPE_DIFFUSE); + } + mCtrlGlow = getChild<LLSpinCtrl>("glow"); if(mCtrlGlow) { @@ -492,30 +521,33 @@ void LLPanelFace::getState() BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_matmedia = - childGetSelectionInterface("combobox matmedia"); + LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia"); if (combobox_matmedia) { - combobox_matmedia->selectNthItem(0); + if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) + { + combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox matmedia'" << llendl; + llwarns << "failed getChild for 'combobox matmedia'" << llendl; } getChildView("combobox matmedia")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_mattype = - childGetSelectionInterface("combobox mattype"); + LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype"); if (combobox_mattype) { - combobox_mattype->selectNthItem(0); + if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE) + { + combobox_mattype->selectNthItem(MATTYPE_DIFFUSE); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox mattype'" << llendl; + llwarns << "failed getChild for 'combobox mattype'" << llendl; } getChildView("combobox mattype")->setEnabled(editable); onCommitMaterialsMedia(NULL, this); @@ -565,12 +597,41 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + BOOL is_alpha = FALSE; + struct f2 : public LLSelectedTEGetFunctor<BOOL> + { + BOOL get(LLViewerObject* object, S32 te_index) + { + BOOL is_alpha = FALSE; + + LLViewerTexture* image = object->getTEImage(te_index); + if (image) is_alpha = image->getIsAlphaMask(); + return is_alpha; + } + } func2; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, is_alpha ); + if(LLViewerMedia::textureHasMedia(id)) { - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); } + if (!is_alpha) + { + // Selected texture has no alpha, force alpha mode None + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) + { + combobox_alphamode->selectNthItem(ALPHAMODE_NONE); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + } + onCommitAlphaMode(getChild<LLComboBox>("combobox alpha"),this); + } + if (identical) { // All selected have the same texture @@ -579,6 +640,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } else @@ -591,6 +656,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); + getChildView("combobox alphamode")->setEnabled( FALSE ); + getChildView("label alphamode")->setEnabled( FALSE ); + getChildView("maskcutoff")->setEnabled( FALSE); + getChildView("label maskcutoff")->setEnabled( FALSE ); } else { @@ -598,6 +667,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } } @@ -803,6 +876,15 @@ void LLPanelFace::getState() getChildView("combobox shininess")->setEnabled(editable); getChild<LLUICtrl>("combobox shininess")->setTentative(!identical); getChildView("label shininess")->setEnabled(editable); + getChildView("glossiness")->setEnabled(editable); + getChild<LLUICtrl>("glossiness")->setTentative(!identical); + getChildView("label glossiness")->setEnabled(editable); + getChildView("environment")->setEnabled(editable); + getChild<LLUICtrl>("environment")->setTentative(!identical); + getChildView("label environment")->setEnabled(editable); + getChildView("shinycolorswatch")->setEnabled(editable); + getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical); + getChildView("label shinycolor")->setEnabled(editable); } { @@ -955,12 +1037,9 @@ void LLPanelFace::getState() getChildView("label shininess")->setEnabled(FALSE); getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("textbox autofix")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); - // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); @@ -1016,30 +1095,50 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLComboBox* mComboMaterialsMedia = self->getChild<LLComboBox>("combobox matmedia"); - if (!mComboMaterialsMedia) + LLComboBox* comboMaterialsMedia = self->getChild<LLComboBox>("combobox matmedia"); + if (!comboMaterialsMedia) { return; } - U32 materials_media = mComboMaterialsMedia->getCurrentIndex(); - LLComboBox* mComboMaterialType = self->getChild<LLComboBox>("combobox mattype"); - if (!mComboMaterialType) + U32 materials_media = comboMaterialsMedia->getCurrentIndex(); + LLComboBox* comboMaterialType = self->getChild<LLComboBox>("combobox mattype"); + if (!comboMaterialType) { return; } - U32 material_type = mComboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == 1); - bool show_texture = (!show_media) && (material_type == 0); - bool show_bumpiness = (!show_media) && (material_type == 1); - bool show_shininess = (!show_media) && (material_type == 2); + U32 material_type = comboMaterialType->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA); + bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE); + bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL); + bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR); self->getChildView("combobox mattype")->setVisible(!show_media); self->getChildView("media_info")->setVisible(show_media); self->getChildView("add_media")->setVisible(show_media); self->getChildView("delete_media")->setVisible(show_media); self->getChildView("button align")->setVisible(show_media); self->getChildView("texture control")->setVisible(show_texture); + self->getChildView("label alphamode")->setVisible(show_texture); + self->getChildView("combobox alphamode")->setVisible(show_texture); + self->getChildView("label maskcutoff")->setVisible(false); + self->getChildView("maskcutoff")->setVisible(false); + if (show_texture) + { + onCommitAlphaMode(ctrl, userdata); + } + self->getChildView("shinytexture control")->setVisible(show_shininess); self->getChildView("combobox shininess")->setVisible(show_shininess); self->getChildView("label shininess")->setVisible(show_shininess); + self->getChildView("label glossiness")->setVisible(false); + self->getChildView("glossiness")->setVisible(false); + self->getChildView("label environment")->setVisible(false); + self->getChildView("environment")->setVisible(false); + self->getChildView("label shinycolor")->setVisible(false); + self->getChildView("shinycolorswatch")->setVisible(false); + if (show_shininess) + { + onCommitShiny(ctrl, userdata); + } + self->getChildView("bumpytexture control")->setVisible(show_bumpiness); self->getChildView("combobox bumpiness")->setVisible(show_bumpiness); self->getChildView("label bumpiness")->setVisible(show_bumpiness); } @@ -1068,10 +1167,38 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboShiny = self->getChild<LLComboBox>("combobox shininess"); + if (!comboShiny) + { + return; + } + U32 shiny_value = comboShiny->getCurrentIndex(); + bool show_shinyctrls = (shiny_value == SHINY_TEXTURE); // Use texture + self->getChildView("label glossiness")->setVisible(show_shinyctrls); + self->getChildView("glossiness")->setVisible(show_shinyctrls); + self->getChildView("label environment")->setVisible(show_shinyctrls); + self->getChildView("environment")->setVisible(show_shinyctrls); + self->getChildView("label shinycolor")->setVisible(show_shinyctrls); + self->getChildView("shinycolorswatch")->setVisible(show_shinyctrls); self->sendShiny(); } // static +void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboAlphaMode = self->getChild<LLComboBox>("combobox alphamode"); + if (!comboAlphaMode) + { + return; + } + U32 alpha_value = comboAlphaMode->getCurrentIndex(); + bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking + self->getChildView("label maskcutoff")->setVisible(show_alphactrls); + self->getChildView("maskcutoff")->setVisible(show_alphactrls); +} + +// static void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index acac2c1bf5..56b4034a2d 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -85,6 +85,7 @@ protected: static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); + static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); static void onCommitGlow( LLUICtrl* ctrl, void *userdata); static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index d58ee05fb6..feceee5709 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1051,6 +1051,7 @@ void render_hud_attachments() if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { + LLPipeline::sRenderingHUDs = TRUE; LLCamera hud_cam = *LLViewerCamera::getInstance(); LLVector3 origin = hud_cam.getOrigin(); hud_cam.setOrigin(-1.f,0,0); @@ -1124,6 +1125,7 @@ void render_hud_attachments() gPipeline.toggleRenderDebugFeature((void*) LLPipeline::RENDER_DEBUG_FEATURE_UI); } LLPipeline::sUseOcclusion = use_occlusion; + LLPipeline::sRenderingHUDs = FALSE; } gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index b04d30db55..0b5e0235ee 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -33,6 +33,7 @@ #include "llglslshader.h" #include "lluictrlfactory.h" #include "llsliderctrl.h" +#include "pipeline.h" #include <llgl.h> @@ -127,6 +128,13 @@ void LLWLParamSet::update(LLGLSLShader * shader) const } } } + + if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender) + { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2); + } else { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0); + } } void LLWLParamSet::set(const std::string& paramName, float x) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 24144382dc..205598060a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -377,6 +377,7 @@ BOOL LLPipeline::sRenderDeferred = FALSE; BOOL LLPipeline::sMemAllocationThrottled = FALSE; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; +BOOL LLPipeline::sRenderingHUDs; static LLCullResult* sCull = NULL; @@ -396,7 +397,7 @@ void validate_framebuffer_object(); bool addDeferredAttachments(LLRenderTarget& target) { - return target.addColorAttachment(GL_RGBA) && //specular + return target.addColorAttachment(GL_SRGB_ALPHA) && //specular target.addColorAttachment(GL_RGB10_A2); //normal+z } @@ -898,11 +899,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) BOOL ssao = RenderDeferredSSAO; //allocate deferred rendering color buffers - if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; + if (!mDeferredScreen.allocate(resX, resY, GL_SRGB8_ALPHA8, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (!addDeferredAttachments(mDeferredScreen)) return false; - if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; + if (!mScreen.allocate(resX, resY, GL_RGBA12, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (samples > 0) { if (!mFXAABuffer.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false; @@ -3602,8 +3603,8 @@ void LLPipeline::postSort(LLCamera& camera) for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { LLSpatialGroup* group = *i; - if (sUseOcclusion && - group->isOcclusionState(LLSpatialGroup::OCCLUDED) || + if ((sUseOcclusion && + group->isOcclusionState(LLSpatialGroup::OCCLUDED)) || (RenderAutoHideSurfaceAreaLimit > 0.f && group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit*llmax(group->mObjectBoxSize, 10.f))) { @@ -5034,8 +5035,8 @@ void LLPipeline::renderDebug() LLSpatialPartition* part = region->getSpatialPartition(i); if (part) { - if ( hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES) || - !hud_only && hasRenderType(part->mDrawableType) ) + if ( (hud_only && (part->mDrawableType == RENDER_TYPE_HUD || part->mDrawableType == RENDER_TYPE_HUD_PARTICLES)) || + (!hud_only && hasRenderType(part->mDrawableType)) ) { part->renderDebug(); } @@ -7382,6 +7383,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mScreen.bindTexture(0, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } + + if (!LLViewerCamera::getInstance()->cameraUnderWater()) + { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2); + } else { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0); + } shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); @@ -7423,6 +7431,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { mScreen.bindTexture(0, channel); } + + if (!LLViewerCamera::getInstance()->cameraUnderWater()) + { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2); + } else { + shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 1.0); + } gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 36abeca295..e264081910 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -554,7 +554,8 @@ public: static BOOL sRenderDeferred; static BOOL sMemAllocationThrottled; static S32 sVisibleLightCount; - static F32 sMinRenderSize; + static F32 sMinRenderSize; + static BOOL sRenderingHUDs; //screen texture U32 mScreenWidth; diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 26b2d83351..21cbf9673d 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -155,36 +155,36 @@ follows="left|top" height="10" layout="topleft" - name="label shininess" left_pad="10" + name="label alphamode" text_readonly_color="LabelDisabledColor" - top_delta="6" + top_delta="0" width="90"> - Shininess + Alpha mode </text> <combo_box height="23" layout="topleft" - left_pad="10" - name="combobox shininess" - top_delta="-6" - width="90"> + left_delta="0" + name="combobox alphamode" + top_pad="4" + width="120"> <combo_box.item label="None" name="None" value="None" /> <combo_box.item - label="Low" - name="Low" - value="Low" /> + label="Alpha blending" + name="Alpha blending" + value="Alpha blending" /> <combo_box.item - label="Medium" - name="Medium" - value="Medium" /> + label="Alpha masking" + name="Alpha masking" + value="Alpha masking" /> <combo_box.item - label="High" - name="High" - value="High" /> + label="Emissive mask" + name="Emissive mask" + value="Emissive mask" /> </combo_box> <text type="string" @@ -192,7 +192,43 @@ follows="left|top" height="10" layout="topleft" - left_delta="-100" + left_delta="0" + name="label maskcutoff" + text_readonly_color="LabelDisabledColor" + top_pad="4" + width="90"> + Mask cutoff + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_pad="4" + left_delta="0" + name="maskcutoff" + width="80" /> + <texture_picker + can_apply_immediately="true" + default_image_name="Default" + fallback_image="locked_image.j2c" + follows="left|top" + height="80" + label="Texture " + layout="topleft" + left="10" + name="bumpytexture control" + tool_tip="Click to choose a picture" + top_delta="-55" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_pad="10" name="label bumpiness" text_readonly_color="LabelDisabledColor" top_delta="0" @@ -278,13 +314,142 @@ label="weave" name="weave" value="weave" /> + <combo_box.item + label="Use texture" + name="Use texture" + value="Use texture" /> + </combo_box> + <texture_picker + can_apply_immediately="true" + default_image_name="Default" + fallback_image="locked_image.j2c" + follows="left|top" + height="80" + label="Texture " + layout="topleft" + left="10" + name="shinytexture control" + tool_tip="Click to choose a picture" + top_delta="-14" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + name="label shininess" + left_pad="10" + text_readonly_color="LabelDisabledColor" + top_delta="6" + width="90"> + Shininess + </text> + <combo_box + height="23" + layout="topleft" + left_pad="10" + name="combobox shininess" + top_delta="-6" + width="90"> + <combo_box.item + label="None" + name="None" + value="None" /> + <combo_box.item + label="Low" + name="Low" + value="Low" /> + <combo_box.item + label="Medium" + name="Medium" + value="Medium" /> + <combo_box.item + label="High" + name="High" + value="High" /> + <combo_box.item + label="Use texture" + name="Use texture" + value="Use texture" /> </combo_box> <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-100" + name="label glossiness" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Glossiness + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_delta="-4" + left_pad="10" + name="glossiness" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-126" + name="label environment" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Environment + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_delta="-4" + left_pad="10" + name="environment" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-126" + name="label shinycolor" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Color + </text> + <!-- label is blank because control places it below the box --> + <color_swatch + can_apply_immediately="true" + follows="left|top" + height="45" + label="" + layout="topleft" + left_pad="10" + name="shinycolorswatch" + tool_tip="Click to open color picker" + top_delta="-4" + width="64" /> + <text follows="left|top|right" height="9" layout="topleft" left="10" - top_delta="-8" + top_delta="-50" use_ellipses="true" read_only="true" name="media_info" @@ -370,14 +535,6 @@ name="TexScaleU" top_pad="5" width="265" /> - <!-- <check_box - height="19" - label="Flip" - layout="topleft" - left_pad="5" - name="checkbox flip s" - top_delta="0" - width="70" /> --> <spinner follows="left|top" height="19" @@ -390,14 +547,6 @@ max_val="100" name="TexScaleV" width="265" /> - <!-- <check_box - height="19" - label="Flip" - layout="topleft" - left_pad="5" - name="checkbox flip t" - top_delta="0" - width="70" /> --> <spinner decimal_digits="1" follows="left|top" @@ -411,16 +560,7 @@ min_val="0.1" name="rptctrl" width="265" /> - <!-- <button - follows="left|top" - height="19" - label="Apply" - label_selected="Apply" - layout="topleft" - left_pad="5" - name="button apply" - width="75" /> --> - <spinner + <spinner decimal_digits="2" follows="left|top" height="19" |