diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:06 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-04-30 03:04:06 +0300 |
commit | e00edbeb4a7edfe4f190ac7bf2197aa8240e50c6 (patch) | |
tree | 25db350e573224fc2900c1e760f7cf429c599abe /indra/llprimitive | |
parent | 3ad10e3075840b442f3a8f4593b4b4f10bad48e0 (diff) | |
parent | ce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff) |
Merge branch 'master' into DRTVWR-522-maint
# Conflicts:
# doc/contributions.txt
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llmaterial.cpp | 40 | ||||
-rw-r--r-- | indra/llprimitive/llmaterial.h | 11 |
2 files changed, 50 insertions, 1 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index a219ac1450..a1bfc4edd9 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -28,6 +28,8 @@ #include "llmaterial.h" +#include "../llrender/llglheaders.h" + /** * Materials cap parameters */ @@ -105,6 +107,8 @@ LLMaterial::LLMaterial() , mSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT) , mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY) , mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + , mDiffuseFormatPrimary(GL_RGBA) + , mDiffuseBaked(false) , mAlphaMaskCutoff(0) { } @@ -311,6 +315,20 @@ void LLMaterial::setEnvironmentIntensity(U8 intensity) mEnvironmentIntensity = intensity; } +U8 LLMaterial::getDiffuseAlphaModeRender() const +{ + if (mDiffuseBaked + || mDiffuseFormatPrimary == GL_RGBA + || mDiffuseFormatPrimary == GL_ALPHA) + { + return mDiffuseAlphaMode; + } + else + { + return DIFFUSE_ALPHA_MODE_NONE; + } +} + U8 LLMaterial::getDiffuseAlphaMode() const { return mDiffuseAlphaMode; @@ -321,6 +339,26 @@ void LLMaterial::setDiffuseAlphaMode(U8 alpha_mode) mDiffuseAlphaMode = alpha_mode; } +U32 LLMaterial::getDiffuseFormatPrimary() const +{ + return mDiffuseFormatPrimary; +} + +void LLMaterial::setDiffuseFormatPrimary(U32 format_primary) +{ + mDiffuseFormatPrimary = format_primary; +} + +bool LLMaterial::getIsDiffuseBaked() const +{ + return mDiffuseBaked; +} + +void LLMaterial::setDiffuseBaked(bool baked) +{ + mDiffuseBaked = baked; +} + U8 LLMaterial::getAlphaMaskCutoff() const { return mAlphaMaskCutoff; @@ -437,7 +475,7 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode) } else { - ret = getDiffuseAlphaMode(); + ret = getDiffuseAlphaModeRender(); } llassert(ret < SHADER_COUNT); diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index d58b7ee812..1207917568 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -115,8 +115,17 @@ public: void setSpecularLightExponent(U8 exponent); U8 getEnvironmentIntensity() const; void setEnvironmentIntensity(U8 intensity); + + // getDiffuseAlphaModeRender takes into account if image supports alpha + // and returns value apropriate for render + // getDiffuseAlphaMode() returns value as is + U8 getDiffuseAlphaModeRender() const; U8 getDiffuseAlphaMode() const; void setDiffuseAlphaMode(U8 alpha_mode); + U32 getDiffuseFormatPrimary() const; + void setDiffuseFormatPrimary(U32 format_primary); + bool getIsDiffuseBaked() const; + void setDiffuseBaked(bool baked); U8 getAlphaMaskCutoff() const; void setAlphaMaskCutoff(U8 cutoff); @@ -147,6 +156,8 @@ protected: U8 mSpecularLightExponent; U8 mEnvironmentIntensity; U8 mDiffuseAlphaMode; + U32 mDiffuseFormatPrimary; // value from texture, LLGLenum, is not included in fromLLSD/asLLSD + bool mDiffuseBaked; // is not included in fromLLSD/asLLSD U8 mAlphaMaskCutoff; }; |