Renderer update. Incl mac fixes, DoF improvements, windlight floater code cleanup. (shining-fixes merge)

This commit is contained in:
Shyotl
2012-02-09 14:26:21 -06:00
parent b0267e4631
commit f7b2139e81
35 changed files with 644 additions and 676 deletions

View File

@@ -2,31 +2,25 @@
* @file llvolumexml.cpp
* @brief LLVolumeXml base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -40,9 +34,9 @@
//============================================================================
LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params)
{
LLXMLNode *ret = new LLXMLNode("profile", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
@@ -52,9 +46,9 @@ LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params)
}
LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params)
{
LLXMLNode *ret = new LLXMLNode("path", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE);
ret->createChild("curve_type", TRUE)->setByteValue(1, &params->getCurveType());
ret->createChild("interval", FALSE)->setFloatValue(2, &params->getBegin());
ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV);
@@ -69,12 +63,15 @@ LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params)
}
LLXMLNode *LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params)
{
LLXMLNode *ret = new LLXMLNode("shape", FALSE);
LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE);
exportPathParams(&params->getPathParams())->setParent(ret);
exportProfileParams(&params->getProfileParams())->setParent(ret);
LLPointer<LLXMLNode> node ;
node = exportPathParams(&params->getPathParams()) ;
node->setParent(ret);
node = exportProfileParams(&params->getProfileParams()) ;
node->setParent(ret);
return ret;
}

View File

@@ -2,31 +2,25 @@
* @file llvolumexml.h
* @brief LLVolumeXml base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -40,11 +34,11 @@
class LLVolumeXml
{
public:
static LLXMLNode* exportProfileParams(const LLProfileParams* params);
static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params);
static LLXMLNode* exportPathParams(const LLPathParams* params);
static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params);
static LLXMLNode* exportVolumeParams(const LLVolumeParams* params);
static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params);
};
#endif // LL_LLVOLUMEXML_H

View File

@@ -2,31 +2,25 @@
* @file llcubemap.cpp
* @brief LLCubeMap class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
#include "linden_common.h"
@@ -266,7 +260,7 @@ void LLCubeMap::setMatrix(S32 stage)
if (mMatrixStage < 0) return;
if (stage > 0)
//if (stage > 0)
{
gGL.getTexUnit(stage)->activate();
}
@@ -285,17 +279,17 @@ void LLCubeMap::setMatrix(S32 stage)
gGL.loadMatrix((F32 *)trans.mMatrix);
gGL.matrixMode(LLRender::MM_MODELVIEW);
if (stage > 0)
/*if (stage > 0)
{
gGL.getTexUnit(0)->activate();
}
}*/
}
void LLCubeMap::restoreMatrix()
{
if (mMatrixStage < 0) return;
if (mMatrixStage > 0)
//if (mMatrixStage > 0)
{
gGL.getTexUnit(mMatrixStage)->activate();
}
@@ -303,10 +297,10 @@ void LLCubeMap::restoreMatrix()
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
if (mMatrixStage > 0)
/*if (mMatrixStage > 0)
{
gGL.getTexUnit(0)->activate();
}
}*/
}
void LLCubeMap::setReflection (void)

View File

@@ -2,31 +2,25 @@
* @file llcubemap.h
* @brief LLCubeMap class definition
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/

View File

