Merge LL 3.3.2 release

Tank_Master 2012-05-28 17:02:11 -07:00
commit 1c55d5cbb6
467 changed files with 8367 additions and 3293 deletions

19
.hgtags
View File

@ -265,23 +265,32 @@ e9c82fca5ae6fb8a8af29012d78fb194a29323f3 3.2.9-beta1
a01ef9bed28627f4ca543fbc1d70c79cc297a90f DRTVWR-118_3.2.9-beta2
a01ef9bed28627f4ca543fbc1d70c79cc297a90f 3.2.9-beta2
987425b1acf4752379b2e1eb20944b4b35d67a85 3.2.8-beta2
d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
d5f263687f43f278107363365938f0a214920a4b 3.3.0-start
dffd0457ee0745de65bf95f0642a5c9e46b8e2f0 viewer-beta-candidate
d5f263687f43f278107363365938f0a214920a4b DRTVWR-119
d5f263687f43f278107363365938f0a214920a4b 3.3.0-beta1
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
5e8d2662f38a66eca6c591295f5880d47afc73f7 3.3.0-release
dffd0457ee0745de65bf95f0642a5c9e46b8e2f0 viewer-beta-candidate
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 viewer-beta-candidate
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 viewer-beta-candidate
28b95a6a28dca3338d9a1f4f204b96678df9f6a5 viewer-beta-candidate
b43cd25be49e3984ff5361cefad020e069131d98 3.3.1-start
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 DRTVWR-125
3e2fca4ed1a0dc9fe6d8a6664e71098bb035a367 3.3.1-start
28b95a6a28dca3338d9a1f4f204b96678df9f6a5 3.3.1-beta1
1dc545e44617975da2a4a32fe303386c687a6ca1 viewer-beta-candidate
1dc545e44617975da2a4a32fe303386c687a6ca1 3.3.1-beta2
1dc545e44617975da2a4a32fe303386c687a6ca1 DRTVWR-139
5e8d2662f38a66eca6c591295f5880d47afc73f7 viewer-release-candidate
c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
c623bbc854b6f7ee1b33a3718f76715046aa2937 3.3.1-release
2174ed1c7129562428a5cfe8651ed77b8d26ae18 3.2.6-start
4891c46a56fed7512c783b9cbe7cb7260727bf0c 3.2.7-start
d29a260119f8d5a5d168e25fed0c7ea6b3f40161 3.3.2-beta1
675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-beta2
c623bbc854b6f7ee1b33a3718f76715046aa2937 viewer-release-candidate
675668bd24d3bea570814f71762a2a806f7e1b8d viewer-release-candidate
675668bd24d3bea570814f71762a2a806f7e1b8d 3.3.2-release
425f96b1e81e01644bf5e951961e7d1023bffb89 RLVa-1.2.0
fc0cbb86f5bd6e7737159e35aea2c4cf9f619b62 RLVa-1.2.1
43cb7dc1804de1a25c0b2b3f0715584af1f8b470 RLVa-1.2.2

View File

@ -35,6 +35,7 @@ viewer-development.build_debug_release_separately = true
# Notifications - to configure email notices, add a setting like this:
# <username>_<reponame>.email = <email-address>
# =================================================================
# Canonical viewer integration builds - Oz Linden
# =================================================================
@ -137,19 +138,6 @@ oz_viewer-beta-review.viewer_channel = "Second Life Beta Viewer"
oz_viewer-beta-review.login_channel = "Second Life Beta Viewer"
oz_viewer-beta-review.email = oz@lindenlab.com
oz_project-1.build_debug_release_separately = true
oz_project-1.codeticket_add_context = false
oz_project-1.email = oz@lindenlab.com
oz_project-2.build_debug_release_separately = true
oz_project-2.codeticket_add_context = false
oz_project-2.email = oz@lindenlab.com
oz_project-3.build_debug_release_separately = true
oz_project-3.codeticket_add_context = false
oz_project-3.email = oz@lindenlab.com
oz_project-4.build_debug_release_separately = true
oz_project-4.codeticket_add_context = false
oz_project-4.email = oz@lindenlab.com
# =================================================================
# asset delivery 2010 projects
# =================================================================

View File

@ -1250,9 +1250,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>26aa7c367ffadd573f61a6a96f820f80</string>
<string>4a98d727561cd1f4ac5ee02907411df1</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111201.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
@ -1262,9 +1262,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>c05a33ee8b6f253b5a744596dfc3707d</string>
<string>f50e5f0cc880c55b3f0f7e67dc8f7221</string>
<key>url</key>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-qt4.6-20101013.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Linux/installer/llqtwebkit-4.7.1-linux-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
@ -1274,9 +1274,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>270db8568a0c4bab266d98e1a820aec4</string>
<string>5e3cd6af397e853a963a6de40d440ff4</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111201.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20120228.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>

View File

@ -132,10 +132,6 @@ if test -f scripts/update_version_files.py ; then
end_section UpdateVer
fi
# Now retrieve the version for use in the version manager
# First three parts only, $revision will be appended automatically.
build_viewer_update_version_manager_version=`python scripts/get_version.py --viewer-version | sed 's/\.[0-9]*$//'`
if [ -z "$AUTOBUILD" ]
then
export autobuild_dir="$here/../../../autobuild/bin/"
@ -177,9 +173,6 @@ eval "$("$AUTOBUILD" source_environment)"
env|sort
# Install packages.
"$AUTOBUILD" install --skip-license-check
# Now run the build
succeeded=true
build_processes=
@ -195,10 +188,19 @@ do
begin_section "Do$variant"
build_dir=`build_dir_$arch $variant`
build_dir_stubs="$build_dir/win_setup/$variant"
begin_section "PreClean"
rm -rf "$build_dir"
end_section "PreClean"
mkdir -p "$build_dir"
mkdir -p "$build_dir/tmp"
#export TMP="$build_dir/tmp"
# Install packages.
begin_section "AutobuildInstall"
"$AUTOBUILD" install --verbose --skip-license-check
end_section "AutobuildInstall"
if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
then
if $build_link_parallel

View File

@ -234,7 +234,7 @@ Borg Capalini
Boroondas Gupte
OPEN-29
OPEN-39
OPEN-39
OPEN-54
OPEN-99
SNOW-278
SNOW-503
@ -396,6 +396,8 @@ Frontera Thor
Fury Rosewood
Gaberoonie Zanzibar
Ganymedes Costagravas
Geenz Spad
STORM-1823
Gene Frostbite
GeneJ Composer
Geneko Nemeth
@ -622,6 +624,8 @@ Jonathan Yap
STORM-1796
STORM-1807
STORM-1808
STORM-637
STORM-1822
STORM-1809
STORM-1793
STORM-1810
@ -868,6 +872,7 @@ Nicky Perian
OPEN-1
STORM-1087
STORM-1090
STORM-1828
Nicoladie Gymnast
Nounouch Hapmouche
VWR-238
@ -1187,6 +1192,8 @@ Unlikely Quintessa
UsikuFarasi Kanarik
Vadim Bigbear
VWR-2681
Vaalith Jinn
STORM-64
Vector Hastings
VWR-8726
Veritas Raymaker

View File

@ -18,5 +18,5 @@ else (STANDALONE)
elseif (LINUX)
set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a)
endif (WINDOWS)
set(JSONCPP_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
endif (STANDALONE)

View File

@ -13,7 +13,7 @@ elseif (LINUX)
set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin)
elseif (DARWIN)
set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)")
set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs")
endif (WINDOWS)
# Autobuild packages must provide 'release' versions of libraries, but may provide versions for
@ -33,7 +33,14 @@ else(WINDOWS OR DARWIN)
set(AUTOBUILD_LIBS_INSTALL_DIRS ${AUTOBUILD_INSTALL_DIR}/lib/${CMAKE_BUILD_TYPE_LOWER})
endif(WINDOWS OR DARWIN)
list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
# When we're building something other than Release, append the
# packages/lib/release directory to deal with autobuild packages that don't
# provide (e.g.) lib/debug libraries.
list(APPEND AUTOBUILD_LIBS_INSTALL_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}, extending AUTOBUILD_LIBS_INSTALL_DIRS")
endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message(STATUS "For ${CMAKE_BUILD_TYPE}, AUTOBUILD_LIBS_INSTALL_DIRS: ${AUTOBUILD_LIBS_INSTALL_DIRS}")
link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS})
if (LINUX)

View File

@ -0,0 +1,15 @@
# -*- cmake -*-
if (VIEWER)
set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
if (INCLUDE_VLD_CMAKE)
if (WINDOWS)
add_definitions(-DINCLUDE_VLD=1)
endif (WINDOWS)
endif (INCLUDE_VLD_CMAKE)
endif (VIEWER)

View File

@ -70,9 +70,10 @@ elseif (LINUX)
QtNetwork
QtGui
QtCore
qgif
qjpeg
jpeg
jscore
# qgif
# qjpeg
# jpeg
fontconfig
X11
Xrender

View File

View File

@ -126,7 +126,7 @@ public:
virtual void addDebugText( const std::string& text ) = 0;
virtual const LLUUID& getID() = 0;
virtual const LLUUID& getID() const = 0;
//-------------------------------------------------------------------------
// End Interface
//-------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
const S32 LL_VERSION_MAJOR = 3;
const S32 LL_VERSION_MINOR = 3;
const S32 LL_VERSION_PATCH = 1;
const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Firestorm-private";

View File

@ -60,6 +60,12 @@ BOOL LLImagePNG::updateData()
// Decode the PNG data and extract sizing information
LLPngWrapper pngWrapper;
if (!pngWrapper.isValidPng(getData()))
{
setLastError("LLImagePNG data does not have a valid PNG header!");
return FALSE;
}
LLPngWrapper::ImageInfo infop;
if (! pngWrapper.readPng(getData(), NULL, &infop))
{
@ -90,6 +96,12 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time)
// Decode the PNG data into the raw image
LLPngWrapper pngWrapper;
if (!pngWrapper.isValidPng(getData()))
{
setLastError("LLImagePNG data does not have a valid PNG header!");
return FALSE;
}
if (! pngWrapper.readPng(getData(), raw_image))
{
setLastError(pngWrapper.getErrorMessage());

View File

@ -54,7 +54,7 @@ public:
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)
{}
LLCoord(const LLCoordCommon& other)
@ -67,7 +67,7 @@ public:
return COORD_FRAME::convertToCommon();
}
void set(S32 x, S32 y) { mX = x; mY = y;}
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); }

View File

@ -35,7 +35,7 @@ import re
import errno
import socket
VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "1") # default to verbose
VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "0") # default to quiet
# Support usage such as INTEGRATION_TEST_VERBOSE=off -- distressing to user if
# that construct actually turns on verbosity...
VERBOSE = not re.match(r"(0|off|false|quiet)$", VERBOSE, re.IGNORECASE)

View File

