diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-07 23:49:37 +0000 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-07 23:49:37 +0000 |
commit | 6d77503542216ece1eecf82dce19ebd8d6be7327 (patch) | |
tree | e55dbda0c9926f66eebcdb29efdf6195f86c3547 /indra/newview | |
parent | 0f33f0a6f356773ed69e4dcaffb7d589c9b47561 (diff) |
Isolate more legacy atmo param use in sky (convert to getLightAttenuation and getLightTransmittance).
Optimize sky texture creation.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lllegacyatmospherics.cpp | 6 | ||||
-rw-r--r-- | indra/newview/lllegacyatmospherics.h | 1 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 71 | ||||
-rw-r--r-- | indra/newview/llvosky.h | 14 |
4 files changed, 34 insertions, 58 deletions
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index a589ef0a68..622f75a88b 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -200,7 +200,6 @@ void LLAtmospherics::init() { const F32 haze_int = color_intens(mHaze.calcSigSca(0)); mHazeConcentration = haze_int / (color_intens(mHaze.calcAirSca(0)) + haze_int); - calc(); mInitialized = true; } @@ -445,11 +444,6 @@ LLColor3 LLAtmospherics::calcSkyColorWLFrag(LLVector3 & Pn, AtmosphericsVars& va return res; } -void LLAtmospherics::calc() -{ - -} - void LLAtmospherics::updateFog(const F32 distance, LLVector3& tosun) { if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG)) diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index 2f0c094c10..71469a622a 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -213,7 +213,6 @@ public: ~LLAtmospherics(); void init(); - void calc(); void updateFog(const F32 distance, LLVector3& tosun); const LLHaze& getHaze() const { return mHaze; } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 950378c567..d295efaa66 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -336,7 +336,7 @@ LLVOSky::~LLVOSky() void LLVOSky::init() { - calcAtmospherics(); + updateDirections(); // Initialize the cached normalized direction vectors for (S32 side = 0; side < 6; ++side) @@ -408,7 +408,7 @@ void LLVOSky::restoreGL() mBloomTexturep->setNoDelete() ; mBloomTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - calcAtmospherics(); + updateDirections(); if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) @@ -486,7 +486,7 @@ void LLVOSky::createSkyTexture(const S32 side, const S32 tile) } } -void LLVOSky::calcAtmospherics(void) +void LLVOSky::updateDirections(void) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -508,8 +508,6 @@ void LLVOSky::calcAtmospherics(void) // between sunlight and point lights in windlight to normalize point lights. F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f); LLEnvironment::instance().setSceneLightStrength(2.0f * (1.0f + sun_dynamic_range * dp)); - - m_legacyAtmospherics.calc(); } void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time) @@ -541,7 +539,7 @@ BOOL LLVOSky::updateSky() const S32 total_no_tiles = 6 * NUM_TILES; const S32 cycle_frame_no = total_no_tiles + 1; - if (mUpdateTimer.getElapsedTimeF32() > 0.001f) + if (mUpdateTimer.getElapsedTimeF32() > 0.025f) { mUpdateTimer.reset(); const S32 frame = next_frame; @@ -553,7 +551,7 @@ BOOL LLVOSky::updateSky() // sInterpVal = (F32)next_frame / cycle_frame_no; LLSkyTex::setInterpVal( mInterpVal ); LLHeavenBody::setInterpVal( mInterpVal ); - calcAtmospherics(); + updateDirections(); if (mForceUpdate || total_no_tiles == frame) { @@ -595,8 +593,6 @@ BOOL LLVOSky::updateSky() } } - calcAtmospherics(); - for (int side = 0; side < 6; side++) { LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE); @@ -610,45 +606,33 @@ BOOL LLVOSky::updateSky() mShinyTex[side].createGLImage(mShinyTex[side].getWhich(FALSE)); } next_frame = 0; - } - } - } - /// *TODO really, sky texture and env map should be shared on a single texture - /// I'll let Brad take this at some point - - // update the sky texture - for (S32 i = 0; i < 6; ++i) - { - mSkyTex[i].create(1.0f); - mShinyTex[i].create(1.0f); - } - - // update the environment map - if (mCubeMap) - { - std::vector<LLPointer<LLImageRaw> > images; - images.reserve(6); - for (S32 side = 0; side < 6; side++) - { - images.push_back(mShinyTex[side].getImageRaw(TRUE)); + // update the sky texture + for (S32 i = 0; i < 6; ++i) + { + mSkyTex[i].create(1.0f); + mShinyTex[i].create(1.0f); + } + + // update the environment map + if (mCubeMap) + { + std::vector<LLPointer<LLImageRaw> > images; + images.reserve(6); + for (S32 side = 0; side < 6; side++) + { + images.push_back(mShinyTex[side].getImageRaw(TRUE)); + } + mCubeMap->init(images); + gGL.getTexUnit(0)->disable(); + } + } } - mCubeMap->init(images); - gGL.getTexUnit(0)->disable(); } gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - // *TODO: decide whether we need to update the stars vertex buffer in LLVOWLSky -Brad. - //gPipeline.markRebuild(gSky.mVOWLSkyp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - mForceUpdate = FALSE; } - else - { - const S32 side = frame / NUM_TILES; - const S32 tile = frame % NUM_TILES; - createSkyTexture(side, tile); - } } if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) @@ -1405,7 +1389,7 @@ void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_an mMoon.renewDirection(); mLastLightingDirection = mSun.getDirection(); - calcAtmospherics(); + updateDirections(); if ( !mInitialized ) { @@ -1439,7 +1423,8 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_di mSun.setDirection(sun_direction); mMoon.setDirection(moon_dir); - calcAtmospherics(); + updateDirections(); + if (dp < 0.995f) { //the sun jumped a great deal, update immediately mForceUpdate = TRUE; } diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index e4d99a5e8b..f8a6827a2b 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -230,13 +230,7 @@ class LLCubeMap; class LLVOSky : public LLStaticViewerObject { - -public: - void calcAtmospherics(void); - - void initSkyTextureDirs(const S32 side, const S32 tile); - void createSkyTexture(const S32 side, const S32 tile); - +public: enum { FACE_SIDE0, @@ -249,7 +243,6 @@ public: FACE_MOON, // was 7 FACE_BLOOM, // was 8 FACE_REFLECTION, // was 10 - FACE_DUMMY, //for an ATI bug --bao FACE_COUNT }; @@ -343,6 +336,11 @@ public: protected: ~LLVOSky(); + void updateDirections(void); + + void initSkyTextureDirs(const S32 side, const S32 tile); + void createSkyTexture(const S32 side, const S32 tile); + LLPointer<LLViewerFetchedTexture> mSunTexturep; LLPointer<LLViewerFetchedTexture> mMoonTexturep; LLPointer<LLViewerFetchedTexture> mBloomTexturep; |