@@ -1,32 +1,26 @@
/**
/**
* @file llrender.cpp
* @brief LLRender implementation
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -1009,7 +1003,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
const glh::matrix4f& mat = gGL.getModelviewMatrix();
mat.mult_matrix_dir(dir);
mSpotDirection.set(direction);
mSpotDirection.set(dir.v);
}
}
@@ -1446,6 +1440,8 @@ void LLRender::loadIdentity()
flush();
{
llassert_always(mMatrixMode < NUM_MATRIX_MODES) ;
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity();
mMatHash[mMatrixMode]++;
}

View File

@@ -7,31 +7,25 @@
* code, to define an interface for a multiple rendering API abstraction of the UI
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/

View File

@@ -1119,6 +1119,8 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("magnification");
mReservedUniforms.push_back("max_cof");
mReservedUniforms.push_back("res_scale");
mReservedUniforms.push_back("dof_width");
mReservedUniforms.push_back("dof_height");
mReservedUniforms.push_back("depthMap");
mReservedUniforms.push_back("shadowMap0");

View File

@@ -2,31 +2,25 @@
* @file llshadermgr.h
* @brief Shader Manager
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -148,6 +142,8 @@ public:
DOF_MAGNIFICATION,
DOF_MAX_COF,
DOF_RES_SCALE,
DOF_WIDTH,
DOF_HEIGHT,
DEFERRED_DEPTH,
DEFERRED_SHADOW0,

View File

@@ -798,14 +798,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
{
LLMemType mt2(LLMemType::MTYPE_VERTEX_CONSTRUCTOR);
if (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping)
{
mMappable = true;
}
else
{
mMappable = false;
}
mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
//zero out offsets
for (U32 i = 0; i < TYPE_MAX; i++)

View File

@@ -33,7 +33,6 @@
#include "v4math.h"
#include "v4coloru.h"
#include "llstrider.h"
#include "llmemory.h"
#include "llrender.h"
#include <set>
#include <vector>

View File

@@ -50,18 +50,18 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform float haze_horizon;
uniform float haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 max_y;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform vec4 cloud_color;
uniform vec4 cloud_scale;
uniform float cloud_scale;
void main()
{
@@ -77,7 +77,7 @@ void main()
// Set altitude
if (P.y > 0.)
{
P *= (max_y.x / P.y);
P *= (max_y / P.y);
}
else
{
@@ -99,12 +99,12 @@ void main()
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights
temp1 = blue_density + haze_density.x;
temp1 = blue_density + haze_density;
blue_weight = blue_density / temp1;
haze_weight = haze_density.x / temp1;
haze_weight = haze_density / temp1;
// Compute sunlight from P & lightnorm (for long rays like sky)
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -112,7 +112,7 @@ void main()
sunlight *= exp( - light_atten * temp2.y);
// Distance
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -136,14 +136,14 @@ void main()
// Increase ambient when there are more clouds
vec4 tmpAmbient = ambient;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
// Dim sunlight by cloud shadow percentage
sunlight *= (1. - cloud_shadow.x);
sunlight *= (1. - cloud_shadow);
// Haze color below cloud
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
);
// CLOUDS
@@ -164,13 +164,13 @@ void main()
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
// Make a nice cloud density based on the cloud_shadow value that was passed in.
vary_CloudDensity = 2. * (cloud_shadow.x - 0.25);
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
// Texture coords
vary_texcoord0 = texcoord0;
vary_texcoord0.xy -= 0.5;
vary_texcoord0.xy /= cloud_scale.x;
vary_texcoord0.xy /= cloud_scale;
vary_texcoord0.xy += 0.5;
vary_texcoord1 = vary_texcoord0;

View File

@@ -37,14 +37,24 @@ uniform vec2 screen_res;
uniform float max_cof;
uniform float res_scale;
uniform float dof_width;
uniform float dof_height;
VARYING vec2 vary_fragcoord;
vec4 dofSample(sampler2DRect tex, vec2 tc)
{
tc.x = min(tc.x, dof_width);
tc.y = min(tc.y, dof_height);
return texture2DRect(tex, tc);
}
void main()
{
vec2 tc = vary_fragcoord.xy;
vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale);
vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);

View File

@@ -44,19 +44,17 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform float haze_horizon;
uniform float haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 max_y;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform vec4 cloud_color;
uniform vec4 cloud_scale;
void main()
{
@@ -71,7 +69,7 @@ void main()
// Set altitude
if (P.y > 0.)
{
P *= (max_y.x / P.y);
P *= (max_y / P.y);
}
else
{
@@ -93,12 +91,12 @@ void main()
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights
temp1 = blue_density + haze_density.x;
temp1 = blue_density + haze_density;
blue_weight = blue_density / temp1;
haze_weight = haze_density.x / temp1;
haze_weight = haze_density / temp1;
// Compute sunlight from P & lightnorm (for long rays like sky)
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -106,7 +104,7 @@ void main()
sunlight *= exp( - light_atten * temp2.y);
// Distance
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -131,20 +129,20 @@ void main()
// Haze color above cloud
vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
);
// Increase ambient when there are more clouds
vec4 tmpAmbient = ambient;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
// Dim sunlight by cloud shadow percentage
sunlight *= (1. - cloud_shadow.x);
sunlight *= (1. - cloud_shadow);
// Haze color below cloud
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
);
// Final atmosphere additive

View File

@@ -51,12 +51,12 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 distance_multiplier;
uniform vec4 max_y;
uniform float haze_horizon;
uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 env_mat;
@@ -161,13 +161,13 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//sunlight attenuation effect (hue and brightness) due to atmosphere
//this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
//I had thought blue_density and haze_density should have equal weighting,
//but attenuation due to haze_density tends to seem too strong
temp1 = blue_density + vec4(haze_density.r);
temp1 = blue_density + vec4(haze_density);
blue_weight = blue_density / temp1;
haze_weight = vec4(haze_density.r) / temp1;
haze_weight = vec4(haze_density) / temp1;
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
temp2.y = max(0.0, tmpLightnorm.y);
@@ -175,12 +175,12 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
sunlight *= exp( - light_atten * temp2.y);
// main atmospheric scattering line integral
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
// compiler gets confused.
temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
temp1 = exp(-temp1 * temp2.z * distance_multiplier);
//final atmosphere attenuation factor
setAtmosAttenuation(temp1.rgb);
@@ -201,7 +201,7 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
temp2.x += .25;
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
@@ -215,8 +215,8 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//haze color
setAdditiveColor(
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
+ tmpAmbient)));
//brightness of surface both sunlight and ambient

View File

@@ -51,12 +51,12 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 distance_multiplier;
uniform vec4 max_y;
uniform float haze_horizon;
uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 env_mat;
@@ -161,13 +161,13 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//sunlight attenuation effect (hue and brightness) due to atmosphere
//this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
//I had thought blue_density and haze_density should have equal weighting,
//but attenuation due to haze_density tends to seem too strong
temp1 = blue_density + vec4(haze_density.r);
temp1 = blue_density + vec4(haze_density);
blue_weight = blue_density / temp1;
haze_weight = vec4(haze_density.r) / temp1;
haze_weight = vec4(haze_density) / temp1;
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
temp2.y = max(0.0, tmpLightnorm.y);
@@ -175,12 +175,12 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
sunlight *= exp( - light_atten * temp2.y);
// main atmospheric scattering line integral
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
// compiler gets confused.
temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
temp1 = exp(-temp1 * temp2.z * distance_multiplier);
//final atmosphere attenuation factor
setAtmosAttenuation(temp1.rgb);
@@ -201,7 +201,7 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
temp2.x += .25;
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
@@ -215,8 +215,8 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//haze color
setAdditiveColor(
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
+ tmpAmbient)));
//brightness of surface both sunlight and ambient

View File

@@ -47,12 +47,12 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 distance_multiplier;
uniform vec4 max_y;
uniform float haze_horizon;
uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
void calcAtmospherics(vec3 inPositionEye) {
@@ -61,8 +61,8 @@ void calcAtmospherics(vec3 inPositionEye) {
setPositionEye(P);
//(TERRAIN) limit altitude
if (P.y > max_y.x) P *= (max_y.x / P.y);
if (P.y < -max_y.x) P *= (-max_y.x / P.y);
if (P.y > max_y) P *= (max_y / P.y);
if (P.y < -max_y) P *= (-max_y / P.y);
vec3 tmpLightnorm = lightnorm.xyz;
@@ -78,13 +78,13 @@ void calcAtmospherics(vec3 inPositionEye) {
//sunlight attenuation effect (hue and brightness) due to atmosphere
//this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
//I had thought blue_density and haze_density should have equal weighting,
//but attenuation due to haze_density tends to seem too strong
temp1 = blue_density + vec4(haze_density.r);
temp1 = blue_density + vec4(haze_density);
blue_weight = blue_density / temp1;
haze_weight = vec4(haze_density.r) / temp1;
haze_weight = vec4(haze_density) / temp1;
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
temp2.y = max(0.0, tmpLightnorm.y);
@@ -92,12 +92,12 @@ void calcAtmospherics(vec3 inPositionEye) {
sunlight *= exp( - light_atten * temp2.y);
// main atmospheric scattering line integral
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
// ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati
// compiler gets confused.
temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
temp1 = exp(-temp1 * temp2.z * distance_multiplier);
//final atmosphere attenuation factor
setAtmosAttenuation(temp1.rgb);
@@ -122,12 +122,12 @@ void calcAtmospherics(vec3 inPositionEye) {
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
//haze color
setAdditiveColor(
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
+ tmpAmbient)));
//brightness of surface both sunlight and ambient

View File

@@ -49,18 +49,18 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform float haze_horizon;
uniform float haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 max_y;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform vec4 cloud_color;
uniform vec4 cloud_scale;
uniform float cloud_scale;
void main()
{
@@ -76,7 +76,7 @@ void main()
// Set altitude
if (P.y > 0.)
{
P *= (max_y.x / P.y);
P *= (max_y / P.y);
}
else
{
@@ -98,12 +98,12 @@ void main()
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights
temp1 = blue_density + haze_density.x;
temp1 = blue_density + haze_density;
blue_weight = blue_density / temp1;
haze_weight = haze_density.x / temp1;
haze_weight = haze_density / temp1;
// Compute sunlight from P & lightnorm (for long rays like sky)
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -111,7 +111,7 @@ void main()
sunlight *= exp( - light_atten * temp2.y);
// Distance
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -135,14 +135,14 @@ void main()
// Increase ambient when there are more clouds
vec4 tmpAmbient = ambient;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
// Dim sunlight by cloud shadow percentage
sunlight *= (1. - cloud_shadow.x);
sunlight *= (1. - cloud_shadow);
// Haze color below cloud
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
);
// CLOUDS
@@ -163,13 +163,13 @@ void main()
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
// Make a nice cloud density based on the cloud_shadow value that was passed in.
vary_CloudDensity = 2. * (cloud_shadow.x - 0.25);
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
// Texture coords
vary_texcoord0 = texcoord0;
vary_texcoord0.xy -= 0.5;
vary_texcoord0.xy /= cloud_scale.x;
vary_texcoord0.xy /= cloud_scale;
vary_texcoord0.xy += 0.5;
vary_texcoord1 = vary_texcoord0;

View File

@@ -42,19 +42,17 @@ uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
uniform vec4 haze_horizon;
uniform vec4 haze_density;
uniform float haze_horizon;
uniform float haze_density;
uniform vec4 cloud_shadow;
uniform vec4 density_multiplier;
uniform vec4 max_y;
uniform float cloud_shadow;
uniform float density_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform vec4 cloud_color;
uniform vec4 cloud_scale;
void main()
{
@@ -68,7 +66,7 @@ void main()
// Set altitude
if (P.y > 0.)
{
P *= (max_y.x / P.y);
P *= (max_y / P.y);
}
else
{
@@ -90,12 +88,12 @@ void main()
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x);
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights
temp1 = blue_density + haze_density.x;
temp1 = blue_density + haze_density;
blue_weight = blue_density / temp1;
haze_weight = haze_density.x / temp1;
haze_weight = haze_density / temp1;
// Compute sunlight from P & lightnorm (for long rays like sky)
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
@@ -103,7 +101,7 @@ void main()
sunlight *= exp( - light_atten * temp2.y);
// Distance
temp2.z = Plen * density_multiplier.x;
temp2.z = Plen * density_multiplier;
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
@@ -128,20 +126,20 @@ void main()
// Haze color above cloud
vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
);
// Increase ambient when there are more clouds
vec4 tmpAmbient = ambient;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5;
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
// Dim sunlight by cloud shadow percentage
sunlight *= (1. - cloud_shadow.x);
sunlight *= (1. - cloud_shadow);
// Haze color below cloud
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
);
// Final atmosphere additive

View File

@@ -42,7 +42,6 @@
#include "llcubemap.h"
#include "llsky.h"
#include "llagent.h"
#include "lldrawable.h"
#include "llface.h"
#include "llviewercamera.h"

View File

@@ -43,7 +43,6 @@
#include "llglheaders.h"
#include "llrender.h"
#include "llagent.h"
#include "llcubemap.h"
#include "lldrawable.h"
#include "llface.h"

View File

@@ -2,31 +2,25 @@
* @file lldrawpoolsimple.cpp
* @brief LLDrawPoolSimple class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -35,7 +29,6 @@
#include "lldrawpoolsimple.h"
#include "llviewercamera.h"
#include "llagent.h"
#include "lldrawable.h"
#include "llface.h"
#include "llsky.h"

View File

@@ -71,6 +71,8 @@ LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL;
std::set<std::string> LLFloaterWindLight::sDefaultPresets;
static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
static const F32 WL_BLUE_HORIZON_DENSITY_SCALE = 2.0f;
static const F32 WL_CLOUD_SLIDER_SCALE = 1.0f;
LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater"))
{
@@ -308,7 +310,7 @@ void LLFloaterWindLight::syncMenu()
LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
LLWLParamSet& currentParams = param_mgr->mCurParams;
LLWLParamSet& cur_params = param_mgr->mCurParams;
//std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues;
// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
@@ -320,59 +322,37 @@ void LLFloaterWindLight::syncMenu()
// [/RLVa:KB]
// blue horizon
param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err);
childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0);
childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0);
childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0);
childSetValue("WLBlueHorizonI",
std::max(param_mgr->mBlueHorizon.r / 2.0,
std::max(param_mgr->mBlueHorizon.g / 2.0,
param_mgr->mBlueHorizon.b / 2.0)));
param_mgr->mBlueHorizon = cur_params.getVector(param_mgr->mBlueHorizon.mName, err);
setColorSwatch("WLBlueHorizon", param_mgr->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE);
// haze density, horizon, mult, and altitude
param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err);
childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r);
param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err);
childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r);
param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err);
childSetValue("WLDensityMult", param_mgr->mDensityMult.x *
param_mgr->mDensityMult.mult);
param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err);
childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x);
param_mgr->mHazeDensity = cur_params.getFloat(param_mgr->mHazeDensity.mName, err);
childSetValue("WLHazeDensity", (F32) param_mgr->mHazeDensity);
param_mgr->mHazeHorizon = cur_params.getFloat(param_mgr->mHazeHorizon.mName, err);
childSetValue("WLHazeHorizon", (F32) param_mgr->mHazeHorizon);
param_mgr->mDensityMult = cur_params.getFloat(param_mgr->mDensityMult.mName, err);
childSetValue("WLDensityMult", ((F32) param_mgr->mDensityMult) * param_mgr->mDensityMult.mult);
param_mgr->mMaxAlt = cur_params.getFloat(param_mgr->mMaxAlt.mName, err);
childSetValue("WLMaxAltitude", (F32) param_mgr->mMaxAlt);
// blue density
param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err);
childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0);
childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0);
childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0);
childSetValue("WLBlueDensityI",
std::max(param_mgr->mBlueDensity.r / 2.0,
std::max(param_mgr->mBlueDensity.g / 2.0, param_mgr->mBlueDensity.b / 2.0)));
param_mgr->mBlueDensity = cur_params.getVector(param_mgr->mBlueDensity.mName, err);
setColorSwatch("WLBlueDensity", param_mgr->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE);
// Lighting
// sunlight
param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err);
childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLSunlightI",
std::max(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE,
std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE)));
param_mgr->mSunlight = cur_params.getVector(param_mgr->mSunlight.mName, err);
setColorSwatch("WLSunlight", param_mgr->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
// glow
param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err);
param_mgr->mGlow = cur_params.getVector(param_mgr->mGlow.mName, err);
childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f);
childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f);
// ambient
param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err);
childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLAmbientI",
std::max(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE,
std::max(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE)));
param_mgr->mAmbient = cur_params.getVector(param_mgr->mAmbient.mName, err);
setColorSwatch("WLAmbient", param_mgr->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE);
childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI);
childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI);
@@ -380,31 +360,26 @@ void LLFloaterWindLight::syncMenu()
// Clouds
// Cloud Color
param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err);
childSetValue("WLCloudColorR", param_mgr->mCloudColor.r);
childSetValue("WLCloudColorG", param_mgr->mCloudColor.g);
childSetValue("WLCloudColorB", param_mgr->mCloudColor.b);
childSetValue("WLCloudColorI",
std::max(param_mgr->mCloudColor.r,
std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b)));
param_mgr->mCloudColor = cur_params.getVector(param_mgr->mCloudColor.mName, err);
setColorSwatch("WLCloudColor", param_mgr->mCloudColor, WL_CLOUD_SLIDER_SCALE);
// Cloud
param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err);
param_mgr->mCloudMain = cur_params.getVector(param_mgr->mCloudMain.mName, err);
childSetValue("WLCloudX", param_mgr->mCloudMain.r);
childSetValue("WLCloudY", param_mgr->mCloudMain.g);
childSetValue("WLCloudDensity", param_mgr->mCloudMain.b);
// Cloud Detail
param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err);
param_mgr->mCloudDetail = cur_params.getVector(param_mgr->mCloudDetail.mName, err);
childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r);
childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g);
childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
// Cloud extras
param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err);
param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err);
childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x);
childSetValue("WLCloudScale", param_mgr->mCloudScale.x);
param_mgr->mCloudCoverage = cur_params.getFloat(param_mgr->mCloudCoverage.mName, err);
param_mgr->mCloudScale = cur_params.getFloat(param_mgr->mCloudScale.mName, err);
childSetValue("WLCloudCoverage", (F32) param_mgr->mCloudCoverage);
childSetValue("WLCloudScale", (F32) param_mgr->mCloudScale);
// cloud scrolling
bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX();
@@ -414,16 +389,20 @@ void LLFloaterWindLight::syncMenu()
childSetValue("DrawClassicClouds", gSavedSettings.getBOOL("SkyUseClassicClouds"));
// disable if locked, enable if not
if(lockX)
if (lockX)
{
childDisable("WLCloudScrollX");
} else {
}
else
{
childEnable("WLCloudScrollX");
}
if(lockY)
if (lockY)
{
childDisable("WLCloudScrollY");
} else {
}
else
{
childEnable("WLCloudScrollY");
}
@@ -431,17 +410,32 @@ void LLFloaterWindLight::syncMenu()
childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err);
childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x);
param_mgr->mDistanceMult = cur_params.getFloat(param_mgr->mDistanceMult.mName, err);
childSetValue("WLDistanceMult", (F32) param_mgr->mDistanceMult);
// Tweak extras
param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err);
childSetValue("WLGamma", param_mgr->mWLGamma.x);
param_mgr->mWLGamma = cur_params.getFloat(param_mgr->mWLGamma.mName, err);
childSetValue("WLGamma", (F32) param_mgr->mWLGamma);
childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
}
void LLFloaterWindLight::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
{
std::string child_name(name);
LLVector4 color_vec = from_ctrl;
color_vec/=k;
child_name.push_back('R');
childSetValue(name.data(), color_vec[0]);
child_name.replace(child_name.length()-1,1,1,'G');
childSetValue(child_name, color_vec[1]);
child_name.replace(child_name.length()-1,1,1,'B');
childSetValue(child_name, color_vec[2]);
child_name.replace(child_name.length()-1,1,1,'I');
childSetValue(child_name, llmax(color_vec.mV[0], color_vec.mV[1], color_vec.mV[2]));
}
// static
LLFloaterWindLight* LLFloaterWindLight::instance()
@@ -497,240 +491,238 @@ void LLFloaterWindLight::onClose(bool app_quitting)
}
// color control callbacks
void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
colorControl->r = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
colorControl->r *= 3;
color_ctrl->r = sldr_ctrl->getValueF32();
if (color_ctrl->isSunOrAmbientColor)
{
color_ctrl->r *= WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->isBlueHorizonOrDensity)
{
color_ctrl->r *= WL_BLUE_HORIZON_DENSITY_SCALE;
}
if(colorControl->isBlueHorizonOrDensity) {
colorControl->r *= 2;
}
// move i if it's the max
if(colorControl->r >= colorControl->g && colorControl->r >= colorControl->b
&& colorControl->hasSliderName) {
colorControl->i = colorControl->r;
std::string name = colorControl->mSliderName;
if (color_ctrl->r >= color_ctrl->g && color_ctrl->r >= color_ctrl->b && color_ctrl->hasSliderName)
{
color_ctrl->i = color_ctrl->r;
std::string name = color_ctrl->mSliderName;
name.append("I");
if(colorControl->isSunOrAmbientColor) {
sWindLight->childSetValue(name, colorControl->r / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
sWindLight->childSetValue(name, colorControl->r / 2);
} else {
sWindLight->childSetValue(name, colorControl->r);
if (color_ctrl->isSunOrAmbientColor)
{
sWindLight->childSetValue(name, color_ctrl->r / WL_SUN_AMBIENT_SLIDER_SCALE);
}
else if (color_ctrl->isBlueHorizonOrDensity)
{
sWindLight->childSetValue(name, color_ctrl->r / WL_BLUE_HORIZON_DENSITY_SCALE);
}
else
{
sWindLight->childSetValue(name, color_ctrl->r);
}
}
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
colorControl->g = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
colorControl->g *= 3;
color_ctrl->g = sldr_ctrl->getValueF32();
if (color_ctrl->isSunOrAmbientColor)
{
color_ctrl->g *= WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->isBlueHorizonOrDensity)
{
color_ctrl->g *= WL_BLUE_HORIZON_DENSITY_SCALE;
}
if(colorControl->isBlueHorizonOrDensity) {
colorControl->g *= 2;
}
// move i if it's the max
if(colorControl->g >= colorControl->r && colorControl->g >= colorControl->b
&& colorControl->hasSliderName) {
colorControl->i = colorControl->g;
std::string name = colorControl->mSliderName;
if (color_ctrl->g >= color_ctrl->r && color_ctrl->g >= color_ctrl->b && color_ctrl->hasSliderName)
{
color_ctrl->i = color_ctrl->g;
std::string name = color_ctrl->mSliderName;
name.append("I");
if(colorControl->isSunOrAmbientColor) {
sWindLight->childSetValue(name, colorControl->g / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
sWindLight->childSetValue(name, colorControl->g / 2);
} else {
sWindLight->childSetValue(name, colorControl->g);
if (color_ctrl->isSunOrAmbientColor)
{
sWindLight->childSetValue(name, color_ctrl->g / WL_SUN_AMBIENT_SLIDER_SCALE);
}
else if (color_ctrl->isBlueHorizonOrDensity)
{
sWindLight->childSetValue(name, color_ctrl->g / WL_BLUE_HORIZON_DENSITY_SCALE);
}
else
{
sWindLight->childSetValue(name, color_ctrl->g);
}
}
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
colorControl->b = sldrCtrl->getValueF32();
if(colorControl->isSunOrAmbientColor) {
colorControl->b *= 3;
color_ctrl->b = sldr_ctrl->getValueF32();
if (color_ctrl->isSunOrAmbientColor)
{
color_ctrl->b *= WL_SUN_AMBIENT_SLIDER_SCALE;
}
if (color_ctrl->isBlueHorizonOrDensity)
{
color_ctrl->b *= WL_BLUE_HORIZON_DENSITY_SCALE;
}
if(colorControl->isBlueHorizonOrDensity) {
colorControl->b *= 2;
}
// move i if it's the max
if(colorControl->b >= colorControl->r && colorControl->b >= colorControl->g
&& colorControl->hasSliderName) {
colorControl->i = colorControl->b;
std::string name = colorControl->mSliderName;
if (color_ctrl->b >= color_ctrl->r && color_ctrl->b >= color_ctrl->g && color_ctrl->hasSliderName)
{
color_ctrl->i = color_ctrl->b;
std::string name = color_ctrl->mSliderName;
name.append("I");
if(colorControl->isSunOrAmbientColor) {
sWindLight->childSetValue(name, colorControl->b / 3);
} else if(colorControl->isBlueHorizonOrDensity) {
sWindLight->childSetValue(name, colorControl->b / 2);
} else {
sWindLight->childSetValue(name, colorControl->b);
if (color_ctrl->isSunOrAmbientColor)
{
sWindLight->childSetValue(name, color_ctrl->b / WL_SUN_AMBIENT_SLIDER_SCALE);
}
else if (color_ctrl->isBlueHorizonOrDensity)
{
sWindLight->childSetValue(name, color_ctrl->b / WL_BLUE_HORIZON_DENSITY_SCALE);
}
else
{
sWindLight->childSetValue(name, color_ctrl->b);
}
}
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * color_ctrl = static_cast<WLColorControl *>(userData);
colorControl->i = sldrCtrl->getValueF32();
color_ctrl->i = sldr_ctrl->getValueF32();
// only for sliders where we pass a name
if(colorControl->hasSliderName) {
if(color_ctrl->hasSliderName)
{
// set it to the top
F32 maxVal = std::max(std::max(colorControl->r, colorControl->g), colorControl->b);
F32 iVal;
if(colorControl->isSunOrAmbientColor)
{
iVal = colorControl->i * 3;
}
else if(colorControl->isBlueHorizonOrDensity)
{
iVal = colorControl->i * 2;
}
else
{
iVal = colorControl->i;
}
// get the names of the other sliders
std::string rName = colorControl->mSliderName;
rName.append("R");
std::string gName = colorControl->mSliderName;
gName.append("G");
std::string bName = colorControl->mSliderName;
bName.append("B");
F32 maxVal = std::max(std::max(color_ctrl->r, color_ctrl->g), color_ctrl->b);
F32 scale = 1.f;
if(color_ctrl->isSunOrAmbientColor)
scale = WL_SUN_AMBIENT_SLIDER_SCALE;
else if(color_ctrl->isBlueHorizonOrDensity)
WL_BLUE_HORIZON_DENSITY_SCALE;
F32 iVal = color_ctrl->i * scale;
// handle if at 0
if(iVal == 0) {
colorControl->r = 0;
colorControl->g = 0;
colorControl->b = 0;
if(iVal == 0)
{
color_ctrl->r = 0;
color_ctrl->g = 0;
color_ctrl->b = 0;
// if all at the start
// set them all to the intensity
} else if (maxVal == 0) {
colorControl->r = iVal;
colorControl->g = iVal;
colorControl->b = iVal;
} else {
}
else if (maxVal == 0)
{
color_ctrl->r = iVal;
color_ctrl->g = iVal;
color_ctrl->b = iVal;
}
else
{
// add delta amounts to each
F32 delta = (iVal - maxVal) / maxVal;
colorControl->r *= (1.0f + delta);
colorControl->g *= (1.0f + delta);
colorControl->b *= (1.0f + delta);
color_ctrl->r *= (1.0f + delta);
color_ctrl->g *= (1.0f + delta);
color_ctrl->b *= (1.0f + delta);
}
// divide sun color vals by three
if(colorControl->isSunOrAmbientColor)
{
sWindLight->childSetValue(rName, colorControl->r/3);
sWindLight->childSetValue(gName, colorControl->g/3);
sWindLight->childSetValue(bName, colorControl->b/3);
}
else if(colorControl->isBlueHorizonOrDensity)
{
sWindLight->childSetValue(rName, colorControl->r/2);
sWindLight->childSetValue(gName, colorControl->g/2);
sWindLight->childSetValue(bName, colorControl->b/2);
}
else
{
// set the sliders to the new vals
sWindLight->childSetValue(rName, colorControl->r);
sWindLight->childSetValue(gName, colorControl->g);
sWindLight->childSetValue(bName, colorControl->b);
}
// set the sliders to the new vals
std::string child_name(color_ctrl->mSliderName);
child_name.push_back('R');
sWindLight->childSetValue(child_name, color_ctrl->r/scale);
child_name.replace(child_name.length()-1,1,1,'G');
sWindLight->childSetValue(child_name, color_ctrl->g/scale);
child_name.replace(child_name.length()-1,1,1,'B');
sWindLight->childSetValue(child_name, color_ctrl->b/scale);
}
// now update the current parameters and send them to shaders
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
/// GLOW SPECIFIC CODE
void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
// scaled by 20
colorControl->r = (2 - sldrCtrl->getValueF32()) * 20;
color_ctrl->r = (2 - sldr_ctrl->getValueF32()) * 20;
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
/// \NOTE that we want NEGATIVE (-) B
void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
/// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
colorControl->b = -sldrCtrl->getValueF32() * 5;
color_ctrl->b = -sldr_ctrl->getValueF32() * 5;
colorControl->update(LLWLParamManager::getInstance()->mCurParams);
color_ctrl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
}
void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
WLFloatControl * floatControl = static_cast<WLFloatControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
floatControl->x = sldrCtrl->getValueF32() / floatControl->mult;
floatControl->x = sldr_ctrl->getValueF32() / floatControl->mult;
floatControl->update(LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->propagateParameters();
@@ -738,7 +730,7 @@ void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
@@ -752,12 +744,12 @@ void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData)
// time of day
void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle");
LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle");
WLColorControl * colorControl = static_cast<WLColorControl *>(userData);
WLColorControl * color_ctrl = static_cast<WLColorControl *>(userData);
// get the two angles
LLWLParamManager * param_mgr = LLWLParamManager::getInstance();
@@ -766,20 +758,20 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData)
param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32());
// set the sun vector
colorControl->r = -sin(param_mgr->mCurParams.getEastAngle()) *
color_ctrl->r = -sin(param_mgr->mCurParams.getEastAngle()) *
cos(param_mgr->mCurParams.getSunAngle());
colorControl->g = sin(param_mgr->mCurParams.getSunAngle());
colorControl->b = cos(param_mgr->mCurParams.getEastAngle()) *
color_ctrl->g = sin(param_mgr->mCurParams.getSunAngle());
color_ctrl->b = cos(param_mgr->mCurParams.getEastAngle()) *
cos(param_mgr->mCurParams.getSunAngle());
colorControl->i = 1.f;
color_ctrl->i = 1.f;
colorControl->update(param_mgr->mCurParams);
color_ctrl->update(param_mgr->mCurParams);
param_mgr->propagateParameters();
}
void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
F32 * tweak = static_cast<F32 *>(userData);
@@ -790,7 +782,7 @@ void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
@@ -974,36 +966,35 @@ void LLFloaterWindLight::onOpenDayCycle(void* userData)
// Clouds
void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldr_ctrl->getValueF32() + 10.0f);
}
void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
// *HACK all cloud scrolling is off by an additive of 10.
LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f);
// *HACK all cloud scrolling is off by an additive of 10.
LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldr_ctrl->getValueF32() + 10.0f);
}
void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
bool lock = cbCtrl->get();
bool lock = cb_ctrl->get();
LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock);
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>(
"WLCloudScrollX");
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>("WLCloudScrollX");
if(cbCtrl->get())
if (cb_ctrl->get())
{
sldr->setEnabled(false);
}
@@ -1016,16 +1007,15 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData)
{
deactivateAnimator();
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
bool lock = cbCtrl->get();
LLCheckBoxCtrl* cb_ctrl = static_cast<LLCheckBoxCtrl*>(ctrl);
bool lock = cb_ctrl->get();
LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>(
"WLCloudScrollY");
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>("WLCloudScrollY");
if(cbCtrl->get())
if (cb_ctrl->get())
{
sldr->setEnabled(false);
}
@@ -1035,10 +1025,6 @@ void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData)
}
}
void LLFloaterWindLight::deactivateAnimator()
{
LLWLParamManager::getInstance()->mAnimator.deactivate();
}
void LLFloaterWindLight::onClickNext(void* user_data)
{

View File

@@ -67,6 +67,8 @@ public:
static bool newPromptCallback(const LLSD& notification, const LLSD& response);
void setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k);
/// general purpose callbacks for dealing with color controllers
static void onColorControlRMoved(LLUICtrl* ctrl, void* userData);
static void onColorControlGMoved(LLUICtrl* ctrl, void* userData);
@@ -133,8 +135,6 @@ public:
/// sync up sliders with parameters
void syncMenu();
/// turn off animated skies
static void deactivateAnimator();
static void selectTab(std::string tab_name);

View File

@@ -2,31 +2,25 @@
* @file llvosky.cpp
* @brief LLVOSky class implementation
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -348,7 +342,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
blue_density = LLColor3();
blue_horizon = LLColor3();
haze_density = 0.f;
haze_horizon = LLColor3();
haze_horizon = 1.f;
density_multiplier = 0.f;
max_y = 0.f;
glow = LLColor3();
@@ -659,17 +653,17 @@ void LLVOSky::initAtmospherics(void)
sunlight_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("sunlight_color", error));
ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("ambient", error));
//lightnorm = LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error);
gamma = LLWLParamManager::getInstance()->mCurParams.getVector("gamma", error)[0];
gamma = LLWLParamManager::getInstance()->mCurParams.getFloat("gamma", error);
blue_density = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_density", error));
blue_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_horizon", error));
haze_density = LLWLParamManager::getInstance()->mCurParams.getVector("haze_density", error)[0];
haze_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("haze_horizon", error));
density_multiplier = LLWLParamManager::getInstance()->mCurParams.getVector("density_multiplier", error)[0];
max_y = LLWLParamManager::getInstance()->mCurParams.getVector("max_y", error)[0];
haze_density = LLWLParamManager::getInstance()->mCurParams.getFloat("haze_density", error);
haze_horizon = LLWLParamManager::getInstance()->mCurParams.getFloat("haze_horizon", error);
density_multiplier = LLWLParamManager::getInstance()->mCurParams.getFloat("density_multiplier", error);
max_y = LLWLParamManager::getInstance()->mCurParams.getFloat("max_y", error);
glow = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("glow", error));
cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_shadow", error)[0];
cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", error);
cloud_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_color", error));
cloud_scale = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_scale", error)[0];
cloud_scale = LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_scale", error);
cloud_pos_density1 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density1", error));
cloud_pos_density2 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density2", error));
@@ -833,7 +827,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// Haze color above cloud
vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient)
+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight * temp2.mV[0] + ambient)
+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient)
);
// Increase ambient when there are more clouds
@@ -844,7 +838,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// Haze color below cloud
LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient)
+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight * temp2.mV[0] + tmpAmbient)
+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient)
);
// Final atmosphere additive
@@ -1010,7 +1004,7 @@ void LLVOSky::calcAtmospherics(void)
//haze color
vary_HazeColor =
(blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient)
+ componentMult(haze_horizon.mV[0] * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
+ componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient)
);
//brightness of surface both sunlight and ambient

View File

@@ -416,7 +416,7 @@ public:
LLColor3 blue_density;
LLColor3 blue_horizon;
F32 haze_density;
LLColor3 haze_horizon;
F32 haze_horizon;
F32 density_multiplier;
F32 max_y;
LLColor3 glow;

View File

@@ -202,6 +202,12 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
F32 size_inv = 1.f / size;
F32 z_fudge = 0.f;
if (getIsEdgePatch())
{ //bump edge patches down 10 cm to prevent aliasing along edges
z_fudge = -0.1f;
}
for (y = 0; y < size; y++)
{
for (x = 0; x < size; x++)
@@ -210,6 +216,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
position_agent = getPositionAgent() - getScale() * 0.5f;
position_agent.mV[VX] += (x + 0.5f) * step_x;
position_agent.mV[VY] += (y + 0.5f) * step_y;
position_agent.mV[VZ] += z_fudge;
*verticesp++ = position_agent - right + up;
*verticesp++ = position_agent - right - up;

View File

@@ -102,10 +102,10 @@ LLWaterParamManager::~LLWaterParamManager()
void LLWaterParamManager::loadAllPresets()
{
// First, load system (coming out of the box) water presets.
loadPresetsFromDir(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
loadPresetsFromDir(getSysDir());
// Then load user presets. Note that user day presets will modify any system ones already loaded.
loadPresetsFromDir(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
loadPresetsFromDir(getUserDir());
}
void LLWaterParamManager::loadPresetsFromDir(const std::string& dir)
@@ -327,7 +327,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
shader->uniform1f("waterFogDensity", getFogDensity());
shader->uniform1f("waterFogKS", mWaterFogKS);
shader->uniform4f("distance_multiplier", 0, 0, 0, 0);
shader->uniform1f("distance_multiplier", 0);
}
}
@@ -349,7 +349,7 @@ void LLWaterParamManager::applyParams(const LLSD& params, bool interpolate)
}
}
//static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params");
static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params");
void LLWaterParamManager::updateShaderLinks()
{
@@ -375,7 +375,7 @@ void LLWaterParamManager::updateShaderLinks()
void LLWaterParamManager::update(LLViewerCamera * cam)
{
//LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM);
LLFastTimer ftm(FTM_UPDATE_WATERPARAM);
// update the shaders and the menu
propagateParameters();

View File

@@ -319,9 +319,6 @@ public:
F32 getFogDensity(void);
LLColor4 getFogColor(void);
// singleton pattern implementation
static LLWaterParamManager * instance();
public:
LLWaterParamSet mCurParams;

View File

@@ -2,31 +2,25 @@
* @file llwaterparamset.cpp
* @brief Implementation for the LLWaterParamSet class.
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/
@@ -35,7 +29,6 @@
#include "llwaterparamset.h"
#include "llsd.h"
#include "llfloaterwater.h"
#include "llwaterparammanager.h"
#include "lluictrlfactory.h"
#include "llsliderctrl.h"

View File

@@ -2,31 +2,25 @@
* @file llwlparamset.h
* @brief Interface for the LLWaterParamSet class.
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* 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.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* 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.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* 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$
*/

