From c334a185f331a3392c2d0ccaf8241166ef9d8049 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 05:59:48 -0700 Subject: NORSPEC-151 NORSPEC-152 fix handling of disable of bumpy and shiny in graphics panel to also disable deferred properly and add hooks for default norm and spec textures in texture picker --- indra/newview/app_settings/settings.xml | 47 +++++++++++- indra/newview/llappviewer.cpp | 3 +- indra/newview/llpanelface.cpp | 126 ++++++++++++++++---------------- indra/newview/lltexturectrl.cpp | 10 +-- indra/newview/lltexturectrl.h | 4 + indra/newview/llviewercontrol.cpp | 21 +++++- indra/newview/pipeline.cpp | 12 ++- indra/newview/pipeline.h | 1 + 8 files changed, 151 insertions(+), 73 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2e53cf2da0..b82da4c5ab 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2862,6 +2862,28 @@ Value 0 + DefaultBlankNormalTexture + + Comment + Texture used as 'Blank' in texture picker for normal maps. (UUID texture reference) + Persist + 1 + Type + String + Value + 5b53359e-59dd-d8a2-04c3-9e65134da47a + + DefaultBlankSpecularTexture + + Comment + Texture used as 'Blank' in texture picker for specular maps. (UUID texture reference) + Persist + 1 + Type + String + Value + cd35472f-71fa-9b9c-8e73-a2c324f5751a + DefaultFemaleAvatar Comment @@ -2884,8 +2906,29 @@ Value Male Shape & Outfit - - DefaultObjectTexture + DefaultObjectNormalTexture + + Comment + Texture used as 'Default' in texture picker for normal map. (UUID texture reference) + Persist + 1 + Type + String + Value + 2d9dd1d8-9d57-3cfb-f965-f7613e702d8e + + DefaultObjectSpecularTexture + + Comment + Texture used as 'Default' in texture picker for specular map. (UUID texture reference) + Persist + 1 + Type + String + Value + e0491381-964c-0d68-1caa-91ab2f4c6d6a + + DefaultObjectTexture Comment Texture used as 'Default' in texture picker. (UUID texture reference) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9ac80dd6c0..bb81b197cc 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -598,7 +598,8 @@ static void settings_to_globals() static void settings_modify() { LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderDeferred"); - LLPipeline::sRenderDeferred = gSavedSettings.getBOOL("RenderDeferred"); + LLPipeline::sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); + LLPipeline::sRenderDeferred = LLPipeline::sRenderBump && gSavedSettings.getBOOL("RenderDeferred"); LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b2f76e2114..c9029bfcb0 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -157,7 +157,8 @@ BOOL LLPanelFace::postBuild() mShinyTextureCtrl = getChild("shinytexture control"); if(mShinyTextureCtrl) { - mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" ))); + mShinyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankSpecularTexture" ))); mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); @@ -172,7 +173,8 @@ BOOL LLPanelFace::postBuild() mBumpyTextureCtrl = getChild("bumpytexture control"); if(mBumpyTextureCtrl) { - mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectNormalTexture" ))); + mBumpyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankNormalTexture" ))); mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); @@ -741,23 +743,23 @@ void LLPanelFace::updateUI() } func2; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); - mIsAlpha = FALSE; - switch (image_format) - { - case GL_RGBA: - case GL_ALPHA: - { - mIsAlpha = TRUE; - } - break; - - case GL_RGB: break; - default: - { - llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; - } - break; - } + mIsAlpha = FALSE; + switch (image_format) + { + case GL_RGBA: + case GL_ALPHA: + { + mIsAlpha = TRUE; + } + break; + + case GL_RGB: break; + default: + { + llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + } + break; + } if(LLViewerMedia::textureHasMedia(id)) { @@ -768,15 +770,15 @@ void LLPanelFace::updateUI() struct alpha_get : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 te_index) - { + { U8 ret = 1; LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); if (mat) - { + { ret = mat->getDiffuseAlphaMode(); - } + } return ret; } @@ -808,7 +810,7 @@ void LLPanelFace::updateUI() if(texture_ctrl && !texture_ctrl->isPickerShown()) { - if (identical_diffuse) + if (identical_diffuse) { texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); @@ -818,7 +820,7 @@ void LLPanelFace::updateUI() getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); } - else if (id.isNull()) + else if (id.isNull()) { // None selected texture_ctrl->setTentative( FALSE ); @@ -835,54 +837,54 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); - } - } + getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); + getChildView("label alphamode")->setEnabled(editable && mIsAlpha); + getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); + getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + } + } - if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) + if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) + { + if (identical_spec) + { + shinytexture_ctrl->setTentative( FALSE ); + shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setImageAssetID( specmap_id ); + } + else if (specmap_id.isNull()) + { + shinytexture_ctrl->setTentative( FALSE ); + shinytexture_ctrl->setEnabled( FALSE ); + shinytexture_ctrl->setImageAssetID( LLUUID::null ); + } + else { - if (identical_spec) - { - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( specmap_id ); - } - else if (specmap_id.isNull()) - { - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( FALSE ); - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - } - else - { shinytexture_ctrl->setTentative( TRUE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( specmap_id ); - } - } + shinytexture_ctrl->setImageAssetID( specmap_id ); + } + } - if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) - { - if (identical_norm) + if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) + { + if (identical_norm) + { + bumpytexture_ctrl->setTentative( FALSE ); + bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_ctrl->setImageAssetID( normmap_id ); + } + else if (normmap_id.isNull()) { - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( normmap_id ); - } - else if (normmap_id.isNull()) - { - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( FALSE ); + bumpytexture_ctrl->setTentative( FALSE ); + bumpytexture_ctrl->setEnabled( FALSE ); bumpytexture_ctrl->setImageAssetID( LLUUID::null ); } - else - { + else + { bumpytexture_ctrl->setTentative( TRUE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( normmap_id ); + bumpytexture_ctrl->setImageAssetID( normmap_id ); } } } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e2d0fdf357..5be342e3d0 100755 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -144,7 +144,7 @@ public: static void onBtnCancel( void* userdata ); void onBtnPipette( ); //static void onBtnRevert( void* userdata ); - static void onBtnWhite( void* userdata ); + static void onBtnBlank( void* userdata ); static void onBtnNone( void* userdata ); static void onBtnClear( void* userdata ); void onSelectionChange(const std::deque &items, BOOL user_action); @@ -426,7 +426,7 @@ BOOL LLFloaterTexturePicker::postBuild() childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); childSetAction("None", LLFloaterTexturePicker::onBtnNone,this); - childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this); + childSetAction("Blank", LLFloaterTexturePicker::onBtnBlank,this); childSetCommitCallback("show_folders_check", onShowFolders, this); @@ -581,7 +581,7 @@ void LLFloaterTexturePicker::draw() } getChildView("Default")->setEnabled(mImageAssetID != mOwner->getDefaultImageAssetID()); - getChildView("Blank")->setEnabled(mImageAssetID != mWhiteImageAssetID ); + getChildView("Blank")->setEnabled(mImageAssetID != mOwner->getBlankImageAssetID()); getChildView("None")->setEnabled(mOwner->getAllowNoTexture() && !mImageAssetID.isNull() ); LLFloater::draw(); @@ -721,11 +721,11 @@ void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata) } // static -void LLFloaterTexturePicker::onBtnWhite(void* userdata) +void LLFloaterTexturePicker::onBtnBlank(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; self->setCanApply(true, true); - self->setImageID( self->mWhiteImageAssetID ); + self->setImageID( self->mOwner->getBlankImageAssetID() ); self->commitIfImmediateSet(); } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 3fd024082e..a7ef1b3f78 100755 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -146,6 +146,9 @@ public: const std::string& getDefaultImageName() const { return mDefaultImageName; } + void setBlankImageAssetID( const LLUUID& id ) { mBlankImageAssetID = id; } + const LLUUID& getBlankImageAssetID() const { return mBlankImageAssetID; } + void setCaption(const std::string& caption); void setCanApplyImmediately(BOOL b); @@ -202,6 +205,7 @@ private: LLUUID mImageItemID; LLUUID mImageAssetID; LLUUID mDefaultImageAssetID; + LLUUID mBlankImageAssetID; LLUIImagePtr mFallbackImage; std::string mDefaultImageName; LLHandle mFloaterHandle; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index a62f73deef..afbb59e723 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -401,6 +401,25 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue) return true; } +// This looks a great deal like handleRenderDeferredChanged because +// Advanced Lighting (Materials) implies bumps and shiny so disabling +// bumps should further disable that feature. +// +static bool handleRenderBumpChanged(const LLSD& newval) +{ + LLRenderTarget::sUseFBO = newval.asBoolean(); + if (gPipeline.isInit()) + { + gPipeline.updateRenderBump(); + gPipeline.updateRenderDeferred(); + gPipeline.releaseGLBuffers(); + gPipeline.createGLBuffers(); + gPipeline.resetVertexBuffers(); + LLViewerShaderMgr::instance()->setShaders(); + } + return true; +} + static bool handleRenderUseImpostorsChanged(const LLSD& newvalue) { LLVOAvatar::sUseImpostors = newvalue.asBoolean(); @@ -629,7 +648,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); - gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleRenderBumpChanged, _2)); gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _2)); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 42a47c694f..f4b445c2eb 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1026,13 +1026,19 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) return true; } +//static +void LLPipeline::updateRenderBump() +{ + sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); +} + //static void LLPipeline::updateRenderDeferred() { BOOL deferred = ((RenderDeferred && LLRenderTarget::sUseFBO && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && + LLPipeline::sRenderBump && VertexShaderEnable && RenderAvatarVP && WindLightUseAtmosShaders) ? TRUE : FALSE) && @@ -6992,7 +6998,9 @@ void LLPipeline::doResetVertexBuffers() LLVertexBuffer::unbind(); - sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); + updateRenderBump(); + updateRenderDeferred(); + sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO"); LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO"); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index fbfb2d012f..9b7d1d642c 100755 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -395,6 +395,7 @@ public: static void toggleRenderHighlights(void* data); static BOOL getRenderHighlights(void* data); + static void updateRenderBump(); static void updateRenderDeferred(); static void refreshCachedSettings(); -- cgit v1.2.3