@ -101,6 +101,8 @@ void APIENTRY gl_debug_callback(GLenum source,
}
#endif
void parse_glsl_version(S32& major, S32& minor);
void ll_init_fail_log(std::string filename)
{
gFailLog.open(filename.c_str());
@ -299,6 +301,7 @@ PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL;
PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;
PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer = NULL;
#if LL_WINDOWS
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
@ -447,7 +450,8 @@ LLGLManager::LLGLManager() :
mDriverVersionMinor(0),
mDriverVersionRelease(0),
mGLVersion(1.0f),
mGLSLVersionMajor(0),
mGLSLVersionMinor(0),
mVRAM(0),
mGLMaxVertexRange(0),
mGLMaxIndexRange(0)
@ -558,15 +562,20 @@ bool LLGLManager::initGL()
mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
if (mGLVersion >= 2.1f && LLImageGL::sCompressTextures)
{ //use texture compression
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
if (mGLVersion >= 2.f)
{
parse_glsl_version(mGLSLVersionMajor, mGLSLVersionMinor);
#if LL_DARWIN
//never use GLSL greater than 1.20 on OSX
if (mGLSLVersionMajor > 1 || mGLSLVersionMinor >= 30)
{
mGLSLVersionMajor = 1;
mGLSLVersionMinor = 20;
}
#endif
}
else
{ //GL version is < 3.0, always disable texture compression
LLImageGL::sCompressTextures = false;
}
// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
// from being recognized as ATI.
if (mGLVendor.substr(0,4) == "ATI ")
@ -1313,6 +1322,7 @@ void LLGLManager::initExtensions()
glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB");
glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB");
glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB");
glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttribIPointer");
glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB");
glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB");
glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB");
@ -2111,6 +2121,55 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor
}
}
void parse_glsl_version(S32& major, S32& minor)
{
// GL_SHADING_LANGUAGE_VERSION returns a null-terminated string with the format:
// <major>.<minor>[.<release>] [<vendor specific>]
const char* version = (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION);
major = 0;
minor = 0;
if( !version )
{
return;
}
std::string ver_copy( version );
S32 len = (S32)strlen( version ); /* Flawfinder: ignore */
S32 i = 0;
S32 start;
// Find the major version
start = i;
for( ; i < len; i++ )
{
if( '.' == version[i] )
{
break;
}
}
std::string major_str = ver_copy.substr(start,i-start);
LLStringUtil::convertToS32(major_str, major);
if( '.' == version[i] )
{
i++;
}
// Find the minor version
start = i;
for( ; i < len; i++ )
{
if( ('.' == version[i]) || isspace(version[i]) )
{
break;
}
}
std::string minor_str = ver_copy.substr(start,i-start);
LLStringUtil::convertToS32(minor_str, minor);
}
LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply)
{
mApply = apply;

View File

@ -138,6 +138,8 @@ public:
S32 mDriverVersionMinor;
S32 mDriverVersionRelease;
F32 mGLVersion; // e.g = 1.4
S32 mGLSLVersionMajor;
S32 mGLSLVersionMinor;
std::string mDriverVersionVendorString;
S32 mVRAM; // VRAM in MB

View File

@ -199,6 +199,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
@ -460,6 +461,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
@ -693,6 +695,7 @@ extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;

View File

@ -109,7 +109,12 @@ void LLGLSLShader::unload()
glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
for (GLsizei i = 0; i < count; i++)
{
glDeleteObjectARB(obj[i]);
#if !LL_DARWIN
if (glIsProgramARB(obj[i]))
#endif
{
glDeleteObjectARB(obj[i]);
}
}
glDeleteObjectARB(mProgramObject);
@ -161,8 +166,9 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
return FALSE;
}
if (gGLManager.mGLVersion < 3.1f)
{ //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 3)
{ //indexed texture rendering requires GLSL 1.3 or later
//attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
}

View File

@ -582,34 +582,46 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
GLcharARB* text[4096];
GLuint count = 0;
F32 version = gGLManager.mGLVersion;
//hack to never use GLSL > 1.20 on OSX
#if LL_DARWIN
version = llmin(version, 2.9f);
#endif
if (version < 2.1f)
S32 major_version = gGLManager.mGLSLVersionMajor;
S32 minor_version = gGLManager.mGLSLVersionMinor;
if (major_version == 1 && minor_version < 30)
{
text[count++] = strdup("#version 110\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
}
else if (version < 3.3f)
{
//set version to 1.20
text[count++] = strdup("#version 120\n");
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
if (minor_version < 10)
{
//should NEVER get here -- if major version is 1 and minor version is less than 10,
// viewer should never attempt to use shaders, continuing will result in undefined behavior
llerrs << "Unsupported GLSL Version." << llendl;
}
if (minor_version <= 19)
{
text[count++] = strdup("#version 110\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n");
}
else if (minor_version <= 29)
{
//set version to 1.20
text[count++] = strdup("#version 120\n");
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n");
}
}
else
{
if (version < 4.f)
if (major_version < 4)
{
//set version to 1.30
text[count++] = strdup("#version 130\n");
//some implementations of GLSL 1.30 require integer precision be explicitly declared
text[count++] = strdup("precision mediump int;\n");
text[count++] = strdup("precision highp float;\n");
}
else
{ //set version to 400
@ -625,16 +637,25 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
// ("varying" is deprecated after version 1.20)
text[count++] = strdup("#define VARYING out\n");
text[count++] = strdup("#define VARYING_FLAT flat out\n");
}
else
{
text[count++] = strdup("#define VARYING in\n");
text[count++] = strdup("#define VARYING_FLAT flat in\n");
}
//backwards compatibility with legacy texture lookup syntax
text[count++] = strdup("#define texture2D texture\n");
text[count++] = strdup("#define textureCube texture\n");
text[count++] = strdup("#define texture2DLod textureLod\n");
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
if (major_version > 1 || minor_version >= 40)
{ //GLSL 1.40 replaces texture2DRect et al with texture
text[count++] = strdup("#define texture2DRect texture\n");
text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
}
}
//copy preprocessor definitions into buffer
@ -658,22 +679,24 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
.
uniform sampler2D texN;
VARYING float vary_texture_index;
VARYING_FLAT ivec4 vary_texture_index;
vec4 ret = vec4(1,0,1,1);
vec4 diffuseLookup(vec2 texcoord)
{
switch (int(vary_texture_index+0.25))
switch (vary_texture_index.r))
{
case 0: return texture2D(tex0, texcoord);
case 1: return texture2D(tex1, texcoord);
case 2: return texture2D(tex2, texcoord);
case 0: ret = texture2D(tex0, texcoord); break;
case 1: ret = texture2D(tex1, texcoord); break;
case 2: ret = texture2D(tex2, texcoord); break;
.
.
.
case N: return texture2D(texN, texcoord);
case N: return texture2D(texN, texcoord); break;
}
return vec4(0,0,0,0);
return ret;
}
*/
@ -686,7 +709,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
if (texture_index_channels > 1)
{
text[count++] = strdup("VARYING float vary_texture_index;\n");
text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n");
}
text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
@ -698,60 +721,28 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
text[count++] = strdup("return texture2D(tex0, texcoord);\n");
text[count++] = strdup("}\n");
}
else if (gGLManager.mGLVersion >= 3.f)
{
// <FS:ND> some older drivers from ATI don't like that switch, which results in every texture being pink. Replace with if-statments
// text[count++] = strdup("\tswitch (int(vary_texture_index+0.25))\n");
// text[count++] = strdup("\t{\n");
else if (major_version > 1 || minor_version >= 30)
{ //switches are supported in GLSL 1.30 and later
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
text[count++] = strdup("\t{\n");
// //switch body
// for (S32 i = 0; i < texture_index_channels; ++i)
// {
// std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i);
// text[count++] = strdup(case_str.c_str());
// }
// text[count++] = strdup("\t}\n");
// text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
// text[count++] = strdup("}\n");
text[count++] = strdup("if ( vary_texture_index < 0 ) { return vec4(0,1,1,1); }\n");
//switch body
for (S32 i = 0; i < texture_index_channels; ++i)
{
std::stringstream str;
str << "if ( vary_texture_index <= " << i << ".25 ) { return texture2D(tex" << i << ", texcoord); }\n";
text[count++] = strdup(str.str().c_str());
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
text[count++] = strdup(case_str.c_str());
}
text[count++] = strdup("return vec4(1,0,1,1);\n");
text[count++] = strdup("}\n");
// </FS:ND>
text[count++] = strdup("\t}\n");
text[count++] = strdup("\treturn ret;\n");
text[count++] = strdup("}\n");
}
else
{
//switches aren't supported, make block that looks like:
/*
int ti = int(vary_texture_index+0.25);
if (ti == 0) return texture2D(tex0, texcoord);
if (ti == 1) return texture2D(tex1, texcoord);
.
.
.
if (ti == N) return texture2D(texN, texcoord);
*/
text[count++] = strdup("int ti = int(vary_texture_index+0.25);\n");
for (S32 i = 0; i < texture_index_channels; ++i)
{
std::string if_str = llformat("if (ti == %d) return texture2D(tex%d, texcoord);\n", i, i);
text[count++] = strdup(if_str.c_str());
}
text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
text[count++] = strdup("}\n");
}
{ //should never get here. Indexed texture rendering requires GLSL 1.30 or later
// (for passing integers between vertex and fragment shaders)
llerrs << "Indexed texture rendering requires GLSL 1.30 or later." << llendl;
}
}
//copy file into memory
@ -1092,6 +1083,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

@ -142,6 +142,8 @@ public:
DOF_MAGNIFICATION,
DOF_MAX_COF,
DOF_RES_SCALE,
DOF_WIDTH,
DOF_HEIGHT,
DEFERRED_DEPTH,
DEFERRED_SHADOW0,

View File

