diff options
| -rw-r--r-- | indra/llmath/v3color.h | 8 | ||||
| -rw-r--r-- | indra/llmath/v4color.h | 11 | ||||
| -rw-r--r-- | indra/llmath/v4math.h | 12 | ||||
| -rw-r--r-- | indra/llprimitive/llprimitive.h | 4 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 17 | ||||
| -rw-r--r-- | indra/newview/llvosky.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llvovolume.h | 1 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 21 | 
10 files changed, 70 insertions, 22 deletions
| diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 43910a1bbe..ac78197510 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -475,5 +475,13 @@ inline LLColor3 lerp(const LLColor3 &a, const LLColor3 &b, F32 u)  		a.mV[VZ] + (b.mV[VZ] - a.mV[VZ]) * u);  } +inline const LLColor3 srgbColor3(const LLColor3 &a) { +	LLColor3 srgbColor; +	srgbColor.mV[0] = linearTosRGB(a.mV[0]); +	srgbColor.mV[1] = linearTosRGB(a.mV[1]); +	srgbColor.mV[2] = linearTosRGB(a.mV[2]); + +	return srgbColor; +}  #endif diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 614cdc9f3e..d9dd28ec54 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -656,5 +656,16 @@ void LLColor4::clamp()  	}  } +inline const LLColor4 srgbColor4(const LLColor4 &a) { +	LLColor4 srgbColor; + +	srgbColor.mV[0] = linearTosRGB(a.mV[0]); +	srgbColor.mV[1] = linearTosRGB(a.mV[1]); +	srgbColor.mV[2] = linearTosRGB(a.mV[2]); +	srgbColor.mV[3] = a.mV[3]; + +	return srgbColor; +} +  #endif diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index 3f6d480ed9..00baeefa5c 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -534,6 +534,18 @@ inline F32		LLVector4::normVec(void)  	return (mag);  } +// Because apparently some parts of the viewer use this for color info. +inline const LLVector4 srgbVector4(const LLVector4 &a) { +	LLVector4 srgbColor; + +	srgbColor.mV[0] = linearTosRGB(a.mV[0]); +	srgbColor.mV[1] = linearTosRGB(a.mV[1]); +	srgbColor.mV[2] = linearTosRGB(a.mV[2]); +	srgbColor.mV[3] = a.mV[3]; + +	return srgbColor; +} +  #endif diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index c138c2ac2b..677606abd1 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -133,6 +133,7 @@ class LLLightParams : public LLNetworkData  {  protected:  	LLColor4 mColor; // alpha = intensity +	LLColor4 msRGBColor; // Only used in deferred (for now?)  	F32 mRadius;  	F32 mFalloff;  	F32 mCutoff; @@ -150,12 +151,13 @@ public:  	bool fromLLSD(LLSD& sd); -	void setColor(const LLColor4& color)	{ mColor = color; mColor.clamp(); } +	void setColor(const LLColor4& color)	{ mColor = color; mColor.clamp(); msRGBColor = srgbColor4(mColor); }  	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; } +	LLColor4 getsRGBColor() const			{ return msRGBColor; }  	F32 getRadius() const					{ return mRadius; }  	F32 getFalloff() const					{ return mFalloff; }  	F32 getCutoff() const					{ return mCutoff; } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 2bf7ad9902..fe6010fabd 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1193,7 +1193,7 @@ void LLRender::syncLightState()  		shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, 8, direction[0].mV);  		shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);  		shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV); -		shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV); +		shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, srgbColor4(mAmbientLightColor).mV);          shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);          shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);  	} diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index e608f6eaf2..7f59852b62 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -503,7 +503,12 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()                  LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); -                sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); +				if (LLPipeline::RenderDeferred) { +					sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, srgbColor4(color).mV); +				} +				else { +					sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); +				}                  sun_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);                  LLFacePool::LLOverrideFaceColor color_override(this, color); @@ -554,9 +559,15 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()              F32 moon_brightness = (float)psky->getMoonBrightness();              moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS,  moon_brightness); -            moon_shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR,  1, gSky.mVOSkyp->getMoon().getColor().mV); -            moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); +			if (LLPipeline::RenderDeferred) { +				moon_shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, srgbColor4(gSky.mVOSkyp->getMoon().getColor()).mV); +				moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, srgbColor4(color).mV); +			} +			else { +				moon_shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, gSky.mVOSkyp->getMoon().getColor().mV); +				moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); +			}              moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);              LLFacePool::LLOverrideFaceColor color_override(this, color); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 8bcd875d90..954a590682 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -210,6 +210,9 @@ void LLSkyTex::createGLImage(S32 which)  	if (LLPipeline::RenderDeferred) {  		mTexture[which]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA);  	} +	else { +		mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); +	}  	mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);  	mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);  } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 4ddd9c4568..85bc1ba845 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3239,6 +3239,19 @@ LLColor3 LLVOVolume::getLightColor() const  	}  } +LLColor3 LLVOVolume::getLightsRGBColor() const +{ +	const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); +	if (param_block) +	{ +		return LLColor3(param_block->getsRGBColor()) * param_block->getsRGBColor().mV[3]; +	} +	else +	{ +		return LLColor3(1, 1, 1); +	} +} +  LLUUID LLVOVolume::getLightTextureID() const  {  	if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 0882fc095d..aeabcda911 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -251,6 +251,7 @@ public:  	BOOL getIsLight() const;  	LLColor3 getLightBaseColor() const; // not scaled by intensity  	LLColor3 getLightColor() const; // scaled by intensity +	LLColor3 getLightsRGBColor() const; // Used to get the (cached) light color in sRGB color space.  Also scaled by intensity.  	LLUUID	getLightTextureID() const;  	bool isLightSpotlight() const;  	LLVector3 getSpotLightParams() const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 658410fd3d..2a7cac3eda 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8368,7 +8368,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_      shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);      shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); -    shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); +    shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, srgbColor4(mMoonDiffuse).mV);      LLEnvironment& environment = LLEnvironment::instance();      shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); @@ -8705,7 +8705,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)                      const F32* c = center.getF32ptr();                      F32 s = volume->getLightRadius(); -                    LLColor3 col = volume->getLightColor(); +                    LLColor3 col = volume->getLightsRGBColor();                      if (col.magVecSquared() < 0.001f)                      { @@ -8742,10 +8742,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)                                  continue;                              } -                            /*col.mV[0] = powf(col.mV[0], 2.2f); -                            col.mV[1] = powf(col.mV[1], 2.2f); -                            col.mV[2] = powf(col.mV[2], 2.2f);*/ -                                                          LL_RECORD_BLOCK_TIME(FTM_LOCAL_LIGHTS);                              gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);                              gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); @@ -8801,7 +8797,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)                      setupSpotLight(gDeferredSpotLightProgram, drawablep); -                    LLColor3 col = volume->getLightColor(); +                    LLColor3 col = volume->getLightsRGBColor();                      /*col.mV[0] = powf(col.mV[0], 2.2f);                      col.mV[1] = powf(col.mV[1], 2.2f);                      col.mV[2] = powf(col.mV[2], 2.2f);*/ @@ -8850,12 +8846,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)                      col[count] = light_colors.front();                      light_colors.pop_front(); -                    /*col[count].mV[0] = powf(col[count].mV[0], 2.2f); -                    col[count].mV[1] = powf(col[count].mV[1], 2.2f); -                    col[count].mV[2] = powf(col[count].mV[2], 2.2f);*/ -                                          far_z = llmin(light[count].mV[2]-light[count].mV[3], far_z); -                    //col[count] = pow4fsrgb(col[count], 2.2f);                      count++;                      if (count == max_count || fullscreen_lights.empty())                      { @@ -8897,11 +8888,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)                      setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); -                    LLColor3 col = volume->getLightColor(); -                     -                    /*col.mV[0] = powf(col.mV[0], 2.2f); -                    col.mV[1] = powf(col.mV[1], 2.2f); -                    col.mV[2] = powf(col.mV[2], 2.2f);*/ +                    LLColor3 col = volume->getLightsRGBColor();                      gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);                      gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); | 
