summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-06-14 09:41:33 -0700
committerGraham Linden <graham@lindenlab.com>2013-06-14 09:41:33 -0700
commitf04e9363b9daca52c1fd2e675c2646f7e1d05054 (patch)
tree6ab37ca763d176780e776d3dbcb6f6315ad8f4b9
parentfec6ab591ef644ee8058742f16849ca9ff53c6a6 (diff)
NORSPEC-266 fix issues with observer feedback on edits of material map parameters
-rw-r--r--indra/newview/llmaterialmgr.cpp43
-rwxr-xr-xindra/newview/llpanelface.cpp53
-rwxr-xr-xindra/newview/llpanelface.h2
-rwxr-xr-xindra/newview/llviewerobject.cpp12
-rwxr-xr-xindra/newview/llvovolume.cpp19
-rwxr-xr-xindra/newview/pipeline.cpp11
6 files changed, 71 insertions, 69 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index fdc1dfd749..16871adc4d 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -335,36 +335,29 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
itMaterial = ret.first;
}
- // we may have cleared our queues on leaving a region before we recv'd our
- // update for this material...too late now!
- //
- if (isGetPending(region_id, material_id))
- {
-
- TEMaterialPair te_mat_pair;
- te_mat_pair.materialID = material_id;
+ TEMaterialPair te_mat_pair;
+ te_mat_pair.materialID = material_id;
- U32 i = 0;
- while (i < LLTEContents::MAX_TES)
+ U32 i = 0;
+ while (i < LLTEContents::MAX_TES)
+ {
+ te_mat_pair.te = i++;
+ get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
+ if (itCallbackTE != mGetTECallbacks.end())
{
- te_mat_pair.te = i++;
- get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
- if (itCallbackTE != mGetTECallbacks.end())
- {
- (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te);
- delete itCallbackTE->second;
- mGetTECallbacks.erase(itCallbackTE);
- }
+ (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te);
+ delete itCallbackTE->second;
+ mGetTECallbacks.erase(itCallbackTE);
}
+ }
- get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
- if (itCallback != mGetCallbacks.end())
- {
- (*itCallback->second)(material_id, itMaterial->second);
+ get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
+ if (itCallback != mGetCallbacks.end())
+ {
+ (*itCallback->second)(material_id, itMaterial->second);
- delete itCallback->second;
- mGetCallbacks.erase(itCallback);
- }
+ delete itCallback->second;
+ mGetCallbacks.erase(itCallback);
}
mGetPending.erase(pending_material_t(region_id, material_id));
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index f4226c0a7f..911af9df04 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -327,16 +327,25 @@ void LLPanelFace::sendBump(U32 bumpiness)
{
LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
bumpytexture_ctrl->clear();
- bumpytexture_ctrl->setImageAssetID(LLUUID());
+ bumpytexture_ctrl->setImageAssetID(LLUUID());
}
- U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
- LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
-
updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
+
+ U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
+
+ // Clear legacy bump to None when using an actual normal map
+ //
+ if (!current_normal_map.isNull())
+ bump = 0;
+
+ // Set the normal map or reset it to null as appropriate
+ //
LLSelectedTEMaterial::setNormalID(this, current_normal_map);
+
+ LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
}
void LLPanelFace::sendTexGen()
@@ -354,13 +363,21 @@ void LLPanelFace::sendShiny(U32 shininess)
if (shininess < SHINY_TEXTURE)
{
texture_ctrl->clear();
- texture_ctrl->setImageAssetID(LLUUID());
-
- U8 shiny = (U8) shininess & TEM_SHINY_MASK;
- LLSelectMgr::getInstance()->selectionSetShiny( shiny );
+ texture_ctrl->setImageAssetID(LLUUID());
}
- updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true);
- LLSelectedTEMaterial::setSpecularID(this, texture_ctrl->getImageAssetID());
+
+ LLUUID specmap = getCurrentSpecularMap();
+
+ U8 shiny = (U8) shininess & TEM_SHINY_MASK;
+ if (!specmap.isNull())
+ shiny = 0;
+
+ LLSelectedTEMaterial::setSpecularID(this, specmap);
+
+ LLSelectMgr::getInstance()->selectionSetShiny( shiny );
+
+ updateShinyControls(!specmap.isNull(), true);
+
}
void LLPanelFace::sendFullbright()
@@ -752,21 +769,18 @@ void LLPanelFace::updateUI()
LLUUID norm_map_id = getCurrentNormalMap();
LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
+
+ bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
+
if (combobox_bumpiness)
{
- if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull())
- {
- combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE);
- }
- else
- {
- combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0));
- }
+ combobox_bumpiness->selectNthItem((S32)bumpy);
}
else
{
llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl;
}
+
getChildView("combobox bumpiness")->setEnabled(editable);
getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy);
getChildView("label bumpiness")->setEnabled(editable);
@@ -876,8 +890,6 @@ void LLPanelFace::updateUI()
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))
{
shinytexture_ctrl->setTentative( FALSE );
@@ -2314,7 +2326,6 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a
if (tep)
{
LLMaterial* mat = tep->getMaterialParams().get();
- mat = (tep->getMaterialID().isNull() ? NULL : mat);
if (mat)
{
diffuse_mode = mat->getDiffuseAlphaMode();
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 222f8f3688..42c1f6bd48 100755
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -261,7 +261,7 @@ private:
{
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
LLMaterialMgr::getInstance()->remove(object->getID(),face);
- object->setTEMaterialID(face, LLMaterialID::null);
+ new_material = NULL;
}
else
{
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 6c20f638e5..6f7b2f40e6 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4168,12 +4168,8 @@ void LLViewerObject::changeTENormalMap(S32 index, LLViewerTexture* new_image)
{
return ;
}
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
mTENormalMaps[index] = new_image ;
+ refreshMaterials();
}
void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image)
@@ -4182,12 +4178,8 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image)
{
return ;
}
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
mTESpecularMaps[index] = new_image ;
+ refreshMaterials();
}
S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 83ffd3e695..007c2b9003 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4115,8 +4115,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get();
LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID();
- mat = mat_id.isNull() ? NULL : mat;
-
bool batchable = false;
U32 shader_mask = 0xFFFFFFFF; //no shader
@@ -4547,7 +4545,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
LLMaterial* mat = te->getMaterialParams().get();
- mat = te->getMaterialID().isNull() ? NULL : mat;
if (mat && LLPipeline::sRenderDeferred)
{
@@ -5343,7 +5340,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
LLMaterial* mat = te->getMaterialParams().get();
- mat = te->getMaterialID().isNull() ? NULL : mat;
bool can_be_shiny = true;
if (mat)
@@ -5353,6 +5349,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
}
+ bool use_legacy_bump = te->getBumpmap() && (!mat || mat->getNormalID().isNull());
+
if (mat && LLPipeline::sRenderDeferred && !hud_group)
{
bool material_pass = false;
@@ -5395,6 +5393,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
{
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
}
+ else if (use_legacy_bump)
+ {
+ // we have a material AND legacy bump settings, but no normal map
+ registerFace(group, facep, LLRenderPass::PASS_BUMP);
+ }
else
{
material_pass = true;
@@ -5502,7 +5505,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
}
}
- else if (te->getBumpmap() && !mat)
+ else if (use_legacy_bump)
{ //register in deferred bump pass
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
@@ -5537,14 +5540,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
{
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
}
- if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && te->getBumpmap())
+ if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump)
{ //if this is the deferred render and a bump map is present, register in post deferred bump
registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
}
}
else
{
- if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !mat))
+ if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && use_legacy_bump)
{ //non-shiny or fullbright deferred bump
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
@@ -5578,7 +5581,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() && !mat && LLPipeline::sRenderBump)
+ if (!force_simple && LLPipeline::sRenderBump && use_legacy_bump)
{
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 3255f5821f..8942092221 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1696,6 +1696,8 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
return 0;
}
+ LLMaterial* mat = te->getMaterialParams().get();
+
bool color_alpha = te->getColor().mV[3] < 0.999f;
bool alpha = color_alpha;
if (imagep)
@@ -1703,9 +1705,9 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
}
- if (alpha && te->getMaterialParams())
+ if (alpha && mat)
{
- switch (te->getMaterialParams()->getDiffuseAlphaMode())
+ switch (mat->getDiffuseAlphaMode())
{
case 1:
alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool.
@@ -1724,10 +1726,11 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
{
return LLDrawPool::POOL_ALPHA;
}
- else if ((te->getBumpmap() || te->getShiny()) && !te->getMaterialParams().isNull())
+ else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull()))
{
return LLDrawPool::POOL_BUMP;
- } else if (!te->getMaterialParams().isNull() && !alpha)
+ }
+ else if (mat && !alpha)
{
return LLDrawPool::POOL_MATERIALS;
}