@ -380,6 +380,12 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
{
bool error = false;
if (gGLManager.mGLSLVersionMajor < 2 && gGLManager.mGLSLVersionMinor < 30)
{
//make sure texture index is disabled
data_mask = data_mask & ~MAP_TEXTURE_INDEX;
}
if (LLGLSLShader::sNoFixedFunction)
{
for (U32 i = 0; i < TYPE_MAX; ++i)
@ -1311,7 +1317,7 @@ void LLVertexBuffer::setupVertexArray()
1, //TYPE_WEIGHT,
4, //TYPE_WEIGHT4,
4, //TYPE_CLOTHWEIGHT,
1, //TYPE_TEXTURE_INDEX
4, //TYPE_TEXTURE_INDEX
};
U32 attrib_type[] =
@ -1328,7 +1334,24 @@ void LLVertexBuffer::setupVertexArray()
GL_FLOAT, //TYPE_WEIGHT,
GL_FLOAT, //TYPE_WEIGHT4,
GL_FLOAT, //TYPE_CLOTHWEIGHT,
GL_FLOAT, //TYPE_TEXTURE_INDEX
GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX
};
bool attrib_integer[] =
{
false, //TYPE_VERTEX,
false, //TYPE_NORMAL,
false, //TYPE_TEXCOORD0,
false, //TYPE_TEXCOORD1,
false, //TYPE_TEXCOORD2,
false, //TYPE_TEXCOORD3,
false, //TYPE_COLOR,
false, //TYPE_EMISSIVE,
false, //TYPE_BINORMAL,
false, //TYPE_WEIGHT,
false, //TYPE_WEIGHT4,
false, //TYPE_CLOTHWEIGHT,
true, //TYPE_TEXTURE_INDEX
};
U32 attrib_normalized[] =
@ -1356,7 +1379,21 @@ void LLVertexBuffer::setupVertexArray()
if (mTypeMask & (1 << i))
{
glEnableVertexAttribArrayARB(i);
glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], (void*) mOffsets[i]);
if (attrib_integer[i])
{
#if !LL_DARWIN
//glVertexattribIPointer requires GLSL 1.30 or later
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
{
glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (void*) mOffsets[i]);
}
#endif
}
else
{
glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], (void*) mOffsets[i]);
}
}
else
{
@ -2338,11 +2375,14 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
}
if (data_mask & MAP_TEXTURE_INDEX)
if (data_mask & MAP_TEXTURE_INDEX &&
(gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
{
#if !LL_DARWIN
S32 loc = TYPE_TEXTURE_INDEX;
void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
#endif
}
if (data_mask & MAP_VERTEX)
{

View File

@ -34,109 +34,113 @@
#include "llview.h"
#include "llwindow.h"
// Global singleton
LLClipboard gClipboard;
LLClipboard::LLClipboard()
LLClipboard::LLClipboard() :
mGeneration(0)
{
mSourceItem = NULL;
reset();
}
LLClipboard::~LLClipboard()
{
reset();
}
void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
void LLClipboard::reset()
{
mSourceID = source_id;
mString = src.substr(pos, len);
LLView::getWindow()->copyTextToClipboard( mString );
// Increment the clipboard count
mGeneration++;
// Clear the clipboard
mObjects.clear();
mCutMode = false;
mString = LLWString();
}
void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id )
// Copy the input uuid to the LL clipboard
bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type)
{
mSourceID = source_id;
mString = src;
LLView::getWindow()->copyTextToClipboard( mString );
reset();
return addToClipboard(src, type);
}
const LLWString& LLClipboard::getPasteWString( LLUUID* source_id )
// Add the input uuid to the LL clipboard
// Convert the uuid to string and concatenate that string to the system clipboard if legit
bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType type)
{
if( mSourceID.notNull() )
bool res = false;
if (src.notNull())
{
LLWString temp_string;
LLView::getWindow()->pasteTextFromClipboard(temp_string);
if( temp_string != mString )
res = true;
if (LLAssetType::lookupIsAssetIDKnowable(type))
{
mSourceID.setNull();
mString = temp_string;
LLWString source = utf8str_to_wstring(src.asString());
res = addToClipboard(source, 0, source.size());
}
if (res)
{
mObjects.push_back(src);
mGeneration++;
}
}
else
{
LLView::getWindow()->pasteTextFromClipboard(mString);
}
if( source_id )
{
*source_id = mSourceID;
}
return mString;
return res;
}
BOOL LLClipboard::canPasteString() const
bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const
{
return LLView::getWindow()->isClipboardTextAvailable();
}
void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
{
mSourceID = source_id;
mString = src.substr(pos, len);
LLView::getWindow()->copyTextToPrimary( mString );
}
const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id )
{
if( mSourceID.notNull() )
bool res = false;
S32 count = mObjects.size();
if (count > 0)
{
LLWString temp_string;
LLView::getWindow()->pasteTextFromPrimary(temp_string);
if( temp_string != mString )
res = true;
inv_objects.clear();
for (S32 i = 0; i < count; i++)
{
mSourceID.setNull();
mString = temp_string;
inv_objects.push_back(mObjects[i]);
}
}
else
{
LLView::getWindow()->pasteTextFromPrimary(mString);
}
if( source_id )
{
*source_id = mSourceID;
}
return mString;
return res;
}
BOOL LLClipboard::canPastePrimaryString() const
// Returns true if the LL Clipboard has pasteable items in it
bool LLClipboard::hasContents() const
{
return LLView::getWindow()->isPrimaryTextAvailable();
return (mObjects.size() > 0);
}
void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type)
// Returns true if the input uuid is in the list of clipboard objects
bool LLClipboard::isOnClipboard(const LLUUID& object) const
{
mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, "");
std::vector<LLUUID>::const_iterator iter = std::find(mObjects.begin(), mObjects.end(), object);
return (iter != mObjects.end());
}
// Copy the input string to the LL and the system clipboard
bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
{
return addToClipboard(src, pos, len, use_primary);
}
// Concatenate the input string to the LL and the system clipboard
bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
{
mString = src.substr(pos, len);
return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString));
}
// Copy the System clipboard to the output string.
// Manage the LL Clipboard / System clipboard consistency
bool LLClipboard::pasteFromClipboard(LLWString &dst, bool use_primary)
{
bool res = (use_primary ? LLView::getWindow()->pasteTextFromPrimary(dst) : LLView::getWindow()->pasteTextFromClipboard(dst));
if (res)
{
mString = dst;
}
return res;
}
// Return true if there's something on the System clipboard
bool LLClipboard::isTextAvailable(bool use_primary) const
{
return (use_primary ? LLView::getWindow()->isPrimaryTextAvailable() : LLView::getWindow()->isClipboardTextAvailable());
}

View File

@ -27,46 +27,68 @@
#ifndef LL_LLCLIPBOARD_H
#define LL_LLCLIPBOARD_H
#include <boost/function.hpp>
#include "llstring.h"
#include "lluuid.h"
#include "stdenums.h"
#include "llsingleton.h"
#include "llassettype.h"
#include "llinventory.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLClipboard
//
// This class is used to cut/copy/paste text strings and inventory items around
// the world. Use LLClipboard::instance().method() to use its methods.
// Note that the text and UUIDs are loosely coupled only. There are few cases
// where the viewer does offer a serialized version of the UUID on the clipboard.
// In those case, the text is overridden when copying/cutting the item.
// In all other cases, the text and the UUIDs are very much independent.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLClipboard
class LLClipboard : public LLSingleton<LLClipboard>
{
public:
LLClipboard();
~LLClipboard();
/* We support two flavors of clipboard. The default is the explicitly
copy-and-pasted clipboard. The second is the so-called 'primary' clipboard
which is implicitly copied upon selection on platforms which expect this
(i.e. X11/Linux). */
void copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
void copyFromString(const LLWString &copy_from, const LLUUID& source_id = LLUUID::null );
BOOL canPasteString() const;
const LLWString& getPasteWString(LLUUID* source_id = NULL);
void copyFromPrimarySubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
BOOL canPastePrimaryString() const;
const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL);
// Support clipboard for object known only by their uuid and asset type
void setSourceObject(const LLUUID& source_id, LLAssetType::EType type);
const LLInventoryObject* getSourceObject() { return mSourceItem; }
// Clears the clipboard
void reset();
// Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state)
int getGeneration() const { return mGeneration; }
// Text strings management:
// ------------------------
// We support two flavors of text clipboards. The default is the explicitly
// copy-and-pasted clipboard. The second is the so-called 'primary' clipboard
// which is implicitly copied upon selection on platforms which expect this
// (i.e. X11/Linux, Mac).
bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
bool addToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
bool pasteFromClipboard(LLWString& dst, bool use_primary = false);
bool isTextAvailable(bool use_primary = false) const;
// Object list management:
// -----------------------
// Clears and adds one single object to the clipboard
bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
// Adds one object to the current list of objects on the clipboard
bool addToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
// Gets a copy of the objects on the clipboard
bool pasteFromClipboard(std::vector<LLUUID>& inventory_objects) const;
bool hasContents() const; // True if the clipboard has pasteable objects
bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard
bool isCutMode() const { return mCutMode; }
void setCutMode(bool mode) { mCutMode = mode; mGeneration++; }
private:
LLUUID mSourceID;
LLWString mString;
LLInventoryObject* mSourceItem;
std::vector<LLUUID> mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat)
LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment) if the asset type is knowable.
bool mCutMode; // This is a convenience flag for the viewer.
int mGeneration; // Incremented when the clipboard changes so that interested parties can check for changes on the clipboard.
};
// Global singleton
extern LLClipboard gClipboard;
#endif // LL_LLCLIPBOARD_H

View File

