summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llmaterial.cpp33
-rw-r--r--indra/llprimitive/llmaterial.h16
2 files changed, 49 insertions, 0 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index f6fd8e557a..7d1ce4ab86 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -181,3 +181,36 @@ bool LLMaterial::operator != (const LLMaterial& rhs) const
{
return !(*this == rhs);
}
+
+
+U32 LLMaterial::getShaderMask()
+{ //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"
+ 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 5b56d11cd2..fd35045e45 100644
--- a/indra/llprimitive/llmaterial.h
+++ b/indra/llprimitive/llmaterial.h
@@ -36,6 +36,20 @@
class LLMaterial
{
public:
+
+ typedef enum
+ {
+ DIFFUSE_ALPHA_MODE_NONE = 0,
+ DIFFUSE_ALPHA_MODE_BLEND = 1,
+ DIFFUSE_ALPHA_MODE_MASK = 2,
+ DIFFUSE_ALPHA_MODE_EMISSIVE = 3
+ } eDiffuseAlphaMode;
+
+ typedef enum
+ {
+ SHADER_COUNT = 16
+ } eShaderCount;
+
LLMaterial();
LLMaterial(const LLSD& material_data);
@@ -77,6 +91,8 @@ public:
bool operator == (const LLMaterial& rhs) const;
bool operator != (const LLMaterial& rhs) const;
+ U32 getShaderMask();
+
protected:
LLUUID mNormalID;
F32 mNormalOffsetX;