diff options
Diffstat (limited to 'indra')
13 files changed, 143 insertions, 84 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 8431744892..088ba95b75 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -760,12 +760,13 @@ bool LLGLManager::initGL() { //using multisample textures on ATI results in black screen for some reason mHasTextureMultisample = FALSE; } -#endif + if (mIsIntel && mGLVersion <= 3.f) { //never try to use framebuffer objects on older intel drivers (crashy) mHasFramebufferObject = FALSE; } +#endif if (mHasFramebufferObject) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index db42a54e42..338532e71d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -137,6 +137,7 @@ void main() if (spec.a > 0.0) { + lit = min(da*6.0, 1.0) * dist_atten; //vec3 ref = dot(pos+lv, norm); vec3 h = normalize(lv+npos); float nh = dot(norm, h); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 893a92299a..6675bfde69 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -78,9 +78,15 @@ vec3 decode_normal (vec2 enc) return n; } +vec4 correctWithGamma(vec4 col) +{ + return vec4(pow(col.rgb, vec3(2.2)), col.a); +} + vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); + ret = correctWithGamma(ret); vec2 dist = tc-vec2(0.5); @@ -96,7 +102,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - + ret = correctWithGamma(ret); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -113,7 +120,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - + ret = correctWithGamma(ret); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); @@ -226,6 +234,8 @@ void main() if (spec.a > 0.0) { + dlit *= min(da*6.0, 1.0) * dist_atten; + vec3 npos = -normalize(pos); //vec3 ref = dot(pos+lv, norm); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 36406cbf57..69cdb2ce71 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -119,6 +119,8 @@ void main() vec4 spec = texture2DRect(specularRect, frag.xy); if (spec.a > 0.0) { + lit = min(da*6.0, 1.0) * dist_atten; + vec3 npos = -normalize(pos); vec3 h = normalize(lv+npos); float nh = dot(norm, h); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 5d936233fe..a1dff9188f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -321,8 +321,6 @@ void main() col += spec_contrib; } - col = mix(col.rgb, diffuse.rgb, diffuse.a); - if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; @@ -332,6 +330,8 @@ void main() col = atmosLighting(col); col = scaleSoftClip(col); + + col = mix(col.rgb, diffuse.rgb, diffuse.a); } frag_color.rgb = col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index b29f676ecc..c918a42c73 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -234,6 +234,7 @@ void main() if (spec.a > 0.0) { + dlit *= min(da*6.0, 1.0) * dist_atten; vec3 npos = -normalize(pos); //vec3 ref = dot(pos+lv, norm); diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index 8494ffba52..9064904191 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -48,11 +48,9 @@ void main() mat = modelview_matrix * mat; vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; + vertex_color = emissive; + calcAtmospherics(pos.xyz); - vertex_color = emissive; - gl_Position = projection_matrix*vec4(pos, 1.0); - - } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 9ddbb6da6a..a6b0f7e7c1 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -79,10 +79,17 @@ vec3 decode_normal (vec2 enc) return n; } +vec4 correctWithGamma(vec4 col) +{ + return vec4(pow(col.rgb, vec3(2.2)), col.a); +} + + vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - + ret = correctWithGamma(ret); + vec2 dist = tc-vec2(0.5); float det = max(1.0-lod/(proj_lod*0.5), 0.0); @@ -97,7 +104,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - + ret = correctWithGamma(ret); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); float det = min(lod/(proj_lod*0.5), 1.0); @@ -114,7 +122,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - + ret = correctWithGamma(ret); + vec2 dist = tc-vec2(0.5); float d = dot(dist,dist); @@ -243,6 +252,7 @@ void main() if (spec.a > 0.0) { vec3 npos = -normalize(pos); + dlit *= min(da*6.0, 1.0) * dist_atten; //vec3 ref = dot(pos+lv, norm); vec3 h = normalize(lv+npos); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 15584548cc..10a598a85c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -330,8 +330,6 @@ void main() col += spec_contrib; } - col = mix(col, diffuse.rgb, diffuse.a); - if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; @@ -341,6 +339,8 @@ void main() col = atmosLighting(col); col = scaleSoftClip(col); + + col = mix(col.rgb, diffuse.rgb, diffuse.a); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index aa964fa0a3..91ff1f1e76 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -248,6 +248,7 @@ void main() if (spec.a > 0.0) { + dlit *= min(da*6.0, 1.0) * dist_atten; vec3 npos = -normalize(pos); //vec3 ref = dot(pos+lv, norm); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 612741e57c..69f10cd4df 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -182,6 +182,7 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass) break; case 4: beginDeferredRiggedBump(); + break; default: beginDeferredRiggedMaterial(pass-5); break; @@ -252,10 +253,11 @@ void LLDrawPoolAvatar::beginPostDeferredPass(S32 pass) case 4: beginRiggedFullbrightAlpha(); break; - case 5: + case 9: beginRiggedGlow(); + break; default: - beginDeferredRiggedMaterialAlpha(pass-6); + beginDeferredRiggedMaterialAlpha(pass-5); break; } } @@ -368,14 +370,14 @@ void LLDrawPoolAvatar::renderPostDeferred(S32 pass) 13, //rigged glow }; - pass = actual_pass[pass]; + S32 p = actual_pass[pass]; if (LLPipeline::sImpostorRender) { //HACK for impostors so actual pass ends up being proper pass - pass -= 2; + p -= 2; } - render(pass); + render(p); } @@ -1299,20 +1301,28 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - S32 p = 0; - switch (pass) + if (LLPipeline::sRenderDeferred) { - case 9: p = 1; break; - case 10: p = 5; break; - case 11: p = 9; break; - case 12: p = 13; break; - } + S32 p = 0; + switch (pass) + { + case 9: p = 1; break; + case 10: p = 5; break; + case 11: p = 9; break; + case 12: p = 13; break; + } + { + LLGLEnable blend(GL_BLEND); + renderDeferredRiggedMaterial(avatarp, p); + } + return; + } + else if (pass == 9) { - LLGLEnable blend(GL_BLEND); - renderDeferredRiggedMaterial(avatarp, p); + renderRiggedGlow(avatarp); + return; } - return; } if (pass == 13) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 6474e1b1de..08a16c9c33 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1097,6 +1097,12 @@ bool LLFace::canRenderAsMask() { return false; } + + LLMaterial* mat = te->getMaterialParams(); + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + { + return false; + } if ((te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 67ef072508..1a3f4832fd 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1569,19 +1569,30 @@ void LLPanelFace::getState() LLMaterialID get(LLViewerObject* object, S32 te_index) { LLMaterialID material_id; - + return object->getTE(te_index)->getMaterialID(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterialID ); - llinfos << "Material ID returned: '" - << mMaterialID.asString() << "', isNull? " - << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + int selected_te = node->getLastSelectedTE(); + if (selected_te >= 0) + { + mMaterialID = node->getObject()->getTE(selected_te)->getMaterialID(); + } + } + + llinfos << "Material ID returned: '" << mMaterialID.asString() << "', isNull? " << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + if (!mMaterialID.isNull() && editable) { llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; - LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } + } // Set variable values for numeric expressions @@ -1774,14 +1785,38 @@ void LLPanelFace::updateMaterial() mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger())); + LLMaterialPtr material_to_set = mMaterial; + + // If we're editing a single face and not the entire material for an object, + // we need to clone the material so that our changes to the material's settings + // don't automatically propagate to the non-selected faces + // NORSPEC-92 + // + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + if (node->getTESelectMask() != TE_SELECT_MASK_ALL) + { + llinfos << "Cloning material to apply to subselection." << llendl; + material_to_set = new LLMaterial(mMaterial->asLLSD()); + } + else + { + llinfos << "Apply material change to whole selection." << llendl; + } + } + + llassert(!material_to_set.isNull()); + + material_to_set->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex()); + material_to_set->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); if (!norm_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(norm_map_id); + material_to_set->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal(); @@ -1792,18 +1827,18 @@ void LLPanelFace::updateMaterial() bumpy_scale_v *= 0.5f; } - mMaterial->setNormalOffset(getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(), + material_to_set->setNormalOffset(getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(), getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - mMaterial->setNormalRotation(getChild<LLUICtrl>("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); + material_to_set->setNormalRotation(getChild<LLUICtrl>("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(LLUUID()); - mMaterial->setNormalOffset(0.0f,0.0f); - mMaterial->setNormalRepeat(1.0f,1.0f); - mMaterial->setNormalRotation(0.0f); + material_to_set->setNormalID(LLUUID()); + material_to_set->setNormalOffset(0.0f,0.0f); + material_to_set->setNormalRepeat(1.0f,1.0f); + material_to_set->setNormalRotation(0.0f); } LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); @@ -1811,8 +1846,8 @@ void LLPanelFace::updateMaterial() if (!spec_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(spec_map_id); - mMaterial->setSpecularOffset(getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(), + material_to_set->setSpecularID(spec_map_id); + material_to_set->setSpecularOffset(getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(), getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal()); F32 shiny_scale_u = getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(); @@ -1824,48 +1859,32 @@ void LLPanelFace::updateMaterial() shiny_scale_v *= 0.5f; } - mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - mMaterial->setSpecularRotation(getChild<LLUICtrl>("shinyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + material_to_set->setSpecularRotation(getChild<LLUICtrl>("shinyRot")->getValue().asReal()*DEG_TO_RAD); //override shininess to 0.2f if this is a new material if (!new_material) { - mMaterial->setSpecularLightColor(getChild<LLColorSwatchCtrl>("shinycolorswatch")->get()); - mMaterial->setSpecularLightExponent(getChild<LLUICtrl>("glossiness")->getValue().asInteger()); - mMaterial->setEnvironmentIntensity(getChild<LLUICtrl>("environment")->getValue().asInteger()); + material_to_set->setSpecularLightColor(getChild<LLColorSwatchCtrl>("shinycolorswatch")->get()); + material_to_set->setSpecularLightExponent(getChild<LLUICtrl>("glossiness")->getValue().asInteger()); + material_to_set->setEnvironmentIntensity(getChild<LLUICtrl>("environment")->getValue().asInteger()); } } else { LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(LLUUID()); - mMaterial->setSpecularOffset(0.0f,0.0f); - mMaterial->setSpecularRepeat(1.0f,1.0f); - mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - mMaterial->setEnvironmentIntensity(0); + material_to_set->setSpecularID(LLUUID()); + material_to_set->setSpecularOffset(0.0f,0.0f); + material_to_set->setSpecularRepeat(1.0f,1.0f); + material_to_set->setSpecularRotation(0.0f); + material_to_set->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + material_to_set->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + material_to_set->setEnvironmentIntensity(0); } - LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - - LLMaterialPtr material_to_set = mMaterial; - - // If we're editing a single face and not the entire material for an object, - // we need to clone the material so that our changes to the material's settings - // don't automatically propagate to the non-selected faces - // NORSPEC-92 - // - LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); - LLSelectNode* node = sel->getFirstNode(); - if (node) - { - if (node->getTESelectMask() != TE_SELECT_MASK_ALL) - { - material_to_set = new LLMaterial(*mMaterial); - } - } - LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); + LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; + + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else { @@ -1934,11 +1953,11 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = combo_mattype->getCurrentIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled(); + bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); self->getChildView("combobox mattype")->setVisible(!show_media); - self->getChildView("rptctrl")->setVisible(!show_media); + self->getChildView("rptctrl")->setVisible(show_texture); // Media controls self->getChildView("media_info")->setVisible(show_media); @@ -1947,12 +1966,12 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("button align")->setVisible(show_media); // Diffuse texture controls - self->getChildView("texture control")->setVisible(show_texture); - self->getChildView("label alphamode")->setVisible(show_texture); - self->getChildView("combobox alphamode")->setVisible(show_texture); + self->getChildView("texture control")->setVisible(show_texture && !show_media); + self->getChildView("label alphamode")->setVisible(show_texture && !show_media); + self->getChildView("combobox alphamode")->setVisible(show_texture && !show_media); self->getChildView("label maskcutoff")->setVisible(false); self->getChildView("maskcutoff")->setVisible(false); - if (show_texture) + if (show_texture && !show_media) { updateAlphaControls(ctrl, userdata); } |