@ -69,10 +69,10 @@ namespace LLInitParam
{
void TypeValues<LLFloaterEnums::EOpenPositioning>::declareValues()
{
declare("none", LLFloaterEnums::OPEN_POSITIONING_NONE);
declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING);
declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED);
declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED);
declare("relative", LLFloaterEnums::POSITIONING_RELATIVE);
declare("cascading", LLFloaterEnums::POSITIONING_CASCADING);
declare("centered", LLFloaterEnums::POSITIONING_CENTERED);
declare("specified", LLFloaterEnums::POSITIONING_SPECIFIED);
}
}
@ -183,9 +183,7 @@ LLFloater::Params::Params()
// [/SL:KB]
can_dock("can_dock", false),
show_title("show_title", true),
open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE),
specified_left("specified_left"),
specified_bottom("specified_bottom"),
positioning("positioning", LLFloaterEnums::POSITIONING_RELATIVE),
header_height("header_height", 0),
legacy_header_height("legacy_header_height", 0),
close_image("close_image"),
@ -256,9 +254,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
mCanClose(p.can_close),
mDragOnLeft(p.can_drag_on_left),
mResizable(p.can_resize),
mOpenPositioning(p.open_positioning),
mSpecifiedLeft(p.specified_left),
mSpecifiedBottom(p.specified_bottom),
mPositioning(p.positioning),
mMinWidth(p.min_width),
mMinHeight(p.min_height),
mHeaderHeight(p.header_height),
@ -569,10 +565,18 @@ LLFloater::~LLFloater()
void LLFloater::storeRectControl()
{
// do not store rect when attached to another floater -Zi
if( mTornOff && mRectControl.size() > 1 )
if( mTornOff &&!mRectControl.empty())
{
getControlGroup()->setRect( mRectControl, getRect() );
}
if (!mPosXControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
{
getControlGroup()->setF32( mPosXControl, mPosition.mX );
}
if (!mPosYControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
{
getControlGroup()->setF32( mPosYControl, mPosition.mY );
}
}
void LLFloater::storeVisibilityControl()
@ -601,23 +605,6 @@ void LLFloater::storeTearOffStateControl()
}
// [/SL:KB]
LLRect LLFloater::getSavedRect() const
{
LLRect rect;
if (mRectControl.size() > 1)
{
rect = getControlGroup()->getRect(mRectControl);
}
return rect;
}
bool LLFloater::hasSavedRect() const
{
return !getSavedRect().isEmpty();
}
// static
std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
{
@ -927,7 +914,7 @@ void LLFloater::applyControlsAndPosition(LLFloater* other)
//applyPositioning(other);
if ((strcmp(getName().c_str(), "panel_im") != 0))
{
applyPositioning(other);
applyPositioning(other, true);
}
// </FS:Ansariel> Don't apply position to undocked IM floater (FIRE-5459)
}
@ -946,29 +933,68 @@ bool LLFloater::applyRectControl()
{
bool saved_rect = false;
LLRect screen_rect = calcScreenRect();
mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
LLFloater* last_in_group = LLFloaterReg::getLastFloaterInGroup(mInstanceName);
if (last_in_group && last_in_group != this)
{
// other floaters in our group, position ourselves relative to them and don't save the rect
mRectControl.clear();
mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP;
mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
}
else if (mRectControl.size() > 1)
else
{
// If we have a saved rect, use it
const LLRect& rect = getControlGroup()->getRect(mRectControl);
saved_rect = rect.notEmpty();
if (saved_rect)
bool rect_specified = false;
if (!mRectControl.empty())
{
setOrigin(rect.mLeft, rect.mBottom);
if (mResizable)
// If we have a saved rect, use it
const LLRect& rect = getControlGroup()->getRect(mRectControl);
if (rect.notEmpty()) saved_rect = true;
if (saved_rect)
{
reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
setOrigin(rect.mLeft, rect.mBottom);
if (mResizable)
{
reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
}
mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
LLRect screen_rect = calcScreenRect();
mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
rect_specified = true;
}
}
LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl);
LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl);
if (x_control.notNull()
&& y_control.notNull()
&& !x_control->isDefault()
&& !y_control->isDefault())
{
mPosition.mX = x_control->getValue().asReal();
mPosition.mY = y_control->getValue().asReal();
mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
applyRelativePosition();
saved_rect = true;
}
// remember updated position
if (rect_specified)
{
storeRectControl();
}
}
if (saved_rect)
{
// propagate any derived positioning data back to settings file
storeRectControl();
}
return saved_rect;
}
@ -985,50 +1011,56 @@ bool LLFloater::applyDockState()
return docked;
}
void LLFloater::applyPositioning(LLFloater* other)
void LLFloater::applyPositioning(LLFloater* other, bool on_open)
{
// Otherwise position according to the positioning code
switch (mOpenPositioning)
switch (mPositioning)
{
case LLFloaterEnums::OPEN_POSITIONING_CENTERED:
case LLFloaterEnums::POSITIONING_CENTERED:
center();
break;
case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED:
{
// Translate relative to snap rect
setOrigin(mSpecifiedLeft, mSpecifiedBottom);
const LLRect& snap_rect = gFloaterView->getSnapRect();
translate(snap_rect.mLeft, snap_rect.mBottom);
translateIntoRect(snap_rect);
}
case LLFloaterEnums::POSITIONING_SPECIFIED:
break;
case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
if (other != NULL && other != this)
case LLFloaterEnums::POSITIONING_CASCADING:
if (!on_open)
{
stackWith(*other);
applyRelativePosition();
}
else
// fall through
case LLFloaterEnums::POSITIONING_CASCADE_GROUP:
if (on_open)
{
static const U32 CASCADING_FLOATER_HOFFSET = 0;
static const U32 CASCADING_FLOATER_VOFFSET = 0;
if (other != NULL && other != this)
{
stackWith(*other);
}
else
{
static const U32 CASCADING_FLOATER_HOFFSET = 0;
static const U32 CASCADING_FLOATER_VOFFSET = 0;
const LLRect& snap_rect = gFloaterView->getSnapRect();
const LLRect& snap_rect = gFloaterView->getSnapRect();
const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
S32 rect_height = getRect().getHeight();
setOrigin(horizontal_offset, vertical_offset - rect_height);
S32 rect_height = getRect().getHeight();
setOrigin(horizontal_offset, vertical_offset - rect_height);
translate(snap_rect.mLeft, snap_rect.mBottom);
translateIntoRect(snap_rect);
translate(snap_rect.mLeft, snap_rect.mBottom);
}
setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
}
break;
case LLFloaterEnums::OPEN_POSITIONING_NONE:
case LLFloaterEnums::POSITIONING_RELATIVE:
{
applyRelativePosition();
break;
}
default:
// Do nothing
break;
@ -1157,7 +1189,9 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
if (by_user && !isMinimized())
{
storeRectControl();
mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
LLRect screen_rect = calcScreenRect();
mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
}
// if not minimized, adjust all snapped dependents to new shape
@ -1336,6 +1370,7 @@ void LLFloater::setMinimized(BOOL minimize)
// Reshape *after* setting mMinimized
reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
applyPositioning(NULL, false);
}
make_ui_sound("UISndWindowClose");
@ -1676,7 +1711,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock)
if (mDocked)
{
setMinimized(FALSE);
mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
}
updateTitleButtons();
@ -1716,11 +1751,11 @@ void LLFloater::setTornOff(bool torn_off)
openFloater(getKey());
// get floater rect size from either the rect control or the saved rect -Zi
if (mRectControl.size() <= 1)
if (this->mRectControl.empty())
// restore old size and position -Zi
new_rect= getExpandedRect();
else
new_rect= getSavedRect();
new_rect= getControlGroup()->getRect(mRectControl);
// only force position for floaters that have an empty rect -Zi
if(new_rect.isEmpty())
@ -2339,19 +2374,14 @@ LLFloaterView::LLFloaterView (const Params& p)
mSnapOffsetBottom(0),
mSnapOffsetRight(0)
{
mSnapView = getHandle();
}
// By default, adjust vertical.
void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
S32 old_right = mLastSnapRect.mRight;
S32 old_top = mLastSnapRect.mTop;
LLView::reshape(width, height, called_from_parent);
S32 new_right = getSnapRect().mRight;
S32 new_top = getSnapRect().mTop;
mLastSnapRect = getSnapRect();
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
@ -2364,35 +2394,39 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
continue;
}
if (!floaterp->isMinimized())
if (!floaterp->isMinimized() && floaterp->getCanDrag())
{
LLRect r = floaterp->getRect();
LLRect old_rect = floaterp->getRect();
floaterp->applyPositioning(NULL, false);
LLRect new_rect = floaterp->getRect();
// Compute absolute distance from each edge of screen
S32 left_offset = llabs(r.mLeft - 0);
S32 right_offset = llabs(old_right - r.mRight);
//LLRect r = floaterp->getRect();
S32 top_offset = llabs(old_top - r.mTop);
S32 bottom_offset = llabs(r.mBottom - 0);
//// Compute absolute distance from each edge of screen
//S32 left_offset = llabs(r.mLeft - 0);
//S32 right_offset = llabs(old_right - r.mRight);
S32 translate_x = 0;
S32 translate_y = 0;
//S32 top_offset = llabs(old_top - r.mTop);
//S32 bottom_offset = llabs(r.mBottom - 0);
if (left_offset > right_offset)
{
translate_x = new_right - old_right;
}
S32 translate_x = new_rect.mLeft - old_rect.mLeft;
S32 translate_y = new_rect.mBottom - old_rect.mBottom;
if (top_offset < bottom_offset)
{
translate_y = new_top - old_top;
}
//if (left_offset > right_offset)
//{
// translate_x = new_right - old_right;
//}
//if (top_offset < bottom_offset)
//{
// translate_y = new_top - old_top;
//}
// don't reposition immovable floaters
if (floaterp->getCanDrag())
{
floaterp->translate(translate_x, translate_y);
}
//if (floaterp->getCanDrag())
//{
// floaterp->translate(translate_x, translate_y);
//}
BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents)
{
if (dependent_floater.get())
@ -3101,9 +3135,11 @@ void LLFloater::setInstanceName(const std::string& name)
std::string ctrl_name = getControlName(mInstanceName, mKey);
// save_rect and save_visibility only apply to registered floaters
if (!mRectControl.empty())
if (mSaveRect)
{
mRectControl = LLFloaterReg::declareRectControl(ctrl_name);
mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name);
mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name);
}
if (!mVisibilityControl.empty())
{
@ -3166,7 +3202,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
LLPanel::initFromParams(p);
// override any follows flags
setFollows(FOLLOWS_NONE);
if (mPositioning != LLFloaterEnums::POSITIONING_SPECIFIED)
{
setFollows(FOLLOWS_NONE);
}
mTitle = p.title;
mShortTitle = p.short_title;
@ -3185,19 +3224,14 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
mSingleInstance = p.single_instance;
mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance;
mOpenPositioning = p.open_positioning;
mSpecifiedLeft = p.specified_left;
mSpecifiedBottom = p.specified_bottom;
mPositioning = p.positioning;
// ## Zi: Optional Drop Shadows
// we do this here because the values in the constructor get ignored, probably due to
// the comment at the beginning of this method. -Zi
mDropShadow = p.drop_shadow;
if (p.save_rect && mRectControl.empty())
{
mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set
}
mSaveRect = p.save_rect;
if (p.save_visibility)
{
mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set
@ -3326,7 +3360,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
params.rect.left.set(0);
}
params.from_xui = true;
applyXUILayout(params, parent);
applyXUILayout(params, parent, parent == gFloaterView ? gFloaterView->getSnapRect() : parent->getLocalRect());
initFromParams(params);
initFloater(params);
@ -3485,8 +3519,27 @@ void LLFloater::stackWith(LLFloater& other)
next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight());
setShape(next_rect);
if (!other.getHost())
{
other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
}
}
void LLFloater::applyRelativePosition()
{
LLRect snap_rect = gFloaterView->getSnapRect();
LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
LLRect floater_screen_rect = calcScreenRect();
LLCoordGL new_center = mPosition.convert();
LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY());
translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY);
}
LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater)
: coord_t((S32)x, (S32)y)
{
@ -3522,6 +3575,9 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const
const LLCoordFloater& self = static_cast<const LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
LLRect snap_rect = gFloaterView->getSnapRect();
LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
LLFloater* floaterp = mFloater.get();
S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;
@ -3563,6 +3619,10 @@ void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from)
{
LLCoordFloater& self = static_cast<LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
LLRect snap_rect = gFloaterView->getSnapRect();
LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
LLFloater* floaterp = mFloater.get();
S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;

View File

@ -64,12 +64,12 @@ namespace LLFloaterEnums
{
enum EOpenPositioning
{
OPEN_POSITIONING_NONE,
OPEN_POSITIONING_CASCADING,
OPEN_POSITIONING_CASCADE_GROUP,
OPEN_POSITIONING_CENTERED,
OPEN_POSITIONING_SPECIFIED,
OPEN_POSITIONING_COUNT
POSITIONING_RELATIVE,
POSITIONING_CASCADING,
POSITIONING_CASCADE_GROUP,
POSITIONING_CENTERED,
POSITIONING_SPECIFIED,
POSITIONING_COUNT
};
}
@ -167,10 +167,7 @@ public:
can_dock,
show_title;
Optional<LLFloaterEnums::EOpenPositioning> open_positioning;
Optional<S32> specified_left;
Optional<S32> specified_bottom;
Optional<LLFloaterEnums::EOpenPositioning> positioning;
Optional<S32> header_height,
label_v_padding, // <FS:Zi> Make vertical label padding a per-skin option
@ -283,8 +280,6 @@ public:
BOOL isResizable() const { return mResizable; }
void setResizeLimits( S32 min_width, S32 min_height );
void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
LLRect getSavedRect() const;
bool hasSavedRect() const;
static std::string getControlName(const std::string& name, const LLSD& key);
static LLControlGroup* getControlGroup();
@ -369,7 +364,7 @@ public:
void enableResizeCtrls(bool enable, bool width = true, bool height = true);
bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mOpenPositioning); }
bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); }
protected:
void applyControlsAndPosition(LLFloater* other);
@ -377,7 +372,9 @@ protected:
virtual bool applyRectControl();
bool applyDockState();
void applyPositioning(LLFloater* other);
void applyPositioning(LLFloater* other, bool on_open);
void applyRelativePosition();
// [SL:KB] - Patch: UI-FloaterTearOffState | Checked: 2011-09-30 (Catznip-3.2.0a) | Added: Catznip-3.0.0a
void applyTearOffState();
// [/SL:KB]
@ -450,7 +447,10 @@ public:
// [/SL:KB]
protected:
bool mSaveRect;
std::string mRectControl;
std::string mPosXControl;
std::string mPosYControl;
std::string mVisibilityControl;
std::string mDocStateControl;
// [SL:KB] - Patch: UI-FloaterTearOffState | Checked: 2011-09-30 (Catznip-3.2.0a) | Added: Catznip-3.0.0a
@ -482,9 +482,7 @@ private:
BOOL mDragOnLeft;
BOOL mResizable;
LLFloaterEnums::EOpenPositioning mOpenPositioning;
S32 mSpecifiedLeft;
S32 mSpecifiedBottom;
LLFloaterEnums::EOpenPositioning mPositioning;
LLCoordFloater mPosition;
S32 mMinWidth;

View File

