diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/v4math.h | 19 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 5 | ||||
-rw-r--r-- | indra/newview/llsettingsbase.h | 1 | ||||
-rw-r--r-- | indra/newview/llsettingssky.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llsettingssky.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llwlparammanager.cpp | 4 |
11 files changed, 89 insertions, 57 deletions
diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index 293005a627..3f6d480ed9 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -30,6 +30,7 @@ #include "llerror.h" #include "llmath.h" #include "v3math.h" +#include "v2math.h" class LLMatrix3; class LLMatrix4; @@ -46,6 +47,8 @@ class LLVector4 LLVector4(); // Initializes LLVector4 to (0, 0, 0, 1) explicit LLVector4(const F32 *vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2], vec[3]) explicit LLVector4(const F64 *vec); // Initialized LLVector4 to ((F32) vec[0], (F32) vec[1], (F32) vec[3], (F32) vec[4]); + explicit LLVector4(const LLVector2 &vec); + explicit LLVector4(const LLVector2 &vec, F32 z, F32 w); explicit LLVector4(const LLVector3 &vec); // Initializes LLVector4 to (vec, 1) explicit LLVector4(const LLVector3 &vec, F32 w); // Initializes LLVector4 to (vec, w) explicit LLVector4(const LLSD &sd); @@ -185,6 +188,22 @@ inline LLVector4::LLVector4(const F64 *vec) mV[VW] = (F32) vec[VW]; } +inline LLVector4::LLVector4(const LLVector2 &vec) +{ + mV[VX] = vec[VX]; + mV[VY] = vec[VY]; + mV[VZ] = 0.f; + mV[VW] = 0.f; +} + +inline LLVector4::LLVector4(const LLVector2 &vec, F32 z, F32 w) +{ + mV[VX] = vec[VX]; + mV[VY] = vec[VY]; + mV[VZ] = z; + mV[VW] = w; +} + inline LLVector4::LLVector4(const LLVector3 &vec) { mV[VX] = vec.mV[VX]; diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index e7457826a3..bba94a976f 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -406,7 +406,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, for ( ; fileIter != mShaderFiles.end(); fileIter++ ) { GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); - LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; + LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << " shaderhandle=" << shaderhandle << LL_ENDL; if (shaderhandle) { attachObject(shaderhandle); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index e721ad93fa..4e9a1f5de5 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -953,7 +953,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade // Add shader file to map mShaderObjects[filename] = ret; shader_level = try_gpu_class; - } + LL_WARNS("RIDER") << "Shader '" << filename << "' loaded with handle=" << ret << LL_ENDL; + } else { if (shader_level > 1) diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index dec2930970..84a1f2c1ab 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -117,9 +117,20 @@ void LLEnvironment::updateCloudScroll() F64 delta_t = s_cloud_timer.getElapsedTimeAndResetF64(); - LLVector2 cloud_delta = static_cast<F32>(delta_t) * (mCurrentSky->getCloudScrollRate() - LLVector2(10.0, 10.0)) / 100.0; + LLVector2 cloud_delta = static_cast<F32>(delta_t)* (mCurrentSky->getCloudScrollRate() - LLVector2(10.0, 10.0)) / 100.0; + mCloudScrollDelta += cloud_delta; + +// { +// LLVector2 v2(mCurrentSky->getCloudScrollRate()); +// static F32 xoffset(0.f); +// static F32 yoffset(0.f); +// +// xoffset += F32(delta_t * (v2[0] - 10.f) / 100.f); +// yoffset += F32(delta_t * (v2[1] - 10.f) / 100.f); +// +// LL_WARNS("RIDER") << "offset " << mCloudScrollDelta << " vs (" << xoffset << ", " << yoffset << ")" << LL_ENDL; +// } - mCloudScroll += cloud_delta; } @@ -158,7 +169,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS { LLVector4 vect4(value); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL; - shader->uniform4fv((*it).second, 4, vect4.mV); + shader->uniform4fv((*it).second, 1, vect4.mV); break; } @@ -176,7 +187,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS } //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL; -// psetting->applySpecial(shader); + psetting->applySpecial(shader); if (LLPipeline::sRenderDeferred && !LLPipeline::sReflectionRender && !LLPipeline::sUnderWaterRender) { @@ -213,17 +224,17 @@ void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mCurrentSky->getSceneLightStrength()); - { - LLVector4 cloud_scroll(mCloudScroll[0], mCloudScroll[1], 0.0, 0.0); -// val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset; -// val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset; -// val.mV[2] = (F32)i->second[2].asReal(); -// val.mV[3] = (F32)i->second[3].asReal(); - - stop_glerror(); - shader->uniform4fv(LLSettingsSky::SETTING_CLOUD_POS_DENSITY1, 1, cloud_scroll.mV); - stop_glerror(); - } +// { +// LLVector4 cloud_scroll(mCloudScroll[0], mCloudScroll[1], 0.0, 0.0); +// // val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset; +// // val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset; +// // val.mV[2] = (F32)i->second[2].asReal(); +// // val.mV[3] = (F32)i->second[3].asReal(); +// +// stop_glerror(); +// shader->uniform4fv(LLSettingsSky::SETTING_CLOUD_POS_DENSITY1, 1, cloud_scroll.mV); +// stop_glerror(); +// } } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index bbb5f45ad9..3a834963f3 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -54,6 +54,9 @@ public: void updateShaderUniforms(LLGLSLShader *shader); void addSky(const LLSettingsSky::ptr_t &sky); + + inline LLVector2 getCloudScrollDelta() const { return mCloudScrollDelta; } + private: static const F32 SUN_DELTA_YAW; @@ -61,7 +64,7 @@ private: typedef std::map<LLUUID, LLSettingsSky::ptr_t> AssetSkyMap_t; LLVector4 mRotatedLight; - LLVector2 mCloudScroll; + LLVector2 mCloudScrollDelta; // cumulative cloud delta LLSettingsSky::ptr_t mCurrentSky; diff --git a/indra/newview/llsettingsbase.h b/indra/newview/llsettingsbase.h index cd5098cbb6..142b74caf9 100644 --- a/indra/newview/llsettingsbase.h +++ b/indra/newview/llsettingsbase.h @@ -140,7 +140,6 @@ protected: // Calculate any custom settings that may need to be cached. virtual void updateSettings() { mDirty = false; }; - virtual stringset_t getSkipApplyKeys() const { return stringset_t(); } // Apply any settings that need special handling. virtual void applySpecial(void *) { }; diff --git a/indra/newview/llsettingssky.cpp b/indra/newview/llsettingssky.cpp index 26ed719b3b..1d71140430 100644 --- a/indra/newview/llsettingssky.cpp +++ b/indra/newview/llsettingssky.cpp @@ -37,6 +37,7 @@ #include "llglslshader.h" #include "llviewershadermgr.h" +#include "llenvironment.h" #include "llsky.h" //========================================================================= @@ -482,7 +483,7 @@ LLSettingsSky::parammapping_t LLSettingsSky::getParameterMap() const param_map[SETTING_BLUE_DENSITY] = LLShaderMgr::BLUE_DENSITY; param_map[SETTING_BLUE_HORIZON] = LLShaderMgr::BLUE_HORIZON; param_map[SETTING_CLOUD_COLOR] = LLShaderMgr::CLOUD_COLOR; - param_map[SETTING_CLOUD_POS_DENSITY1] = LLShaderMgr::CLOUD_POS_DENSITY1; + param_map[SETTING_CLOUD_POS_DENSITY2] = LLShaderMgr::CLOUD_POS_DENSITY2; param_map[SETTING_CLOUD_SCALE] = LLShaderMgr::CLOUD_SCALE; param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW; @@ -499,44 +500,37 @@ LLSettingsSky::parammapping_t LLSettingsSky::getParameterMap() const return param_map; } - -LLSettingsSky::stringset_t LLSettingsSky::getSkipApplyKeys() const -{ - - static stringset_t skip_apply_set; - - if (skip_apply_set.empty()) - { - skip_apply_set.insert(SETTING_MOON_ROTATION); - skip_apply_set.insert(SETTING_SUN_ROTATION); - skip_apply_set.insert(SETTING_NAME); - skip_apply_set.insert(SETTING_STAR_BRIGHTNESS); - skip_apply_set.insert(SETTING_CLOUD_SCROLL_RATE); - skip_apply_set.insert(SETTING_LIGHT_NORMAL); - skip_apply_set.insert(SETTING_DOME_OFFSET); - skip_apply_set.insert(SETTING_DOME_RADIUS); - } - - return skip_apply_set; -} - void LLSettingsSky::applySpecial(void *ptarget) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; - if (shader->mShaderGroup == LLGLSLShader::SG_SKY) - { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mLightDirectionClamped.mV); - } + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mLightDirectionClamped.mV); shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength); shader->uniform4f(LLShaderMgr::GAMMA, getGama(), 0.0, 0.0, 1.0); + { + //LLEnvironment::instance().getCloudDelta(); + LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); + vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); + shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); + } -} +// { +// LLVector4 val(mSettings[ ]; +// val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset; +// val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset; +// val.mV[2] = (F32)i->second[2].asReal(); +// val.mV[3] = (F32)i->second[3].asReal(); +// +// stop_glerror(); +// //_WARNS("RIDER") << "pushing '" << param.String() << "' as " << val << LL_ENDL; +// shader->uniform4fv(param, 1, val.mV); +// stop_glerror(); +// +// } -//------------------------------------------------------------------------- -// const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); -// const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); -// const std::string LLSettingsSky::SETTING_NAME("name"); + //param_map[SETTING_CLOUD_POS_DENSITY1] = LLShaderMgr::CLOUD_POS_DENSITY1; + +} diff --git a/indra/newview/llsettingssky.h b/indra/newview/llsettingssky.h index 2fb9ff3887..4e333f0584 100644 --- a/indra/newview/llsettingssky.h +++ b/indra/newview/llsettingssky.h @@ -116,12 +116,12 @@ public: LLColor3 getCloudPosDensity1() const { - return mSettings[SETTING_CLOUD_POS_DENSITY1].asReal(); + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); } LLColor3 getCloudPosDensity2() const { - return mSettings[SETTING_CLOUD_POS_DENSITY2].asReal(); + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); } F32 getCloudScale() const @@ -296,7 +296,6 @@ protected: virtual parammapping_t getParameterMap() const; - virtual stringset_t getSkipApplyKeys() const; virtual void applySpecial(void *); private: diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index e53db403e1..d810d7077b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -79,6 +79,8 @@ #include "llpostprocess.h" #include "llscenemonitor.h" +#include "llenvironment.h" + extern LLPointer<LLViewerTexture> gStartTexture; extern bool gShiftFrame; @@ -200,7 +202,9 @@ void display_update_camera() gViewerWindow->setup3DRender(); // update all the sky/atmospheric/water settings - LLWLParamManager::getInstance()->update(LLViewerCamera::getInstance()); + // *LAPRAS + //LLWLParamManager::getInstance()->update(LLViewerCamera::getInstance()); + LLEnvironment::instance().update(LLViewerCamera::getInstance()); LLWaterParamManager::getInstance()->update(LLViewerCamera::getInstance()); // Update land visibility too diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 8adc86b423..313cdaa500 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -45,6 +45,7 @@ #include "llrender.h" #include "lljoint.h" #include "llskinningutil.h" +#include "llenvironment.h" #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") @@ -3430,7 +3431,8 @@ std::string LLViewerShaderMgr::getShaderDirPrefix(void) void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader) { //*LAPRAS*/ - LLWLParamManager::getInstance()->updateShaderUniforms(shader); + LLEnvironment::instance().updateShaderUniforms(shader); + //LLWLParamManager::getInstance()->updateShaderUniforms(shader); LLWaterParamManager::getInstance()->updateShaderUniforms(shader); } diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index de2d3bc41d..b6e1c36a33 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -351,8 +351,8 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) { if (gPipeline.canUseWindLightShaders()) { - LLEnvironment::instance().updateGLVariablesForSettings(shader, LLEnvironment::instance().getCurrentSky()); - //mCurParams.update(shader); + //LLEnvironment::instance().updateGLVariablesForSettings(shader, LLEnvironment::instance().getCurrentSky()); + mCurParams.update(shader); } if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) |