diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llrender.cpp | 21 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 4 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 1 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 471dbce1dd..554721399a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -735,6 +735,24 @@ void LLLightState::setSunPrimary(bool v) } } +void LLLightState::setSize(F32 v) +{ + if (mSize != v) + { + ++gGL.mLightHash; + mSize = v; + } +} + +void LLLightState::setFalloff(F32 v) +{ + if (mFalloff != v) + { + ++gGL.mLightHash; + mFalloff = v; + } +} + void LLLightState::setAmbient(const LLColor4& ambient) { if (mAmbient != ambient) @@ -969,6 +987,7 @@ void LLRender::syncLightState() LLVector3 diffuse[LL_NUM_LIGHT_UNITS]; LLVector3 diffuse_b[LL_NUM_LIGHT_UNITS]; bool sun_primary[LL_NUM_LIGHT_UNITS]; + LLVector2 size[LL_NUM_LIGHT_UNITS]; for (U32 i = 0; i < LL_NUM_LIGHT_UNITS; i++) { @@ -980,11 +999,13 @@ void LLRender::syncLightState() diffuse[i].set(light->mDiffuse.mV); diffuse_b[i].set(light->mDiffuseB.mV); sun_primary[i] = light->mSunIsPrimary; + size[i].set(light->mSize, light->mFalloff); } shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, LL_NUM_LIGHT_UNITS, position[0].mV); shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, LL_NUM_LIGHT_UNITS, direction[0].mV); shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, LL_NUM_LIGHT_UNITS, attenuation[0].mV); + shader->uniform2fv(LLShaderMgr::LIGHT_DEFERRED_ATTENUATION, LL_NUM_LIGHT_UNITS, size[0].mV); shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, LL_NUM_LIGHT_UNITS, diffuse[0].mV); shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV); shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 095ed400f4..b1fb60cf92 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -246,6 +246,8 @@ public: void setSpotCutoff(const F32& cutoff); void setSpotDirection(const LLVector3& direction); void setSunPrimary(bool v); + void setSize(F32 size); + void setFalloff(F32 falloff); protected: friend class LLRender; @@ -266,6 +268,8 @@ protected: F32 mSpotExponent; F32 mSpotCutoff; + F32 mSize = 0.f; + F32 mFalloff = 0.f; }; class LLRender diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 5293166ec3..2ea1c0d698 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1180,6 +1180,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("light_position"); mReservedUniforms.push_back("light_direction"); mReservedUniforms.push_back("light_attenuation"); + mReservedUniforms.push_back("light_deferred_attenuation"); mReservedUniforms.push_back("light_diffuse"); mReservedUniforms.push_back("light_ambient"); mReservedUniforms.push_back("light_count"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 008e3dafa6..249eeace31 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -55,6 +55,7 @@ public: LIGHT_POSITION, // "light_position" LIGHT_DIRECTION, // "light_direction" LIGHT_ATTENUATION, // "light_attenuation" + LIGHT_DEFERRED_ATTENUATION, // "light_deferred_attenuation" LIGHT_DIFFUSE, // "light_diffuse" LIGHT_AMBIENT, // "light_ambient" MULTI_LIGHT_COUNT, // "light_count" |