@ -113,7 +113,9 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
{
LLFloater* inst = *iter;
if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING))
if (inst->getVisible()
&& (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)
|| inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP)))
{
if (candidate_rect.mTop > inst->getRect().mTop)
{
@ -390,9 +392,7 @@ void LLFloaterReg::restoreVisibleInstances()
//static
std::string LLFloaterReg::getRectControlName(const std::string& name)
{
std::string res = std::string("floater_rect_") + name;
LLStringUtil::replaceChar( res, ' ', '_' );
return res;
return std::string("floater_rect_") + getBaseControlName(name);
}
//static
@ -400,19 +400,48 @@ std::string LLFloaterReg::declareRectControl(const std::string& name)
{
std::string controlname = getRectControlName(name);
LLFloater::getControlGroup()->declareRect(controlname, LLRect(),
llformat("Window Position and Size for %s", name.c_str()),
llformat("Window Size for %s", name.c_str()),
TRUE);
return controlname;
}
std::string LLFloaterReg::declarePosXControl(const std::string& name)
{
std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_x";
LLFloater::getControlGroup()->declareF32(controlname,
10.f,
llformat("Window X Position for %s", name.c_str()),
TRUE);
return controlname;
}
std::string LLFloaterReg::declarePosYControl(const std::string& name)
{
std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_y";
LLFloater::getControlGroup()->declareF32(controlname,
10.f,
llformat("Window Y Position for %s", name.c_str()),
TRUE);
return controlname;
}
//static
std::string LLFloaterReg::getVisibilityControlName(const std::string& name)
{
std::string res = std::string("floater_vis_") + name;
return std::string("floater_vis_") + getBaseControlName(name);
}
//static
std::string LLFloaterReg::getBaseControlName(const std::string& name)
{
std::string res(name);
LLStringUtil::replaceChar( res, ' ', '_' );
return res;
}
//static
std::string LLFloaterReg::declareVisibilityControl(const std::string& name)
{

View File

@ -143,9 +143,11 @@ public:
// Control Variables
static std::string getRectControlName(const std::string& name);
static std::string declareRectControl(const std::string& name);
static std::string declarePosXControl(const std::string& name);
static std::string declarePosYControl(const std::string& name);
static std::string getVisibilityControlName(const std::string& name);
static std::string declareVisibilityControl(const std::string& name);
static std::string getBaseControlName(const std::string& name);
static std::string declareDockStateControl(const std::string& name);
static std::string getDockStateControlName(const std::string& name);

View File

@ -113,7 +113,26 @@ S32 LLLayoutPanel::getLayoutDim() const
? getRect().getWidth()
: getRect().getHeight()));
}
S32 LLLayoutPanel::getTargetDim() const
{
return mTargetDim;
}
void LLLayoutPanel::setTargetDim(S32 value)
{
LLRect new_rect(getRect());
if (mOrientation == LLLayoutStack::HORIZONTAL)
{
new_rect.mRight = new_rect.mLeft + value;
}
else
{
new_rect.mTop = new_rect.mBottom + value;
}
setShape(new_rect, true);
}
S32 LLLayoutPanel::getVisibleDim() const
{
F32 min_dim = getRelevantMinDim();
@ -172,12 +191,15 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user)
LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
if (stackp)
{
stackp->mNeedsLayout = true;
if (by_user)
{
// tell layout stack to account for new shape
{ // tell layout stack to account for new shape
// make sure that panels have already been auto resized
stackp->updateLayout();
// now apply requested size to panel
stackp->updatePanelRect(this, new_rect);
}
stackp->mNeedsLayout = true;
}
LLPanel::handleReshape(new_rect, by_user);
}
@ -266,7 +288,6 @@ void LLLayoutStack::draw()
drawChild(panelp, 0, 0, !clip_rect.isEmpty());
}
}
mAnimatedThisFrame = false;
}
void LLLayoutStack::removeChild(LLView* view)
@ -355,7 +376,7 @@ void LLLayoutStack::updateLayout()
if (!mNeedsLayout) return;
bool animation_in_progress = animatePanels();
bool continue_animating = animatePanels();
F32 total_visible_fraction = 0.f;
S32 space_to_distribute = (mOrientation == HORIZONTAL)
? getRect().getWidth()
@ -486,7 +507,7 @@ void LLLayoutStack::updateLayout()
// clear animation flag at end, since panel resizes will set it
// and leave it set if there is any animation in progress
mNeedsLayout = animation_in_progress;
mNeedsLayout = continue_animating;
} // end LLLayoutStack::updateLayout
LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
@ -559,6 +580,7 @@ void LLLayoutStack::updateClass()
for (instance_iter it = beginInstances(); it != endInstances(); ++it)
{
it->updateLayout();
it->mAnimatedThisFrame = false;
}
}
@ -628,7 +650,7 @@ void LLLayoutStack::normalizeFractionalSizes()
bool LLLayoutStack::animatePanels()
{
bool animation_in_progress = false;
bool continue_animating = false;
//
// animate visibility
@ -648,14 +670,15 @@ bool LLLayoutStack::animatePanels()
}
}
animation_in_progress = true;
mAnimatedThisFrame = true;
continue_animating = true;
}
else
{
if (panelp->mVisibleAmt != 1.f)
{
panelp->mVisibleAmt = 1.f;
animation_in_progress = true;
mAnimatedThisFrame = true;
}
}
}
@ -672,14 +695,15 @@ bool LLLayoutStack::animatePanels()
}
}
animation_in_progress = true;
continue_animating = true;
mAnimatedThisFrame = true;
}
else
{
if (panelp->mVisibleAmt != 0.f)
{
panelp->mVisibleAmt = 0.f;
animation_in_progress = true;
mAnimatedThisFrame = true;
}
}
}
@ -687,22 +711,31 @@ bool LLLayoutStack::animatePanels()
F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f;
if (panelp->mCollapseAmt != collapse_state)
{
if (!mAnimatedThisFrame)
if (mAnimate)
{
panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
animation_in_progress = true;
if (!mAnimatedThisFrame)
{
panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
{
panelp->mCollapseAmt = collapse_state;
}
mAnimatedThisFrame = true;
continue_animating = true;
}
else
{
panelp->mCollapseAmt = collapse_state;
mAnimatedThisFrame = true;
}
}
}
mAnimatedThisFrame = true;
return animation_in_progress;
if (mAnimatedThisFrame) mNeedsLayout = true;
return continue_animating;
}
void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect )

View File

@ -166,6 +166,8 @@ public:
void setVisible(BOOL visible);
S32 getLayoutDim() const;
S32 getTargetDim() const;
void setTargetDim(S32 value);
S32 getMinDim() const { return llmax(0, mMinDim); }
void setMinDim(S32 value) { mMinDim = value; }

View File

@ -1225,7 +1225,7 @@ void LLLineEditor::cut()
// Prepare for possible rollback
LLLineEditorRollback rollback( this );
gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
deleteSelection();
// Validate new string and rollback the if needed.
@ -1256,13 +1256,13 @@ void LLLineEditor::copy()
{
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
}
}
BOOL LLLineEditor::canPaste() const
{
return !mReadOnly && gClipboard.canPasteString();
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
void LLLineEditor::paste()
@ -1293,14 +1293,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
if (can_paste_it)
{
LLWString paste;
if (is_primary)
{
paste = gClipboard.getPastePrimaryWString();
}
else
{
paste = gClipboard.getPasteWString();
}
LLClipboard::instance().pasteFromClipboard(paste, is_primary);
if (!paste.empty())
{
@ -1387,13 +1380,13 @@ void LLLineEditor::copyPrimary()
{
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length );
LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length, true);
}
}
BOOL LLLineEditor::canPastePrimary() const
{
return !mReadOnly && gClipboard.canPastePrimaryString();
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
void LLLineEditor::updatePrimary()

View File

@ -389,10 +389,17 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
{
*show_h_scrollbar = TRUE;
*visible_height -= scrollbar_size;
// Note: Do *not* recompute *show_v_scrollbar here because with
// the (- scrollbar_size) we just did we will always add a vertical scrollbar
// even if the height of the items is actually less than the visible size.
// Fear not though: there's enough calcVisibleSize() calls to add a vertical slider later.
// The view inside the scroll container should not be extended
// to container's full height to ensure the correct computation
// of *show_v_scrollbar after subtracting horizontal scrollbar_size.
// Must retest now that visible_height has changed
if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) )
{
*show_v_scrollbar = TRUE;
*visible_width -= scrollbar_size;
}
}
}
}

View File

@ -91,7 +91,7 @@ public:
void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
LLRect getVisibleContentRect();
LLRect getContentWindowRect();
const LLRect& getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
virtual const LLRect getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
void pageUp(S32 overlap = 0);
void pageDown(S32 overlap = 0);
void goToTop();
@ -116,6 +116,9 @@ public:
bool autoScroll(S32 x, S32 y);
protected:
LLView* mScrolledView;
private:
// internal scrollbar handlers
virtual void scrollHorizontal( S32 new_pos );
@ -124,7 +127,6 @@ private:
void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
LLView* mScrolledView;
S32 mSize;
BOOL mIsOpaque;
LLUIColor mBackgroundColor;

View File

@ -2517,7 +2517,7 @@ void LLScrollListCtrl::copy()
{
buffer += (*itor)->getContentsCSV() + "\n";
}
gClipboard.copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length());
LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length());
}
// virtual

View File

