Merge branch 'V2MultiWear' of git://github.com/Shyotl/SingularityViewer into V2MultiWear

This commit is contained in:
Lirusaito
2012-05-23 03:46:48 -04:00
31 changed files with 313 additions and 215 deletions

View File

@@ -423,7 +423,7 @@ U32 LLInventoryItem::getCRC32() const
//lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl;
crc += mSaleInfo.getCRC32(); crc += mSaleInfo.getCRC32();
//lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl;
crc += mCreationDate; crc += (U32)mCreationDate;
//lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl;
return crc; return crc;
} }
@@ -539,7 +539,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const
mSaleInfo.packMessage(msg); mSaleInfo.packMessage(msg);
msg->addStringFast(_PREHASH_Name, mName); msg->addStringFast(_PREHASH_Name, mName);
msg->addStringFast(_PREHASH_Description, mDescription); msg->addStringFast(_PREHASH_Description, mDescription);
msg->addS32Fast(_PREHASH_CreationDate, mCreationDate); msg->addS32Fast(_PREHASH_CreationDate, (S32)mCreationDate);
U32 crc = getCRC32(); U32 crc = getCRC32();
msg->addU32Fast(_PREHASH_CRC, crc); msg->addU32Fast(_PREHASH_CRC, crc);
} }

View File

@@ -1,9 +1,26 @@
/* /*
* LLCalcParser.h * LLCalcParser.h
* SecondLife
*
* Created by Aimee Walton on 28/09/2008.
* Copyright 2008 Aimee Walton. * Copyright 2008 Aimee Walton.
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2008, 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$
* *
*/ */
@@ -157,7 +174,7 @@ private:
F32 _log(const F32& a) const { return log(a); } F32 _log(const F32& a) const { return log(a); }
F32 _exp(const F32& a) const { return exp(a); } F32 _exp(const F32& a) const { return exp(a); }
F32 _fabs(const F32& a) const { return fabs(a); } F32 _fabs(const F32& a) const { return fabs(a); }
F32 _floor(const F32& a) const { return llfloor(a); } F32 _floor(const F32& a) const { return (F32)llfloor(a); }
F32 _ceil(const F32& a) const { return llceil(a); } F32 _ceil(const F32& a) const { return llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }

View File

