Mods to hook up water settings to water normals for rendering with support for current to next blending.

Modify LLSettingsFoo::buildDefaultFoo to use a static and avoid re-validation of default sky/water/daycycle settings.

Remove all references to gSun/MoonTextureId globals (they should come from sky settings now).
master
Graham Linden 2018-06-13 00:51:39 +01:00
parent e2adba65de
commit 34865c4bb5
18 changed files with 218 additions and 118 deletions

View File

@ -112,7 +112,7 @@ public:
}
inline void replaceSettings(LLSD settings)
virtual void replaceSettings(LLSD settings)
{
mSettings = settings;
mBlendedFactor = 0.0;

View File

@ -37,6 +37,7 @@
#include "llsettingswater.h"
#include "llframetimer.h"
//=========================================================================
namespace
{

View File

@ -382,8 +382,16 @@ LLSettingsSky::LLSettingsSky():
{
}
void LLSettingsSky::replaceSettings(LLSD settings)
{
LLSettingsBase::replaceSettings(settings);
}
void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
{
llassert(getSettingsType() == end->getSettingsType());
LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);

View File

@ -103,6 +103,8 @@ public:
// Settings status
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
static LLSD defaults();
F32 getPlanetRadius() const;

View File

@ -47,6 +47,7 @@ const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density");
const std::string LLSettingsWater::SETTING_FOG_MOD("underwater_fog_mod");
const std::string LLSettingsWater::SETTING_FRESNEL_OFFSET("fresnel_offset");
const std::string LLSettingsWater::SETTING_FRESNEL_SCALE("fresnel_scale");
const std::string LLSettingsWater::SETTING_TRANSPARENT_TEXTURE("transparent_texture");
const std::string LLSettingsWater::SETTING_NORMAL_MAP("normal_map");
const std::string LLSettingsWater::SETTING_NORMAL_SCALE("normal_scale");
const std::string LLSettingsWater::SETTING_SCALE_ABOVE("scale_above");
@ -69,6 +70,8 @@ const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir");
// *LAPRAS* Change when Agni
static const LLUUID DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661");
static const LLUUID DEFAULT_TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004");
static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055");
//=========================================================================
LLSettingsWater::LLSettingsWater(const LLSD &data) :
@ -95,7 +98,8 @@ LLSD LLSettingsWater::defaults()
dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f);
dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f);
dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999);
dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL);
dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId();
dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId();
dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue();
dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f);
dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f);
@ -171,6 +175,7 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
replaceSettings(blenddata);
setBlendFactor(blendf);
mNextNormalMapID = other->getNormalMapID();
mNextTransparentTextureID = other->getTransparentTextureID();
}
LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const
@ -234,3 +239,12 @@ LLUUID LLSettingsWater::GetDefaultWaterNormalAssetId()
return DEFAULT_WATER_NORMAL;
}
LLUUID LLSettingsWater::GetDefaultTransparentTextureAssetId()
{
return DEFAULT_TRANSPARENT_WATER_TEXTURE;
}
LLUUID LLSettingsWater::GetDefaultOpaqueTextureAssetId()
{
return DEFAULT_OPAQUE_WATER_TEXTURE;
}

View File

@ -39,6 +39,7 @@ public:
static const std::string SETTING_FOG_MOD;
static const std::string SETTING_FRESNEL_OFFSET;
static const std::string SETTING_FRESNEL_SCALE;
static const std::string SETTING_TRANSPARENT_TEXTURE;
static const std::string SETTING_NORMAL_MAP;
static const std::string SETTING_NORMAL_SCALE;
static const std::string SETTING_SCALE_ABOVE;
@ -124,6 +125,16 @@ public:
setValue(SETTING_FRESNEL_SCALE, val);
}
LLUUID getTransparentTextureID() const
{
return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID();
}
void setTransparentTextureID(LLUUID val)
{
setValue(SETTING_TRANSPARENT_TEXTURE, val);
}
LLUUID getNormalMapID() const
{
return mSettings[SETTING_NORMAL_MAP].asUUID();
@ -203,6 +214,10 @@ public:
return mNextNormalMapID;
}
LLUUID getNextTransparentTextureID() const
{
return mNextTransparentTextureID;
}
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
static validation_list_t validationList();
@ -213,6 +228,8 @@ public:
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultWaterNormalAssetId();
static LLUUID GetDefaultTransparentTextureAssetId();
static LLUUID GetDefaultOpaqueTextureAssetId();
protected:
static const std::string SETTING_LEGACY_BLUR_MULTIPILER;
@ -234,6 +251,7 @@ protected:
F32 mWaterFogKS;
private:
LLUUID mNextTransparentTextureID;
LLUUID mNextNormalMapID;
};

