merge rollback from graham

meow-7.2.2
Oz Linden 2013-04-16 14:52:18 -04:00
commit 4b2d6062ba
2 changed files with 16 additions and 70 deletions

View File

@ -54,7 +54,7 @@ public:
static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255));
static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR;
static const U8 DEFAULT_ENV_INTENSITY = ((U8)(0.05f * 255));
static const U8 DEFAULT_ENV_INTENSITY = 0;
LLMaterial();
LLMaterial(const LLSD& material_data);

View File

@ -291,55 +291,10 @@ void LLPanelFace::sendTexture()
}
LLSelectMgr::getInstance()->selectionSetImage(id);
}
mIsAlpha = FALSE;
LLGLenum image_format;
struct f2 : public LLSelectedTEGetFunctor<LLGLenum>
{
LLGLenum get(LLViewerObject* object, S32 te_index)
{
LLGLenum image_format = GL_RGB;
LLViewerTexture* image = object->getTEImage(te_index);
if (image) image_format = image->getPrimaryFormat();
return image_format;
}
} 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;
}
LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode");
if (comboAlphaMode)
{
U32 alpha_mode = comboAlphaMode->getCurrentIndex();
if (mIsAlpha && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE))
{
alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
}
comboAlphaMode->selectNthItem(alpha_mode);
}
}
void LLPanelFace::sendBump()
{
{
LLComboBox* mComboBumpiness = getChild<LLComboBox>("combobox bumpiness");
if(!mComboBumpiness)return;
U32 bumpiness = mComboBumpiness->getCurrentIndex();
@ -834,7 +789,7 @@ void LLPanelFace::getState()
}
} alpha_get_func;
U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
U8 alpha_mode = 1;
LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode);
{
@ -843,13 +798,10 @@ void LLPanelFace::getState()
if (combobox_alphamode)
{
// Should never want to reflect something other than the correct state
// if it's supposed to be set to NONE, that should be enforced elsewhere
//
//if (!mIsAlpha)
//{
// alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
//}
if (!mIsAlpha)
{
alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
}
combobox_alphamode->selectNthItem(alpha_mode);
}
@ -1823,18 +1775,9 @@ void LLPanelFace::updateMaterial()
bool identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen );
bool identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR));
LLUUID norm_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID();
LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
bool doing_diffuse_alpha = (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
bool doing_bumps = (bumpiness == BUMPY_TEXTURE) || !norm_map_id.isNull();
bool doing_shiny = (shininess == SHINY_TEXTURE) || !spec_map_id.isNull();
doing_diffuse_alpha = doing_diffuse_alpha && mIsAlpha;
if (doing_diffuse_alpha
|| doing_bumps
|| doing_shiny)
if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND))
|| (bumpiness == BUMPY_TEXTURE)
|| (shininess == SHINY_TEXTURE))
{
// The user's specified something that needs a material.
bool new_material = false;
@ -1843,10 +1786,11 @@ void LLPanelFace::updateMaterial()
new_material = true;
mMaterial = LLMaterialPtr(new LLMaterial());
}
mMaterial->setDiffuseAlphaMode(alpha_mode);
mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex());
mMaterial->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;
@ -1874,6 +1818,8 @@ void LLPanelFace::updateMaterial()
mMaterial->setNormalRepeat(1.0f,1.0f);
mMaterial->setNormalRotation(0.0f);
}
LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID();
if (!spec_map_id.isNull())
{