@@ -1,111 +1,112 @@
/** /**
* @file llcoord.h * @file llcoord.h
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* 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
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * 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 * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#ifndef LL_LLCOORD_H #ifndef LL_LLCOORD_H
#define LL_LLCOORD_H #define LL_LLCOORD_H
template<typename> class LLCoord;
struct LL_COORD_TYPE_GL;
struct LL_COORD_TYPE_WINDOW;
struct LL_COORD_TYPE_SCREEN;
typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
struct LLCoordCommon
{
LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
LLCoordCommon() : mX(0), mY(0) {}
S32 mX;
S32 mY;
};
// A two-dimensional pixel value // A two-dimensional pixel value
class LLCoord template<typename COORD_FRAME>
class LLCoord : protected COORD_FRAME
{ {
public: public:
S32 mX; typedef LLCoord<COORD_FRAME> self_t;
S32 mY; typename COORD_FRAME::value_t mX;
typename COORD_FRAME::value_t mY;
LLCoord(): mX(0), mY(0) LLCoord(): mX(0), mY(0)
{} {}
LLCoord(S32 x, S32 y): mX(x), mY(y) LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y)
{}
virtual ~LLCoord()
{} {}
virtual void set(S32 x, S32 y) { mX = x; mY = y; } LLCoord(const LLCoordCommon& other)
{
COORD_FRAME::convertFromCommon(other);
}
LLCoordCommon convert() const
{
return COORD_FRAME::convertToCommon();
}
void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;}
bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const self_t& other) const { return !(*this == other); }
static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
}; };
struct LL_COORD_TYPE_GL
// GL coordinates start in the client region of a window,
// with left, bottom = 0, 0
class LLCoordGL : public LLCoord
{ {
public: typedef S32 value_t;
LLCoordGL() : LLCoord()
{} LLCoordCommon convertToCommon() const
LLCoordGL(S32 x, S32 y) : LLCoord(x, y) {
{} const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; } return LLCoordCommon(self.mX, self.mY);
bool operator!=(const LLCoordGL& other) const { return !(*this == other); } }
void convertFromCommon(const LLCoordCommon& from)
{
LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
self.mX = from.mX;
self.mY = from.mY;
}
}; };
//bool operator ==(const LLCoordGL& a, const LLCoordGL& b); struct LL_COORD_TYPE_WINDOW
// Window coords include things like window borders,
// menu regions, etc.
class LLCoordWindow : public LLCoord
{ {
public: typedef S32 value_t;
LLCoordWindow() : LLCoord()
{} LLCoordCommon convertToCommon() const;
LLCoordWindow(S32 x, S32 y) : LLCoord(x, y) void convertFromCommon(const LLCoordCommon& from);
{}
bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
}; };
struct LL_COORD_TYPE_SCREEN
// Screen coords start at left, top = 0, 0
class LLCoordScreen : public LLCoord
{ {
public: typedef S32 value_t;
LLCoordScreen() : LLCoord()
{} LLCoordCommon convertToCommon() const;
LLCoordScreen(S32 x, S32 y) : LLCoord(x, y) void convertFromCommon(const LLCoordCommon& from);
{}
bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
}; };
class LLCoordFont : public LLCoord
{
public:
F32 mZ;
LLCoordFont() : LLCoord(), mZ(0.f)
{}
LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z)
{}
void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; }
void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
};
#endif #endif

View File

@@ -1,31 +1,26 @@
/** /**
* @file llvolume.cpp * @file llvolume.cpp
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* 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
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * 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 * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -2905,7 +2900,7 @@ F32 LLVolume::sculptGetSurfaceArea()
// compute the area of the quad by taking the length of the cross product of the two triangles // compute the area of the quad by taking the length of the cross product of the two triangles
LLVector3 cross1 = (p1 - p2) % (p1 - p3); LLVector3 cross1 = (p1 - p2) % (p1 - p3);
LLVector3 cross2 = (p4 - p2) % (p4 - p3); LLVector3 cross2 = (p4 - p2) % (p4 - p3);
area += (cross1.magVec() + cross2.magVec()) / 2.0; area += (cross1.magVec() + cross2.magVec()) / 2.f;
} }
} }
@@ -5896,7 +5891,7 @@ F32 find_vertex_score(LLVCacheVertexData& data)
} }
//bonus points for having low valence //bonus points for having low valence
F32 valence_boost = powf(data.mActiveTriangles, -FindVertexScore_ValenceBoostPower); F32 valence_boost = powf((F32)data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
score += FindVertexScore_ValenceBoostScale * valence_boost; score += FindVertexScore_ValenceBoostScale * valence_boost;
return score; return score;

View File

@@ -895,25 +895,25 @@ LLSD LLMatrix4::getValue() const
void LLMatrix4::setValue(const LLSD& data) void LLMatrix4::setValue(const LLSD& data)
{ {
mMatrix[0][0] = data[0].asReal(); mMatrix[0][0] = (F32)data[0].asReal();
mMatrix[0][1] = data[1].asReal(); mMatrix[0][1] = (F32)data[1].asReal();
mMatrix[0][2] = data[2].asReal(); mMatrix[0][2] = (F32)data[2].asReal();
mMatrix[0][3] = data[3].asReal(); mMatrix[0][3] = (F32)data[3].asReal();
mMatrix[1][0] = data[4].asReal(); mMatrix[1][0] = (F32)data[4].asReal();
mMatrix[1][1] = data[5].asReal(); mMatrix[1][1] = (F32)data[5].asReal();
mMatrix[1][2] = data[6].asReal(); mMatrix[1][2] = (F32)data[6].asReal();
mMatrix[1][3] = data[7].asReal(); mMatrix[1][3] = (F32)data[7].asReal();
mMatrix[2][0] = data[8].asReal(); mMatrix[2][0] = (F32)data[8].asReal();
mMatrix[2][1] = data[9].asReal(); mMatrix[2][1] = (F32)data[9].asReal();
mMatrix[2][2] = data[10].asReal(); mMatrix[2][2] = (F32)data[10].asReal();
mMatrix[2][3] = data[11].asReal(); mMatrix[2][3] = (F32)data[11].asReal();
mMatrix[3][0] = data[12].asReal(); mMatrix[3][0] = (F32)data[12].asReal();
mMatrix[3][1] = data[13].asReal(); mMatrix[3][1] = (F32)data[13].asReal();
mMatrix[3][2] = data[14].asReal(); mMatrix[3][2] = (F32)data[14].asReal();
mMatrix[3][3] = data[15].asReal(); mMatrix[3][3] = (F32)data[15].asReal();
} }

View File

@@ -57,8 +57,9 @@ std::string LLFontGL::sAppDir;
LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f); LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
LLFontRegistry* LLFontGL::sFontRegistry = NULL; LLFontRegistry* LLFontGL::sFontRegistry = NULL;
LLCoordFont LLFontGL::sCurOrigin; LLCoordGL LLFontGL::sCurOrigin;
std::vector<LLCoordFont> LLFontGL::sOriginStack; F32 LLFontGL::sCurDepth;
std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack;
const F32 EXT_X_BEARING = 1.f; const F32 EXT_X_BEARING = 1.f;
const F32 EXT_Y_BEARING = 0.f; const F32 EXT_Y_BEARING = 0.f;
@@ -221,7 +222,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
gGL.pushMatrix(); gGL.pushMatrix();
gGL.loadIdentity(); gGL.loadIdentity();
gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurDepth);
// this code snaps the text origin to a pixel grid to start with // this code snaps the text origin to a pixel grid to start with
F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);

View File

@@ -212,8 +212,9 @@ public:
static std::string getFontPathLocal(); static std::string getFontPathLocal();
static std::string getFontPathSystem(); static std::string getFontPathSystem();
static LLCoordFont sCurOrigin; static LLCoordGL sCurOrigin;
static std::vector<LLCoordFont> sOriginStack; static F32 sCurDepth;
static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
static LLColor4 sShadowColor; static LLColor4 sShadowColor;

View File

@@ -1440,6 +1440,8 @@ void LLRender::loadIdentity()
flush(); flush();
{ {
llassert_always(mMatrixMode < NUM_MATRIX_MODES) ;
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity(); mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity();
mMatHash[mMatrixMode]++; mMatHash[mMatrixMode]++;
} }
@@ -1687,7 +1689,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
LLTexUnit* LLRender::getTexUnit(U32 index) LLTexUnit* LLRender::getTexUnit(U32 index)
{ {
if ((index >= 0) && (index < mTexUnits.size())) if (index < mTexUnits.size())
{ {
return mTexUnits[index]; return mTexUnits[index];
} }

View File

@@ -1105,8 +1105,9 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("proj_shadow_res"); mReservedUniforms.push_back("proj_shadow_res");
mReservedUniforms.push_back("depth_cutoff"); mReservedUniforms.push_back("depth_cutoff");
mReservedUniforms.push_back("norm_cutoff"); mReservedUniforms.push_back("norm_cutoff");
mReservedUniforms.push_back("shadow_target_width");
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_NORM_CUTOFF+1); llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH+1);
mReservedUniforms.push_back("tc_scale"); mReservedUniforms.push_back("tc_scale");
mReservedUniforms.push_back("rcp_screen_res"); mReservedUniforms.push_back("rcp_screen_res");

View File

@@ -130,6 +130,7 @@ public:
DEFERRED_PROJ_SHADOW_RES, DEFERRED_PROJ_SHADOW_RES,
DEFERRED_DEPTH_CUTOFF, DEFERRED_DEPTH_CUTOFF,
DEFERRED_NORM_CUTOFF, DEFERRED_NORM_CUTOFF,
DEFERRED_SHADOW_TARGET_WIDTH,
FXAA_TC_SCALE, FXAA_TC_SCALE,
FXAA_RCP_SCREEN_RES, FXAA_RCP_SCREEN_RES,

View File

@@ -1644,21 +1644,22 @@ void LLUI::translate(F32 x, F32 y, F32 z)
gGL.translatef(x,y,z); gGL.translatef(x,y,z);
LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mX += (S32) x;
LLFontGL::sCurOrigin.mY += (S32) y; LLFontGL::sCurOrigin.mY += (S32) y;
LLFontGL::sCurOrigin.mZ += z; LLFontGL::sCurDepth += z;
} }
//static //static
void LLUI::pushMatrix() void LLUI::pushMatrix()
{ {
gGL.pushMatrix(); gGL.pushMatrix();
LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
} }
//static //static
void LLUI::popMatrix() void LLUI::popMatrix()
{ {
gGL.popMatrix(); gGL.popMatrix();
LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
LLFontGL::sOriginStack.pop_back(); LLFontGL::sOriginStack.pop_back();
} }
@@ -1668,7 +1669,7 @@ void LLUI::loadIdentity()
gGL.loadIdentity(); gGL.loadIdentity();
LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mX = 0;
LLFontGL::sCurOrigin.mY = 0; LLFontGL::sCurOrigin.mY = 0;
LLFontGL::sCurOrigin.mZ = 0; LLFontGL::sCurDepth = 0.f;
} }
//static //static

View File

@@ -28,8 +28,6 @@
#include "llwindowcallbacks.h" #include "llwindowcallbacks.h"
#include "llcoord.h"
// //
// LLWindowCallbacks // LLWindowCallbacks
// //

View File

@@ -26,7 +26,7 @@
#ifndef LLWINDOWCALLBACKS_H #ifndef LLWINDOWCALLBACKS_H
#define LLWINDOWCALLBACKS_H #define LLWINDOWCALLBACKS_H
class LLCoordGL; #include "llcoord.h"
class LLWindow; class LLWindow;
class LLWindowCallbacks class LLWindowCallbacks

View File

@@ -10583,7 +10583,7 @@
<key>Type</key> <key>Type</key>
<string>U32</string> <string>U32</string>
<key>Value</key> <key>Value</key>
<real>128</real> <real>512</real>
</map> </map>
<key>RenderSpecularResY</key> <key>RenderSpecularResY</key>
@@ -10607,7 +10607,7 @@
<key>Type</key> <key>Type</key>
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>8</real> <real>384</real>
</map> </map>
<key>RenderDeferred</key> <key>RenderDeferred</key>

View File

@@ -128,7 +128,7 @@ void main()
if (sa > 0.0) if (sa > 0.0)
{ {
sa = texture2D(lightFunc,vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); sa = 6 * texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
sa *= noise; sa *= noise;
col += da*sa*light_col[i].rgb*spec.rgb; col += da*sa*light_col[i].rgb*spec.rgb;
} }

View File

@@ -109,7 +109,7 @@ void main()
float sa = dot(normalize(lv-normalize(pos)),norm); float sa = dot(normalize(lv-normalize(pos)),norm);
if (sa > 0.0) if (sa > 0.0)
{ {
sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); sa = 6 * texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
sa *= noise; sa *= noise;
col += da*sa*color.rgb*spec.rgb; col += da*sa*color.rgb*spec.rgb;
} }

View File

@@ -29,11 +29,11 @@ out vec4 frag_color;
#define frag_color gl_FragColor #define frag_color gl_FragColor
#endif #endif
uniform float minimum_alpha;
uniform sampler2D diffuseMap; uniform sampler2D diffuseMap;
VARYING vec4 post_pos; VARYING float pos_zd2;
VARYING float pos_w;
VARYING float target_pos_x;
VARYING vec4 vertex_color; VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord0;
@@ -41,12 +41,20 @@ void main()
{ {
float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a; float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a;
if (alpha < minimum_alpha) if (alpha < 0.05) // treat as totally transparent
{ {
discard; discard;
} }
if (alpha < 0.88) // treat as semi-transparent
{
if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25)
{
discard;
}
}
frag_color = vec4(1,1,1,1); frag_color = vec4(1,1,1,1);
gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); gl_FragDepth = max(pos_zd2/pos_w+0.5, 0.0);
} }

View File

@@ -25,12 +25,15 @@
uniform mat4 texture_matrix0; uniform mat4 texture_matrix0;
uniform mat4 modelview_projection_matrix; uniform mat4 modelview_projection_matrix;
uniform float shadow_target_width;
ATTRIBUTE vec3 position; ATTRIBUTE vec3 position;
ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec4 diffuse_color;
ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec2 texcoord0;
VARYING vec4 post_pos; VARYING float pos_zd2;
VARYING float pos_w;
VARYING float target_pos_x;
VARYING vec4 vertex_color; VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord0;
@@ -39,8 +42,11 @@ void passTextureIndex();
void main() void main()
{ {
//transform vertex //transform vertex
vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0); vec4 pre_pos = vec4(position.xyz, 1.0);
post_pos = pos; vec4 pos = modelview_projection_matrix * pre_pos;
target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x;
pos_w = pos.w;
pos_zd2 = pos.z * 0.5;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);

View File

@@ -301,11 +301,11 @@ void main()
// //
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz); float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).r; vec3 dumbshiny = vary_SunlitColor*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together // add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb; vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib); bloom = dot(spec_contrib, spec_contrib) / 4;
col += spec_contrib; col += spec_contrib;
//add environmentmap //add environmentmap

View File

@@ -857,7 +857,10 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
if (wearable) if (wearable)
{ {
mWearableDatas[type].erase(mWearableDatas[type].begin() + index); mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
if (isAgentAvatarValid())
{
gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE); gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
}
wearable->setLabelUpdated(); wearable->setLabelUpdated();
} }
} }

View File

@@ -722,7 +722,7 @@ void LLMediaCtrl::draw()
// to get render origin for this view (with unit scale) // to get render origin for this view (with unit scale)
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]),
floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]),
LLFontGL::sCurOrigin.mZ); LLFontGL::sCurDepth);
} }
// scale texture to fit the space using texture coords // scale texture to fit the space using texture coords

View File

@@ -36,7 +36,8 @@
#include "llpanel.h" #include "llpanel.h"
#include "llviewermedia.h" #include "llviewermedia.h"
class LLCoordWindow; #include "llcoord.h"
class LLViewerMediaImpl; class LLViewerMediaImpl;
class LLPanelMediaHUD : public LLPanel class LLPanelMediaHUD : public LLPanel

View File

@@ -38,8 +38,8 @@
#include "llstat.h" #include "llstat.h"
#include "lltimer.h" #include "lltimer.h"
#include "m4math.h" #include "m4math.h"
#include "llcoord.h"
class LLCoordGL;
class LLViewerObject; class LLViewerObject;
// This rotation matrix moves the default OpenGL reference frame // This rotation matrix moves the default OpenGL reference frame

View File

@@ -210,6 +210,16 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
return true; return true;
} }
static bool handleLUTBufferChanged(const LLSD& newvalue)
{
if (gPipeline.isInit())
{
gPipeline.releaseLUTBuffers();
gPipeline.createLUTBuffers();
}
return true;
}
static bool handleAnisotropicChanged(const LLSD& newvalue) static bool handleAnisotropicChanged(const LLSD& newvalue)
{ {
LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean(); LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean();
@@ -636,9 +646,9 @@ void settings_setup_listeners()
gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleLUTBufferChanged, _2));
gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2)); gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2));
gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));

View File

@@ -769,7 +769,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
LLGLState::checkStates(); LLGLState::checkStates();
LLGLState::checkClientArrays(); LLGLState::checkClientArrays();
if (!for_snapshot || tiling) //if (!for_snapshot)
{ {
LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery");
gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance());
@@ -921,13 +921,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
if (to_texture) if (to_texture)
{ {
gGL.setColorMask(true, true); gGL.setColorMask(true, true);
if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
{ {
gPipeline.mDeferredScreen.bindTarget(); gPipeline.mDeferredScreen.bindTarget();
glClearColor(1,0,1,1); glClearColor(1,0,1,1);
gPipeline.mDeferredScreen.clear(); gPipeline.mDeferredScreen.clear();
} }
else if(!tiling) else
{ {
gPipeline.mScreen.bindTarget(); gPipeline.mScreen.bindTarget();
if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders()) if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders())
@@ -994,7 +995,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
GL_DEPTH_BUFFER_BIT, GL_NEAREST); GL_DEPTH_BUFFER_BIT, GL_NEAREST);
} }
} }
else if(!tiling) else
{ {
gPipeline.mScreen.flush(); gPipeline.mScreen.flush();
if(LLRenderTarget::sUseFBO) if(LLRenderTarget::sUseFBO)
@@ -1017,7 +1018,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
LLPipeline::sUnderWaterRender = FALSE; LLPipeline::sUnderWaterRender = FALSE;
LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
if (!for_snapshot) if (!for_snapshot || LLPipeline::sRenderDeferred)
{ {
LLFastTimer t(FTM_RENDER_UI); LLFastTimer t(FTM_RENDER_UI);
gFrameStats.start(LLFrameStats::RENDER_UI); gFrameStats.start(LLFrameStats::RENDER_UI);

View File

@@ -904,6 +904,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLMemType mt(LLMemType::MTYPE_OBJECT); LLMemType mt(LLMemType::MTYPE_OBJECT);
U32 retval = 0x0; U32 retval = 0x0;
// If region is removed from the list it is also deleted.
if (!LLWorld::instance().isRegionListed(mRegionp))
{
llwarns << "Updating object in an invalid region" << llendl;
return retval;
}
// Coordinates of objects on simulators are region-local. // Coordinates of objects on simulators are region-local.
U64 region_handle; U64 region_handle;
mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
@@ -3556,7 +3563,8 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const
void LLViewerObject::updatePositionCaches() const void LLViewerObject::updatePositionCaches() const
{ {
if(mRegionp) // If region is removed from the list it is also deleted.
if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{ {
if (!isRoot()) if (!isRoot())
{ {
@@ -3573,7 +3581,8 @@ void LLViewerObject::updatePositionCaches() const
const LLVector3d LLViewerObject::getPositionGlobal() const const LLVector3d LLViewerObject::getPositionGlobal() const
{ {
if(mRegionp) // If region is removed from the list it is also deleted.
if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{ {
LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
@@ -3592,7 +3601,8 @@ const LLVector3d LLViewerObject::getPositionGlobal() const
const LLVector3 &LLViewerObject::getPositionAgent() const const LLVector3 &LLViewerObject::getPositionAgent() const
{ {
if (mRegionp) // If region is removed from the list it is also deleted.
if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{ {
if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent())) if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
{ {

View File

@@ -1486,6 +1486,11 @@ void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d
} }
} }
bool LLWorld::isRegionListed(const LLViewerRegion* region) const
{
region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);
return it != mRegionList.end();
}
LLHTTPRegistration<LLEstablishAgentCommunication> LLHTTPRegistration<LLEstablishAgentCommunication>
gHTTPRegistrationEstablishAgentCommunication( gHTTPRegistrationEstablishAgentCommunication(

View File

@@ -163,6 +163,11 @@ public:
std::vector<LLVector3d>* positions = NULL, std::vector<LLVector3d>* positions = NULL,
const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
// Returns 'true' if the region is in mRegionList,
// 'false' if the region has been removed due to region change
// or if the circuit to this simulator had been lost.
bool isRegionListed(const LLViewerRegion* region) const;
private: private:
region_list_t mActiveRegionList; region_list_t mActiveRegionList;
region_list_t mRegionList; region_list_t mRegionList;

View File

@@ -52,7 +52,6 @@ const S32 DEFAULT_TRACKING_ARROW_SIZE = 16;
class LLColor4; class LLColor4;
class LLColor4U; class LLColor4U;
class LLCoordGL;
class LLViewerTexture; class LLViewerTexture;
class LLTextBox; class LLTextBox;

View File

@@ -718,9 +718,10 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (shadow_detail > 0) if (shadow_detail > 0)
{ //allocate 4 sun shadow maps { //allocate 4 sun shadow maps
U32 sun_shadow_map_width = ((U32(resX*scale)+1)&~1); // must be even to avoid a stripe in the horizontal shadow blur
for (U32 i = 0; i < 4; i++) for (U32 i = 0; i < 4; i++)
{ {
if (!mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false; if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
} }
} }
else else
@@ -736,9 +737,10 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (shadow_detail > 1) if (shadow_detail > 1)
{ //allocate two spot shadow maps { //allocate two spot shadow maps
U32 spot_shadow_map_width = width;
for (U32 i = 4; i < 6; i++) for (U32 i = 4; i < 6; i++)
{ {
if (!mShadow[i].allocate(width, height, 0, TRUE, FALSE)) return false; if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false;
} }
} }
else else
@@ -845,11 +847,7 @@ void LLPipeline::releaseGLBuffers()
mTrueNoiseMap = 0; mTrueNoiseMap = 0;
} }
if (mLightFunc) releaseLUTBuffers();
{
LLImageGL::deleteTextures(1, &mLightFunc);
mLightFunc = 0;
}
mWaterRef.release(); mWaterRef.release();
mWaterDis.release(); mWaterDis.release();
@@ -865,6 +863,15 @@ void LLPipeline::releaseGLBuffers()
LLVOAvatar::resetImpostors(); LLVOAvatar::resetImpostors();
} }
void LLPipeline::releaseLUTBuffers()
{
if (mLightFunc)
{
LLImageGL::deleteTextures(1, &mLightFunc);
mLightFunc = 0;
}
}
void LLPipeline::releaseScreenBuffers() void LLPipeline::releaseScreenBuffers()
{ {
mScreen.release(); mScreen.release();
@@ -957,50 +964,68 @@ void LLPipeline::createGLBuffers()
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
} }
createLUTBuffers();
}
gBumpImageList.restoreGL();
}
void LLPipeline::createLUTBuffers()
{
if (sRenderDeferred)
{
if (!mLightFunc) if (!mLightFunc)
{ {
U32 lightResX = gSavedSettings.getU32("RenderSpecularResX"); U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
U32 lightResY = gSavedSettings.getU32("RenderSpecularResY"); U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
U8* lg = new U8[lightResX*lightResY]; U8* ls = new U8[lightResX*lightResY];
static const LLCachedControl<F32> specExp("RenderSpecularExponent");
// Calculate the (normalized) Blinn-Phong specular lookup texture.
for (U32 y = 0; y < lightResY; ++y) for (U32 y = 0; y < lightResY; ++y)
{ {
for (U32 x = 0; x < lightResX; ++x) for (U32 x = 0; x < lightResX; ++x)
{ {
//spec func ls[y*lightResX+x] = 0;
F32 sa = (F32) x/(lightResX-1); F32 sa = (F32) x/(lightResX-1);
F32 spec = (F32) y/(lightResY-1); F32 spec = (F32) y/(lightResY-1);
//lg[y*lightResX+x] = (U8) (powf(sa, 128.f*spec*spec)*255); F32 n = spec * spec * specExp;
//F32 sp = acosf(sa)/(1.f-spec); // Nothing special here. Just your typical blinn-phong term.
spec = powf(sa, n);
static const LLCachedControl<F32> render_specular_exponent("RenderSpecularExponent"); // Apply our normalization function.
sa = powf(sa, render_specular_exponent); // Note: This is the full equation that applies the full normalization curve, not an approximation.
F32 a = acosf(sa*0.25f+0.75f); // This is fine, given we only need to create our LUT once per buffer initialization.
F32 m = llmax(0.5f-spec*0.5f, 0.001f); // The only trade off is we have a really low dynamic range.
F32 t2 = tanf(a)/m; // This means we have to account for things not being able to exceed 0 to 1 in our shaders.
t2 *= t2; spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n)));
F32 c4a = (3.f+4.f*cosf(2.f*a)+cosf(4.f*a))/8.f; // Always sample at a 1.0/2.2 curve.
F32 bd = 1.f/(4.f*m*m*c4a)*powf(F_E, -t2); // This "Gamma corrects" our specular term, boosting our lower exponent reflections.
spec = powf(spec, 1.f/2.2f);
lg[y*lightResX+x] = (U8) (llclamp(bd, 0.f, 1.f)*255); // Easy fix for our dynamic range problem: divide by 6 here, multiply by 6 in our shaders.
// This allows for our specular term to exceed a value of 1 in our shaders.
// This is something that can be important for energy conserving specular models where higher exponents can result in highlights that exceed a range of 0 to 1.
// Technically, we could just use an R16F texture, but driver support for R16F textures can be somewhat spotty at times.
// This works remarkably well for higher specular exponents, though banding can sometimes be seen on lower exponents.
// Combined with a bit of noise and trilinear filtering, the banding is hardly noticable.
ls[y*lightResX+x] = (U8)(llclamp(spec * (1.f / 6), 0.f, 1.f) * 255);
} }
} }
LLImageGL::generateTextures(1, &mLightFunc); LLImageGL::generateTextures(1, &mLightFunc);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R8, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, lg, false); LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R8, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false);
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
delete [] lg; delete [] ls;
} }
} }
gBumpImageList.restoreGL();
} }
void LLPipeline::restoreGL() void LLPipeline::restoreGL()
{ {
LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_RESTORE_GL); LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_RESTORE_GL);
@@ -8173,7 +8198,7 @@ static LLFastTimer::DeclareTimer FTM_SHADOW_RENDER("Render Shadows");
static LLFastTimer::DeclareTimer FTM_SHADOW_ALPHA("Alpha Shadow"); static LLFastTimer::DeclareTimer FTM_SHADOW_ALPHA("Alpha Shadow");
static LLFastTimer::DeclareTimer FTM_SHADOW_SIMPLE("Simple Shadow"); static LLFastTimer::DeclareTimer FTM_SHADOW_SIMPLE("Simple Shadow");
void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, BOOL use_shader, BOOL use_occlusion) void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, BOOL use_shader, BOOL use_occlusion, U32 target_width)
{ {
LLFastTimer t(FTM_SHADOW_RENDER); LLFastTimer t(FTM_SHADOW_RENDER);
@@ -8264,6 +8289,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
LLFastTimer ftm(FTM_SHADOW_ALPHA); LLFastTimer ftm(FTM_SHADOW_ALPHA);
gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f); gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f);
gDeferredShadowAlphaMaskProgram.uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
U32 mask = LLVertexBuffer::MAP_VERTEX | U32 mask = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD0 |
@@ -9050,11 +9076,13 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mShadow[j].getViewport(gGLViewport); mShadow[j].getViewport(gGLViewport);
mShadow[j].clear(); mShadow[j].clear();
U32 target_width = mShadow[j].getWidth();
{ {
static LLCullResult result[4]; static LLCullResult result[4];
//LLGLEnable enable(GL_DEPTH_CLAMP_NV); //LLGLEnable enable(GL_DEPTH_CLAMP_NV);
renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE); renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE, TRUE, target_width);
} }
mShadow[j].flush(); mShadow[j].flush();
@@ -9193,11 +9221,13 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mShadow[i+4].getViewport(gGLViewport); mShadow[i+4].getViewport(gGLViewport);
mShadow[i+4].clear(); mShadow[i+4].clear();
U32 target_width = mShadow[i+4].getWidth();
static LLCullResult result[2]; static LLCullResult result[2];
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+i+4; LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+i+4;
renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE); renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width);
mShadow[i+4].flush(); mShadow[i+4].flush();
} }

View File

@@ -118,8 +118,10 @@ public:
void doResetVertexBuffers(); void doResetVertexBuffers();
void resizeScreenTexture(); void resizeScreenTexture();
void releaseGLBuffers(); void releaseGLBuffers();
void releaseLUTBuffers();
void releaseScreenBuffers(); void releaseScreenBuffers();
void createGLBuffers(); void createGLBuffers();
void createLUTBuffers();
void allocateScreenBuffer(U32 resX, U32 resY); void allocateScreenBuffer(U32 resX, U32 resY);
bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples); bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples);
@@ -263,7 +265,7 @@ public:
void generateSunShadow(LLCamera& camera); void generateSunShadow(LLCamera& camera);
void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, BOOL use_shader = TRUE, BOOL use_occlusion = TRUE); void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, BOOL use_shader, BOOL use_occlusion, U32 target_width);
void renderHighlights(); void renderHighlights();
void renderDebug(); void renderDebug();
void renderPhysicsDisplay(); void renderPhysicsDisplay();