View File

@ -1147,6 +1147,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("altDiffuseMap");
mReservedUniforms.push_back("specularMap");
mReservedUniforms.push_back("bumpMap");
mReservedUniforms.push_back("bumpMap2");
mReservedUniforms.push_back("environmentMap");
mReservedUniforms.push_back("cloud_noise_texture");
mReservedUniforms.push_back("cloud_noise_texture_next");

View File

@ -77,6 +77,7 @@ public:
ALTERNATE_DIFFUSE_MAP,
SPECULAR_MAP,
BUMP_MAP,
BUMP_MAP2,
ENVIRONMENT_MAP,
CLOUD_NOISE_MAP,
CLOUD_NOISE_MAP_NEXT,

View File

@ -37,6 +37,8 @@ vec3 scaleSoftClip(vec3 inColor);
vec3 atmosTransport(vec3 inColor);
uniform sampler2D bumpMap;
uniform sampler2D bumpMap2;
uniform float blend_factor;
uniform sampler2D screenTex;
uniform sampler2D refTex;
uniform sampler2DRectShadow shadowMap0;
@ -72,6 +74,15 @@ VARYING vec4 vary_position;
vec3 srgb_to_linear(vec3 cs);
vec2 encode_normal(vec3 n);
vec3 BlendNormal(vec3 bump1, vec3 bump2)
{
//vec3 normal = bump1.xyz * vec3( 2.0, 2.0, 2.0) - vec3(1.0, 1.0, 0.0);
//vec3 normal2 = bump2.xyz * vec3(-2.0, -2.0, 2.0) + vec3(1.0, 1.0, -1.0);
//vec3 n = normalize(normal * dot(normal, normal2) - (normal2 * normal.z));
vec3 n = normalize(mix(bump1, bump2, blend_factor));
return n;
}
void main()
{
vec4 color;
@ -81,9 +92,19 @@ void main()
vec3 viewVec = normalize(view.xyz);
//get wave normals
vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
vec3 wave1_a = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2_a = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
vec3 wave3_a = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
vec3 wave1_b = texture2D(bumpMap2, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2_b = texture2D(bumpMap2, littleWave.xy).xyz*2.0-1.0;
vec3 wave3_b = texture2D(bumpMap2, littleWave.zw).xyz*2.0-1.0;
vec3 wave1 = BlendNormal(wave1_a, wave1_b);
vec3 wave2 = BlendNormal(wave2_a, wave2_b);
vec3 wave3 = BlendNormal(wave3_a, wave3_b);
//get base fresnel components
vec3 df = vec3(

View File

@ -33,6 +33,8 @@ vec3 scaleSoftClip(vec3 inColor);
vec3 atmosTransport(vec3 inColor);
uniform sampler2D bumpMap;
uniform sampler2D bumpMap2;
uniform float blend_factor;
uniform sampler2D screenTex;
uniform sampler2D refTex;
@ -55,6 +57,15 @@ VARYING vec4 refCoord;
VARYING vec4 littleWave;
VARYING vec4 view;
vec3 BlendNormal(vec3 bump1, vec3 bump2)
{
//vec3 normal = bump1.xyz * vec3( 2.0, 2.0, 2.0) - vec3(1.0, 1.0, 0.0);
//vec3 normal2 = bump2.xyz * vec3(-2.0, -2.0, 2.0) + vec3(1.0, 1.0, -1.0);
//vec3 n = normalize(normal * dot(normal, normal2) - (normal2 * normal.z));
vec3 n = normalize(mix(bump1, bump2, blend_factor));
return n;
}
void main()
{
vec4 color;
@ -65,9 +76,18 @@ void main()
vec3 viewVec = normalize(view.xyz);
//get wave normals
vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
vec3 wave1_a = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2_a = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0;
vec3 wave3_a = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0;
vec3 wave1_b = texture2D(bumpMap2, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
vec3 wave2_b = texture2D(bumpMap2, littleWave.xy).xyz*2.0-1.0;
vec3 wave3_b = texture2D(bumpMap2, littleWave.zw).xyz*2.0-1.0;
vec3 wave1 = BlendNormal(wave1_a, wave1_b);
vec3 wave2 = BlendNormal(wave2_a, wave2_b);
vec3 wave3 = BlendNormal(wave3_a, wave3_b);
//get base fresnel components
vec3 df = vec3(

View File

@ -390,8 +390,6 @@ extern LLVector3 gRelativeWindVec;
extern U32 gPacketsIn;
extern BOOL gPrintMessagesThisFrame;
extern LLUUID gSunTextureID;
extern LLUUID gMoonTextureID;
extern LLUUID gBlackSquareID;
extern BOOL gRandomizeFramerate;

View File

@ -50,9 +50,6 @@
#include "llsettingssky.h"
#include "llsettingswater.h"
const LLUUID TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004");
const LLUUID OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055");
static float sTime;
BOOL deferred_render = FALSE;
@ -60,33 +57,51 @@ BOOL deferred_render = FALSE;
BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE;
BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE;
BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE;
//LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f);
F32 LLDrawPoolWater::sWaterFogEnd = 0.f;
//LLVector3 LLDrawPoolWater::sLightDir;
LLDrawPoolWater::LLDrawPoolWater() :
LLFacePool(POOL_WATER)
LLDrawPoolWater::LLDrawPoolWater() : LLFacePool(POOL_WATER)
{
mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE);
llassert(mWaterImagep);
mWaterImagep->setNoDelete();
mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(OPAQUE_WATER_TEXTURE);
llassert(mOpaqueWaterImagep);
mWaterNormp = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL);
mWaterNormp->setNoDelete();
restoreGL();
}
LLDrawPoolWater::~LLDrawPoolWater()
{
}
void LLDrawPoolWater::setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId)
{
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mWaterImagep[0] = LLViewerTextureManager::getFetchedTexture(!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId());
mWaterImagep[1] = LLViewerTextureManager::getFetchedTexture(!nextTransparentTextureId.isNull() ? nextTransparentTextureId : (!transparentTextureId.isNull() ? transparentTextureId : pwater->GetDefaultTransparentTextureAssetId()));
mWaterImagep[0]->addTextureStats(1024.f*1024.f);
mWaterImagep[1]->addTextureStats(1024.f*1024.f);
}
void LLDrawPoolWater::setOpaqueTexture()
{
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mOpaqueWaterImagep = LLViewerTextureManager::getFetchedTexture(pwater->GetDefaultOpaqueTextureAssetId());
mOpaqueWaterImagep->addTextureStats(1024.f*1024.f);
}
void LLDrawPoolWater::setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId)
{
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mWaterNormp[0] = LLViewerTextureManager::getFetchedTexture(!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId());
mWaterNormp[1] = LLViewerTextureManager::getFetchedTexture(!nextNormalMapId.isNull() ? nextNormalMapId : (!normalMapId.isNull() ? normalMapId : pwater->GetDefaultWaterNormalAssetId()));
mWaterNormp[0]->addTextureStats(1024.f*1024.f);
mWaterNormp[1]->addTextureStats(1024.f*1024.f);
}
//static
void LLDrawPoolWater::restoreGL()
{
/*LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
if (pwater)
{
setTransparentTextures(pwater->getTransparentTextureID(), pwater->getNextTransparentTextureID());
setOpaqueTexture(pwater->GetDefaultOpaqueTextureAssetId());
setNormalMaps(pwater->getNormalMapID(), pwater->getNextNormalMapID());
}*/
}
LLDrawPool *LLDrawPoolWater::instancePool()
@ -98,12 +113,7 @@ LLDrawPool *LLDrawPoolWater::instancePool()
void LLDrawPoolWater::prerender()
{
mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ?
LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
// got rid of modulation by light color since it got a little too
// green at sunset and sl-57047 (underwater turns black at 8:00)
mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ? LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
}
S32 LLDrawPoolWater::getNumPasses()
@ -194,10 +204,13 @@ void LLDrawPoolWater::render(S32 pass)
LLGLDisable cullFace(GL_CULL_FACE);
// Set up second pass first
mWaterImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(1)->activate();
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->bind(mWaterImagep) ;
gGL.getTexUnit(1)->bind(mWaterImagep[0]) ;
gGL.getTexUnit(2)->activate();
gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->bind(mWaterImagep[1]) ;
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
F32 up_dot = camera_up * LLVector3::z_axis;
@ -254,6 +267,14 @@ void LLDrawPoolWater::render(S32 pass)
gGL.getTexUnit(1)->activate();
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
glDisable(GL_TEXTURE_GEN_S); //texture unit 1
glDisable(GL_TEXTURE_GEN_T); //texture unit 1
gGL.getTexUnit(1)->activate();
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
glDisable(GL_TEXTURE_GEN_S); //texture unit 1
glDisable(GL_TEXTURE_GEN_T); //texture unit 1
@ -353,8 +374,6 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
gPipeline.disableLights();
mOpaqueWaterImagep->addTextureStats(1024.f*1024.f);
// Activate the texture binding and bind one
// texture since all images will have the same texture
gGL.getTexUnit(0)->activate();
@ -568,23 +587,23 @@ void LLDrawPoolWater::shade()
//bind normal map
S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP);
// change mWaterNormp if needed
if (mWaterNormp->getID() != pwater->getNormalMapID())
{
mWaterNormp = LLViewerTextureManager::getFetchedTexture(pwater->getNormalMapID());
if (mWaterNormp[0] && mWaterNormp[1])
{
gGL.getTexUnit(bumpTex)->bind(mWaterNormp[0]) ;
gGL.getTexUnit(bumpTex + 1)->bind(mWaterNormp[1]) ;
if (gSavedSettings.getBOOL("RenderWaterMipNormal"))
{
mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
}
else
{
mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_POINT);
mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_POINT);
}
}
mWaterNormp->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(bumpTex)->bind(mWaterNormp) ;
if (gSavedSettings.getBOOL("RenderWaterMipNormal"))
{
mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
}
else
{
mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT);
}
S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX);
if (screentex > -1)

