Clouds still funky but better.
parent
5d3599f5d1
commit
0d414c1fb5
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 *) { };
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
//
|
||||
// }
|
||||
|
||||
//param_map[SETTING_CLOUD_POS_DENSITY1] = LLShaderMgr::CLOUD_POS_DENSITY1;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier");
|
||||
// const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm");
|
||||
// const std::string LLSettingsSky::SETTING_NAME("name");
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue