summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2020-04-21 13:12:05 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-04-21 13:12:05 +0300
commita4b1c0330a6a8e43bf4c41c5b0c836bd1dee2268 (patch)
tree6d68d3e3f665d60fa946bd24a4b324b5e63339fb /indra/llprimitive
parenta8df6762ff88458916397b9707f6954b2714e14d (diff)
parentd7f1c88c35849e56f5b352f13c16a08467d1533b (diff)
Merge branch 'master' into DRTVWR-482
# Conflicts: # indra/newview/app_settings/shaders/class1/objects/previewV.glsl # indra/newview/lldynamictexture.cpp # indra/newview/llfloatermodelpreview.cpp
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp2
-rw-r--r--indra/llprimitive/llprimitive.cpp6
-rw-r--r--indra/llprimitive/llprimitive.h19
3 files changed, 18 insertions, 9 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 8f75d89e5a..139f48fef8 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1784,7 +1784,7 @@ void LLDAELoader::extractTranslationViaElement( daeElement* pTranslateElement, L
{
if ( pTranslateElement )
{
- domTranslate* pTranslateChild = dynamic_cast<domTranslate*>( pTranslateElement );
+ domTranslate* pTranslateChild = static_cast<domTranslate*>( pTranslateElement );
domFloat3 translateChild = pTranslateChild->getValue();
LLVector3 singleJointTranslation( translateChild[0], translateChild[1], translateChild[2] );
transform.setTranslation( singleJointTranslation );
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index bc5dd62f45..53b83a40d7 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1659,7 +1659,7 @@ BOOL LLLightParams::unpack(LLDataPacker &dp)
{
LLColor4U color;
dp.unpackColor4U(color, "color");
- setColor(LLColor4(color));
+ setLinearColor(LLColor4(color));
F32 radius;
dp.unpackF32(radius, "radius");
@@ -1707,7 +1707,7 @@ LLSD LLLightParams::asLLSD() const
{
LLSD sd;
- sd["color"] = ll_sd_from_color4(getColor());
+ sd["color"] = ll_sd_from_color4(getLinearColor());
sd["radius"] = getRadius();
sd["falloff"] = getFalloff();
sd["cutoff"] = getCutoff();
@@ -1721,7 +1721,7 @@ bool LLLightParams::fromLLSD(LLSD& sd)
w = "color";
if (sd.has(w))
{
- setColor( ll_color4_from_sd(sd["color"]) );
+ setLinearColor( ll_color4_from_sd(sd["color"]) );
} else goto fail;
w = "radius";
if (sd.has(w))
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 6fd433c337..b1f8112223 100644
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -131,8 +131,8 @@ extern const F32 LIGHT_MAX_CUTOFF;
class LLLightParams : public LLNetworkData
{
-protected:
- LLColor4 mColor; // alpha = intensity
+private:
+ LLColor4 mColor; // linear color (not gamma corrected), alpha = intensity
F32 mRadius;
F32 mFalloff;
F32 mCutoff;
@@ -149,13 +149,22 @@ public:
operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd);
-
- void setColor(const LLColor4& color) { mColor = color; mColor.clamp(); }
+ // set the color by gamma corrected color value
+ // color - gamma corrected color value (directly taken from an on-screen color swatch)
+ void setSRGBColor(const LLColor4& color) { setLinearColor(linearColor4(color)); }
+
+ // set the color by linear color value
+ // color - linear color value (value as it appears in shaders)
+ void setLinearColor(const LLColor4& color) { mColor = color; mColor.clamp(); }
void setRadius(F32 radius) { mRadius = llclamp(radius, LIGHT_MIN_RADIUS, LIGHT_MAX_RADIUS); }
void setFalloff(F32 falloff) { mFalloff = llclamp(falloff, LIGHT_MIN_FALLOFF, LIGHT_MAX_FALLOFF); }
void setCutoff(F32 cutoff) { mCutoff = llclamp(cutoff, LIGHT_MIN_CUTOFF, LIGHT_MAX_CUTOFF); }
- LLColor4 getColor() const { return mColor; }
+ // get the linear space color of this light. This value can be fed directly to shaders
+ LLColor4 getLinearColor() const { return mColor; }
+ // get the sRGB (gamma corrected) color of this light, this is the value that should be displayed in the UI
+ LLColor4 getSRGBColor() const { return srgbColor4(mColor); }
+
F32 getRadius() const { return mRadius; }
F32 getFalloff() const { return mFalloff; }
F32 getCutoff() const { return mCutoff; }