View File

@ -37,9 +37,10 @@ class LLWaterSurface;
class LLDrawPoolWater: public LLFacePool
{
protected:
LLPointer<LLViewerTexture> mWaterImagep;
LLPointer<LLViewerTexture> mOpaqueWaterImagep;
LLPointer<LLViewerTexture> mWaterNormp;
LLPointer<LLViewerTexture> mWaterImagep[2];
LLPointer<LLViewerTexture> mWaterNormp[2];
LLPointer<LLViewerTexture> mOpaqueWaterImagep;
public:
static BOOL sSkipScreenCopy;
@ -81,6 +82,10 @@ public:
void renderReflection(LLFace* face);
void shade();
void setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId);
void setOpaqueTexture();
void setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId);
protected:
void renderOpaqueLegacyWater();
};

View File

@ -57,6 +57,7 @@
#include "llinventorymodel.h"
#include "llassetstorage.h"
#include "llvfile.h"
#include "lldrawpoolwater.h"
#include <boost/algorithm/string/replace.hpp>
@ -415,18 +416,24 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::strin
LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
{
LLSD settings = LLSettingsSky::defaults();
settings[SETTING_NAME] = std::string("_default_");
static LLSD default_settings;
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
LLSD results = LLSettingsBase::settingValidation(settings, validations);
if (!results["success"].asBoolean())
if (!default_settings.size())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
LLSettingsSky::ptr_t();
default_settings = LLSettingsSky::defaults();
default_settings[SETTING_NAME] = std::string("_default_");
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
LLSD results = LLSettingsBase::settingValidation(default_settings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
LLSettingsSky::ptr_t();
}
}
LLSettingsSky::ptr_t skyp = std::make_shared<LLSettingsVOSky>(settings);
LLSettingsSky::ptr_t skyp = std::make_shared<LLSettingsVOSky>(default_settings);
return skyp;
}
@ -662,18 +669,24 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::s
LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
{
LLSD settings = LLSettingsWater::defaults();
settings[SETTING_NAME] = std::string("_default_");
static LLSD default_settings;
LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList();
LLSD results = LLSettingsWater::settingValidation(settings, validations);
if (!results["success"].asBoolean())
if (!default_settings.size())
{
LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL;
return LLSettingsWater::ptr_t();
default_settings = LLSettingsWater::defaults();
default_settings[SETTING_NAME] = std::string("_default_");
LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList();
LLSD results = LLSettingsWater::settingValidation(default_settings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL;
return LLSettingsWater::ptr_t();
}
}
LLSettingsWater::ptr_t waterp = std::make_shared<LLSettingsVOWater>(settings);
LLSettingsWater::ptr_t waterp = std::make_shared<LLSettingsVOWater>(default_settings);
return waterp;
}
@ -726,6 +739,9 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, getWaterPlane().mV);
shader->uniform1f(LLShaderMgr::WATER_FOGKS, getWaterFogKS());
F32 blend_factor = LLEnvironment::instance().getCurrentWater()->getBlendFactor();
shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV);
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
@ -768,6 +784,13 @@ void LLSettingsVOWater::updateSettings()
mWaterFogKS = 1.f / llmax(light_direction.mV[2], WATER_FOG_LIGHT_CLAMP);
}
LLDrawPoolWater* pwaterpool = (LLDrawPoolWater*)gPipeline.getPool(LLDrawPool::POOL_WATER);
if (pwaterpool)
{
pwaterpool->setTransparentTextures(getTransparentTextureID(), getNextTransparentTextureID());
pwaterpool->setNormalMaps(getNormalMapID(), getNextNormalMapID());
}
}
LLSettingsWater::parammapping_t LLSettingsVOWater::getParameterMap() const
@ -966,18 +989,23 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regio
LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle()
{
LLSD settings = LLSettingsDay::defaults();
settings[SETTING_NAME] = std::string("_default_");
static LLSD default_settings;
LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList();
LLSD results = LLSettingsDay::settingValidation(settings, validations);
if (!results["success"].asBoolean())
if (!default_settings.size())
{
LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL;
LLSettingsDay::ptr_t();
default_settings = LLSettingsDay::defaults();
default_settings[SETTING_NAME] = std::string("_default_");
LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList();
LLSD results = LLSettingsDay::settingValidation(default_settings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL;
LLSettingsDay::ptr_t();
}
}
LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(settings);
LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(default_settings);
dayp->initialize();
return dayp;

View File

@ -3499,28 +3499,6 @@ bool process_login_success_response()
}
}
// LAPRAS
#if 0
LLSD global_textures = response["global-textures"][0];
if(global_textures.size())
{
// Extract sun and moon texture IDs. These are used
// in the LLVOSky constructor, but I can't figure out
// how to pass them in. JC
LLUUID id = global_textures["sun_texture_id"];
if(id.notNull())
{
gSunTextureID = id;
}
id = global_textures["moon_texture_id"];
if(id.notNull())
{
gMoonTextureID = id;
}
}
#endif
// set the location of the Agent Appearance service, from which we can request
// avatar baked textures if they are supported by the current region
std::string agent_appearance_url = response["agent_appearance_service"];