View File

@@ -91,10 +91,10 @@ LLWLParamManager::LLWLParamManager() :
mWLGamma(1.0f, "gamma"),
mBlueHorizon(0.25f, 0.25f, 1.0f, 1.0f, "blue_horizon", "WLBlueHorizon"),
mHazeDensity(1.0f, 1.0f, 1.0f, 0.5f, "haze_density"),
mHazeDensity(1.0f, "haze_density"),
mBlueDensity(0.25f, 0.25f, 0.25f, 1.0f, "blue_density", "WLBlueDensity"),
mDensityMult(1.0f, "density_multiplier", 1000),
mHazeHorizon(1.0f, 1.0f, 1.0f, 0.5f, "haze_horizon"),
mHazeHorizon(1.0f, "haze_horizon"),
mMaxAlt(4000.0f, "max_y"),
// Lighting
@@ -284,10 +284,10 @@ void LLWLParamManager::refreshRegionPresets()
void LLWLParamManager::loadAllPresets()
{
// First, load system (coming out of the box) sky presets.
loadPresetsFromDir(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
loadPresetsFromDir(getSysDir());
// Then load user presets. Note that user day presets will modify any system ones already loaded.
loadPresetsFromDir(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
loadPresetsFromDir(getUserDir());
}
void LLWLParamManager::loadPresetsFromDir(const std::string& dir)

View File

@@ -120,9 +120,8 @@ struct WLFloatControl {
{
}
inline WLFloatControl & operator = (LLVector4 const & val) {
x = val.mV[0];
inline WLFloatControl & operator = (F32 val) {
x = val;
return *this;
}
@@ -289,10 +288,10 @@ public:
/// Atmospherics
WLColorControl mBlueHorizon;
WLColorControl mHazeDensity;
WLFloatControl mHazeDensity;
WLColorControl mBlueDensity;
WLFloatControl mDensityMult;
WLColorControl mHazeHorizon;
WLFloatControl mHazeHorizon;
WLFloatControl mMaxAlt;
/// Lighting
@@ -315,15 +314,11 @@ public:
private:
friend class LLWLAnimator;
std::vector<LLGLSLShader *> mShaderList;
friend class LLSingleton<LLWLParamManager>;
/*virtual*/ void initSingleton();
LLWLParamManager();
~LLWLParamManager();
static void loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status);
void loadAllPresets();
@@ -333,6 +328,11 @@ private:
static std::string getSysDir();
static std::string getUserDir();
friend class LLSingleton<LLWLParamManager>;
/*virtual*/ void initSingleton();
LLWLParamManager();
~LLWLParamManager();
// list of all the parameters, listed by name
std::map<LLWLParamKey, LLWLParamSet> mParamList;

View File

@@ -101,36 +101,62 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
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();
shader->uniform4fv(param, 1, val.mV);
}
else
stop_glerror();
shader->uniform4fv(param, 1, val.mV);
stop_glerror();
}
else if (param == "cloud_scale" || param == "cloud_shadow" ||
param == "density_multiplier" || param == "distance_multiplier" ||
param == "haze_density" || param == "haze_horizon" ||
param == "max_y" )
{
F32 val = (F32) i->second[0].asReal();
stop_glerror();
shader->uniform1f(param, val);
stop_glerror();
}
else // param is the uniform name
{
LLVector4 val;
// handle all the different cases
if(i->second.isArray() && i->second.size() == 4)
if (i->second.isArray() && i->second.size() == 4)
{
LLVector4 val;
val.mV[0] = (F32) i->second[0].asReal();
val.mV[1] = (F32) i->second[1].asReal();
val.mV[2] = (F32) i->second[2].asReal();
val.mV[3] = (F32) i->second[3].asReal();
stop_glerror();
shader->uniform4fv(param, 1, val.mV);
stop_glerror();
}
else if(i->second.isReal())
else if (i->second.isReal())
{
val.mV[0] = (F32) i->second.asReal();
F32 val = (F32) i->second.asReal();
stop_glerror();
shader->uniform1f(param, val);
stop_glerror();
}
else if(i->second.isInteger())
else if (i->second.isInteger())
{
val.mV[0] = (F32) i->second.asReal();
S32 val = (S32) i->second.asInteger();
stop_glerror();
shader->uniform1i(param, val);
stop_glerror();
}
else if(i->second.isBoolean())
else if (i->second.isBoolean())
{
val.mV[0] = i->second.asBoolean();
S32 val = (i->second.asBoolean() ? 1 : 0);
stop_glerror();
shader->uniform1i(param, val);
stop_glerror();
}
shader->uniform4fv(param, 1, val.mV);
}
}
}
@@ -151,7 +177,8 @@ void LLWLParamSet::set(const std::string& paramName, float x)
}
}
void LLWLParamSet::set(const std::string& paramName, float x, float y) {
void LLWLParamSet::set(const std::string& paramName, float x, float y)
{
mParamValues[paramName][0] = x;
mParamValues[paramName][1] = y;
}

View File

@@ -4249,7 +4249,9 @@ void LLPipeline::renderDebug()
}
/*for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
/*gGL.flush();
glLineWidth(16-i*2);
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
@@ -4264,10 +4266,17 @@ void LLPipeline::renderDebug()
}
}
}
}*/
}
gGL.flush();
glLineWidth(1.f);*/
}
}
if (mRenderDebugMask & RENDER_DEBUG_WIND_VECTORS)
{
gAgent.getRegion()->mWind.renderVectors();
}
if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION)
{
// Debug composition layers
@@ -6500,9 +6509,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, b
mDeferredLight.flush();
}
U32 dof_width = mScreen.getWidth()*CameraDoFResScale;
U32 dof_height = mScreen.getHeight()*CameraDoFResScale;
{ //perform DoF sampling at half-res (preserve alpha channel)
mScreen.bindTarget();
glViewport(0,0,(GLsizei) (mScreen.getWidth()*CameraDoFResScale), (GLsizei) (mScreen.getHeight()*CameraDoFResScale));
glViewport(0,0, dof_width, dof_height);
gGL.setColorMask(true, false);
shader = &gDeferredPostProgram;
@@ -6560,6 +6572,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, b
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
shader->uniform1f(LLShaderMgr::DOF_WIDTH, dof_width-1);
shader->uniform1f(LLShaderMgr::DOF_HEIGHT, dof_height-1);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);