@ -1468,7 +1468,7 @@ void LLTextEditor::cut()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID );
LLClipboard::instance().copyToClipboard( getWText(), left_pos, length);
deleteSelection( FALSE );
onKeyStroke();
@ -1488,12 +1488,12 @@ void LLTextEditor::copy()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
gClipboard.copyFromSubstring(getWText(), left_pos, length, mSourceID);
LLClipboard::instance().copyToClipboard(getWText(), left_pos, length);
}
BOOL LLTextEditor::canPaste() const
{
return !mReadOnly && gClipboard.canPasteString();
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
// paste from clipboard
@ -1529,16 +1529,8 @@ void LLTextEditor::pasteHelper(bool is_primary)
return;
}
LLUUID source_id;
LLWString paste;
if (is_primary)
{
paste = gClipboard.getPastePrimaryWString(&source_id);
}
else
{
paste = gClipboard.getPasteWString(&source_id);
}
LLClipboard::instance().pasteFromClipboard(paste, is_primary);
if (paste.empty())
{
@ -1622,12 +1614,12 @@ void LLTextEditor::copyPrimary()
}
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
gClipboard.copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID);
LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true);
}
BOOL LLTextEditor::canPastePrimary() const
{
return !mReadOnly && gClipboard.canPastePrimaryString();
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
void LLTextEditor::updatePrimary()

View File

@ -1841,7 +1841,10 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
void LLView::setShape(const LLRect& new_rect, bool by_user)
{
handleReshape(new_rect, by_user);
if (new_rect != getRect())
{
handleReshape(new_rect, by_user);
}
}
void LLView::handleReshape(const LLRect& new_rect, bool by_user)
@ -2231,145 +2234,163 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect)
}
//static
void LLView::applyXUILayout(LLView::Params& p, LLView* parent)
void LLView::applyXUILayout(LLView::Params& p, LLView* parent, LLRect layout_rect)
{
if (!parent) return;
const S32 VPAD = 4;
const S32 MIN_WIDGET_HEIGHT = 10;
// *NOTE: This will confuse export of floater/panel coordinates unless
// the default is also "topleft". JC
if (p.layout().empty() && parent)
if (p.layout().empty())
{
p.layout = parent->getLayout();
}
if (parent)
if (layout_rect.isEmpty())
{
LLRect parent_rect = parent->getLocalRect();
// overwrite uninitialized rect params, using context
LLRect default_rect = parent->getLocalRect();
layout_rect = parent->getLocalRect();
}
bool layout_topleft = (p.layout() == "topleft");
// overwrite uninitialized rect params, using context
LLRect default_rect = parent->getLocalRect();
// convert negative or centered coordinates to parent relative values
// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth();
if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth();
if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight();
if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight();
bool layout_topleft = (p.layout() == "topleft");
// convert negative or centered coordinates to parent relative values
// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
if (p.rect.left.isProvided())
{
p.rect.left = p.rect.left + ((p.rect.left >= 0) ? layout_rect.mLeft : layout_rect.mRight);
}
if (p.rect.right.isProvided())
{
p.rect.right = p.rect.right + ((p.rect.right >= 0) ? layout_rect.mLeft : layout_rect.mRight);
}
if (p.rect.bottom.isProvided())
{
p.rect.bottom = p.rect.bottom + ((p.rect.bottom >= 0) ? layout_rect.mBottom : layout_rect.mTop);
if (layout_topleft)
{
//invert top to bottom
if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top;
if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom;
p.rect.bottom = layout_rect.mBottom + layout_rect.mTop - p.rect.bottom;
}
// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
{
p.rect.height = MIN_WIDGET_HEIGHT;
}
default_rect.translate(0, default_rect.getHeight());
// If there was a recently constructed child, use its rectangle
get_last_child_rect(parent, &default_rect);
}
if (p.rect.top.isProvided())
{
p.rect.top = p.rect.top + ((p.rect.top >= 0) ? layout_rect.mBottom : layout_rect.mTop);
if (layout_topleft)
{
// Invert the sense of bottom_delta for topleft layout
if (p.bottom_delta.isProvided())
{
p.bottom_delta = -p.bottom_delta;
}
else if (p.top_pad.isProvided())
{
p.bottom_delta = -(p.rect.height + p.top_pad);
}
else if (p.top_delta.isProvided())
{
p.bottom_delta =
-(p.top_delta + p.rect.height - default_rect.getHeight());
}
else if (!p.left_delta.isProvided()
&& !p.left_pad.isProvided())
{
// set default position is just below last rect
p.bottom_delta.set(-(p.rect.height + VPAD), false);
}
else
{
p.bottom_delta.set(0, false);
}
// default to same left edge
if (!p.left_delta.isProvided())
{
p.left_delta.set(0, false);
}
if (p.left_pad.isProvided())
{
// left_pad is based on prior widget's right edge
p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
}
default_rect.translate(p.left_delta, p.bottom_delta);
//invert top to bottom
p.rect.top = layout_rect.mBottom + layout_rect.mTop - p.rect.top;
}
}
// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
{
p.rect.height = MIN_WIDGET_HEIGHT;
}
default_rect.translate(0, default_rect.getHeight());
// If there was a recently constructed child, use its rectangle
get_last_child_rect(parent, &default_rect);
if (layout_topleft)
{
// Invert the sense of bottom_delta for topleft layout
if (p.bottom_delta.isProvided())
{
p.bottom_delta = -p.bottom_delta;
}
else if (p.top_pad.isProvided())
{
p.bottom_delta = -(p.rect.height + p.top_pad);
}
else if (p.top_delta.isProvided())
{
p.bottom_delta =
-(p.top_delta + p.rect.height - default_rect.getHeight());
}
else if (!p.left_delta.isProvided()
&& !p.left_pad.isProvided())
{
// set default position is just below last rect
p.bottom_delta.set(-(p.rect.height + VPAD), false);
}
else
{
// set default position is just below last rect
if (!p.bottom_delta.isProvided())
{
p.bottom_delta.set(-(p.rect.height + VPAD), false);
}
if (!p.left_delta.isProvided())
{
p.left_delta.set(0, false);
}
default_rect.translate(p.left_delta, p.bottom_delta);
{
p.bottom_delta.set(0, false);
}
// default to same left edge
if (!p.left_delta.isProvided())
{
p.left_delta.set(0, false);
}
if (p.left_pad.isProvided())
{
// left_pad is based on prior widget's right edge
p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
}
default_rect.translate(p.left_delta, p.bottom_delta);
}
else
{
// set default position is just below last rect
if (!p.bottom_delta.isProvided())
{
p.bottom_delta.set(-(p.rect.height + VPAD), false);
}
if (!p.left_delta.isProvided())
{
p.left_delta.set(0, false);
}
default_rect.translate(p.left_delta, p.bottom_delta);
}
// this handles case where *both* x and x_delta are provided
// ignore x in favor of default x + x_delta
if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
if (p.left_delta.isProvided()) p.rect.left.set(0, false);
// this handles case where *both* x and x_delta are provided
// ignore x in favor of default x + x_delta
if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
if (p.left_delta.isProvided()) p.rect.left.set(0, false);
// selectively apply rectangle defaults, making sure that
// params are not flagged as having been "provided"
// as rect params are overconstrained and rely on provided flags
if (!p.rect.left.isProvided())
{
p.rect.left.set(default_rect.mLeft, false);
//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
p.rect.paramChanged(p.rect.left, true);
}
if (!p.rect.bottom.isProvided())
{
p.rect.bottom.set(default_rect.mBottom, false);
p.rect.paramChanged(p.rect.bottom, true);
}
if (!p.rect.top.isProvided())
{
p.rect.top.set(default_rect.mTop, false);
p.rect.paramChanged(p.rect.top, true);
}
if (!p.rect.right.isProvided())
{
p.rect.right.set(default_rect.mRight, false);
p.rect.paramChanged(p.rect.right, true);
// selectively apply rectangle defaults, making sure that
// params are not flagged as having been "provided"
// as rect params are overconstrained and rely on provided flags
if (!p.rect.left.isProvided())
{
p.rect.left.set(default_rect.mLeft, false);
//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
p.rect.paramChanged(p.rect.left, true);
}
if (!p.rect.bottom.isProvided())
{
p.rect.bottom.set(default_rect.mBottom, false);
p.rect.paramChanged(p.rect.bottom, true);
}
if (!p.rect.top.isProvided())
{
p.rect.top.set(default_rect.mTop, false);
p.rect.paramChanged(p.rect.top, true);
}
if (!p.rect.right.isProvided())
{
p.rect.right.set(default_rect.mRight, false);
p.rect.paramChanged(p.rect.right, true);
}
if (!p.rect.width.isProvided())
{
p.rect.width.set(default_rect.getWidth(), false);
p.rect.paramChanged(p.rect.width, true);
}
if (!p.rect.height.isProvided())
{
p.rect.height.set(default_rect.getHeight(), false);
p.rect.paramChanged(p.rect.height, true);
}
}
if (!p.rect.width.isProvided())
{
p.rect.width.set(default_rect.getWidth(), false);
p.rect.paramChanged(p.rect.width, true);
}
if (!p.rect.height.isProvided())
{
p.rect.height.set(default_rect.getHeight(), false);
p.rect.paramChanged(p.rect.height, true);
}
}

View File

@ -505,7 +505,7 @@ public:
// Set up params after XML load before calling new(),
// usually to adjust layout.
static void applyXUILayout(Params& p, LLView* parent);
static void applyXUILayout(Params& p, LLView* parent, LLRect layout_rect = LLRect());
// For re-export of floaters and panels, convert the coordinate system
// to be top-left based.

View File

@ -192,6 +192,21 @@ BOOL LLWindow::setSize(LLCoordScreen size)
return setSizeImpl(size);
}
BOOL LLWindow::setSize(LLCoordWindow size)
{
//HACK: we are inconsistently using minimum window dimensions
// in this case, we are constraining the inner "client" rect and other times
// we constrain the outer "window" rect
// There doesn't seem to be a good way to do this consistently without a bunch of platform
// specific code
if (!getMaximized())
{
size.mX = llmax(size.mX, mMinWindowWidth);
size.mY = llmax(size.mY, mMinWindowHeight);
}
return setSizeImpl(size);
}
// virtual
void LLWindow::setMinSize(U32 min_width, U32 min_height, bool enforce_immediately)

View File

@ -73,6 +73,7 @@ public:
virtual BOOL getSize(LLCoordWindow *size) = 0;
virtual BOOL setPosition(LLCoordScreen position) = 0;
BOOL setSize(LLCoordScreen size);
BOOL setSize(LLCoordWindow size);
virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
@ -177,6 +178,7 @@ protected:
virtual BOOL canDelete();
virtual BOOL setSizeImpl(LLCoordScreen size) = 0;
virtual BOOL setSizeImpl(LLCoordWindow size) = 0;
protected:
LLWindowCallbacks* mCallbacks;

View File

@ -47,6 +47,7 @@ public:
/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};

View File

@ -1268,6 +1268,31 @@ BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size)
return TRUE;
}
BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size)
{
Rect client_rect;
if (mWindow)
{
OSStatus err = GetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
if (err == noErr)
{
client_rect.right = client_rect.left + size.mX;
client_rect.bottom = client_rect.top + size.mY;
err = SetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
}
if (err == noErr)
{
return TRUE;
}
else
{
llinfos << "Error setting size" << err << llendl;
return FALSE;
}
}
return FALSE;
}
void LLWindowMacOSX::swapBuffers()
{
aglSwapBuffers(mContext);

View File

@ -59,6 +59,7 @@ public:
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);

View File

@ -987,6 +987,25 @@ BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size)
return FALSE;
}
BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size)
{
if(mWindow)
{
// Push a resize event onto SDL's queue - we'll handle it
// when it comes out again.
SDL_Event event;
event.type = SDL_VIDEORESIZE;
event.resize.w = size.mX;
event.resize.h = size.mY;
SDL_PushEvent(&event); // copied into queue
return TRUE;
}
return FALSE;
}
void LLWindowSDL::swapBuffers()
{
if (mWindow)

View File

@ -64,6 +64,7 @@ public:
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);

View File

@ -873,10 +873,30 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size)
return FALSE;
}
WINDOWPLACEMENT placement;
placement.length = sizeof(WINDOWPLACEMENT);
if (!GetWindowPlacement(mWindowHandle, &placement)) return FALSE;
placement.showCmd = SW_RESTORE;
if (!SetWindowPlacement(mWindowHandle, &placement)) return FALSE;
moveWindow(position, size);
return TRUE;
}
BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
{
RECT window_rect = {0, 0, size.mX, size.mY };
DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
DWORD dw_style = WS_OVERLAPPEDWINDOW;
AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
return setSizeImpl(LLCoordScreen(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
}
// changing fullscreen resolution
BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
{
@ -887,12 +907,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
DWORD current_refresh;
DWORD dw_ex_style;
DWORD dw_style;
RECT window_rect;
RECT window_rect = {0, 0, 0, 0};
S32 width = size.mX;
S32 height = size.mY;
BOOL auto_show = FALSE;
if (mhRC)
if (mhRC)
{
auto_show = TRUE;
resetDisplayResolution();
@ -987,7 +1007,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
dw_ex_style = WS_EX_APPWINDOW;
dw_style = WS_POPUP;
// Move window borders out not to cover window contents
// Move window borders out not to cover window contents.
// This converts client rect to window rect, i.e. expands it by the window border size.
AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
}
// If it failed, we don't want to run fullscreen
@ -1015,6 +1036,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
dw_style = WS_OVERLAPPEDWINDOW;
}
// don't post quit messages when destroying old windows
mPostQuit = FALSE;
@ -1810,6 +1832,10 @@ static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse");
LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
{
// Ignore clicks not originated in the client area, i.e. mouse-up events not preceded with a WM_LBUTTONDOWN.
// This helps prevent avatar walking after maximizing the window by double-clicking the title bar.
static bool sHandleLeftMouseUp = true;
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA);
@ -2156,10 +2182,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE));
return 0;
case WM_NCLBUTTONDOWN:
{
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_NCLBUTTONDOWN");
// A click in a non-client area, e.g. title bar or window border.
sHandleLeftMouseUp = false;
}
break;
case WM_LBUTTONDOWN:
{
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
LLFastTimer t2(FTM_MOUSEHANDLER);
sHandleLeftMouseUp = true;
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->interruptLanguageTextInput();
@ -2224,6 +2260,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
{
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
LLFastTimer t2(FTM_MOUSEHANDLER);
if (!sHandleLeftMouseUp)
{
sHandleLeftMouseUp = true;
break;
}
//if (gDebugClicks)
//{
// LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;

View File

@ -58,6 +58,7 @@ public:
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);

View File

@ -529,6 +529,7 @@ typedef enum e_lscript_runtime_permissions
SCRIPT_PERMISSION_CHANGE_PERMISSIONS,
SCRIPT_PERMISSION_TRACK_CAMERA,
SCRIPT_PERMISSION_CONTROL_CAMERA,
SCRIPT_PERMISSION_TELEPORT,
SCRIPT_PERMISSION_EOF
} LSCRIPTRunTimePermissions;
@ -545,6 +546,7 @@ const U32 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_EOF] =
(0x1 << 9), // SCRIPT_PERMISSION_CHANGE_PERMISSIONS
(0x1 << 10),// SCRIPT_PERMISSION_TRACK_CAMERA
(0x1 << 11),// SCRIPT_PERMISSION_CONTROL_CAMERA
(0x1 << 12),// SCRIPT_PERMISSION_TELEPORT
};
// http_request string constants

