summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-06-11 11:45:11 -0700
committerRider Linden <rider@lindenlab.com>2018-06-11 11:45:11 -0700
commit0f608cb764856ae8586a9d9631842a782cb70a23 (patch)
tree97a12c3bfcc14ae73df00c68141e9519493a0619 /indra
parent97da85de0b1e0f8c2fc60c156c31b237b869230a (diff)
parent4fbdfe637049e0a2e93c6fed030e61b32a43ae07 (diff)
Merge
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingssky.cpp14
-rw-r--r--indra/llinventory/llsettingssky.h2
-rw-r--r--indra/llrender/llglslshader.cpp11
-rw-r--r--indra/llrender/llrender.h9
-rw-r--r--indra/llrender/llshadermgr.cpp6
-rw-r--r--indra/llrender/llshadermgr.h2
-rw-r--r--indra/newview/app_settings/logcontrol.xml2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl63
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonV.glsl48
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl4
-rw-r--r--indra/newview/lldrawpoolwater.cpp25
-rw-r--r--indra/newview/lldrawpoolwater.h1
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp27
-rw-r--r--indra/newview/llface.cpp5
-rw-r--r--indra/newview/llface.h1
-rw-r--r--indra/newview/llsettingsvo.cpp2
-rw-r--r--indra/newview/llsky.cpp28
-rw-r--r--indra/newview/llsky.h5
-rw-r--r--indra/newview/llstartup.cpp4
-rw-r--r--indra/newview/lltoolgun.cpp9
-rw-r--r--indra/newview/llviewershadermgr.cpp32
-rw-r--r--indra/newview/llviewershadermgr.h1
-rw-r--r--indra/newview/llvosky.cpp184
-rw-r--r--indra/newview/llvosky.h20
-rw-r--r--indra/newview/llvovolume.cpp7
27 files changed, 417 insertions, 144 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 4763215cff..38574c4ef8 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -602,8 +602,8 @@ LLSD LLSettingsSky::defaults()
dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1;
dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID;
- dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow!
- dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID;
+ dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId();
+ dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId();
dfltsetting[SETTING_TYPE] = "sky";
@@ -1053,3 +1053,13 @@ LLUUID LLSettingsSky::GetDefaultAssetId()
{
return DEFAULT_ASSET_ID;
}
+
+LLUUID LLSettingsSky::GetDefaultSunTextureId()
+{
+ return DEFAULT_SUN_ID;
+}
+
+LLUUID LLSettingsSky::GetDefaultMoonTextureId()
+{
+ return DEFAULT_MOON_ID;
+}
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 6fb9aad342..c30efe0781 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -412,6 +412,8 @@ public:
virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
+ static LLUUID GetDefaultSunTextureId();
+ static LLUUID GetDefaultMoonTextureId();
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 37bcf0c163..ff79efcc5b 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -767,18 +767,19 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap");
S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap");
S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap");
+ S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap");
S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap");
std::set<S32> skip_index;
- if (-1 != diffuseMap && (-1 != specularMap || -1 != bumpMap || -1 != environmentMap))
+ if (-1 != diffuseMap && (-1 != specularMap || -1 != bumpMap || -1 != environmentMap || -1 != altDiffuseMap))
{
GLenum type;
GLsizei length;
GLint size = -1;
char name[1024];
- diffuseMap = specularMap = bumpMap = environmentMap = -1;
+ diffuseMap = altDiffuseMap = specularMap = bumpMap = environmentMap = -1;
for (S32 i = 0; i < activeCount; i++)
{
@@ -815,6 +816,12 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
environmentMap = i;
continue;
}
+
+ if (-1 == altDiffuseMap && std::string(name) == "altDiffuseMap")
+ {
+ altDiffuseMap = i;
+ continue;
+ }
}
bool specularDiff = specularMap < diffuseMap && -1 != specularMap;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 1bc5e89eac..62cd526550 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -265,10 +265,11 @@ public:
enum eTexIndex
{
- DIFFUSE_MAP = 0,
- NORMAL_MAP,
- SPECULAR_MAP,
- NUM_TEXTURE_CHANNELS,
+ DIFFUSE_MAP = 0,
+ ALTERNATE_DIFFUSE_MAP = 1,
+ NORMAL_MAP = 1,
+ SPECULAR_MAP = 2,
+ NUM_TEXTURE_CHANNELS = 3,
};
enum eVolumeTexIndex
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index fd187b99ee..ebdfbd89b2 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -552,8 +552,8 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
if (log.length() > 0)
{
- LL_INFOS("ShaderErrors") << "Shader loading from " << fname << ":\n" << LL_ENDL;
- LL_INFOS("ShaderErrors") << log << LL_ENDL;
+ LL_WARNS("ShaderLoading") << "Shader loading from " << fname << ":\n" << LL_ENDL;
+ LL_WARNS("ShaderLoading") << log << LL_ENDL;
}
}
@@ -1144,6 +1144,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("color");
mReservedUniforms.push_back("diffuseMap");
+ mReservedUniforms.push_back("altDiffuseMap");
mReservedUniforms.push_back("specularMap");
mReservedUniforms.push_back("bumpMap");
mReservedUniforms.push_back("environmentMap");
@@ -1309,6 +1310,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("scattering_texture");
mReservedUniforms.push_back("single_mie_scattering_texture");
mReservedUniforms.push_back("irradiance_texture");
+ mReservedUniforms.push_back("blend_factor");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 9919dbe31a..3fac21883f 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -74,6 +74,7 @@ public:
PROJECTOR_AMBIENT_LOD,
DIFFUSE_COLOR,
DIFFUSE_MAP,
+ ALTERNATE_DIFFUSE_MAP,
SPECULAR_MAP,
BUMP_MAP,
ENVIRONMENT_MAP,
@@ -227,6 +228,7 @@ public:
SCATTER_TEX,
SINGLE_MIE_SCATTER_TEX,
ILLUMINANCE_TEX,
+ BLEND_FACTOR,
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 951c8edcc7..670dfe2dec 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -50,8 +50,8 @@
</array>
<key>tags</key>
<array>
+ <string>ShaderErrors/string>
<!-- sample entry for debugging specific items
- <string>ShaderLoading</string>
<string>Avatar</string>
<string>Inventory</string>
<string>SceneLoadTiming</string>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 04237a6012..8649484d2f 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6617,6 +6617,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>MouseMoon</key>
+ <map>
+ <key>Comment</key>
+ <string />
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>MuteAmbient</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
index 0d8dab0a41..e918bdcb9d 100644
--- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
@@ -56,41 +56,7 @@ VARYING vec4 refCoord;
VARYING vec4 littleWave;
VARYING vec4 view;
-vec4 applyWaterFog(vec4 color, vec3 viewVec)
-{
- //normalize view vector
- vec3 view = normalize(viewVec);
- float es = -view.z;
-
- //find intersection point with water plane and eye vector
-
- //get eye depth
- float e0 = max(-waterPlane.w, 0.0);
-
- //get object depth
- float depth = length(viewVec);
-
- //get "thickness" of water
- float l = max(depth, 0.1);
-
- float kd = waterFogDensity;
- float ks = waterFogKS;
- vec4 kc = waterFogColor;
-
- float F = 0.98;
-
- float t1 = -kd * pow(F, ks * e0);
- float t2 = kd + ks * es;
- float t3 = pow(F, t2*l) - 1.0;
-
- float L = min(t1/t2*t3, 1.0);
-
- float D = pow(0.98, l*kd);
- //return vec4(1.0, 0.0, 1.0, 1.0);
- return color * D + kc * L;
- //depth /= 10.0;
- //return vec4(depth,depth,depth,0.0);
-}
+vec4 applyWaterFogView(vec3 pos, vec4 color);
void main()
{
@@ -108,5 +74,5 @@ void main()
vec4 fb = texture2D(screenTex, distort);
- frag_color = applyWaterFog(fb,view.xyz);
+ frag_color = applyWaterFogView(view.xyz, fb);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
new file mode 100644
index 0000000000..4d0d8882b9
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -0,0 +1,63 @@
+/**
+ * @file moonF.glsl
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+/*[EXTRA_CODE_HERE]*/
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+uniform vec4 color;
+uniform vec4 sunlight_color;
+uniform vec3 lumWeights;
+uniform float minLuminance;
+uniform sampler2D diffuseMap;
+uniform sampler2D altDiffuseMap;
+uniform float blend_factor; // interp factor between moon A/B
+VARYING vec2 vary_texcoord0;
+
+void main()
+{
+ vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
+ vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
+ vec4 c = mix(moonA, moonB, blend_factor);
+
+ c.rgb = fullbrightAtmosTransport(c.rgb);
+ c.rgb = fullbrightScaleSoftClip(c.rgb);
+ c.rgb = pow(c.rgb, vec3(0.45f));
+ // mix factor which blends when sunlight is brighter
+ // and shows true moon color at night
+ float mix = dot(normalize(sunlight_color.rgb), lumWeights);
+ mix = smoothstep(-0.5f, 2.0f, mix);
+ frag_color = vec4(c.rgb, mix * c.a);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
new file mode 100644
index 0000000000..7c4dfbd999
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
@@ -0,0 +1,48 @@
+/**
+ * @file moonV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+//void calcAtmospherics(vec3 inPositionEye);
+
+VARYING vec2 vary_texcoord0;
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz, 1.0);
+ vec4 pos = (modelview_matrix * vert);
+
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ //calcAtmospherics(pos.xyz);
+}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 371b32406c..9f56bff4c2 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -105,7 +105,7 @@ vec4 getPosition(vec2 pos_screen)
#ifdef WATER_FOG
-vec4 applyWaterFogDeferred(vec3 pos, vec4 color);
+vec4 applyWaterFogView(vec3 pos, vec4 color);
#endif
void main()
@@ -198,7 +198,7 @@ void main()
}
#ifdef WATER_FOG
- vec4 fogged = applyWaterFogDeferred(pos,vec4(col, bloom));
+ vec4 fogged = applyWaterFogView(pos,vec4(col, bloom));
col = fogged.rgb;
bloom = fogged.a;
#endif
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 9cd59c61ec..1ecf0ab8f9 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -68,15 +68,6 @@ F32 LLDrawPoolWater::sWaterFogEnd = 0.f;
LLDrawPoolWater::LLDrawPoolWater() :
LLFacePool(POOL_WATER)
{
- mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
- gGL.getTexUnit(0)->bind(mHBTex[0]) ;
- mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
-
- mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
- gGL.getTexUnit(0)->bind(mHBTex[1]);
- mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
-
-
mWaterImagep = LLViewerTextureManager::getFetchedTexture(TRANSPARENT_WATER_TEXTURE);
llassert(mWaterImagep);
mWaterImagep->setNoDelete();
@@ -461,7 +452,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
LLGLSNoFog noFog;
- gGL.getTexUnit(0)->bind(mHBTex[dr]);
+ gGL.getTexUnit(0)->bind((dr == 0) ? voskyp->getSunTex() : voskyp->getMoonTex());
LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV));
face->renderIndexed();
@@ -536,14 +527,14 @@ void LLDrawPoolWater::shade()
if (eyedepth < 0.f && LLPipeline::sWaterReflections)
{
- if (deferred_render)
- {
- shader = &gDeferredUnderWaterProgram;
- }
+ if (deferred_render)
+ {
+ shader = &gDeferredUnderWaterProgram;
+ }
else
- {
- shader = &gUnderWaterProgram;
- }
+ {
+ shader = &gUnderWaterProgram;
+ }
}
else if (deferred_render)
{
diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h
index 55f892d249..5df84bc8f0 100644
--- a/indra/newview/lldrawpoolwater.h
+++ b/indra/newview/lldrawpoolwater.h
@@ -37,7 +37,6 @@ class LLWaterSurface;
class LLDrawPoolWater: public LLFacePool
{
protected:
- LLPointer<LLViewerTexture> mHBTex[2];
LLPointer<LLViewerTexture> mWaterImagep;
LLPointer<LLViewerTexture> mOpaqueWaterImagep;
LLPointer<LLViewerTexture> mWaterNormp;
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index c6abba95bc..3e74b06a7f 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -52,7 +52,7 @@ LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL;
static LLGLSLShader* cloud_shader = NULL;
static LLGLSLShader* sky_shader = NULL;
-
+static LLGLSLShader* moon_shader = NULL;
LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
LLDrawPool(POOL_WL_SKY)
@@ -109,6 +109,11 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )
LLPipeline::sUnderWaterRender ?
&gObjectFullbrightNoColorWaterProgram :
&gWLCloudProgram;
+
+ moon_shader =
+ LLPipeline::sUnderWaterRender ?
+ &gObjectFullbrightNoColorWaterProgram :
+ &gWLMoonProgram;
}
void LLDrawPoolWLSky::endRenderPass( S32 pass )
@@ -275,6 +280,7 @@ void LLDrawPoolWLSky::renderStars(void) const
void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const
{
+#if REMOVE_BEFORE_FLIGHT
if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull())
{
LLGLEnable blend(GL_BLEND);
@@ -289,6 +295,7 @@ void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeigh
cloud_shader->unbind();
}
+#endif
}
void LLDrawPoolWLSky::renderHeavenlyBodies()
@@ -311,7 +318,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON];
- if (gSky.mVOSkyp->getMoon().getDraw() && face->getGeomCount())
+ if (gSky.mVOSkyp->getMoon().getDraw() && face->getGeomCount() && moon_shader)
{
// *NOTE: even though we already bound this texture above for the
// stars register combiners, we bind again here for defensive reasons,
@@ -328,8 +335,11 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
if (gPipeline.canUseVertexShaders())
{
- gHighlightProgram.bind();
- gHighlightProgram.uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
+ moon_shader->bind();
+ moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
+ moon_shader->uniform3fv(LLShaderMgr::GLOW_LUM_WEIGHTS, 1, LLPipeline::RenderGlowLumWeights.mV);
+ F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor();
+ moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
}
LLFacePool::LLOverrideFaceColor color_override(this, color);
@@ -338,7 +348,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
if (gPipeline.canUseVertexShaders())
{
- gHighlightProgram.unbind();
+ moon_shader->unbind();
}
}
}
@@ -380,10 +390,11 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
gDeferredStarProgram.bind();
- // *NOTE: have to bind a texture here since register combiners blending in
+ // *NOTE: have to bind moon textures here since register combiners blending in
// renderStars() requires something to be bound and we might as well only
- // bind the moon's texture once.
- gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture());
+ // bind the moon textures once.
+ gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(LLRender::DIFFUSE_MAP));
+ gGL.getTexUnit(1)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP));
renderHeavenlyBodies();
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 3f2247c9c5..1acb1650cd 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -306,6 +306,11 @@ void LLFace::setDiffuseMap(LLViewerTexture* tex)
setTexture(LLRender::DIFFUSE_MAP, tex);
}
+void LLFace::setAlternateDiffuseMap(LLViewerTexture* tex)
+{
+ setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, tex);
+}
+
void LLFace::setNormalMap(LLViewerTexture* tex)
{
setTexture(LLRender::NORMAL_MAP, tex);
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index ee545acb94..8531df8561 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -106,6 +106,7 @@ public:
void setDiffuseMap(LLViewerTexture* tex);
void setNormalMap(LLViewerTexture* tex);
void setSpecularMap(LLViewerTexture* tex);
+ void setAlternateDiffuseMap(LLViewerTexture* tex);
void switchTexture(U32 ch, LLViewerTexture* new_texture);
void dirtyTexture();
LLXformMatrix* getXform() const { return mXform; }
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 28d1371350..0ec7db2ed7 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -520,6 +520,8 @@ void LLSettingsVOSky::updateSettings()
LLVector3 sun_direction_cfr(sun_direction.mV[0], -sun_direction.mV[1], sun_direction.mV[2]);
LLVector3 moon_direction_cfr(moon_direction.mV[0], -moon_direction.mV[1], moon_direction.mV[2]);
gSky.setSunAndMoonDirectionsCFR(sun_direction_cfr, moon_direction_cfr);
+ gSky.setSunTextures(getSunTextureId(), getNextSunTextureId());
+ gSky.setMoonTextures(getMoonTextureId(), getNextMoonTextureId());
}
void LLSettingsVOSky::applySpecial(void *ptarget)
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 41fe206ada..6b7db9bb01 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -129,6 +129,20 @@ void LLSky::resetVertexBuffers()
}
}
+void LLSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next)
+{
+ if(mVOSkyp.notNull()) {
+ mVOSkyp->setSunTextures(sun_texture, sun_texture_next);
+ }
+}
+
+void LLSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next)
+{
+ if(mVOSkyp.notNull()) {
+ mVOSkyp->setMoonTextures(moon_texture, moon_texture_next);
+ }
+}
+
void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction)
{
if(mVOSkyp.notNull()) {
@@ -136,6 +150,20 @@ void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLV
}
}
+void LLSky::setSunDirectionCFR(const LLVector3 &sun_direction)
+{
+ if(mVOSkyp.notNull()) {
+ mVOSkyp->setSunDirectionCFR(sun_direction);
+ }
+}
+
+void LLSky::setMoonDirectionCFR(const LLVector3 &moon_direction)
+{
+ if(mVOSkyp.notNull()) {
+ mVOSkyp->setMoonDirectionCFR(moon_direction);
+ }
+}
+
//////////////////////////////////////////////////////////////////////
// Public Methods
//////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index 8e86853481..b618b9bfe6 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -53,6 +53,11 @@ public:
// These directions should be in CFR coord sys (+x at, +z up, +y right)
void setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction);
+ void setSunDirectionCFR(const LLVector3 &sun_direction);
+ void setMoonDirectionCFR(const LLVector3 &moon_direction);
+
+ void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next);
+ void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next);
LLColor4 getSkyFogColor() const;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e7a149ac0c..7430a2578f 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3499,6 +3499,8 @@ bool process_login_success_response()
}
}
+// LAPRAS
+#if 0
LLSD global_textures = response["global-textures"][0];
if(global_textures.size())
{
@@ -3516,8 +3518,8 @@ bool process_login_success_response()
{
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
diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp
index fb96804bfa..ee757f2566 100644
--- a/indra/newview/lltoolgun.cpp
+++ b/indra/newview/lltoolgun.cpp
@@ -108,7 +108,14 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
if (gSavedSettings.getBOOL("MouseSun"))
{
LLVector3 sunpos = LLViewerCamera::getInstance()->getAtAxis();
- gSky.setSunAndMoonDirectionsCFR(sunpos, -sunpos);
+ gSky.setSunDirectionCFR(sunpos);
+ gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
+ }
+
+ if (gSavedSettings.getBOOL("MouseMoon"))
+ {
+ LLVector3 moonpos = LLViewerCamera::getInstance()->getAtAxis();
+ gSky.setMoonDirectionCFR(moonpos);
gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 820e18290f..ebbf331d30 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -176,7 +176,7 @@ LLGLSLShader gImpostorProgram;
// WindLight shader handles
LLGLSLShader gWLSkyProgram;
LLGLSLShader gWLCloudProgram;
-
+LLGLSLShader gWLMoonProgram;
// Effects Shaders
LLGLSLShader gGlowProgram;
@@ -250,6 +250,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
//ONLY shaders that need WL Param management should be added here
mShaderList.push_back(&gWLSkyProgram);
mShaderList.push_back(&gWLCloudProgram);
+ mShaderList.push_back(&gWLMoonProgram);
mShaderList.push_back(&gAvatarProgram);
mShaderList.push_back(&gObjectShinyProgram);
mShaderList.push_back(&gObjectShinyNonIndexedProgram);
@@ -828,6 +829,7 @@ void LLViewerShaderMgr::unloadShaders()
gWLSkyProgram.unload();
gWLCloudProgram.unload();
+ gWLMoonProgram.unload();
gPostColorFilterProgram.unload();
gPostNightVisionProgram.unload();
@@ -1058,12 +1060,12 @@ BOOL LLViewerShaderMgr::loadShadersWater()
//load under water vertex shader
gUnderWaterProgram.mName = "Underwater Shader";
gUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gUnderWaterProgram.mFeatures.hasWaterFog = true;
gUnderWaterProgram.mShaderFiles.clear();
gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/underWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
- gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
- gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
-
+ gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
+ gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gUnderWaterProgram.createShader(NULL, NULL);
}
@@ -1858,6 +1860,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
// load water shader
gDeferredUnderWaterProgram.mName = "Deferred Under Water Shader";
gDeferredUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredUnderWaterProgram.mFeatures.hasWaterFog = true;
gDeferredUnderWaterProgram.mFeatures.hasGamma = true;
gDeferredUnderWaterProgram.mFeatures.hasTransport = true;
gDeferredUnderWaterProgram.mFeatures.hasSrgb = true;
@@ -3480,6 +3483,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
{
gWLSkyProgram.unload();
gWLCloudProgram.unload();
+ gWLMoonProgram.unload();
gDownsampleMinMaxDepthRectProgram.unload();
gInscatterRectProgram.unload();
return TRUE;
@@ -3503,7 +3507,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
success = gWLSkyProgram.createShader(NULL, NULL);
}
- if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+ if (success)
{
gWLCloudProgram.mName = "Windlight Cloud Program";
//gWLCloudProgram.mFeatures.hasGamma = true;
@@ -3515,6 +3519,24 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
success = gWLCloudProgram.createShader(NULL, NULL);
}
+ if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+ {
+ gWLMoonProgram.mName = "Windlight Moon Program";
+ gWLMoonProgram.mShaderFiles.clear();
+ gWLMoonProgram.mFeatures.calculatesAtmospherics = true;
+ gWLMoonProgram.mFeatures.hasTransport = true;
+ gWLMoonProgram.mFeatures.hasGamma = true;
+ gWLMoonProgram.mFeatures.hasAtmospherics = true;
+ gWLMoonProgram.mFeatures.isFullbright = true;
+ gWLMoonProgram.mFeatures.disableTextureIndex = true;
+ gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonV.glsl", GL_VERTEX_SHADER_ARB));
+ gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gWLMoonProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
+ gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ success = gWLMoonProgram.createShader(NULL, NULL);
+ }
+
return success;
}
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 10c60187f3..d4967ca5a5 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -279,6 +279,7 @@ extern LLGLSLShader gImpostorProgram;
// WindLight shader handles
extern LLGLSLShader gWLSkyProgram;
extern LLGLSLShader gWLCloudProgram;
+extern LLGLSLShader gWLMoonProgram;
// Post Process Shaders
extern LLGLSLShader gPostColorFilterProgram;
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index fc83218b1a..359415b185 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -74,9 +74,10 @@ 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;
+//LLUUID gSunTextureID = IMG_SUN;
+//LLUUID gMoonTextureID = IMG_MOON;
/***************************************
SkyTex
@@ -387,10 +388,11 @@ 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);
+ //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);
@@ -481,10 +483,15 @@ void LLVOSky::restoreGL()
{
mSkyTex[i].restoreGL();
}
- 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);
+
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+
+ if (psky)
+ {
+ setSunTextures(psky->getSunTextureId(), psky->getNextSunTextureId());
+ setMoonTextures(psky->getMoonTextureId(), psky->getNextMoonTextureId());
+ }
+
mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1);
mBloomTexturep->setNoDelete() ;
mBloomTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -715,10 +722,28 @@ bool LLVOSky::updateSky()
void LLVOSky::updateTextures()
{
- if (mSunTexturep)
+ if (mSunTexturep[0])
+ {
+ mSunTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
+
+ if (mSunTexturep[1])
+ {
+ mSunTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
+
+ if (mMoonTexturep[0])
{
- mSunTexturep->addTextureStats( (F32)MAX_IMAGE_AREA );
- mMoonTexturep->addTextureStats( (F32)MAX_IMAGE_AREA );
+ mMoonTexturep[0]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
+
+ if (mMoonTexturep[1])
+ {
+ mMoonTexturep[1]->addTextureStats( (F32)MAX_IMAGE_AREA );
+ }
+
+ if (mBloomTexturep)
+ {
mBloomTexturep->addTextureStats( (F32)MAX_IMAGE_AREA );
}
}
@@ -737,13 +762,60 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline)
mFace[FACE_SIDE0 + i] = mDrawable->addFace(poolp, NULL);
}
- mFace[FACE_SUN] = mDrawable->addFace(poolp, mSunTexturep);
- mFace[FACE_MOON] = mDrawable->addFace(poolp, mMoonTexturep);
- mFace[FACE_BLOOM] = mDrawable->addFace(poolp, mBloomTexturep);
+ mFace[FACE_SUN] = mDrawable->addFace(poolp, nullptr);
+ mFace[FACE_MOON] = mDrawable->addFace(poolp, nullptr);
+ mFace[FACE_BLOOM] = mDrawable->addFace(poolp, nullptr);
return mDrawable;
}
+void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next)
+{
+ mSunTexturep[0] = LLViewerTextureManager::getFetchedTexture(sun_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+ mSunTexturep[1] = LLViewerTextureManager::getFetchedTexture(sun_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+
+ if (mFace[FACE_SUN])
+ {
+ if (mSunTexturep[0])
+ {
+ mSunTexturep[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ mFace[FACE_SUN]->setTexture(LLRender::DIFFUSE_MAP, mSunTexturep[0]);
+
+ if (mSunTexturep[1])
+ {
+ mSunTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mFace[FACE_SUN]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mSunTexturep[1]);
+ }
+ }
+}
+
+void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next)
+{
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+
+ LLUUID moon_tex = moon_texture.isNull() ? psky->GetDefaultMoonTextureId() : moon_texture;
+ LLUUID moon_tex_next = moon_texture_next.isNull() ? (moon_texture.isNull() ? psky->GetDefaultMoonTextureId() : moon_texture) : moon_texture_next;
+
+ mMoonTexturep[0] = LLViewerTextureManager::getFetchedTexture(moon_tex, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+ mMoonTexturep[1] = LLViewerTextureManager::getFetchedTexture(moon_tex_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+
+ if (mFace[FACE_MOON])
+ {
+ if (mMoonTexturep[0])
+ {
+ mMoonTexturep[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
+ mFace[FACE_MOON]->setTexture(LLRender::DIFFUSE_MAP, mMoonTexturep[0]);
+
+ if (mMoonTexturep[1])
+ {
+ mMoonTexturep[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
+ mFace[FACE_MOON]->setTexture(LLRender::ALTERNATE_DIFFUSE_MAP, mMoonTexturep[1]);
+ }
+ }
+}
+
static LLTrace::BlockTimerStatHandle FTM_GEO_SKY("Sky Geometry");
BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
@@ -849,44 +921,18 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
const F32 height_above_water = camera_height - water_height;
bool sun_flag = FALSE;
-
if (mSun.isVisible())
- {
- if (mMoon.isVisible())
- {
- sun_flag = look_at * mSun.getDirection() > 0;
- }
- else
- {
- sun_flag = TRUE;
- }
+ {
+ sun_flag = !mMoon.isVisible() || ((look_at * mSun.getDirection()) > 0);
}
- if (height_above_water > 0)
- {
- bool render_ref = gPipeline.getPool(LLDrawPool::POOL_WATER)->getVertexShaderLevel() == 0;
-
- if (sun_flag)
- {
- setDrawRefl(0);
- if (render_ref)
- {
- updateReflectionGeometry(drawable, height_above_water, mSun);
- }
- }
- else
- {
- setDrawRefl(1);
- if (render_ref)
- {
- updateReflectionGeometry(drawable, height_above_water, mMoon);
- }
- }
- }
- else
- {
- setDrawRefl(-1);
- }
+ bool above_water = (height_above_water > 0);
+ bool render_ref = above_water && gPipeline.getPool(LLDrawPool::POOL_WATER)->getVertexShaderLevel() == 0;
+ setDrawRefl(above_water ? (sun_flag ? 0 : 1) : -1);
+ if (render_ref)
+ {
+ updateReflectionGeometry(drawable, height_above_water, mSun);
+ }
LLPipeline::sCompiles++;
return TRUE;
@@ -1354,3 +1400,39 @@ void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLV
LLSkyTex::stepCurrent();
}
+
+void LLVOSky::setSunDirectionCFR(const LLVector3 &sun_dir_cfr)
+{
+ mSun.setDirection(sun_dir_cfr);
+
+ mLastLightingDirection = mSun.getDirection();
+
+ // Push the sun "South" as it approaches directly overhead so that we can always see bump mapping
+ // on the upward facing faces of cubes.
+ {
+ // Same as dot product with the up direction + clamp.
+ F32 sunDot = llmax(0.f, sun_dir_cfr.mV[2]);
+ sunDot *= sunDot;
+
+ // Create normalized vector that has the sunDir pushed south about an hour and change.
+ LLVector3 adjustedDir = (sun_dir_cfr + LLVector3(0.f, -0.70711f, 0.70711f)) * 0.5f;
+
+ // Blend between normal sun dir and adjusted sun dir based on how close we are
+ // to having the sun overhead.
+ mBumpSunDir = adjustedDir * sunDot + sun_dir_cfr * (1.0f - sunDot);
+ mBumpSunDir.normalize();
+ }
+
+ updateDirections();
+
+ LLSkyTex::stepCurrent();
+}
+
+void LLVOSky::setMoonDirectionCFR(const LLVector3 &moon_dir_cfr)
+{
+ mMoon.setDirection(moon_dir_cfr);
+
+ updateDirections();
+
+ LLSkyTex::stepCurrent();
+}
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 4de3d12068..d6d294de6a 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -45,8 +45,8 @@ 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;
+//extern LLUUID gSunTextureID;
+//extern LLUUID gMoonTextureID;
class LLFace;
class LLHaze;
@@ -239,6 +239,8 @@ public:
// directions provided should already be in CFR coord sys (+x at, +z up, +y right)
void setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir, const LLVector3 &moon_dir);
+ void setSunDirectionCFR(const LLVector3 &sun_direction);
+ void setMoonDirectionCFR(const LLVector3 &moon_direction);
bool updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB);
@@ -267,9 +269,13 @@ public:
bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; }
LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; }
- LLViewerTexture* getSunTex() const { return mSunTexturep; }
- LLViewerTexture* getMoonTex() const { return mMoonTexturep; }
- LLViewerTexture* getBloomTex() const { return mBloomTexturep; }
+ LLViewerTexture* getSunTex() const { return mSunTexturep[0]; }
+ LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; }
+ LLViewerTexture* getBloomTex() const { return mBloomTexturep; }
+
+ void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next);
+ void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next);
+
void forceSkyUpdate(void) { mForceUpdate = TRUE; }
public:
@@ -284,8 +290,8 @@ protected:
void initSkyTextureDirs(const S32 side, const S32 tile);
void createSkyTexture(const S32 side, const S32 tile);
- LLPointer<LLViewerFetchedTexture> mSunTexturep;
- LLPointer<LLViewerFetchedTexture> mMoonTexturep;
+ LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
+ LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
LLPointer<LLViewerFetchedTexture> mBloomTexturep;
static S32 sResolution;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 7d6881f8a8..d4c8d4f923 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2152,7 +2152,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
switch(range_it->second.map)
{
- case LLRender::DIFFUSE_MAP:
+ case LLRender::DIFFUSE_MAP:
{
if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode())
{ //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE
@@ -2194,9 +2194,8 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
mat->setSpecularID(LLUUID::null);
} break;
- case LLRender::NUM_TEXTURE_CHANNELS:
- //nothing to do, make compiler happy
- break;
+ default:
+ break;
} //switch
} //for