View File

@@ -325,8 +325,8 @@ std::string RlvExtGetSet::onGetEnv(std::string strSetting)
else if ("densitymultiplier" == strSetting) nValue = pWLParams->mDensityMult.x * pWLParams->mDensityMult.mult;
else if ("distancemultiplier" == strSetting) nValue = pWLParams->mDistanceMult;
else if ("eastangle" == strSetting) nValue = pWLParams->mCurParams.getEastAngle() / F_TWO_PI;
else if ("hazedensity" == strSetting) nValue = pWLParams->mHazeDensity.r;
else if ("hazehorizon" == strSetting) nValue = pWLParams->mHazeHorizon.r;
else if ("hazedensity" == strSetting) nValue = pWLParams->mHazeDensity;
else if ("hazehorizon" == strSetting) nValue = pWLParams->mHazeHorizon;
else if ("maxaltitude" == strSetting) nValue = pWLParams->mMaxAlt;
else if ("scenegamma" == strSetting) nValue = pWLParams->mWLGamma;
else if ("starbrightness" == strSetting) nValue = pWLParams->mCurParams.getStarBrightness();
@@ -472,8 +472,8 @@ ERlvCmdRet RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& str
else if ("maxaltitude" == strSetting) pFloat = &pWLParams->mMaxAlt;
else if ("scenegamma" == strSetting) pFloat = &pWLParams->mWLGamma;
// See LLFloaterWindLight::onColorControlRMoved()
else if ("hazedensity" == strSetting) pColour = &pWLParams->mHazeDensity;
else if ("hazehorizon" == strSetting) pColour = &pWLParams->mHazeHorizon;
else if ("hazedensity" == strSetting) pFloat = &pWLParams->mHazeDensity;
else if ("hazehorizon" == strSetting) pFloat = &pWLParams->mHazeHorizon;
if (pFloat)
{