diff options
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r-- | indra/newview/llenvironment.cpp | 83 |
1 files changed, 65 insertions, 18 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 05c7decfbd..b14fbefeb9 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -812,7 +812,8 @@ const F64Seconds LLEnvironment::TRANSITION_SLOW(10.0f); const F64Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f); const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("01e41537-ff51-2f1f-8ef7-17e4df760bfb"); -const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c"); +const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("651510b8-5f4d-8991-1592-e7eeab2a5a06"); +const LLUUID LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c"); const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("084e26cd-a900-28e8-08d0-64a9de5c15e2"); const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("8a01b97a-cb20-c1ea-ac63-f7ea84ad0090"); @@ -1265,6 +1266,8 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm } } + gPipeline.mReflectionMapManager.reset(); + if (!mSignalEnvChanged.empty()) mSignalEnvChanged(env, env_version); } @@ -1629,28 +1632,31 @@ LLVector4 LLEnvironment::getRotatedLightNorm() const return toLightNorm(light_direction); } +extern BOOL gCubeSnapshot; + //------------------------------------------------------------------------- void LLEnvironment::update(const LLViewerCamera * cam) { LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; //LL_RECORD_BLOCK_TIME(FTM_ENVIRONMENT_UPDATE); //F32Seconds now(LLDate::now().secondsSinceEpoch()); - static LLFrameTimer timer; - - F32Seconds delta(timer.getElapsedTimeAndResetF32()); - + if (!gCubeSnapshot) { - DayInstance::ptr_t keeper = mCurrentEnvironment; - // make sure the current environment does not go away until applyTimeDelta is done. - mCurrentEnvironment->applyTimeDelta(delta); + static LLFrameTimer timer; - } - // update clouds, sun, and general - updateCloudScroll(); + F32Seconds delta(timer.getElapsedTimeAndResetF32()); - // cache this for use in rotating the rotated light vec for shader param updates later... - mLastCamYaw = cam->getYaw() + SUN_DELTA_YAW; + { + DayInstance::ptr_t keeper = mCurrentEnvironment; + // make sure the current environment does not go away until applyTimeDelta is done. + mCurrentEnvironment->applyTimeDelta(delta); - stop_glerror(); + } + // update clouds, sun, and general + updateCloudScroll(); + + // cache this for use in rotating the rotated light vec for shader param updates later... + mLastCamYaw = cam->getYaw() + SUN_DELTA_YAW; + } updateSettingsUniforms(); @@ -1681,8 +1687,16 @@ void LLEnvironment::updateCloudScroll() if (mCurrentEnvironment->getSky() && !mCloudScrollPaused) { - LLVector2 cloud_delta = static_cast<F32>(delta_t)* (mCurrentEnvironment->getSky()->getCloudScrollRate()) / 100.0; - mCloudScrollDelta += cloud_delta; + LLVector2 rate = mCurrentEnvironment->getSky()->getCloudScrollRate(); + if (rate.isExactlyZero()) + { + mCloudScrollDelta.setZero(); + } + else + { + LLVector2 cloud_delta = static_cast<F32>(delta_t) * (mCurrentEnvironment->getSky()->getCloudScrollRate()) / 100.0; + mCloudScrollDelta += cloud_delta; + } } } @@ -1727,8 +1741,19 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; case LLSD::TypeReal: - shader->uniform1f(it.second.getShaderKey(), value.asReal()); + { + F32 v = value.asReal(); + switch (it.second.getShaderKey()) + { // convert to linear color space if this is a color parameter + case LLShaderMgr::HAZE_HORIZON: + case LLShaderMgr::HAZE_DENSITY: + case LLShaderMgr::CLOUD_SHADOW: + //v = sRGBtoLinear(v); + break; + } + shader->uniform1f(it.second.getShaderKey(), v); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; + } break; case LLSD::TypeBoolean: @@ -1739,8 +1764,30 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con case LLSD::TypeArray: { LLVector4 vect4(value); + + if (gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass()) + { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color + auto max_vec = [](LLVector4 col) + { + LLColor3 color(col); + F32 h, s, l; + color.calcHSL(&h, &s, &l); + + col.mV[0] = col.mV[1] = col.mV[2] = l; + return col; + }; + + switch (it.second.getShaderKey()) + { + case LLShaderMgr::BLUE_HORIZON: + case LLShaderMgr::BLUE_DENSITY: + vect4 = max_vec(vect4); + break; + } + } + //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL; - shader->uniform4fv(it.second.getShaderKey(), vect4 ); + shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) ); break; } |