summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-06-29 21:21:46 +0100
committerGraham Linden <graham@lindenlab.com>2018-06-29 21:21:46 +0100
commit3008962f0c990f4bfd270bee38152d2531ddfcd2 (patch)
tree8a154deaeac115294854e4abb0be5db0bb59d73f
parent82a097b06f2f89e04e99a84a237ffced1c41e5d6 (diff)
Convert tabs to spaces in llprimitive/llmaterial.* for sanity
-rw-r--r--indra/llprimitive/llmaterial.cpp212
-rw-r--r--indra/llprimitive/llmaterial.h214
2 files changed, 213 insertions, 213 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 282bf6ca6b..c0fefaae73 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -65,23 +65,23 @@ const F32 MATERIALS_MULTIPLIER = 10000.f;
template<typename T> T getMaterialField(const LLSD& data, const std::string& field, const LLSD::Type field_type)
{
- if ( (data.has(field)) && (field_type == data[field].type()) )
- {
- return (T)data[field];
- }
- LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL;
- return (T)LLSD();
+ if ( (data.has(field)) && (field_type == data[field].type()) )
+ {
+ return (T)data[field];
+ }
+ LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL;
+ return (T)LLSD();
}
// GCC didn't like the generic form above for some reason
template<> LLUUID getMaterialField(const LLSD& data, const std::string& field, const LLSD::Type field_type)
{
- if ( (data.has(field)) && (field_type == data[field].type()) )
- {
- return data[field].asUUID();
- }
- LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL;
- return LLUUID::null;
+ if ( (data.has(field)) && (field_type == data[field].type()) )
+ {
+ return data[field].asUUID();
+ }
+ LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL;
+ return LLUUID::null;
}
/**
@@ -91,27 +91,27 @@ template<> LLUUID getMaterialField(const LLSD& data, const std::string& field, c
const LLMaterial LLMaterial::null;
LLMaterial::LLMaterial()
- : mNormalOffsetX(0.0f)
- , mNormalOffsetY(0.0f)
- , mNormalRepeatX(1.0f)
- , mNormalRepeatY(1.0f)
- , mNormalRotation(0.0f)
- , mSpecularOffsetX(0.0f)
- , mSpecularOffsetY(0.0f)
- , mSpecularRepeatX(1.0f)
- , mSpecularRepeatY(1.0f)
- , mSpecularRotation(0.0f)
- , mSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR)
- , mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT)
- , mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
- , mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
- , mAlphaMaskCutoff(0)
+ : mNormalOffsetX(0.0f)
+ , mNormalOffsetY(0.0f)
+ , mNormalRepeatX(1.0f)
+ , mNormalRepeatY(1.0f)
+ , mNormalRotation(0.0f)
+ , mSpecularOffsetX(0.0f)
+ , mSpecularOffsetY(0.0f)
+ , mSpecularRepeatX(1.0f)
+ , mSpecularRepeatY(1.0f)
+ , mSpecularRotation(0.0f)
+ , mSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR)
+ , mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT)
+ , mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
+ , mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
+ , mAlphaMaskCutoff(0)
{
}
LLMaterial::LLMaterial(const LLSD& material_data)
{
- fromLLSD(material_data);
+ fromLLSD(material_data);
}
const LLUUID& LLMaterial::getNormalID() const
@@ -333,136 +333,136 @@ void LLMaterial::setAlphaMaskCutoff(U8 cutoff)
LLSD LLMaterial::asLLSD() const
{
- LLSD material_data;
+ LLSD material_data;
S32 normalOffsetXInt = ll_round(mNormalOffsetX * MATERIALS_MULTIPLIER);
S32 normalOffsetYInt = ll_round(mNormalOffsetY * MATERIALS_MULTIPLIER);
S32 normalRotInt = ll_round(mNormalRotation * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_FIELD] = mNormalID;
- material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = normalOffsetXInt;
- material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = normalOffsetYInt;
- material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = ll_round(mNormalRepeatX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = ll_round(mNormalRepeatY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = normalRotInt;
+ material_data[MATERIALS_CAP_NORMAL_MAP_FIELD] = mNormalID;
+ material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = normalOffsetXInt;
+ material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = normalOffsetYInt;
+ material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = ll_round(mNormalRepeatX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = ll_round(mNormalRepeatY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = normalRotInt;
- material_data[MATERIALS_CAP_SPECULAR_MAP_FIELD] = mSpecularID;
+ material_data[MATERIALS_CAP_SPECULAR_MAP_FIELD] = mSpecularID;
S32 specularOffsetXInt = ll_round(mSpecularOffsetX * MATERIALS_MULTIPLIER);
S32 specularOffsetYInt = ll_round(mSpecularOffsetY * MATERIALS_MULTIPLIER);
S32 specularRotInt = ll_round(mSpecularRotation * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = specularOffsetXInt;
- material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = specularOffsetYInt;
- material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = ll_round(mSpecularRepeatX * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = ll_round(mSpecularRepeatY * MATERIALS_MULTIPLIER);
- material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = specularRotInt;
+ material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = specularOffsetXInt;
+ material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = specularOffsetYInt;
+ material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = ll_round(mSpecularRepeatX * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = ll_round(mSpecularRepeatY * MATERIALS_MULTIPLIER);
+ material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = specularRotInt;
- material_data[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = mSpecularLightColor.getValue();
- material_data[MATERIALS_CAP_SPECULAR_EXP_FIELD] = mSpecularLightExponent;
- material_data[MATERIALS_CAP_ENV_INTENSITY_FIELD] = mEnvironmentIntensity;
- material_data[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = mDiffuseAlphaMode;
- material_data[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = mAlphaMaskCutoff;
+ material_data[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = mSpecularLightColor.getValue();
+ material_data[MATERIALS_CAP_SPECULAR_EXP_FIELD] = mSpecularLightExponent;
+ material_data[MATERIALS_CAP_ENV_INTENSITY_FIELD] = mEnvironmentIntensity;
+ material_data[MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = mDiffuseAlphaMode;
+ material_data[MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD] = mAlphaMaskCutoff;
- return material_data;
+ return material_data;
}
void LLMaterial::fromLLSD(const LLSD& material_data)
{
- mNormalID = getMaterialField<LLSD::UUID>(material_data, MATERIALS_CAP_NORMAL_MAP_FIELD, LLSD::TypeUUID);
+ mNormalID = getMaterialField<LLSD::UUID>(material_data, MATERIALS_CAP_NORMAL_MAP_FIELD, LLSD::TypeUUID);
S32 normalOffsetXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD, LLSD::TypeInteger);
S32 normalOffsetYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger);
S32 normalRotInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD, LLSD::TypeInteger);
- mNormalOffsetX = F32(normalOffsetXInt) / MATERIALS_MULTIPLIER;
+ mNormalOffsetX = F32(normalOffsetXInt) / MATERIALS_MULTIPLIER;
mNormalOffsetY = F32(normalOffsetYInt) / MATERIALS_MULTIPLIER;
mNormalRotation = F32(normalRotInt) / MATERIALS_MULTIPLIER;
- mNormalOffsetY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mNormalRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mNormalRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mNormalOffsetY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mNormalRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mNormalRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularID = getMaterialField<LLSD::UUID>(material_data, MATERIALS_CAP_SPECULAR_MAP_FIELD, LLSD::TypeUUID);
+ mSpecularID = getMaterialField<LLSD::UUID>(material_data, MATERIALS_CAP_SPECULAR_MAP_FIELD, LLSD::TypeUUID);
S32 specularOffsetXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD, LLSD::TypeInteger);
S32 specularOffsetYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger);
S32 specularRotInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD, LLSD::TypeInteger);
- mSpecularOffsetX = F32(specularOffsetXInt) / MATERIALS_MULTIPLIER;
+ mSpecularOffsetX = F32(specularOffsetXInt) / MATERIALS_MULTIPLIER;
mSpecularOffsetY = F32(specularOffsetYInt) / MATERIALS_MULTIPLIER;
mSpecularRotation = F32(specularRotInt) / MATERIALS_MULTIPLIER;
- mSpecularOffsetY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularRotation = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mSpecularOffsetY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mSpecularRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mSpecularRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mSpecularRotation = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularLightColor.setValue(getMaterialField<LLSD>(material_data, MATERIALS_CAP_SPECULAR_COLOR_FIELD, LLSD::TypeArray));
- mSpecularLightExponent = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_EXP_FIELD, LLSD::TypeInteger);
- mEnvironmentIntensity = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_ENV_INTENSITY_FIELD, LLSD::TypeInteger);
- mDiffuseAlphaMode = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD, LLSD::TypeInteger);
- mAlphaMaskCutoff = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD, LLSD::TypeInteger);
+ mSpecularLightColor.setValue(getMaterialField<LLSD>(material_data, MATERIALS_CAP_SPECULAR_COLOR_FIELD, LLSD::TypeArray));
+ mSpecularLightExponent = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_EXP_FIELD, LLSD::TypeInteger);
+ mEnvironmentIntensity = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_ENV_INTENSITY_FIELD, LLSD::TypeInteger);
+ mDiffuseAlphaMode = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD, LLSD::TypeInteger);
+ mAlphaMaskCutoff = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD, LLSD::TypeInteger);
}
bool LLMaterial::isNull() const
{
- return (*this == null);
+ return (*this == null);
}
bool LLMaterial::operator == (const LLMaterial& rhs) const
{
- return
- (mNormalID == rhs.mNormalID) && (mNormalOffsetX == rhs.mNormalOffsetX) && (mNormalOffsetY == rhs.mNormalOffsetY) &&
- (mNormalRepeatX == rhs.mNormalRepeatX) && (mNormalRepeatY == rhs.mNormalRepeatY) && (mNormalRotation == rhs.mNormalRotation) &&
- (mSpecularID == rhs.mSpecularID) && (mSpecularOffsetX == rhs.mSpecularOffsetX) && (mSpecularOffsetY == rhs.mSpecularOffsetY) &&
- (mSpecularRepeatX == rhs.mSpecularRepeatX) && (mSpecularRepeatY == rhs.mSpecularRepeatY) && (mSpecularRotation == rhs.mSpecularRotation) &&
- (mSpecularLightColor == rhs.mSpecularLightColor) && (mSpecularLightExponent == rhs.mSpecularLightExponent) &&
- (mEnvironmentIntensity == rhs.mEnvironmentIntensity) && (mDiffuseAlphaMode == rhs.mDiffuseAlphaMode) && (mAlphaMaskCutoff == rhs.mAlphaMaskCutoff);
+ return
+ (mNormalID == rhs.mNormalID) && (mNormalOffsetX == rhs.mNormalOffsetX) && (mNormalOffsetY == rhs.mNormalOffsetY) &&
+ (mNormalRepeatX == rhs.mNormalRepeatX) && (mNormalRepeatY == rhs.mNormalRepeatY) && (mNormalRotation == rhs.mNormalRotation) &&
+ (mSpecularID == rhs.mSpecularID) && (mSpecularOffsetX == rhs.mSpecularOffsetX) && (mSpecularOffsetY == rhs.mSpecularOffsetY) &&
+ (mSpecularRepeatX == rhs.mSpecularRepeatX) && (mSpecularRepeatY == rhs.mSpecularRepeatY) && (mSpecularRotation == rhs.mSpecularRotation) &&
+ (mSpecularLightColor == rhs.mSpecularLightColor) && (mSpecularLightExponent == rhs.mSpecularLightExponent) &&
+ (mEnvironmentIntensity == rhs.mEnvironmentIntensity) && (mDiffuseAlphaMode == rhs.mDiffuseAlphaMode) && (mAlphaMaskCutoff == rhs.mAlphaMaskCutoff);
}
bool LLMaterial::operator != (const LLMaterial& rhs) const
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
U32 LLMaterial::getShaderMask(U32 alpha_mode)
{ //NEVER incorporate this value into the message system -- this function will vary depending on viewer implementation
- U32 ret = 0;
-
- //two least significant bits are "diffuse alpha mode"
- if (alpha_mode != DIFFUSE_ALPHA_MODE_DEFAULT)
- {
- ret = alpha_mode;
- }
- else
- {
- ret = getDiffuseAlphaMode();
- }
-
- llassert(ret < SHADER_COUNT);
-
- //next bit is whether or not specular map is present
- const U32 SPEC_BIT = 0x4;
-
- if (getSpecularID().notNull())
- {
- ret |= SPEC_BIT;
- }
-
- llassert(ret < SHADER_COUNT);
-
- //next bit is whether or not normal map is present
- const U32 NORM_BIT = 0x8;
- if (getNormalID().notNull())
- {
- ret |= NORM_BIT;
- }
-
- llassert(ret < SHADER_COUNT);
-
- return ret;
+ U32 ret = 0;
+
+ //two least significant bits are "diffuse alpha mode"
+ if (alpha_mode != DIFFUSE_ALPHA_MODE_DEFAULT)
+ {
+ ret = alpha_mode;
+ }
+ else
+ {
+ ret = getDiffuseAlphaMode();
+ }
+
+ llassert(ret < SHADER_COUNT);
+
+ //next bit is whether or not specular map is present
+ const U32 SPEC_BIT = 0x4;
+
+ if (getSpecularID().notNull())
+ {
+ ret |= SPEC_BIT;
+ }
+
+ llassert(ret < SHADER_COUNT);
+
+ //next bit is whether or not normal map is present
+ const U32 NORM_BIT = 0x8;
+ if (getNormalID().notNull())
+ {
+ ret |= NORM_BIT;
+ }
+
+ llassert(ret < SHADER_COUNT);
+
+ return ret;
}
diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h
index 64976e508b..d58b7ee812 100644
--- a/indra/llprimitive/llmaterial.h
+++ b/indra/llprimitive/llmaterial.h
@@ -39,115 +39,115 @@ class LLMaterial : public LLRefCount
{
public:
- typedef enum
- {
- DIFFUSE_ALPHA_MODE_NONE = 0,
- DIFFUSE_ALPHA_MODE_BLEND = 1,
- DIFFUSE_ALPHA_MODE_MASK = 2,
- DIFFUSE_ALPHA_MODE_EMISSIVE = 3,
- DIFFUSE_ALPHA_MODE_DEFAULT = 4,
- } eDiffuseAlphaMode;
-
- typedef enum
- {
- SHADER_COUNT = 16,
- ALPHA_SHADER_COUNT = 4
- } eShaderCount;
-
-
-
- static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255));
- static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR;
- static const U8 DEFAULT_ENV_INTENSITY = 0;
-
- LLMaterial();
- LLMaterial(const LLSD& material_data);
-
- LLSD asLLSD() const;
- void fromLLSD(const LLSD& material_data);
-
- const LLUUID& getNormalID() const;
- void setNormalID(const LLUUID& normal_id);
-
- void getNormalOffset(F32& offset_x, F32& offset_y) const;
- F32 getNormalOffsetX() const;
- F32 getNormalOffsetY() const;
-
- void setNormalOffset(F32 offset_x, F32 offset_y);
- void setNormalOffsetX(F32 offset_x);
- void setNormalOffsetY(F32 offset_y);
-
- void getNormalRepeat(F32& repeat_x, F32& repeat_y) const;
- F32 getNormalRepeatX() const;
- F32 getNormalRepeatY() const;
-
- void setNormalRepeat(F32 repeat_x, F32 repeat_y);
- void setNormalRepeatX(F32 repeat_x);
- void setNormalRepeatY(F32 repeat_y);
-
- F32 getNormalRotation() const;
- void setNormalRotation(F32 rot);
-
- const LLUUID& getSpecularID() const;
- void setSpecularID(const LLUUID& specular_id);
- void getSpecularOffset(F32& offset_x, F32& offset_y) const;
- F32 getSpecularOffsetX() const;
- F32 getSpecularOffsetY() const;
-
- void setSpecularOffset(F32 offset_x, F32 offset_y);
- void setSpecularOffsetX(F32 offset_x);
- void setSpecularOffsetY(F32 offset_y);
-
- void getSpecularRepeat(F32& repeat_x, F32& repeat_y) const;
- F32 getSpecularRepeatX() const;
- F32 getSpecularRepeatY() const;
-
- void setSpecularRepeat(F32 repeat_x, F32 repeat_y);
- void setSpecularRepeatX(F32 repeat_x);
- void setSpecularRepeatY(F32 repeat_y);
-
- F32 getSpecularRotation() const;
- void setSpecularRotation(F32 rot);
-
- const LLColor4U getSpecularLightColor() const;
- void setSpecularLightColor(const LLColor4U& color);
- U8 getSpecularLightExponent() const;
- void setSpecularLightExponent(U8 exponent);
- U8 getEnvironmentIntensity() const;
- void setEnvironmentIntensity(U8 intensity);
- U8 getDiffuseAlphaMode() const;
- void setDiffuseAlphaMode(U8 alpha_mode);
- U8 getAlphaMaskCutoff() const;
- void setAlphaMaskCutoff(U8 cutoff);
-
- bool isNull() const;
- static const LLMaterial null;
-
- bool operator == (const LLMaterial& rhs) const;
- bool operator != (const LLMaterial& rhs) const;
-
- U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT);
+ typedef enum
+ {
+ DIFFUSE_ALPHA_MODE_NONE = 0,
+ DIFFUSE_ALPHA_MODE_BLEND = 1,
+ DIFFUSE_ALPHA_MODE_MASK = 2,
+ DIFFUSE_ALPHA_MODE_EMISSIVE = 3,
+ DIFFUSE_ALPHA_MODE_DEFAULT = 4,
+ } eDiffuseAlphaMode;
+
+ typedef enum
+ {
+ SHADER_COUNT = 16,
+ ALPHA_SHADER_COUNT = 4
+ } eShaderCount;
+
+
+
+ static const U8 DEFAULT_SPECULAR_LIGHT_EXPONENT = ((U8)(0.2f * 255));
+ static const LLColor4U DEFAULT_SPECULAR_LIGHT_COLOR;
+ static const U8 DEFAULT_ENV_INTENSITY = 0;
+
+ LLMaterial();
+ LLMaterial(const LLSD& material_data);
+
+ LLSD asLLSD() const;
+ void fromLLSD(const LLSD& material_data);
+
+ const LLUUID& getNormalID() const;
+ void setNormalID(const LLUUID& normal_id);
+
+ void getNormalOffset(F32& offset_x, F32& offset_y) const;
+ F32 getNormalOffsetX() const;
+ F32 getNormalOffsetY() const;
+
+ void setNormalOffset(F32 offset_x, F32 offset_y);
+ void setNormalOffsetX(F32 offset_x);
+ void setNormalOffsetY(F32 offset_y);
+
+ void getNormalRepeat(F32& repeat_x, F32& repeat_y) const;
+ F32 getNormalRepeatX() const;
+ F32 getNormalRepeatY() const;
+
+ void setNormalRepeat(F32 repeat_x, F32 repeat_y);
+ void setNormalRepeatX(F32 repeat_x);
+ void setNormalRepeatY(F32 repeat_y);
+
+ F32 getNormalRotation() const;
+ void setNormalRotation(F32 rot);
+
+ const LLUUID& getSpecularID() const;
+ void setSpecularID(const LLUUID& specular_id);
+ void getSpecularOffset(F32& offset_x, F32& offset_y) const;
+ F32 getSpecularOffsetX() const;
+ F32 getSpecularOffsetY() const;
+
+ void setSpecularOffset(F32 offset_x, F32 offset_y);
+ void setSpecularOffsetX(F32 offset_x);
+ void setSpecularOffsetY(F32 offset_y);
+
+ void getSpecularRepeat(F32& repeat_x, F32& repeat_y) const;
+ F32 getSpecularRepeatX() const;
+ F32 getSpecularRepeatY() const;
+
+ void setSpecularRepeat(F32 repeat_x, F32 repeat_y);
+ void setSpecularRepeatX(F32 repeat_x);
+ void setSpecularRepeatY(F32 repeat_y);
+
+ F32 getSpecularRotation() const;
+ void setSpecularRotation(F32 rot);
+
+ const LLColor4U getSpecularLightColor() const;
+ void setSpecularLightColor(const LLColor4U& color);
+ U8 getSpecularLightExponent() const;
+ void setSpecularLightExponent(U8 exponent);
+ U8 getEnvironmentIntensity() const;
+ void setEnvironmentIntensity(U8 intensity);
+ U8 getDiffuseAlphaMode() const;
+ void setDiffuseAlphaMode(U8 alpha_mode);
+ U8 getAlphaMaskCutoff() const;
+ void setAlphaMaskCutoff(U8 cutoff);
+
+ bool isNull() const;
+ static const LLMaterial null;
+
+ bool operator == (const LLMaterial& rhs) const;
+ bool operator != (const LLMaterial& rhs) const;
+
+ U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT);
protected:
- LLUUID mNormalID;
- F32 mNormalOffsetX;
- F32 mNormalOffsetY;
- F32 mNormalRepeatX;
- F32 mNormalRepeatY;
- F32 mNormalRotation;
-
- LLUUID mSpecularID;
- F32 mSpecularOffsetX;
- F32 mSpecularOffsetY;
- F32 mSpecularRepeatX;
- F32 mSpecularRepeatY;
- F32 mSpecularRotation;
-
- LLColor4U mSpecularLightColor;
- U8 mSpecularLightExponent;
- U8 mEnvironmentIntensity;
- U8 mDiffuseAlphaMode;
- U8 mAlphaMaskCutoff;
+ LLUUID mNormalID;
+ F32 mNormalOffsetX;
+ F32 mNormalOffsetY;
+ F32 mNormalRepeatX;
+ F32 mNormalRepeatY;
+ F32 mNormalRotation;
+
+ LLUUID mSpecularID;
+ F32 mSpecularOffsetX;
+ F32 mSpecularOffsetY;
+ F32 mSpecularRepeatX;
+ F32 mSpecularRepeatY;
+ F32 mSpecularRotation;
+
+ LLColor4U mSpecularLightColor;
+ U8 mSpecularLightExponent;
+ U8 mEnvironmentIntensity;
+ U8 mDiffuseAlphaMode;
+ U8 mAlphaMaskCutoff;
};
typedef LLPointer<LLMaterial> LLMaterialPtr;