summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-10-10 14:07:30 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-10-10 14:07:30 -0700
commit0ea99ea01fc12fa0210a61a3664ff828d3984575 (patch)
treeb24b9595f36ad0047a05971f4bffd944c70e5439 /indra
parentaae0d21790e31271a3accff70741b91d0bd8b184 (diff)
Adding a setting to allow user to edit the specular color alpha.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterdebugmaterials.cpp27
-rw-r--r--indra/newview/llfloaterdebugmaterials.h4
-rw-r--r--indra/newview/skins/default/xui/en/floater_debug_materials.xml24
3 files changed, 44 insertions, 11 deletions
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp
index 8951c833be..10a4e9e022 100644
--- a/indra/newview/llfloaterdebugmaterials.cpp
+++ b/indra/newview/llfloaterdebugmaterials.cpp
@@ -50,6 +50,7 @@
#include "llscrolllistitem.h"
#include "llsd.h"
#include "llselectmgr.h"
+#include "llspinctrl.h"
#include "llstring.h"
#include "llstyle.h"
#include "lltextbase.h"
@@ -192,6 +193,9 @@ BOOL LLFloaterDebugMaterials::postBuild()
mSpecularColor = findChild<LLColorSwatchCtrl>("specular_color");
llassert(mSpecularColor != NULL);
+ mSpecularColorAlpha = findChild<LLSpinCtrl>("specular_color_alpha");
+ llassert(mSpecularColorAlpha != NULL);
+
mSpecularExponent = findChild<LLLineEditor>("specular_exponent");
llassert(mSpecularExponent != NULL);
mSpecularExponent->setPrevalidate(LLTextValidate::validateInt);
@@ -334,6 +338,7 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams)
mSpecularMapRepeatY(NULL),
mSpecularMapRotation(NULL),
mSpecularColor(NULL),
+ mSpecularColorAlpha(NULL),
mSpecularExponent(NULL),
mEnvironmentExponent(NULL),
mAlphaMaskCutoff(NULL),
@@ -664,10 +669,8 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet)
materialData[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = static_cast<LLSD::Integer>(getSpecularMapRepeatY());
materialData[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = static_cast<LLSD::Integer>(getSpecularMapRotation());
- const LLColor4& specularColor = mSpecularColor->get();
- LLColor4U specularColor4U = specularColor;
- materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor4U.getValue();
-
+ LLColor4U specularColor = getSpecularColor();
+ materialData[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = specularColor.getValue();
materialData[MATERIALS_CAP_SPECULAR_EXP_FIELD] = static_cast<LLSD::Integer>(getSpecularExponent());
materialData[MATERIALS_CAP_ENV_INTENSITY_FIELD] = static_cast<LLSD::Integer>(getEnvironmentExponent());
materialData[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = static_cast<LLSD::Integer>(getAlphMaskCutoff());
@@ -1215,6 +1218,7 @@ void LLFloaterDebugMaterials::setState(EState pState)
void LLFloaterDebugMaterials::resetObjectEditInputs()
{
const LLSD zeroValue = static_cast<LLSD::Integer>(0);
+ const LLSD maxAlphaValue = static_cast<LLSD::Integer>(255);
mNormalMap->clear();
mNormalMapOffsetX->setValue(zeroValue);
@@ -1230,13 +1234,12 @@ void LLFloaterDebugMaterials::resetObjectEditInputs()
mSpecularMapRepeatY->setValue(zeroValue);
mSpecularMapRotation->setValue(zeroValue);
- mSpecularColor->clear();
+ mSpecularColor->set(mDefaultSpecularColor);
+ mSpecularColorAlpha->setValue(maxAlphaValue);
mSpecularExponent->setValue(zeroValue);
mEnvironmentExponent->setValue(zeroValue);
mAlphaMaskCutoff->setValue(zeroValue);
mDiffuseAlphaMode->setValue(zeroValue);
-
- mSpecularColor->set(mDefaultSpecularColor);
}
void LLFloaterDebugMaterials::clearGetResults()
@@ -1431,6 +1434,16 @@ S32 LLFloaterDebugMaterials::getSpecularMapRotation() const
return getLineEditorValue(mSpecularMapRotation);
}
+LLColor4U LLFloaterDebugMaterials::getSpecularColor() const
+{
+ const LLColor4& specularColor = mSpecularColor->get();
+ LLColor4U specularColor4U = specularColor;
+
+ specularColor4U.setAlpha(static_cast<U8>(llclamp(llround(mSpecularColorAlpha->get()), 0, 255)));
+
+ return specularColor4U;
+}
+
S32 LLFloaterDebugMaterials::getSpecularExponent() const
{
return getLineEditorValue(mSpecularExponent);
diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h
index 65f3cbd6ca..6ada255015 100644
--- a/indra/newview/llfloaterdebugmaterials.h
+++ b/indra/newview/llfloaterdebugmaterials.h
@@ -37,10 +37,12 @@
class LLButton;
class LLColorSwatchCtrl;
+class LLColor4U;
class LLLineEditor;
class LLMaterialID;
class LLScrollListCtrl;
class LLSD;
+class LLSpinCtrl;
class LLTextBase;
class LLTextureCtrl;
class LLUICtrl;
@@ -135,6 +137,7 @@ private:
S32 getSpecularMapRepeatY() const;
S32 getSpecularMapRotation() const;
+ LLColor4U getSpecularColor() const;
S32 getSpecularExponent() const;
S32 getEnvironmentExponent() const;
S32 getAlphMaskCutoff() const;
@@ -159,6 +162,7 @@ private:
LLLineEditor* mSpecularMapRepeatY;
LLLineEditor* mSpecularMapRotation;
LLColorSwatchCtrl* mSpecularColor;
+ LLSpinCtrl* mSpecularColorAlpha;
LLLineEditor* mSpecularExponent;
LLLineEditor* mEnvironmentExponent;
LLLineEditor* mAlphaMaskCutoff;
diff --git a/indra/newview/skins/default/xui/en/floater_debug_materials.xml b/indra/newview/skins/default/xui/en/floater_debug_materials.xml
index e2e197a14e..504a52e762 100644
--- a/indra/newview/skins/default/xui/en/floater_debug_materials.xml
+++ b/indra/newview/skins/default/xui/en/floater_debug_materials.xml
@@ -572,7 +572,7 @@
bevel_style="none"
follows="left|top|right"
layout="topleft"
- height="132"
+ height="162"
top_pad="-226"
left_pad="20"
width="243">
@@ -603,6 +603,22 @@
name="specular_color"
tool_tip="Click to open color picker"
width="40" />
+ <spinner
+ follows="left|top"
+ height="20"
+ initial_value="255"
+ max_val="255"
+ min_val="0"
+ increment="1"
+ decimal_digits="0"
+ allow_text_entry="true"
+ layout="topleft"
+ label_width="160"
+ left="0"
+ top_pad="10"
+ label="Specular Color Alpha"
+ name="specular_color_alpha"
+ width="240" />
<text
height="13"
word_wrap="false"
@@ -612,8 +628,8 @@
length="1"
follows="left|top"
layout="topleft"
- left_pad="-200"
- top_pad="10"
+ left_pad="-240"
+ top_pad="13"
width="160">
Specular Exponent
</text>
@@ -715,7 +731,7 @@
layout="topleft"
height="22"
left="0"
- top_pad="110"
+ top_pad="80"
width="810">
<button
follows="left|top"