View File

@ -1051,6 +1051,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.mShaderFiles.clear();
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
success = gWaterProgram.createShader(NULL, NULL);
}
@ -1852,6 +1853,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gDeferredWaterProgram.createShader(NULL, NULL);
}

View File

@ -74,11 +74,6 @@ static const LLVector2 TEX11 = LLVector2(1.f, 1.f);
static const F32 LIGHT_DIRECTION_THRESHOLD = (F32) cosf(DEG_TO_RAD * 1.f);
static const F32 COLOR_CHANGE_THRESHOLD = 0.01f;
// LAPRAS
// Exported globals
//LLUUID gSunTextureID = IMG_SUN;
//LLUUID gMoonTextureID = IMG_MOON;
/***************************************
SkyTex
***************************************/
@ -388,11 +383,6 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mSun.setIntensity(SUN_INTENSITY);
mMoon.setIntensity(0.1f * SUN_INTENSITY);
//mSunTexturep = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
//mSunTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
//mMoonTexturep = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
//mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1);
mBloomTexturep->setNoDelete() ;
mBloomTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);

View File

@ -42,12 +42,6 @@ const F32 HEAVENLY_BODY_DIST = HORIZON_DIST - 10.f;
const F32 HEAVENLY_BODY_FACTOR = 0.1f;
const F32 HEAVENLY_BODY_SCALE = HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR;
// HACK: Allow server to change sun and moon IDs.
// I can't figure out how to pass the appropriate
// information into the LLVOSky constructor. JC
//extern LLUUID gSunTextureID;
//extern LLUUID gMoonTextureID;
class LLFace;
class LLHaze;