View File

@ -218,7 +218,8 @@ extern "C" { int yyerror(const char *fmt, ...); }
"PERMISSION_CHANGE_JOINTS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_JOINTS]; return(INTEGER_CONSTANT); }
"PERMISSION_CHANGE_PERMISSIONS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_PERMISSIONS]; return(INTEGER_CONSTANT); }
"PERMISSION_TRACK_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRACK_CAMERA]; return(INTEGER_CONSTANT); }
"PERMISSION_CONTROL_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); }
"PERMISSION_CONTROL_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); }
"PERMISSION_TELEPORT" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TELEPORT]; return(INTEGER_CONSTANT); }
"INVENTORY_TEXTURE" { count(); yylval.ival = LLAssetType::AT_TEXTURE; return(INTEGER_CONSTANT); }
"INVENTORY_SOUND" { count(); yylval.ival = LLAssetType::AT_SOUND; return(INTEGER_CONSTANT); }

View File

@ -42,13 +42,14 @@ include(UnixInstall)
include(LLKDU)
include(ViewerMiscLibs)
include(LLLogin)
include(VisualLeakDetector)
include(GLOD)
include(CMakeCopyIfDifferent)
include(Growl)
include_directories(
${DBUSGLIB_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIR}
${GLOD_INCLUDE_DIR}
${LLAUDIO_INCLUDE_DIRS}
${LLCHARACTER_INCLUDE_DIRS}
@ -324,7 +325,6 @@ set(viewer_SOURCE_FILES
llinspectremoteobject.cpp
llinspecttoast.cpp
llinventorybridge.cpp
llinventoryclipboard.cpp
llinventoryfilter.cpp
llinventoryfunctions.cpp
llinventoryicon.cpp
@ -340,6 +340,7 @@ set(viewer_SOURCE_FILES
lllistbrowser.cpp
lllistcontextmenu.cpp
lllistview.cpp
lllocalbitmaps.cpp
lllocaltextureobject.cpp
lllocationhistory.cpp
lllocationinputctrl.cpp
@ -935,7 +936,6 @@ set(viewer_HEADER_FILES
llinspectremoteobject.h
llinspecttoast.h
llinventorybridge.h
llinventoryclipboard.h
llinventoryfilter.h
llinventoryfunctions.h
llinventoryicon.h
@ -952,6 +952,7 @@ set(viewer_HEADER_FILES
lllistbrowser.h
lllistcontextmenu.h
lllistview.h
lllocalbitmaps.h
lllocaltextureobject.h
lllocationhistory.h
lllocationinputctrl.h

View File

@ -97,6 +97,7 @@ PERMISSION_CHANGE_LINKS Passed to llRequestPermissions library function to req
# PERMISSION_CHANGE_PERMISSIONS Passed to llRequestPermissions library function to request permission to change permissions
PERMISSION_TRACK_CAMERA Passed to llRequestPermissions library function to request permission to track agent's camera
PERMISSION_CONTROL_CAMERA Passed to llRequestPermissions library function to request permission to change agent's camera
PERMISSION_TELEPORT Passed to llRequestPermissions library function to request permission to teleport agent
DEBUG_CHANNEL Chat channel reserved for debug and error messages from scripts
PUBLIC_CHANNEL Chat channel that broadcasts to all nearby users

View File

@ -2199,6 +2199,28 @@
<key>Value</key>
<string>http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html</string>
</map>
<key>AvatarRotateThresholdSlow</key>
<map>
<key>Comment</key>
<string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving slowly (degrees)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<integer>60</integer>
</map>
<key>AvatarRotateThresholdFast</key>
<map>
<key>Comment</key>
<string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving fast (degrees)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<integer>2</integer>
</map>
<key>AvatarBakedTextureUploadTimeout</key>
<map>
<key>Comment</key>
@ -5927,17 +5949,6 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryInboxToggleState</key>
<map>
<key>Comment</key>
<string>Stores the open/closed state of inventory Received items panel</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryLinking</key>
<map>
@ -10067,7 +10078,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>128</real>
<real>512</real>
</map>
<key>RenderSpecularResY</key>
@ -10091,7 +10102,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>8</real>
<real>384</real>
</map>
<key>RenderDeferred</key>
@ -11491,18 +11502,29 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>ShowConsoleWindow</key>
<map>
<key>Comment</key>
<string>Show log in separate OS window</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>NavBarShowCoordinates</key>
<key>ShowConsoleWindow</key>
<map>
<key>Comment</key>
<string>Show log in separate OS window</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>EnableVisualLeakDetector</key>
<map>
<key>Comment</key>
<string>EnableVisualLeakDetector</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>NavBarShowCoordinates</key>
<map>
<key>Comment</key>
<string>Show coordinates in navigation bar</string>
@ -15131,7 +15153,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>WindowX</key>
<map>
<key>Comment</key>
<string>X coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
<string>X coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@ -15142,7 +15164,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>WindowY</key>
<map>
<key>Comment</key>
<string>Y coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
<string>Y coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -134,6 +134,28 @@
<key>Value</key>
<string />
</map>
<key>InventoryInboxHeight</key>
<map>
<key>Comment</key>
<string>Inventory inbox panel height in Inventory floater.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>200</integer>
</map>
<key>InventoryInboxToggleState</key>
<map>
<key>Comment</key>
<string>Stores the open/closed state of inventory Received Items panel.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>DisplayDestinationsOnInitialRun</key>
<map>
<key>Comment</key>

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec4 vertex_color;
@ -34,5 +36,5 @@ uniform sampler2D diffuseMap;
void main()
{
gl_FragColor = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a);
frag_color = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a);
}

View File

@ -26,15 +26,15 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
vec4 diffuseLookup(vec2 texcoord);
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
vec3 atmosLighting(vec3 light);
@ -69,6 +69,6 @@ void main()
color.rgb += diff.rgb * vary_pointlight_col.rgb;
gl_FragColor = color;
frag_color = color;
}

View File

@ -26,15 +26,15 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
uniform sampler2D diffuseMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
vec3 atmosLighting(vec3 light);
@ -81,9 +81,9 @@ void main()
color.rgb += diff.rgb * vary_pointlight_col.rgb;
gl_FragColor = color;
//gl_FragColor = vec4(1,0,1,1);
//gl_FragColor = vec4(1,0,1,1)*shadow;
frag_color = color;
//frag_color = vec4(1,0,1,1);
//frag_color = vec4(1,0,1,1)*shadow;
}

View File

@ -26,14 +26,14 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
uniform sampler2D diffuseMap;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform vec2 screen_res;
vec3 atmosLighting(vec3 light);
@ -79,6 +79,6 @@ void main()
color.rgb += diff.rgb * vary_pointlight_col.rgb;
gl_FragColor = color;
frag_color = color;
}

View File

@ -41,7 +41,6 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
VARYING vec3 vary_position;
VARYING vec3 vary_ambient;
VARYING vec3 vary_directional;
VARYING vec3 vary_normal;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_pointlight_col;
VARYING vec4 vertex_color;
@ -110,8 +109,7 @@ void main()
gl_Position = frag_pos;
vary_position = pos.xyz;
vary_normal = norm;
calcAtmospherics(pos.xyz);
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);

View File

@ -48,7 +48,6 @@ VARYING vec3 vary_ambient;
VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_light;
VARYING vec3 vary_pointlight_col;
VARYING vec4 vertex_color;
@ -134,8 +133,6 @@ void main()
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
vary_light = light_position[0].xyz;
vary_ambient = col.rgb*diffuse_color.rgb;
vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));

View File

@ -23,17 +23,17 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2D diffuseMap;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
void main()
{
//gl_FragColor = vec4(1,1,1,vertex_color.a * texture2D(diffuseMap, vary_texcoord0.xy).a);
gl_FragColor = vec4(1,1,1,1);
frag_color = vec4(1,1,1,1);
}

View File

@ -27,11 +27,8 @@ uniform mat4 modelview_matrix;
uniform mat4 texture_matrix0;
ATTRIBUTE vec3 position;
ATTRIBUTE vec4 diffuse_color;
ATTRIBUTE vec2 texcoord0;
VARYING vec4 vertex_color;
mat4 getObjectSkinnedTransform();
void main()
@ -42,8 +39,6 @@ void main()
mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vertex_color = diffuse_color;
vec4 p = projection_matrix * vec4(pos, 1.0);
p.z = max(p.z, -p.w+0.01);
gl_Position = p;

View File

@ -0,0 +1,148 @@
/**
* @file avatarAlphaNoColorV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
uniform mat4 projection_matrix;
ATTRIBUTE vec3 position;
ATTRIBUTE vec3 normal;
ATTRIBUTE vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
void calcAtmospherics(vec3 inPositionEye);
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);
vec3 scaleDownLight(vec3 light);
vec3 scaleUpLight(vec3 light);
VARYING vec3 vary_position;
VARYING vec3 vary_ambient;
VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
uniform float near_clip;
uniform vec4 color;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
float calcDirectionalLight(vec3 n, vec3 l)
{
float a = max(dot(n,l),0.0);
return a;
}
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
//get distance
float d = dot(lv,lv);
float da = 0.0;
if (d > 0.0 && la > 0.0 && fa > 0.0)
{
//normalize light vector
lv = normalize(lv);
//distance attenuation
float dist2 = d/la;
da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
da *= spot*spot; // GL_SPOT_EXPONENT=2
//angular attenuation
da *= max(dot(n, lv), 0.0);
}
return da;
}
void main()
{
vary_texcoord0 = texcoord0;
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
vec4 pos_in = vec4(position.xyz, 1.0);
pos.x = dot(trans[0], pos_in);
pos.y = dot(trans[1], pos_in);
pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
norm.x = dot(trans[0].xyz, normal);
norm.y = dot(trans[1].xyz, normal);
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
vary_position = pos.xyz;
calcAtmospherics(pos.xyz);
vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
vary_pointlight_col = col.rgb*color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
vary_ambient = col.rgb*color.rgb;
vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0));
col.rgb = col.rgb * color.rgb;
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform sampler2D diffuseMap;
@ -41,9 +43,9 @@ void main()
discard;
}
gl_FragData[0] = vec4(diff.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
frag_data[0] = vec4(diff.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2D diffuseMap;
@ -33,7 +35,7 @@ VARYING vec4 post_pos;
void main()
{
gl_FragColor = 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);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
@ -111,6 +113,6 @@ void main()
col /= defined_weight.xyxx;
col.y *= col.y;
gl_FragColor = col;
frag_color = col;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform sampler2D diffuseMap;
@ -46,9 +48,9 @@ void main()
dot(norm,vary_mat1),
dot(norm,vary_mat2));
gl_FragData[0] = vec4(col, 0.0);
gl_FragData[1] = vertex_color.aaaa; // spec
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(tnorm);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -30,7 +30,7 @@ ATTRIBUTE vec3 position;
ATTRIBUTE vec4 diffuse_color;
ATTRIBUTE vec3 normal;
ATTRIBUTE vec2 texcoord0;
ATTRIBUTE vec2 texcoord2;
ATTRIBUTE vec3 binormal;
VARYING vec3 vary_mat0;
VARYING vec3 vary_mat1;
@ -52,7 +52,7 @@ void main()
vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz);
vec3 b = normalize((mat * vec4(binormal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);

View File

@ -25,7 +25,9 @@
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
/////////////////////////////////////////////////////////////////////////
@ -98,8 +100,8 @@ void main()
color *= 2.;
/// Gamma correct for WL (soft clip effect).
gl_FragData[0] = vec4(scaleSoftClip(color.rgb), alpha1);
gl_FragData[1] = vec4(0.0,0.0,0.0,0.0);
gl_FragData[2] = vec4(0,0,1,0);
frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1);
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
frag_data[2] = vec4(0,0,1,0);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -83,6 +85,6 @@ void main()
sc = max(sc, -max_cof);
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
gl_FragColor.rgb = diff.rgb + bloom.rgb;
gl_FragColor.a = sc/max_cof*0.5+0.5;
frag_color.rgb = diff.rgb + bloom.rgb;
frag_color.a = sc/max_cof*0.5+0.5;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform float minimum_alpha;
@ -44,9 +46,9 @@ void main()
discard;
}
gl_FragData[0] = vec4(col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0); // spec
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0); // spec
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
VARYING vec3 vary_normal;
@ -43,8 +45,8 @@ void main()
discard;
}
gl_FragData[0] = vec4(col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -25,7 +25,9 @@
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform float minimum_alpha;
@ -44,9 +46,9 @@ void main()
discard;
}
gl_FragData[0] = vec4(col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0); // spec
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0); // spec
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform sampler2D diffuseMap;
@ -36,10 +38,10 @@ VARYING vec2 vary_texcoord0;
void main()
{
vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
gl_FragData[0] = vec4(col, 0.0);
gl_FragData[1] = vertex_color.aaaa; // spec
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
VARYING vec3 vary_normal;
@ -35,9 +37,9 @@ void main()
{
vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
gl_FragData[0] = vec4(col, 0.0);
gl_FragData[1] = vertex_color.aaaa; // spec
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
frag_data[0] = vec4(col, 0.0);
frag_data[1] = vertex_color.aaaa; // spec
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -37,14 +39,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);
@ -63,5 +75,5 @@ void main()
diff = mix(diff, col*0.25, a);
}
gl_FragColor = mix(diff, dof, a);
frag_color = mix(diff, dof, a);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
vec3 fullbrightAtmosTransport(vec3 light);
@ -45,6 +47,6 @@ void main()
color.rgb = fullbrightScaleSoftClip(color.rgb);
gl_FragColor = color;
frag_color = color;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec4 vertex_color;
@ -46,6 +48,6 @@ void main()
color.rgb = fullbrightScaleSoftClip(color.rgb);
gl_FragColor = color;
frag_color = color;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
#define FXAA_PC 1
@ -341,18 +343,23 @@ A. Or use FXAA_GREEN_AS_LUMA.
// 1 = API supports gather4 on alpha channel.
// 0 = API does not support gather4 on alpha channel.
//
#if (FXAA_GLSL_130 == 0)
#define FXAA_GATHER4_ALPHA 0
#endif
#if (FXAA_HLSL_5 == 1)
#define FXAA_GATHER4_ALPHA 1
#endif
#ifdef GL_ARB_gpu_shader5
#define FXAA_GATHER4_ALPHA 1
#endif
#ifdef GL_NV_gpu_shader5
#define FXAA_GATHER4_ALPHA 1
#endif
#ifndef FXAA_GATHER4_ALPHA
#define FXAA_GATHER4_ALPHA 0
#endif
#ifdef GL_ARB_gpu_shader5
#define FXAA_GATHER4_ALPHA 1
#endif
#ifdef GL_NV_gpu_shader5
#define FXAA_GATHER4_ALPHA 1
#endif
#ifndef FXAA_GATHER4_ALPHA
#define FXAA_GATHER4_ALPHA 0
#endif
#endif
#endif
/*============================================================================
@ -2113,6 +2120,6 @@ void main()
//diff = texture2D(diffuseMap, vary_tc);
gl_FragColor = diff;
frag_color = diff;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
@ -184,5 +186,5 @@ void main()
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
gl_FragColor.xyz = giAmbient(pos, norm);
frag_color.xyz = giAmbient(pos, norm);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform float minimum_alpha;
@ -45,7 +47,7 @@ void main()
discard;
}
gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
gl_FragData[1] = texture2D(specularMap, vary_texcoord0.xy);
gl_FragData[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0);
frag_data[0] = vec4(col.rgb, col.a * 0.005);
frag_data[1] = texture2D(specularMap, vary_texcoord0.xy);
frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0);
}

View File

@ -26,12 +26,14 @@
uniform sampler2DRect diffuseMap;
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec2 vary_fragcoord;
void main()
{
gl_FragColor = texture2DRect(diffuseMap, vary_fragcoord.xy);
frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
@ -126,7 +128,7 @@ void main()
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;
col += da*sa*light_col[i].rgb*spec.rgb;
}
@ -141,6 +143,6 @@ void main()
discard;
}
gl_FragColor.rgb = out_col;
gl_FragColor.a = 0.0;
frag_color.rgb = out_col;
frag_color.a = 0.0;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
//class 1 -- no shadows
@ -242,6 +244,6 @@ void main()
}
}
gl_FragColor.rgb = col;
gl_FragColor.a = 0.0;
frag_color.rgb = col;
frag_color.a = 0.0;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2D alphaMap;
@ -52,5 +54,5 @@ void main()
norm *= 0.5;
norm += 0.5;
gl_FragColor = vec4(norm, alpha);
frag_color = vec4(norm, alpha);
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -107,7 +109,7 @@ void main()
float sa = dot(normalize(lv-normalize(pos)),norm);
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;
col += da*sa*color.rgb*spec.rgb;
}
@ -118,6 +120,6 @@ void main()
discard;
}
gl_FragColor.rgb = col;
gl_FragColor.a = 0.0;
frag_color.rgb = col;
frag_color.a = 0.0;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -122,5 +124,5 @@ void main()
diff /= w;
}
gl_FragColor = diff;
frag_color = diff;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -40,6 +42,6 @@ void main()
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
gl_FragColor = diff + bloom;
frag_color = diff + bloom;
}

View File

@ -1,5 +1,5 @@
/**
* @file postgiV.glsl
* @file postDeferredV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@ -24,17 +24,17 @@
*/
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
VARYING vec2 vary_fragcoord;
uniform vec2 screen_res;
void main()
{
//transform vertex
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = pos;
gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}

View File

@ -24,8 +24,10 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
@ -96,5 +98,5 @@ void main()
col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z;
gl_FragColor.rgb = col;
frag_color.rgb = col;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform float minimum_alpha;
@ -44,7 +46,7 @@ void main()
discard;
}
gl_FragColor = 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);
}

View File

@ -24,14 +24,16 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec4 post_pos;
void main()
{
gl_FragColor = 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);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
/////////////////////////////////////////////////////////////////////////
@ -57,8 +59,8 @@ void main()
color *= 2.;
/// Gamma correct for WL (soft clip effect).
gl_FragData[0] = vec4(scaleSoftClip(color.rgb), 1.0);
gl_FragData[1] = vec4(0.0,0.0,0.0,0.0);
gl_FragData[2] = vec4(0,0,1,0);
frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
frag_data[2] = vec4(0,0,1,0);
}

View File

@ -26,7 +26,6 @@
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
ATTRIBUTE vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@ -34,7 +33,6 @@ ATTRIBUTE vec2 texcoord0;
// Output parameters
VARYING vec4 vary_HazeColor;
VARYING vec2 vary_texcoord0;
// Inputs
uniform vec3 camPosLocal;
@ -60,8 +58,7 @@ void main()
// World / view / projection
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_texcoord0 = texcoord0;
// Get relative position
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
//vec3 P = position.xyz + vec3(0,50,0);

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -299,11 +301,11 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.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
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib);
bloom = dot(spec_contrib, spec_contrib) / 4;
col += spec_contrib;
//add environmentmap
@ -322,7 +324,7 @@ void main()
col = diffuse.rgb;
}
gl_FragColor.rgb = col;
frag_color.rgb = col;
gl_FragColor.a = bloom;
frag_color.a = bloom;
}

View File

@ -27,7 +27,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect diffuseRect;
@ -184,6 +186,6 @@ void main()
}
}
gl_FragColor.rgb = col;
gl_FragColor.a = 0.0;
frag_color.rgb = col;
frag_color.a = 0.0;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
VARYING vec4 vertex_color;
@ -36,7 +38,7 @@ void main()
{
vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
gl_FragData[0] = col;
gl_FragData[1] = vec4(0,0,0,0);
gl_FragData[2] = vec4(0,0,1,0);
frag_data[0] = col;
frag_data[1] = vec4(0,0,0,0);
frag_data[2] = vec4(0,0,1,0);
}

View File

@ -28,10 +28,12 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
void main()
{
gl_FragColor = vec4(0,0,0,0);
frag_color = vec4(0,0,0,0);
}

View File

@ -1,5 +1,5 @@
/**
* @file giV.glsl
* @file sunLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@ -24,13 +24,8 @@
*/
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
ATTRIBUTE vec4 diffuse_color;
ATTRIBUTE vec2 texcoord0;
VARYING vec4 vertex_color;
VARYING vec2 vary_fragcoord;
uniform vec2 screen_res;
@ -39,10 +34,4 @@ void main()
//transform vertex
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
gl_Position = pos;
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
vec4 tex = vec4(texcoord0,0,1);
tex.w = 1.0;
vertex_color = diffuse_color;
}

View File

@ -26,7 +26,9 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
//class 1 -- no shadow, SSAO only
@ -37,8 +39,6 @@ uniform sampler2D noiseMap;
// Inputs
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform float ssao_radius;
uniform float ssao_max_radius;
uniform float ssao_factor;
@ -49,9 +49,6 @@ VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform float shadow_bias;
uniform float shadow_offset;
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).r;
@ -128,8 +125,8 @@ void main()
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
gl_FragColor[0] = 1.0;
gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
gl_FragColor[2] = 1.0;
gl_FragColor[3] = 1.0;
frag_color[0] = 1.0;
frag_color[1] = calcAmbientOcclusion(pos, norm);
frag_color[2] = 1.0;
frag_color[3] = 1.0;
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform sampler2D detail_0;
@ -51,9 +53,9 @@ void main()
float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
gl_FragData[0] = vec4(outColor.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
frag_data[0] = vec4(outColor.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

View File

@ -24,7 +24,9 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragData[3];
out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
uniform sampler2D diffuseMap;
@ -43,8 +45,8 @@ void main()
discard;
}
gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}

Some files were not shown because too many files have changed in this diff Show More