Merge branch 'viewer/build' into rlva/development
commit
712030c8fc
|
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
# clang-format version 10.0.0+
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Microsoft
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignConsecutiveMacros: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Always
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
|
|
@ -29,21 +30,21 @@ BreakBeforeBraces: Allman
|
|||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
ColumnLimit: 140
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ExperimentalAutoDetectBinPacking: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
|
|
@ -62,18 +63,18 @@ IncludeCategories:
|
|||
SortPriority: 0
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: false
|
||||
IndentCaseLabels: true
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
NamespaceIndentation: Inner
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
|
|
@ -94,16 +95,16 @@ SpaceAfterCStyleCast: true
|
|||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
|
|
|
|||
|
|
@ -244,9 +244,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>471b0b350955152fd87518575057dfc4</string>
|
||||
<string>322dd6c45c384d454ae14ef127984a4e</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60326/566593/bugsplat-1.0.7.542667-darwin64-542667.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65457/612879/bugsplat-1.0.7.546418-darwin64-546418.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin64</string>
|
||||
|
|
@ -256,9 +256,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>70e8bf46145c4cbae6f93e8b70ba5499</string>
|
||||
<string>010a0e73c0fddaa2316411803fad8e69</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60320/566541/bugsplat-3.6.0.4.542667-windows-542667.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65456/612876/bugsplat-3.6.0.8.546418-windows-546418.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows</string>
|
||||
|
|
@ -268,16 +268,16 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>a73696e859fad3f19f835740815a2bd3</string>
|
||||
<string>7e8530762e7b50663708a888c23b8780</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60321/566542/bugsplat-3.6.0.4.542667-windows64-542667.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65455/612874/bugsplat-3.6.0.8.546418-windows64-546418.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows64</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>1.0.7.542667</string>
|
||||
<string>3.6.0.8.546418</string>
|
||||
</map>
|
||||
<key>colladadom</key>
|
||||
<map>
|
||||
|
|
@ -580,9 +580,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>e145f8ea99a21712434e0e868d1885dc</string>
|
||||
<string>cc26af2ebfa241891caca829a6e46b88</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/62333/588183/dullahan-1.7.0.202006240858_81.3.10_gb223419_chromium-81.0.4044.138-darwin64-544091.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65005/607316/dullahan-1.7.0.202008031101_81.3.10_gb223419_chromium-81.0.4044.138-darwin64-546064.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin64</string>
|
||||
|
|
@ -592,9 +592,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>fdbbbfc377e28cba664f2b1c54ea6086</string>
|
||||
<string>4e5b9e2fe65d94e30a4f3d831c767199</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/62331/588162/dullahan-1.7.0.202006241556_81.3.10_gb223419_chromium-81.0.4044.138-windows-544091.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65004/607304/dullahan-1.7.0.202008031759_81.3.10_gb223419_chromium-81.0.4044.138-windows-546064.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows</string>
|
||||
|
|
@ -604,16 +604,16 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>d85a32d905b199534e8feafa34b28e39</string>
|
||||
<string>6f7bf7f915f3d75dbdad08a2d41ca74e</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/62332/588168/dullahan-1.7.0.202006241556_81.3.10_gb223419_chromium-81.0.4044.138-windows64-544091.tar.bz2</string>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/65003/607308/dullahan-1.7.0.202008031800_81.3.10_gb223419_chromium-81.0.4044.138-windows64-546064.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows64</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>1.7.0.202006240858_81.3.10_gb223419_chromium-81.0.4044.138</string>
|
||||
<string>1.7.0.202008031800_81.3.10_gb223419_chromium-81.0.4044.138</string>
|
||||
</map>
|
||||
<key>elfio</key>
|
||||
<map>
|
||||
|
|
@ -748,9 +748,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>dc4c9122de8bf77f34cfc8227d10a272</string>
|
||||
<string>89c37441a806ed80c0102d380eec6fd0</string>
|
||||
<key>url</key>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/59038/554626/fmodstudio-2.00.07.541681-darwin64-541681.tar.bz2</string>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/65400/612632/fmodstudio-2.00.11.546392-darwin64-546392.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin64</string>
|
||||
|
|
@ -760,9 +760,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>c491bdc1690f3d920c66be509ccc6ef2</string>
|
||||
<string>5283050c22d31877cd9e0afbe6feb9fc</string>
|
||||
<key>url</key>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/59039/554632/fmodstudio-2.00.07.541681-linux-541681.tar.bz2</string>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/65398/612630/fmodstudio-2.00.11.546392-linux-546392.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
|
|
@ -772,9 +772,9 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>ae75cdb1cc9da824c9e270bf97bfdd6c</string>
|
||||
<string>5a3c78f4a77ae6477986e33836725e8b</string>
|
||||
<key>url</key>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/54589/506866/fmodstudio-2.00.07.538806-linux64-538806.tar.bz2</string>
|
||||
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/65399/612631/fmodstudio-2.00.11.546392-linux64-546392.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux64</string>
|
||||
|
|
@ -805,7 +805,7 @@
|
|||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>2.00.07.541681</string>
|
||||
<string>2.00.11.546392</string>
|
||||
</map>
|
||||
<key>fontconfig</key>
|
||||
<map>
|
||||
|
|
@ -2187,16 +2187,18 @@
|
|||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>b677ee43822212f0a27c838dc8bf3623</string>
|
||||
<string>9f4687d7d328b0c13a9e651e805e880a</string>
|
||||
<key>hash_algorithm</key>
|
||||
<string>md5</string>
|
||||
<key>url</key>
|
||||
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/67622/646614/llca-202009010215.548269-common-548269.tar.bz2</string>
|
||||
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/71501/691487/llca-202011010215.551526-common-551526.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>common</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>202009010215.548269</string>
|
||||
<string>202011010215.551526</string>
|
||||
</map>
|
||||
<key>llphysicsextensions_source</key>
|
||||
<map>
|
||||
|
|
@ -3495,7 +3497,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
|
|||
<key>canonical_repo</key>
|
||||
<string>https://bitbucket.org/lindenlab/viewer</string>
|
||||
<key>copyright</key>
|
||||
<string>Copyright (c) 2014, Linden Research, Inc.</string>
|
||||
<string>Copyright (c) 2020, Linden Research, Inc.</string>
|
||||
<key>description</key>
|
||||
<string>Second Life Viewer</string>
|
||||
<key>license</key>
|
||||
|
|
|
|||
|
|
@ -223,6 +223,9 @@ Ansariel Hiller
|
|||
MAINT-8723
|
||||
SL-10385
|
||||
SL-10891
|
||||
SL-13364
|
||||
SL-13858
|
||||
SL-13697
|
||||
Aralara Rajal
|
||||
Arare Chantilly
|
||||
CHUIBUG-191
|
||||
|
|
@ -261,6 +264,9 @@ Benjamin Bigdipper
|
|||
Beq Janus
|
||||
BUG-227094
|
||||
Beth Walcher
|
||||
Beq Janus
|
||||
SL-10288
|
||||
SL-13583
|
||||
Bezilon Kasei
|
||||
Biancaluce Robbiani
|
||||
CT-225
|
||||
|
|
@ -831,7 +837,9 @@ Khyota Wulluf
|
|||
Kimar Coba
|
||||
Kithrak Kirkorian
|
||||
Kitty Barnett
|
||||
BUG-228664
|
||||
BUG-228665
|
||||
BUG-228719
|
||||
VWR-19699
|
||||
STORM-288
|
||||
STORM-799
|
||||
|
|
|
|||
|
|
@ -73,8 +73,14 @@ if (WINDOWS)
|
|||
# Without PreferredToolArchitecture=x64, as of 2020-06-26 the 32-bit
|
||||
# compiler on our TeamCity build hosts has started running out of virtual
|
||||
# memory for the precompiled header file.
|
||||
# CP changed to only append the flag for 32bit builds - on 64bit builds,
|
||||
# locally at least, the build output is spammed with 1000s of 'D9002'
|
||||
# warnings about this switch being ignored.
|
||||
# [SL:KB] - Moved to variables for the convenience of people who are not Kitty
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /p:PreferredToolArchitecture=x64")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
if( ADDRESS_SIZE EQUAL 32 )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /p:PreferredToolArchitecture=x64")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zo"
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
12
|
||||
|
|
@ -408,7 +408,7 @@ void showJointScaleOverrides( const LLJoint& joint, const std::string& note, con
|
|||
bool LLJoint::aboveJointPosThreshold(const LLVector3& pos) const
|
||||
{
|
||||
LLVector3 diff = pos - getDefaultPosition();
|
||||
const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm
|
||||
const F32 max_joint_pos_offset = LL_JOINT_TRESHOLD_POS_OFFSET; // 0.1 mm
|
||||
return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset;
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ void LLJoint::clearAttachmentPosOverrides()
|
|||
// getAllAttachmentPosOverrides()
|
||||
//--------------------------------------------------------------------
|
||||
void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
|
||||
std::set<LLVector3>& distinct_pos_overrides)
|
||||
std::set<LLVector3>& distinct_pos_overrides) const
|
||||
{
|
||||
num_pos_overrides = m_attachmentPosOverrides.count();
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
|
||||
|
|
@ -525,7 +525,7 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
|
|||
// getAllAttachmentScaleOverrides()
|
||||
//--------------------------------------------------------------------
|
||||
void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
|
||||
std::set<LLVector3>& distinct_scale_overrides)
|
||||
std::set<LLVector3>& distinct_scale_overrides) const
|
||||
{
|
||||
num_scale_overrides = m_attachmentScaleOverrides.count();
|
||||
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ const U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2);
|
|||
const S32 LL_CHARACTER_MAX_PRIORITY = 7;
|
||||
const F32 LL_MAX_PELVIS_OFFSET = 5.f;
|
||||
|
||||
const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm
|
||||
|
||||
class LLVector3OverrideMap
|
||||
{
|
||||
public:
|
||||
|
|
@ -287,9 +289,9 @@ public:
|
|||
void showAttachmentScaleOverrides(const std::string& av_info) const;
|
||||
|
||||
void getAllAttachmentPosOverrides(S32& num_pos_overrides,
|
||||
std::set<LLVector3>& distinct_pos_overrides);
|
||||
std::set<LLVector3>& distinct_pos_overrides) const;
|
||||
void getAllAttachmentScaleOverrides(S32& num_scale_overrides,
|
||||
std::set<LLVector3>& distinct_scale_overrides);
|
||||
std::set<LLVector3>& distinct_scale_overrides) const;
|
||||
|
||||
// These are used in checks of whether a pos/scale override is considered significant.
|
||||
bool aboveJointPosThreshold(const LLVector3& pos) const;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ LLApp::~LLApp()
|
|||
|
||||
if(mExceptionHandler != 0) delete mExceptionHandler;
|
||||
|
||||
SUBSYSTEM_CLEANUP(LLCommon);
|
||||
SUBSYSTEM_CLEANUP_DBG(LLCommon);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void ll_cleanup_apr()
|
|||
{
|
||||
gAPRInitialized = false;
|
||||
|
||||
LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
|
||||
LL_DEBUGS("APR") << "Cleaning up APR" << LL_ENDL;
|
||||
|
||||
LLThreadLocalPointerBase::destroyAllThreadLocalStorage();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,13 @@
|
|||
#include "llerror.h"
|
||||
#include "llerrorcontrol.h"
|
||||
|
||||
void log_subsystem_cleanup(const char* file, int line, const char* function,
|
||||
void log_subsystem_cleanup(LLError::ELevel level,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* function,
|
||||
const char* classname)
|
||||
{
|
||||
LL_INFOS("Cleanup") << LLError::abbreviateFile(file) << "(" << line << "): "
|
||||
LL_VLOGS(level, "Cleanup") << LLError::abbreviateFile(file) << "(" << line << "): "
|
||||
<< "calling " << classname << "::cleanupClass() in "
|
||||
<< function << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,13 +21,22 @@
|
|||
// shutdown schemes.
|
||||
#define SUBSYSTEM_CLEANUP(CLASSNAME) \
|
||||
do { \
|
||||
log_subsystem_cleanup(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, #CLASSNAME); \
|
||||
log_subsystem_cleanup(LLError::LEVEL_INFO, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, #CLASSNAME); \
|
||||
CLASSNAME::cleanupClass(); \
|
||||
} while (0)
|
||||
|
||||
#define SUBSYSTEM_CLEANUP_DBG(CLASSNAME) \
|
||||
do { \
|
||||
log_subsystem_cleanup(LLError::LEVEL_DEBUG, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, #CLASSNAME); \
|
||||
CLASSNAME::cleanupClass(); \
|
||||
} while (0)
|
||||
// Use ancient do { ... } while (0) macro trick to permit a block of
|
||||
// statements with the same syntax as a single statement.
|
||||
|
||||
void log_subsystem_cleanup(const char* file, int line, const char* function,
|
||||
void log_subsystem_cleanup(LLError::ELevel level,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* function,
|
||||
const char* classname);
|
||||
|
||||
#endif /* ! defined(LL_LLCLEANUP_H) */
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void LLCommon::cleanupClass()
|
|||
sMasterThreadRecorder = NULL;
|
||||
LLTrace::set_master_thread_recorder(NULL);
|
||||
LLThreadSafeRefCount::cleanupThreadSafeRefCount();
|
||||
SUBSYSTEM_CLEANUP(LLTimer);
|
||||
SUBSYSTEM_CLEANUP_DBG(LLTimer);
|
||||
if (sAprInitialized)
|
||||
{
|
||||
ll_cleanup_apr();
|
||||
|
|
|
|||
|
|
@ -332,12 +332,9 @@ namespace LLError
|
|||
}
|
||||
// huh, that's odd, we should see one or the other prefix -- but don't
|
||||
// try to log unless logging is already initialized
|
||||
if (is_available())
|
||||
{
|
||||
// in Python, " or ".join(vector) -- but in C++, a PITB
|
||||
LL_DEBUGS() << "Did not see 'class' or 'struct' prefix on '"
|
||||
<< name << "'" << LL_ENDL;
|
||||
}
|
||||
// in Python, " or ".join(vector) -- but in C++, a PITB
|
||||
LL_DEBUGS() << "Did not see 'class' or 'struct' prefix on '"
|
||||
<< name << "'" << LL_ENDL;
|
||||
return name;
|
||||
|
||||
#else // neither GCC nor Visual Studio
|
||||
|
|
@ -438,9 +435,12 @@ namespace
|
|||
typedef std::vector<LLError::RecorderPtr> Recorders;
|
||||
typedef std::vector<LLError::CallSite*> CallSiteVector;
|
||||
|
||||
class Globals : public LLSingleton<Globals>
|
||||
class Globals
|
||||
{
|
||||
LLSINGLETON(Globals);
|
||||
public:
|
||||
static Globals* getInstance();
|
||||
protected:
|
||||
Globals();
|
||||
public:
|
||||
std::ostringstream messageStream;
|
||||
bool messageStreamInUse;
|
||||
|
|
@ -460,6 +460,16 @@ namespace
|
|||
{
|
||||
}
|
||||
|
||||
Globals* Globals::getInstance()
|
||||
{
|
||||
// According to C++11 Function-Local Initialization
|
||||
// of static variables is supposed to be thread safe
|
||||
// without risk of deadlocks.
|
||||
static Globals inst;
|
||||
|
||||
return &inst;
|
||||
}
|
||||
|
||||
void Globals::addCallSite(LLError::CallSite& site)
|
||||
{
|
||||
callSites.push_back(&site);
|
||||
|
|
@ -512,14 +522,17 @@ namespace LLError
|
|||
|
||||
typedef LLPointer<SettingsConfig> SettingsConfigPtr;
|
||||
|
||||
class Settings : public LLSingleton<Settings>
|
||||
class Settings
|
||||
{
|
||||
LLSINGLETON(Settings);
|
||||
public:
|
||||
static Settings* getInstance();
|
||||
protected:
|
||||
Settings();
|
||||
public:
|
||||
SettingsConfigPtr getSettingsConfig();
|
||||
|
||||
void reset();
|
||||
SettingsStoragePtr saveAndReset();
|
||||
SettingsStoragePtr saveAndReset();
|
||||
void restore(SettingsStoragePtr pSettingsStorage);
|
||||
|
||||
private:
|
||||
|
|
@ -553,6 +566,16 @@ namespace LLError
|
|||
{
|
||||
}
|
||||
|
||||
Settings* Settings::getInstance()
|
||||
{
|
||||
// According to C++11 Function-Local Initialization
|
||||
// of static variables is supposed to be thread safe
|
||||
// without risk of deadlocks.
|
||||
static Settings inst;
|
||||
|
||||
return &inst;
|
||||
}
|
||||
|
||||
SettingsConfigPtr Settings::getSettingsConfig()
|
||||
{
|
||||
return mSettingsConfig;
|
||||
|
|
@ -577,11 +600,6 @@ namespace LLError
|
|||
SettingsConfigPtr newSettingsConfig(dynamic_cast<SettingsConfig *>(pSettingsStorage.get()));
|
||||
mSettingsConfig = newSettingsConfig;
|
||||
}
|
||||
|
||||
bool is_available()
|
||||
{
|
||||
return Settings::instanceExists() && Globals::instanceExists();
|
||||
}
|
||||
}
|
||||
|
||||
namespace LLError
|
||||
|
|
@ -1028,7 +1046,7 @@ namespace LLError
|
|||
std::pair<boost::shared_ptr<RECORDER>, Recorders::iterator>
|
||||
findRecorderPos()
|
||||
{
|
||||
SettingsConfigPtr s = Settings::instance().getSettingsConfig();
|
||||
SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
|
||||
// Since we promise to return an iterator, use a classic iterator
|
||||
// loop.
|
||||
auto end{s->mRecorders.end()};
|
||||
|
|
@ -1071,7 +1089,7 @@ namespace LLError
|
|||
auto found = findRecorderPos<RECORDER>();
|
||||
if (found.first)
|
||||
{
|
||||
SettingsConfigPtr s = Settings::instance().getSettingsConfig();
|
||||
SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
|
||||
s->mRecorders.erase(found.second);
|
||||
}
|
||||
return bool(found.first);
|
||||
|
|
@ -1307,14 +1325,6 @@ namespace LLError
|
|||
return false;
|
||||
}
|
||||
|
||||
// If we hit a logging request very late during shutdown processing,
|
||||
// when either of the relevant LLSingletons has already been deleted,
|
||||
// DO NOT resurrect them.
|
||||
if (Settings::wasDeleted() || Globals::wasDeleted())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
|
||||
|
||||
s->mShouldLogCallCounter++;
|
||||
|
|
@ -1353,10 +1363,8 @@ namespace LLError
|
|||
std::ostringstream* Log::out()
|
||||
{
|
||||
LLMutexTrylock lock(getMutex<LOG_MUTEX>(),5);
|
||||
// If we hit a logging request very late during shutdown processing,
|
||||
// when either of the relevant LLSingletons has already been deleted,
|
||||
// DO NOT resurrect them.
|
||||
if (lock.isLocked() && ! (Settings::wasDeleted() || Globals::wasDeleted()))
|
||||
|
||||
if (lock.isLocked())
|
||||
{
|
||||
Globals* g = Globals::getInstance();
|
||||
|
||||
|
|
@ -1378,14 +1386,6 @@ namespace LLError
|
|||
return;
|
||||
}
|
||||
|
||||
// If we hit a logging request very late during shutdown processing,
|
||||
// when either of the relevant LLSingletons has already been deleted,
|
||||
// DO NOT resurrect them.
|
||||
if (Settings::wasDeleted() || Globals::wasDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(strlen(out->str().c_str()) < 128)
|
||||
{
|
||||
strcpy(message, out->str().c_str());
|
||||
|
|
@ -1418,14 +1418,6 @@ namespace LLError
|
|||
return;
|
||||
}
|
||||
|
||||
// If we hit a logging request very late during shutdown processing,
|
||||
// when either of the relevant LLSingletons has already been deleted,
|
||||
// DO NOT resurrect them.
|
||||
if (Settings::wasDeleted() || Globals::wasDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Globals* g = Globals::getInstance();
|
||||
SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
|
||||
|
||||
|
|
|
|||
|
|
@ -203,11 +203,6 @@ namespace LLError
|
|||
|
||||
LL_COMMON_API std::string abbreviateFile(const std::string& filePath);
|
||||
LL_COMMON_API int shouldLogCallCount();
|
||||
|
||||
// Check whether Globals exists. This should only be used by LLSingleton
|
||||
// infrastructure to avoid trying to log when our internal LLSingleton is
|
||||
// unavailable -- circularity ensues.
|
||||
LL_COMMON_API bool is_available();
|
||||
};
|
||||
|
||||
#endif // LL_LLERRORCONTROL_H
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "llsingleton.h"
|
||||
|
||||
#include "llerror.h"
|
||||
#include "llerrorcontrol.h" // LLError::is_available()
|
||||
#include "llerrorcontrol.h"
|
||||
#include "lldependencies.h"
|
||||
#include "llexception.h"
|
||||
#include "llcoros.h"
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
namespace {
|
||||
void log(LLError::ELevel level,
|
||||
const char* p1, const char* p2, const char* p3, const char* p4);
|
||||
|
||||
bool oktolog();
|
||||
} // anonymous namespace
|
||||
|
||||
// Our master list of all LLSingletons is itself an LLSingleton. We used to
|
||||
|
|
@ -279,8 +277,6 @@ void LLSingletonBase::reset_initializing(list_t::size_type size)
|
|||
|
||||
void LLSingletonBase::MasterList::LockedInitializing::log(const char* verb, const char* name)
|
||||
{
|
||||
if (oktolog())
|
||||
{
|
||||
LL_DEBUGS("LLSingleton") << verb << ' ' << demangle(name) << ';';
|
||||
if (mList)
|
||||
{
|
||||
|
|
@ -292,7 +288,6 @@ void LLSingletonBase::MasterList::LockedInitializing::log(const char* verb, cons
|
|||
}
|
||||
}
|
||||
LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
void LLSingletonBase::capture_dependency()
|
||||
|
|
@ -455,33 +450,11 @@ void LLSingletonBase::deleteAll()
|
|||
|
||||
/*---------------------------- Logging helpers -----------------------------*/
|
||||
namespace {
|
||||
bool oktolog()
|
||||
{
|
||||
// See comments in log() below.
|
||||
return LLError::is_available();
|
||||
}
|
||||
|
||||
void log(LLError::ELevel level,
|
||||
const char* p1, const char* p2, const char* p3, const char* p4)
|
||||
{
|
||||
// The is_available() test below ensures that we'll stop logging once
|
||||
// LLError has been cleaned up. If we had a similar portable test for
|
||||
// std::cerr, this would be a good place to use it.
|
||||
|
||||
// Check LLError::is_available() because some of LLError's infrastructure
|
||||
// is itself an LLSingleton. If that LLSingleton has not yet been
|
||||
// initialized, trying to log will engage LLSingleton machinery... and
|
||||
// around and around we go.
|
||||
if (LLError::is_available())
|
||||
{
|
||||
LL_VLOGS(level, "LLSingleton") << p1 << p2 << p3 << p4 << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Caller may be a test program, or something else whose stderr is
|
||||
// visible to the user.
|
||||
std::cerr << p1 << p2 << p3 << p4 << std::endl;
|
||||
}
|
||||
LL_VLOGS(level, "LLSingleton") << p1 << p2 << p3 << p4 << LL_ENDL;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
/// Exported functions
|
||||
///----------------------------------------------------------------------------
|
||||
static const std::string INV_ITEM_ID_LABEL("item_id");
|
||||
static const std::string INV_FOLDER_ID_LABEL("folder_id");
|
||||
static const std::string INV_FOLDER_ID_LABEL("cat_id");
|
||||
static const std::string INV_PARENT_ID_LABEL("parent_id");
|
||||
static const std::string INV_ASSET_TYPE_LABEL("type");
|
||||
static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
|
||||
|
|
@ -228,22 +228,6 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// exportFile should be replaced with exportLegacyStream
|
||||
// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented...
|
||||
BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const
|
||||
{
|
||||
std::string uuid_str;
|
||||
fprintf(fp, "\tinv_object\t0\n\t{\n");
|
||||
mUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tobj_id\t%s\n", uuid_str.c_str());
|
||||
mParentUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
|
||||
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
|
||||
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
|
||||
fprintf(fp,"\t}\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) const
|
||||
{
|
||||
std::string uuid_str;
|
||||
|
|
@ -603,215 +587,6 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
|
|||
#endif
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLInventoryItem::importFile(LLFILE* fp)
|
||||
{
|
||||
// *NOTE: Changing the buffer size will require changing the scanf
|
||||
// calls below.
|
||||
char buffer[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char keyword[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char junk[MAX_STRING]; /* Flawfinder: ignore */
|
||||
BOOL success = TRUE;
|
||||
|
||||
keyword[0] = '\0';
|
||||
valuestr[0] = '\0';
|
||||
|
||||
mInventoryType = LLInventoryType::IT_NONE;
|
||||
mAssetUUID.setNull();
|
||||
while(success && (!feof(fp)))
|
||||
{
|
||||
if (fgets(buffer, MAX_STRING, fp) == NULL)
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
|
||||
if(0 == strcmp("{",keyword))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(0 == strcmp("}", keyword))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if(0 == strcmp("item_id", keyword))
|
||||
{
|
||||
mUUID.set(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("parent_id", keyword))
|
||||
{
|
||||
mParentUUID.set(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("permissions", keyword))
|
||||
{
|
||||
success = mPermissions.importFile(fp);
|
||||
}
|
||||
else if(0 == strcmp("sale_info", keyword))
|
||||
{
|
||||
// Sale info used to contain next owner perm. It is now in
|
||||
// the permissions. Thus, we read that out, and fix legacy
|
||||
// objects. It's possible this op would fail, but it
|
||||
// should pick up the vast majority of the tasks.
|
||||
BOOL has_perm_mask = FALSE;
|
||||
U32 perm_mask = 0;
|
||||
success = mSaleInfo.importFile(fp, has_perm_mask, perm_mask);
|
||||
if(has_perm_mask)
|
||||
{
|
||||
if(perm_mask == PERM_NONE)
|
||||
{
|
||||
perm_mask = mPermissions.getMaskOwner();
|
||||
}
|
||||
// fair use fix.
|
||||
if(!(perm_mask & PERM_COPY))
|
||||
{
|
||||
perm_mask |= PERM_TRANSFER;
|
||||
}
|
||||
mPermissions.setMaskNext(perm_mask);
|
||||
}
|
||||
}
|
||||
else if(0 == strcmp("shadow_id", keyword))
|
||||
{
|
||||
mAssetUUID.set(valuestr);
|
||||
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
|
||||
cipher.decrypt(mAssetUUID.mData, UUID_BYTES);
|
||||
}
|
||||
else if(0 == strcmp("asset_id", keyword))
|
||||
{
|
||||
mAssetUUID.set(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("type", keyword))
|
||||
{
|
||||
mType = LLAssetType::lookup(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("inv_type", keyword))
|
||||
{
|
||||
mInventoryType = LLInventoryType::lookup(std::string(valuestr));
|
||||
}
|
||||
else if(0 == strcmp("flags", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mFlags);
|
||||
}
|
||||
else if(0 == strcmp("name", keyword))
|
||||
{
|
||||
//strcpy(valuestr, buffer + strlen(keyword) + 3);
|
||||
// *NOTE: Not ANSI C, but widely supported.
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %254s%254[\t]%254[^|]",
|
||||
keyword, junk, valuestr);
|
||||
|
||||
// IW: sscanf chokes and puts | in valuestr if there's no name
|
||||
if (valuestr[0] == '|')
|
||||
{
|
||||
valuestr[0] = '\000';
|
||||
}
|
||||
|
||||
mName.assign(valuestr);
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
}
|
||||
else if(0 == strcmp("desc", keyword))
|
||||
{
|
||||
//strcpy(valuestr, buffer + strlen(keyword) + 3);
|
||||
// *NOTE: Not ANSI C, but widely supported.
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %254s%254[\t]%254[^|]",
|
||||
keyword, junk, valuestr);
|
||||
|
||||
if (valuestr[0] == '|')
|
||||
{
|
||||
valuestr[0] = '\000';
|
||||
}
|
||||
|
||||
disclaimMem(mDescription);
|
||||
mDescription.assign(valuestr);
|
||||
claimMem(mDescription);
|
||||
LLStringUtil::replaceNonstandardASCII(mDescription, ' ');
|
||||
/* TODO -- ask Ian about this code
|
||||
const char *donkey = mDescription.c_str();
|
||||
if (donkey[0] == '|')
|
||||
{
|
||||
LL_ERRS() << "Donkey" << LL_ENDL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if(0 == strcmp("creation_date", keyword))
|
||||
{
|
||||
S32 date;
|
||||
sscanf(valuestr, "%d", &date);
|
||||
mCreationDate = date;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "unknown keyword '" << keyword
|
||||
<< "' in inventory import of item " << mUUID << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
// Need to convert 1.0 simstate files to a useful inventory type
|
||||
// and potentially deal with bad inventory tyes eg, a landmark
|
||||
// marked as a texture.
|
||||
if((LLInventoryType::IT_NONE == mInventoryType)
|
||||
|| !inventory_and_asset_types_match(mInventoryType, mType))
|
||||
{
|
||||
LL_DEBUGS() << "Resetting inventory type for " << mUUID << LL_ENDL;
|
||||
mInventoryType = LLInventoryType::defaultForAssetType(mType);
|
||||
}
|
||||
|
||||
mPermissions.initMasks(mInventoryType);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const
|
||||
{
|
||||
std::string uuid_str;
|
||||
fprintf(fp, "\tinv_item\t0\n\t{\n");
|
||||
mUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\titem_id\t%s\n", uuid_str.c_str());
|
||||
mParentUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
|
||||
mPermissions.exportFile(fp);
|
||||
|
||||
// Check for permissions to see the asset id, and if so write it
|
||||
// out as an asset id. Otherwise, apply our cheesy encryption.
|
||||
if(include_asset_key)
|
||||
{
|
||||
U32 mask = mPermissions.getMaskBase();
|
||||
if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|
||||
|| (mAssetUUID.isNull()))
|
||||
{
|
||||
mAssetUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID shadow_id(mAssetUUID);
|
||||
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
|
||||
cipher.encrypt(shadow_id.mData, UUID_BYTES);
|
||||
shadow_id.toString(uuid_str);
|
||||
fprintf(fp, "\t\tshadow_id\t%s\n", uuid_str.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID::null.toString(uuid_str);
|
||||
fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str());
|
||||
}
|
||||
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
|
||||
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str());
|
||||
fprintf(fp, "\t\tflags\t%08x\n", mFlags);
|
||||
mSaleInfo.exportFile(fp);
|
||||
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
|
||||
fprintf(fp, "\t\tdesc\t%s|\n", mDescription.c_str());
|
||||
fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate);
|
||||
fprintf(fp,"\t}\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
|
||||
{
|
||||
|
|
@ -1463,90 +1238,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
|
|||
msg->getStringFast(block, _PREHASH_Name, mName, block_num);
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLInventoryCategory::importFile(LLFILE* fp)
|
||||
{
|
||||
// *NOTE: Changing the buffer size will require changing the scanf
|
||||
// calls below.
|
||||
char buffer[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char keyword[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
|
||||
|
||||
keyword[0] = '\0';
|
||||
valuestr[0] = '\0';
|
||||
while(!feof(fp))
|
||||
{
|
||||
if (fgets(buffer, MAX_STRING, fp) == NULL)
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %254s %254s",
|
||||
keyword, valuestr);
|
||||
if(0 == strcmp("{",keyword))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(0 == strcmp("}", keyword))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if(0 == strcmp("cat_id", keyword))
|
||||
{
|
||||
mUUID.set(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("parent_id", keyword))
|
||||
{
|
||||
mParentUUID.set(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("type", keyword))
|
||||
{
|
||||
mType = LLAssetType::lookup(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("pref_type", keyword))
|
||||
{
|
||||
mPreferredType = LLFolderType::lookup(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("name", keyword))
|
||||
{
|
||||
//strcpy(valuestr, buffer + strlen(keyword) + 3);
|
||||
// *NOTE: Not ANSI C, but widely supported.
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %254s %254[^|]",
|
||||
keyword, valuestr);
|
||||
mName.assign(valuestr);
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "unknown keyword '" << keyword
|
||||
<< "' in inventory import category " << mUUID << LL_ENDL;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const
|
||||
{
|
||||
std::string uuid_str;
|
||||
fprintf(fp, "\tinv_category\t0\n\t{\n");
|
||||
mUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tcat_id\t%s\n", uuid_str.c_str());
|
||||
mParentUUID.toString(uuid_str);
|
||||
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
|
||||
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
|
||||
fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str());
|
||||
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
|
||||
fprintf(fp,"\t}\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// virtual
|
||||
BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
|
||||
{
|
||||
|
|
@ -1625,6 +1317,45 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
LLSD LLInventoryCategory::exportLLSD() const
|
||||
{
|
||||
LLSD cat_data;
|
||||
cat_data[INV_FOLDER_ID_LABEL] = mUUID;
|
||||
cat_data[INV_PARENT_ID_LABEL] = mParentUUID;
|
||||
cat_data[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
|
||||
cat_data[INV_PREFERRED_TYPE_LABEL] = LLFolderType::lookup(mPreferredType);
|
||||
cat_data[INV_NAME_LABEL] = mName;
|
||||
|
||||
return cat_data;
|
||||
}
|
||||
|
||||
bool LLInventoryCategory::importLLSD(const LLSD& cat_data)
|
||||
{
|
||||
if (cat_data.has(INV_FOLDER_ID_LABEL))
|
||||
{
|
||||
setUUID(cat_data[INV_FOLDER_ID_LABEL].asUUID());
|
||||
}
|
||||
if (cat_data.has(INV_PARENT_ID_LABEL))
|
||||
{
|
||||
setParent(cat_data[INV_PARENT_ID_LABEL].asUUID());
|
||||
}
|
||||
if (cat_data.has(INV_ASSET_TYPE_LABEL))
|
||||
{
|
||||
setType(LLAssetType::lookup(cat_data[INV_ASSET_TYPE_LABEL].asString()));
|
||||
}
|
||||
if (cat_data.has(INV_PREFERRED_TYPE_LABEL))
|
||||
{
|
||||
setPreferredType(LLFolderType::lookup(cat_data[INV_PREFERRED_TYPE_LABEL].asString()));
|
||||
}
|
||||
if (cat_data.has(INV_NAME_LABEL))
|
||||
{
|
||||
mName = cat_data[INV_NAME_LABEL].asString();
|
||||
LLStringUtil::replaceNonstandardASCII(mName, ' ');
|
||||
LLStringUtil::replaceChar(mName, '|', ' ');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
///----------------------------------------------------------------------------
|
||||
/// Local function definitions
|
||||
///----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -95,8 +95,7 @@ public:
|
|||
// Implemented here so that a minimal information set can be transmitted
|
||||
// between simulator and viewer.
|
||||
//--------------------------------------------------------------------
|
||||
// virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
|
|
@ -197,8 +196,6 @@ public:
|
|||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
|
|
@ -269,11 +266,11 @@ public:
|
|||
// File Support
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
virtual BOOL importFile(LLFILE* fp);
|
||||
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
LLSD exportLLSD() const;
|
||||
bool importLLSD(const LLSD& cat_data);
|
||||
//--------------------------------------------------------------------
|
||||
// Member Variables
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@
|
|||
#include "llsingleton.h"
|
||||
#include "llinvtranslationbrdg.h"
|
||||
|
||||
//=========================================================================
|
||||
namespace {
|
||||
LLTranslationBridge::ptr_t sTranslator;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
struct SettingsEntry : public LLDictionaryEntry
|
||||
|
|
@ -49,7 +45,7 @@ struct SettingsEntry : public LLDictionaryEntry
|
|||
mLabel(name),
|
||||
mIconName(iconName)
|
||||
{
|
||||
std::string transdname = sTranslator->getString(mLabel);
|
||||
std::string transdname = LLSettingsType::getInstance()->mTranslator->getString(mLabel);
|
||||
if (!transdname.empty())
|
||||
{
|
||||
mLabel = transdname;
|
||||
|
|
@ -84,6 +80,16 @@ void LLSettingsDictionary::initSingleton()
|
|||
|
||||
//=========================================================================
|
||||
|
||||
LLSettingsType::LLSettingsType(LLTranslationBridge::ptr_t &trans)
|
||||
{
|
||||
mTranslator = trans;
|
||||
}
|
||||
|
||||
LLSettingsType::~LLSettingsType()
|
||||
{
|
||||
mTranslator.reset();
|
||||
}
|
||||
|
||||
LLSettingsType::type_e LLSettingsType::fromInventoryFlags(U32 flags)
|
||||
{
|
||||
return (LLSettingsType::type_e)(flags & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK);
|
||||
|
|
@ -104,13 +110,3 @@ std::string LLSettingsType::getDefaultName(LLSettingsType::type_e type)
|
|||
return getDefaultName(ST_INVALID);
|
||||
return entry->mDefaultNewName;
|
||||
}
|
||||
|
||||
void LLSettingsType::initClass(LLTranslationBridge::ptr_t &trans)
|
||||
{
|
||||
sTranslator = trans;
|
||||
}
|
||||
|
||||
void LLSettingsType::cleanupClass()
|
||||
{
|
||||
sTranslator.reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,15 @@
|
|||
|
||||
#include "llinventorytype.h"
|
||||
#include "llinvtranslationbrdg.h"
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLSettingsType
|
||||
class LLSettingsType : public LLParamSingleton<LLSettingsType>
|
||||
{
|
||||
LLSINGLETON(LLSettingsType, LLTranslationBridge::ptr_t &trans);
|
||||
~LLSettingsType();
|
||||
|
||||
friend struct SettingsEntry;
|
||||
|
||||
public:
|
||||
enum type_e
|
||||
{
|
||||
|
|
@ -48,8 +54,9 @@ public:
|
|||
static LLInventoryType::EIconName getIconName(type_e type);
|
||||
static std::string getDefaultName(type_e type);
|
||||
|
||||
static void initClass(LLTranslationBridge::ptr_t &trans);
|
||||
static void cleanupClass();
|
||||
protected:
|
||||
|
||||
LLTranslationBridge::ptr_t mTranslator;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -565,148 +565,6 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// File support
|
||||
//
|
||||
|
||||
BOOL LLPermissions::importFile(LLFILE* fp)
|
||||
{
|
||||
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
|
||||
const S32 BUFSIZE = 16384;
|
||||
|
||||
// *NOTE: Changing the buffer size will require changing the scanf
|
||||
// calls below.
|
||||
char buffer[BUFSIZE]; /* Flawfinder: ignore */
|
||||
char keyword[256]; /* Flawfinder: ignore */
|
||||
char valuestr[256]; /* Flawfinder: ignore */
|
||||
char uuid_str[256]; /* Flawfinder: ignore */
|
||||
U32 mask;
|
||||
|
||||
keyword[0] = '\0';
|
||||
valuestr[0] = '\0';
|
||||
|
||||
while (!feof(fp))
|
||||
{
|
||||
if (fgets(buffer, BUFSIZE, fp) == NULL)
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %255s %255s",
|
||||
keyword, valuestr);
|
||||
if (!strcmp("{", keyword))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!strcmp("}",keyword))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!strcmp("creator_mask", keyword))
|
||||
{
|
||||
// legacy support for "creator" masks
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskBase = mask;
|
||||
fixFairUse();
|
||||
}
|
||||
else if (!strcmp("base_mask", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskBase = mask;
|
||||
//fixFairUse();
|
||||
}
|
||||
else if (!strcmp("owner_mask", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskOwner = mask;
|
||||
}
|
||||
else if (!strcmp("group_mask", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskGroup = mask;
|
||||
}
|
||||
else if (!strcmp("everyone_mask", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskEveryone = mask;
|
||||
}
|
||||
else if (!strcmp("next_owner_mask", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%x", &mask);
|
||||
mMaskNextOwner = mask;
|
||||
}
|
||||
else if (!strcmp("creator_id", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
||||
mCreator.set(uuid_str);
|
||||
}
|
||||
else if (!strcmp("owner_id", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
||||
mOwner.set(uuid_str);
|
||||
}
|
||||
else if (!strcmp("last_owner_id", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
||||
mLastOwner.set(uuid_str);
|
||||
}
|
||||
else if (!strcmp("group_id", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
||||
mGroup.set(uuid_str);
|
||||
}
|
||||
else if (!strcmp("group_owned", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%d", &mask);
|
||||
if(mask) mIsGroupOwned = true;
|
||||
else mIsGroupOwned = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_INFOS() << "unknown keyword " << keyword << " in permissions import" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
fix();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLPermissions::exportFile(LLFILE* fp) const
|
||||
{
|
||||
std::string uuid_str;
|
||||
|
||||
fprintf(fp, "\tpermissions 0\n");
|
||||
fprintf(fp, "\t{\n");
|
||||
|
||||
fprintf(fp, "\t\tbase_mask\t%08x\n", mMaskBase);
|
||||
fprintf(fp, "\t\towner_mask\t%08x\n", mMaskOwner);
|
||||
fprintf(fp, "\t\tgroup_mask\t%08x\n", mMaskGroup);
|
||||
fprintf(fp, "\t\teveryone_mask\t%08x\n", mMaskEveryone);
|
||||
fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner);
|
||||
|
||||
mCreator.toString(uuid_str);
|
||||
fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str());
|
||||
|
||||
mOwner.toString(uuid_str);
|
||||
fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str());
|
||||
|
||||
mLastOwner.toString(uuid_str);
|
||||
fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str());
|
||||
|
||||
mGroup.toString(uuid_str);
|
||||
fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str());
|
||||
|
||||
if(mIsGroupOwned)
|
||||
{
|
||||
fprintf(fp, "\t\tgroup_owned\t1\n");
|
||||
}
|
||||
fprintf(fp,"\t}\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
|
||||
{
|
||||
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
|
||||
|
|
|
|||
|
|
@ -311,10 +311,6 @@ public:
|
|||
void packMessage(LLMessageSystem* msg) const;
|
||||
void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
|
||||
|
||||
// Load/save support
|
||||
BOOL importFile(LLFILE* fp);
|
||||
BOOL exportFile(LLFILE* fp) const;
|
||||
|
||||
BOOL importLegacyStream(std::istream& input_stream);
|
||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -78,16 +78,6 @@ U32 LLSaleInfo::getCRC32() const
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLSaleInfo::exportFile(LLFILE* fp) const
|
||||
{
|
||||
fprintf(fp, "\tsale_info\t0\n\t{\n");
|
||||
fprintf(fp, "\t\tsale_type\t%s\n", lookup(mSaleType));
|
||||
fprintf(fp, "\t\tsale_price\t%d\n", mSalePrice);
|
||||
fprintf(fp,"\t}\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const
|
||||
{
|
||||
output_stream << "\tsale_info\t0\n\t{\n";
|
||||
|
|
@ -129,69 +119,6 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Deleted LLSaleInfo::exportFileXML() and LLSaleInfo::importXML()
|
||||
// because I can't find any non-test code references to it. 2009-05-04 JC
|
||||
|
||||
BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask)
|
||||
{
|
||||
has_perm_mask = FALSE;
|
||||
|
||||
// *NOTE: Changing the buffer size will require changing the scanf
|
||||
// calls below.
|
||||
char buffer[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char keyword[MAX_STRING]; /* Flawfinder: ignore */
|
||||
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
|
||||
BOOL success = TRUE;
|
||||
|
||||
keyword[0] = '\0';
|
||||
valuestr[0] = '\0';
|
||||
while(success && (!feof(fp)))
|
||||
{
|
||||
if (fgets(buffer, MAX_STRING, fp) == NULL)
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
sscanf( /* Flawfinder: ignore */
|
||||
buffer,
|
||||
" %254s %254s",
|
||||
keyword, valuestr);
|
||||
if(!keyword[0])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(0 == strcmp("{",keyword))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(0 == strcmp("}", keyword))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if(0 == strcmp("sale_type", keyword))
|
||||
{
|
||||
mSaleType = lookup(valuestr);
|
||||
}
|
||||
else if(0 == strcmp("sale_price", keyword))
|
||||
{
|
||||
sscanf(valuestr, "%d", &mSalePrice);
|
||||
mSalePrice = llclamp(mSalePrice, 0, S32_MAX);
|
||||
}
|
||||
else if (!strcmp("perm_mask", keyword))
|
||||
{
|
||||
//LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL;
|
||||
has_perm_mask = TRUE;
|
||||
sscanf(valuestr, "%x", &perm_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "unknown keyword '" << keyword
|
||||
<< "' in sale info import" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask)
|
||||
{
|
||||
has_perm_mask = FALSE;
|
||||
|
|
|
|||
|
|
@ -84,11 +84,6 @@ public:
|
|||
void setSalePrice(S32 price);
|
||||
//void setNextOwnerPermMask(U32 mask) { mNextOwnerPermMask = mask; }
|
||||
|
||||
|
||||
// file serialization
|
||||
BOOL exportFile(LLFILE* fp) const;
|
||||
BOOL importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask);
|
||||
|
||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
||||
LLSD asLLSD() const;
|
||||
operator LLSD() const { return asLLSD(); }
|
||||
|
|
|
|||
|
|
@ -359,7 +359,6 @@ protected:
|
|||
virtual parammapping_t getParameterMap() const { return parammapping_t(); }
|
||||
|
||||
LLSD mSettings;
|
||||
bool mIsValid;
|
||||
|
||||
LLSD cloneSettings() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1295,6 +1295,9 @@ void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const
|
|||
color = linear;
|
||||
}
|
||||
|
||||
// Similar/Shared Algorithms:
|
||||
// indra\llinventory\llsettingssky.cpp -- LLSettingsSky::calculateLightSettings()
|
||||
// indra\newview\app_settings\shaders\class1\windlight\atmosphericsFuncs.glsl -- calcAtmosphericVars()
|
||||
void LLSettingsSky::calculateLightSettings() const
|
||||
{
|
||||
// Initialize temp variables
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
#include "linden_common.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
|
||||
#include "../llinventory.h"
|
||||
|
||||
#include "../test/lltut.h"
|
||||
|
||||
|
||||
|
|
@ -320,27 +320,39 @@ namespace tut
|
|||
template<> template<>
|
||||
void inventory_object::test<7>()
|
||||
{
|
||||
LLFILE* fp = LLFile::fopen("linden_file.dat","w+");
|
||||
if(!fp)
|
||||
std::string filename("linden_file.dat");
|
||||
llofstream fileXML(filename.c_str());
|
||||
if (!fileXML.is_open())
|
||||
{
|
||||
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
|
||||
src1->exportFile(fp, TRUE);
|
||||
fclose(fp);
|
||||
fileXML << LLSDOStreamer<LLSDNotationFormatter>(src1->asLLSD()) << std::endl;
|
||||
fileXML.close();
|
||||
|
||||
LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
|
||||
fp = LLFile::fopen("linden_file.dat","r+");
|
||||
if(!fp)
|
||||
|
||||
LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
|
||||
llifstream file(filename.c_str());
|
||||
if (!file.is_open())
|
||||
{
|
||||
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
src2->importFile(fp);
|
||||
fclose(fp);
|
||||
std::string line;
|
||||
LLPointer<LLSDParser> parser = new LLSDNotationParser();
|
||||
std::getline(file, line);
|
||||
LLSD s_item;
|
||||
std::istringstream iss(line);
|
||||
if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
|
||||
{
|
||||
LL_ERRS()<< "Parsing cache failed" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
src2->fromLLSD(s_item);
|
||||
|
||||
file.close();
|
||||
|
||||
ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
|
||||
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
|
||||
|
|
@ -457,27 +469,39 @@ namespace tut
|
|||
template<> template<>
|
||||
void inventory_object::test<13>()
|
||||
{
|
||||
LLFILE* fp = LLFile::fopen("linden_file.dat","w");
|
||||
if(!fp)
|
||||
std::string filename("linden_file.dat");
|
||||
llofstream fileXML(filename.c_str());
|
||||
if (!fileXML.is_open())
|
||||
{
|
||||
LL_ERRS() << "file coudnt be opened\n" << LL_ENDL;
|
||||
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
|
||||
src1->exportFile(fp, TRUE);
|
||||
fclose(fp);
|
||||
|
||||
LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory();
|
||||
fp = LLFile::fopen("linden_file.dat","r");
|
||||
if(!fp)
|
||||
LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
|
||||
fileXML << LLSDOStreamer<LLSDNotationFormatter>(src1->exportLLSD()) << std::endl;
|
||||
fileXML.close();
|
||||
|
||||
llifstream file(filename.c_str());
|
||||
if (!file.is_open())
|
||||
{
|
||||
LL_ERRS() << "file coudnt be opened\n" << LL_ENDL;
|
||||
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
src2->importFile(fp);
|
||||
fclose(fp);
|
||||
std::string line;
|
||||
LLPointer<LLSDParser> parser = new LLSDNotationParser();
|
||||
std::getline(file, line);
|
||||
LLSD s_item;
|
||||
std::istringstream iss(line);
|
||||
if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
|
||||
{
|
||||
LL_ERRS()<< "Parsing cache failed" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory();
|
||||
src2->importLLSD(s_item);
|
||||
|
||||
ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
|
||||
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ LLUUID LLCoprocedurePool::enqueueCoprocedure(const std::string &name, LLCoproced
|
|||
}
|
||||
|
||||
// The queue should never fill up.
|
||||
LL_ERRS("CoProcMgr") << "Enqueue failed (" << unsigned(pushed) << ")" << LL_ENDL;
|
||||
LL_ERRS("CoProcMgr") << "Enqueue into '" << name << "' failed (" << unsigned(pushed) << ")" << LL_ENDL;
|
||||
return {}; // never executed, pacify the compiler
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -857,12 +857,12 @@ void LLPluginClassMedia::paste()
|
|||
}
|
||||
|
||||
void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache,
|
||||
const std::string &user_data_path_cookies,
|
||||
const std::string &username,
|
||||
const std::string &user_data_path_cef_log)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_user_data_path");
|
||||
message.setValue("cache_path", user_data_path_cache);
|
||||
message.setValue("cookies_path", user_data_path_cookies);
|
||||
message.setValue("cache_path", user_data_path_cache);
|
||||
message.setValue("username", username); // cef shares cache between users but creates user-based contexts
|
||||
message.setValue("cef_log_file", user_data_path_cef_log);
|
||||
|
||||
bool cef_verbose_log = gSavedSettings.getBOOL("CefVerboseLog");
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ public:
|
|||
bool canPaste() const { return mCanPaste; };
|
||||
|
||||
// These can be called before init(), and they will be queued and sent before the media init message.
|
||||
void setUserDataPath(const std::string &user_data_path_cache, const std::string &user_data_path_cookies, const std::string &user_data_path_cef_log);
|
||||
void setUserDataPath(const std::string &user_data_path_cache, const std::string &username, const std::string &user_data_path_cef_log);
|
||||
void setLanguageCode(const std::string &language_code);
|
||||
void setPluginsEnabled(const bool enabled);
|
||||
void setJavascriptEnabled(const bool enabled);
|
||||
|
|
|
|||
|
|
@ -225,6 +225,18 @@ void LLPluginProcessChild::idle(void)
|
|||
}
|
||||
setState(STATE_UNLOADED);
|
||||
}
|
||||
|
||||
if (mInstance)
|
||||
{
|
||||
// Provide some time to the plugin
|
||||
// example: CEF on "cleanup" sets shutdown request, but it still needs idle loop to actually shutdown
|
||||
LLPluginMessage message("base", "idle");
|
||||
message.setValueReal("time", PLUGIN_IDLE_SECONDS);
|
||||
sendMessageToPlugin(message);
|
||||
|
||||
mInstance->idle();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case STATE_UNLOADED:
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
|
|||
return LLModel::NO_ERRORS ;
|
||||
}
|
||||
|
||||
LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& face_list, std::vector<std::string>& materials, domPolylistRef& poly)
|
||||
LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& face_list, std::vector<std::string>& materials, domPolylistRef& poly, LLSD& log_msg)
|
||||
{
|
||||
domPRef p = poly->getP();
|
||||
domListOfUInts& idx = p->getValue();
|
||||
|
|
@ -403,6 +403,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
|
|||
LLVolumeFace::VertexMapData::PointMap point_map;
|
||||
|
||||
U32 cur_idx = 0;
|
||||
bool log_tc_msg = true;
|
||||
for (U32 i = 0; i < vcount.getCount(); ++i)
|
||||
{ //for each polygon
|
||||
U32 first_index = 0;
|
||||
|
|
@ -426,8 +427,21 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
|
|||
|
||||
if (tc_source)
|
||||
{
|
||||
cv.mTexCoord.setVec(tc[idx[cur_idx+tc_offset]*2+0],
|
||||
tc[idx[cur_idx+tc_offset]*2+1]);
|
||||
U64 idx_x = idx[cur_idx + tc_offset] * 2 + 0;
|
||||
U64 idx_y = idx[cur_idx + tc_offset] * 2 + 1;
|
||||
|
||||
if (idx_y < tc.getCount())
|
||||
{
|
||||
cv.mTexCoord.setVec(tc[idx_x], tc[idx_y]);
|
||||
}
|
||||
else if (log_tc_msg)
|
||||
{
|
||||
log_tc_msg = false;
|
||||
LL_WARNS() << "Texture coordinates data is not complete." << LL_ENDL;
|
||||
LLSD args;
|
||||
args["Message"] = "IncompleteTC";
|
||||
log_msg.append(args);
|
||||
}
|
||||
}
|
||||
|
||||
if (norm_source)
|
||||
|
|
@ -1215,7 +1229,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
|
|||
for (S32 i = 0; i < childCount; ++i)
|
||||
{
|
||||
domNode* pNode = daeSafeCast<domNode>(children[i]);
|
||||
if ( isNodeAJoint( pNode ) )
|
||||
if (pNode)
|
||||
{
|
||||
processJointNode( pNode, mJointList );
|
||||
}
|
||||
|
|
@ -1470,6 +1484,12 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
|
|||
}
|
||||
}
|
||||
|
||||
U32 bind_count = model->mSkinInfo.mAlternateBindMatrix.size();
|
||||
if (bind_count > 0 && bind_count != jointCnt)
|
||||
{
|
||||
LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL;
|
||||
}
|
||||
|
||||
//grab raw position array
|
||||
|
||||
domVertices* verts = mesh->getVertices();
|
||||
|
|
@ -1834,59 +1854,61 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran
|
|||
//LL_WARNS()<<"ProcessJointNode# Node:" <<pNode->getName()<<LL_ENDL;
|
||||
|
||||
//1. handle the incoming node - extract out translation via SID or element
|
||||
if (isNodeAJoint(pNode))
|
||||
{
|
||||
LLMatrix4 workingTransform;
|
||||
|
||||
LLMatrix4 workingTransform;
|
||||
//Pull out the translate id and store it in the jointTranslations map
|
||||
daeSIDResolver jointResolverA(pNode, "./translate");
|
||||
domTranslate* pTranslateA = daeSafeCast<domTranslate>(jointResolverA.getElement());
|
||||
daeSIDResolver jointResolverB(pNode, "./location");
|
||||
domTranslate* pTranslateB = daeSafeCast<domTranslate>(jointResolverB.getElement());
|
||||
|
||||
//Pull out the translate id and store it in the jointTranslations map
|
||||
daeSIDResolver jointResolverA( pNode, "./translate" );
|
||||
domTranslate* pTranslateA = daeSafeCast<domTranslate>( jointResolverA.getElement() );
|
||||
daeSIDResolver jointResolverB( pNode, "./location" );
|
||||
domTranslate* pTranslateB = daeSafeCast<domTranslate>( jointResolverB.getElement() );
|
||||
//Translation via SID was successful
|
||||
if (pTranslateA)
|
||||
{
|
||||
extractTranslation(pTranslateA, workingTransform);
|
||||
}
|
||||
else
|
||||
if (pTranslateB)
|
||||
{
|
||||
extractTranslation(pTranslateB, workingTransform);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Translation via child from element
|
||||
daeElement* pTranslateElement = getChildFromElement(pNode, "translate");
|
||||
if (!pTranslateElement || pTranslateElement->typeID() != domTranslate::ID())
|
||||
{
|
||||
//LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL;
|
||||
daeSIDResolver jointResolver(pNode, "./matrix");
|
||||
domMatrix* pMatrix = daeSafeCast<domMatrix>(jointResolver.getElement());
|
||||
if (pMatrix)
|
||||
{
|
||||
//LL_INFOS()<<"A matrix SID was however found!"<<LL_ENDL;
|
||||
domFloat4x4 domArray = pMatrix->getValue();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
workingTransform.mMatrix[i][j] = domArray[i + j * 4];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "The found element is not translate or matrix node - most likely a corrupt export!" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
extractTranslationViaElement(pTranslateElement, workingTransform);
|
||||
}
|
||||
}
|
||||
|
||||
//Translation via SID was successful
|
||||
if ( pTranslateA )
|
||||
{
|
||||
extractTranslation( pTranslateA, workingTransform );
|
||||
}
|
||||
else
|
||||
if ( pTranslateB )
|
||||
{
|
||||
extractTranslation( pTranslateB, workingTransform );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Translation via child from element
|
||||
daeElement* pTranslateElement = getChildFromElement( pNode, "translate" );
|
||||
if ( !pTranslateElement || pTranslateElement->typeID() != domTranslate::ID() )
|
||||
{
|
||||
//LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL;
|
||||
daeSIDResolver jointResolver( pNode, "./matrix" );
|
||||
domMatrix* pMatrix = daeSafeCast<domMatrix>( jointResolver.getElement() );
|
||||
if ( pMatrix )
|
||||
{
|
||||
//LL_INFOS()<<"A matrix SID was however found!"<<LL_ENDL;
|
||||
domFloat4x4 domArray = pMatrix->getValue();
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
for( int j = 0; j < 4; j++ )
|
||||
{
|
||||
workingTransform.mMatrix[i][j] = domArray[i + j*4];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS()<< "The found element is not translate or matrix node - most likely a corrupt export!" <<LL_ENDL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
extractTranslationViaElement( pTranslateElement, workingTransform );
|
||||
}
|
||||
}
|
||||
|
||||
//Store the working transform relative to the nodes name.
|
||||
jointTransforms[ pNode->getName() ] = workingTransform;
|
||||
//Store the working transform relative to the nodes name.
|
||||
jointTransforms[pNode->getName()] = workingTransform;
|
||||
}
|
||||
|
||||
//2. handle the nodes children
|
||||
|
||||
|
|
@ -2356,7 +2378,7 @@ LLColor4 LLDAELoader::getDaeColor(daeElement* element)
|
|||
return value;
|
||||
}
|
||||
|
||||
bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh)
|
||||
bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& log_msg)
|
||||
{
|
||||
LLModel::EModelStatus status = LLModel::NO_ERRORS;
|
||||
domTriangles_Array& tris = mesh->getTriangles_array();
|
||||
|
|
@ -2378,7 +2400,7 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh)
|
|||
for (U32 i = 0; i < polys.getCount(); ++i)
|
||||
{
|
||||
domPolylistRef& poly = polys.get(i);
|
||||
status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly);
|
||||
status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, log_msg);
|
||||
|
||||
if(status != LLModel::NO_ERRORS)
|
||||
{
|
||||
|
|
@ -2442,7 +2464,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
|
|||
|
||||
// Get the whole set of volume faces
|
||||
//
|
||||
addVolumeFacesFromDomMesh(ret, mesh);
|
||||
addVolumeFacesFromDomMesh(ret, mesh, mWarningsArray);
|
||||
|
||||
U32 volume_faces = ret->getNumVolumeFaces();
|
||||
|
||||
|
|
@ -2515,7 +2537,8 @@ bool LLDAELoader::createVolumeFacesFromDomMesh(LLModel* pModel, domMesh* mesh)
|
|||
{
|
||||
pModel->ClearFacesAndMaterials();
|
||||
|
||||
addVolumeFacesFromDomMesh(pModel, mesh);
|
||||
LLSD placeholder;
|
||||
addVolumeFacesFromDomMesh(pModel, mesh, placeholder);
|
||||
|
||||
if (pModel->getNumVolumeFaces() > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ protected:
|
|||
//Verify that a controller matches vertex counts
|
||||
bool verifyController( domController* pController );
|
||||
|
||||
static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh);
|
||||
static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh, LLSD& log_msg);
|
||||
static bool createVolumeFacesFromDomMesh(LLModel* model, domMesh *mesh);
|
||||
|
||||
static LLModel* loadModelFromDomMesh(domMesh* mesh);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ LLModelLoader::LLModelLoader(
|
|||
, mStateCallback(state_cb)
|
||||
, mOpaqueData(opaque_userdata)
|
||||
, mRigValidJointUpload(true)
|
||||
, mLegacyRigValid(true)
|
||||
, mLegacyRigFlags(0)
|
||||
, mNoNormalize(false)
|
||||
, mNoOptimize(false)
|
||||
, mCacheOnlyHitIfRigged(false)
|
||||
|
|
@ -136,6 +136,7 @@ LLModelLoader::LLModelLoader(
|
|||
{
|
||||
assert_main_thread();
|
||||
sActiveLoaderList.push_back(this) ;
|
||||
mWarningsArray = LLSD::emptyArray();
|
||||
}
|
||||
|
||||
LLModelLoader::~LLModelLoader()
|
||||
|
|
@ -146,6 +147,7 @@ LLModelLoader::~LLModelLoader()
|
|||
|
||||
void LLModelLoader::run()
|
||||
{
|
||||
mWarningsArray.clear();
|
||||
doLoadModel();
|
||||
doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this));
|
||||
}
|
||||
|
|
@ -387,7 +389,7 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::st
|
|||
//2. It is suitable for upload as standard av with just skin weights
|
||||
|
||||
bool isJointPositionUploadOK = isRigSuitableForJointPositionUpload( jointListFromAsset );
|
||||
bool isRigLegacyOK = isRigLegacy( jointListFromAsset );
|
||||
U32 legacy_rig_flags = determineRigLegacyFlags( jointListFromAsset );
|
||||
|
||||
// It's OK that both could end up being true.
|
||||
|
||||
|
|
@ -401,19 +403,16 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::st
|
|||
setRigValidForJointPositionUpload( false );
|
||||
}
|
||||
|
||||
if ( !isRigLegacyOK)
|
||||
{
|
||||
// This starts out true, becomes false if false for any loaded
|
||||
// mesh.
|
||||
setLegacyRigValid( false );
|
||||
}
|
||||
legacy_rig_flags |= getLegacyRigFlags();
|
||||
// This starts as 0, changes if any loaded mesh has issues
|
||||
setLegacyRigFlags(legacy_rig_flags);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// isRigLegacy()
|
||||
// determineRigLegacyFlags()
|
||||
//-----------------------------------------------------------------------------
|
||||
bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAsset )
|
||||
U32 LLModelLoader::determineRigLegacyFlags( const std::vector<std::string> &jointListFromAsset )
|
||||
{
|
||||
//No joints in asset
|
||||
if ( jointListFromAsset.size() == 0 )
|
||||
|
|
@ -426,7 +425,12 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
|
|||
{
|
||||
LL_WARNS() << "Rigged to " << jointListFromAsset.size() << " joints, max is " << mMaxJointsPerMesh << LL_ENDL;
|
||||
LL_WARNS() << "Skinning disabled due to too many joints" << LL_ENDL;
|
||||
return false;
|
||||
LLSD args;
|
||||
args["Message"] = "TooManyJoint";
|
||||
args["[JOINTS]"] = LLSD::Integer(jointListFromAsset.size());
|
||||
args["[MAX]"] = LLSD::Integer(mMaxJointsPerMesh);
|
||||
mWarningsArray.append(args);
|
||||
return LEGACY_RIG_FLAG_TOO_MANY_JOINTS;
|
||||
}
|
||||
|
||||
// Unknown joints in asset
|
||||
|
|
@ -437,16 +441,24 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
|
|||
if (mJointMap.find(*it)==mJointMap.end())
|
||||
{
|
||||
LL_WARNS() << "Rigged to unrecognized joint name " << *it << LL_ENDL;
|
||||
LLSD args;
|
||||
args["Message"] = "UnrecognizedJoint";
|
||||
args["[NAME]"] = *it;
|
||||
mWarningsArray.append(args);
|
||||
unknown_joint_count++;
|
||||
}
|
||||
}
|
||||
if (unknown_joint_count>0)
|
||||
{
|
||||
LL_WARNS() << "Skinning disabled due to unknown joints" << LL_ENDL;
|
||||
return false;
|
||||
LLSD args;
|
||||
args["Message"] = "UnknownJoints";
|
||||
args["[COUNT]"] = LLSD::Integer(unknown_joint_count);
|
||||
mWarningsArray.append(args);
|
||||
return LEGACY_RIG_FLAG_UNKNOWN_JOINT;
|
||||
}
|
||||
|
||||
return true;
|
||||
return LEGACY_RIG_OK;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// isRigSuitableForJointPositionUpload()
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ typedef std::deque<std::string> JointNameSet;
|
|||
const S32 SLM_SUPPORTED_VERSION = 3;
|
||||
const S32 NUM_LOD = 4;
|
||||
|
||||
const U32 LEGACY_RIG_OK = 0;
|
||||
const U32 LEGACY_RIG_FLAG_TOO_MANY_JOINTS = 1;
|
||||
const U32 LEGACY_RIG_FLAG_UNKNOWN_JOINT = 2;
|
||||
|
||||
class LLModelLoader : public LLThread
|
||||
{
|
||||
public:
|
||||
|
|
@ -166,7 +170,7 @@ public:
|
|||
void critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset );
|
||||
|
||||
//Determines if a rig is a legacy from the joint list
|
||||
bool isRigLegacy( const std::vector<std::string> &jointListFromAsset );
|
||||
U32 determineRigLegacyFlags( const std::vector<std::string> &jointListFromAsset );
|
||||
|
||||
//Determines if a rig is suitable for upload
|
||||
bool isRigSuitableForJointPositionUpload( const std::vector<std::string> &jointListFromAsset );
|
||||
|
|
@ -174,8 +178,9 @@ public:
|
|||
const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; }
|
||||
void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; }
|
||||
|
||||
const bool isLegacyRigValid( void ) const { return mLegacyRigValid; }
|
||||
void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; }
|
||||
const bool isLegacyRigValid(void) const { return mLegacyRigFlags == 0; }
|
||||
U32 getLegacyRigFlags() const { return mLegacyRigFlags; }
|
||||
void setLegacyRigFlags( U32 rigFlags ) { mLegacyRigFlags = rigFlags; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// isNodeAJoint()
|
||||
|
|
@ -185,6 +190,9 @@ public:
|
|||
return name != NULL && mJointMap.find(name) != mJointMap.end();
|
||||
}
|
||||
|
||||
const LLSD logOut() const { return mWarningsArray; }
|
||||
void clearLog() { mWarningsArray.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
LLModelLoader::load_callback_t mLoadCallback;
|
||||
|
|
@ -194,13 +202,15 @@ protected:
|
|||
void* mOpaqueData;
|
||||
|
||||
bool mRigValidJointUpload;
|
||||
bool mLegacyRigValid;
|
||||
U32 mLegacyRigFlags;
|
||||
|
||||
bool mNoNormalize;
|
||||
bool mNoOptimize;
|
||||
|
||||
JointTransformMap mJointTransformMap;
|
||||
|
||||
LLSD mWarningsArray; // preview floater will pull logs from here
|
||||
|
||||
static std::list<LLModelLoader*> sActiveLoaderList;
|
||||
static bool isAlive(LLModelLoader* loader) ;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2700,10 +2700,11 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w
|
|||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
// Expose desired use of high-performance graphics processor to Optimus driver
|
||||
// Expose desired use of high-performance graphics processor to Optimus driver and to AMD driver
|
||||
extern "C"
|
||||
{
|
||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
{
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -985,38 +985,56 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if( !mHasExplicitFormat )
|
||||
{
|
||||
switch (mComponents)
|
||||
{
|
||||
case 1:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8;
|
||||
mFormatPrimary = GL_LUMINANCE;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 2:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8_ALPHA8;
|
||||
mFormatPrimary = GL_LUMINANCE_ALPHA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 3:
|
||||
mFormatInternal = GL_RGB8;
|
||||
mFormatPrimary = GL_RGB;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 4:
|
||||
mFormatInternal = GL_RGBA8;
|
||||
mFormatPrimary = GL_RGBA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
default:
|
||||
LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
|
||||
}
|
||||
}
|
||||
if (!mHasExplicitFormat)
|
||||
{
|
||||
switch (mComponents)
|
||||
{
|
||||
case 1:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8;
|
||||
mFormatPrimary = GL_LUMINANCE;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 2:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8_ALPHA8;
|
||||
mFormatPrimary = GL_LUMINANCE_ALPHA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 3:
|
||||
#if USE_SRGB_DECODE
|
||||
if (gGLManager.mHasTexturesRGBDecode)
|
||||
{
|
||||
mFormatInternal = GL_SRGB8;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
mFormatInternal = GL_RGB8;
|
||||
}
|
||||
mFormatPrimary = GL_RGB;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 4:
|
||||
#if USE_SRGB_DECODE
|
||||
if (gGLManager.mHasTexturesRGBDecode)
|
||||
{
|
||||
mFormatInternal = GL_SRGB8_ALPHA8;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
mFormatInternal = GL_RGBA8;
|
||||
}
|
||||
mFormatPrimary = GL_RGBA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
default:
|
||||
LL_ERRS() << "Bad number of components for texture: " << (U32) getComponents() << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
mCurrentDiscardLevel = discard_level;
|
||||
mCurrentDiscardLevel = discard_level;
|
||||
mDiscardLevelInAtlas = discard_level;
|
||||
mTexelsInAtlas = raw_image->getWidth() * raw_image->getHeight() ;
|
||||
mLastBindTime = sLastFrameTime;
|
||||
|
|
|
|||
|
|
@ -849,26 +849,32 @@ void LLTexUnit::debugTextureUnit(void)
|
|||
}
|
||||
}
|
||||
|
||||
void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) {
|
||||
void LLTexUnit::setTextureColorSpace(eTextureColorSpace space)
|
||||
{
|
||||
mTexColorSpace = space;
|
||||
|
||||
#if USE_SRGB_DECODE
|
||||
if (gGLManager.mHasTexturesRGBDecode) {
|
||||
|
||||
if (space == TCS_SRGB) {
|
||||
if (gGLManager.mHasTexturesRGBDecode)
|
||||
{
|
||||
if (space == TCS_SRGB)
|
||||
{
|
||||
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
|
||||
}
|
||||
|
||||
if (gDebugGL) {
|
||||
if (gDebugGL)
|
||||
{
|
||||
assert_glerror();
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
|
||||
|
||||
{
|
||||
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
|
||||
}
|
||||
}
|
||||
|
||||
LLLightState::LLLightState(S32 index)
|
||||
|
|
@ -1192,46 +1198,46 @@ void LLRender::refreshState(void)
|
|||
|
||||
void LLRender::syncLightState()
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
LLGLSLShader *shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
if (!shader)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!shader)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (shader->mLightHash != mLightHash)
|
||||
{
|
||||
shader->mLightHash = mLightHash;
|
||||
if (shader->mLightHash != mLightHash)
|
||||
{
|
||||
shader->mLightHash = mLightHash;
|
||||
|
||||
LLVector4 position[8];
|
||||
LLVector3 direction[8];
|
||||
LLVector4 attenuation[8];
|
||||
LLVector3 diffuse[8];
|
||||
LLVector3 diffuse_b[8];
|
||||
bool sun_primary[8];
|
||||
LLVector4 position[LL_NUM_LIGHT_UNITS];
|
||||
LLVector3 direction[LL_NUM_LIGHT_UNITS];
|
||||
LLVector4 attenuation[LL_NUM_LIGHT_UNITS];
|
||||
LLVector3 diffuse[LL_NUM_LIGHT_UNITS];
|
||||
LLVector3 diffuse_b[LL_NUM_LIGHT_UNITS];
|
||||
bool sun_primary[LL_NUM_LIGHT_UNITS];
|
||||
|
||||
for (U32 i = 0; i < 8; i++)
|
||||
{
|
||||
LLLightState* light = mLightState[i];
|
||||
for (U32 i = 0; i < LL_NUM_LIGHT_UNITS; i++)
|
||||
{
|
||||
LLLightState *light = mLightState[i];
|
||||
|
||||
position[i] = light->mPosition;
|
||||
direction[i] = light->mSpotDirection;
|
||||
position[i] = light->mPosition;
|
||||
direction[i] = light->mSpotDirection;
|
||||
attenuation[i].set(light->mLinearAtten, light->mQuadraticAtten, light->mSpecular.mV[2], light->mSpecular.mV[3]);
|
||||
diffuse[i].set(light->mDiffuse.mV);
|
||||
diffuse[i].set(light->mDiffuse.mV);
|
||||
diffuse_b[i].set(light->mDiffuseB.mV);
|
||||
sun_primary[i] = light->mSunIsPrimary;
|
||||
}
|
||||
}
|
||||
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV);
|
||||
shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, 8, direction[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);
|
||||
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, LL_NUM_LIGHT_UNITS, position[0].mV);
|
||||
shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, LL_NUM_LIGHT_UNITS, direction[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, LL_NUM_LIGHT_UNITS, attenuation[0].mV);
|
||||
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, LL_NUM_LIGHT_UNITS, diffuse[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
|
||||
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);
|
||||
shader->uniform4fv(LLShaderMgr::AMBIENT, 1, mAmbientLightColor.mV);
|
||||
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::syncMatrices()
|
||||
|
|
@ -1539,11 +1545,17 @@ void LLRender::matrixMode(eMatrixMode mode)
|
|||
{
|
||||
U32 tex_index = gGL.getCurrentTexUnitIndex();
|
||||
// the shaders don't actually reference anything beyond texture_matrix0/1 outside of terrain rendering
|
||||
llassert_always(tex_index <= 3);
|
||||
mode = eMatrixMode(MM_TEXTURE0 + gGL.getCurrentTexUnitIndex());
|
||||
llassert(tex_index <= 3);
|
||||
mode = eMatrixMode(MM_TEXTURE0 + tex_index);
|
||||
if (mode > MM_TEXTURE3)
|
||||
{
|
||||
// getCurrentTexUnitIndex() can go as high as 32 (LL_NUM_TEXTURE_LAYERS)
|
||||
// Large value will result in a crash at mMatrix
|
||||
LL_WARNS_ONCE() << "Attempted to assign matrix mode out of bounds: " << mode << LL_ENDL;
|
||||
mode = MM_TEXTURE0;
|
||||
}
|
||||
}
|
||||
|
||||
llassert(mode < NUM_MATRIX_MODES);
|
||||
mMatrixMode = mode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -501,23 +501,23 @@ U32 LLRenderTarget::getNumTextures() const
|
|||
return mTex.size();
|
||||
}
|
||||
|
||||
|
||||
void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index));
|
||||
gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index));
|
||||
|
||||
bool isSRGB = false;
|
||||
llassert(mInternalFormat.size() > index);
|
||||
switch (mInternalFormat[index])
|
||||
{
|
||||
case GL_SRGB_ALPHA:
|
||||
case GL_SRGB:
|
||||
case GL_SRGB8:
|
||||
case GL_SRGB_ALPHA:
|
||||
case GL_SRGB8_ALPHA8:
|
||||
isSRGB = true;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
gGL.getTexUnit(channel)->setTextureFilteringOption(filter_options);
|
||||
|
|
|
|||
|
|
@ -1180,7 +1180,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
|
||||
llassert(mReservedUniforms.size() == LLShaderMgr::MULTI_LIGHT_FAR_Z+1);
|
||||
|
||||
|
||||
//NOTE: MUST match order in eGLSLReservedUniforms
|
||||
mReservedUniforms.push_back("proj_mat");
|
||||
mReservedUniforms.push_back("proj_near");
|
||||
mReservedUniforms.push_back("proj_p");
|
||||
|
|
|
|||
|
|
@ -1193,7 +1193,7 @@ bool LLVertexBuffer::createGLBuffer(U32 size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool sucsess = true;
|
||||
bool success = true;
|
||||
|
||||
mEmpty = true;
|
||||
|
||||
|
|
@ -1215,9 +1215,9 @@ bool LLVertexBuffer::createGLBuffer(U32 size)
|
|||
|
||||
if (!mMappedData)
|
||||
{
|
||||
sucsess = false;
|
||||
success = false;
|
||||
}
|
||||
return sucsess;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool LLVertexBuffer::createGLIndices(U32 size)
|
||||
|
|
@ -1232,7 +1232,7 @@ bool LLVertexBuffer::createGLIndices(U32 size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool sucsess = true;
|
||||
bool success = true;
|
||||
|
||||
mEmpty = true;
|
||||
|
||||
|
|
@ -1257,9 +1257,9 @@ bool LLVertexBuffer::createGLIndices(U32 size)
|
|||
|
||||
if (!mMappedIndexData)
|
||||
{
|
||||
sucsess = false;
|
||||
success = false;
|
||||
}
|
||||
return sucsess;
|
||||
return success;
|
||||
}
|
||||
|
||||
void LLVertexBuffer::destroyGLBuffer()
|
||||
|
|
@ -1306,7 +1306,7 @@ bool LLVertexBuffer::updateNumVerts(S32 nverts)
|
|||
{
|
||||
llassert(nverts >= 0);
|
||||
|
||||
bool sucsess = true;
|
||||
bool success = true;
|
||||
|
||||
if (nverts > 65536)
|
||||
{
|
||||
|
|
@ -1318,34 +1318,34 @@ bool LLVertexBuffer::updateNumVerts(S32 nverts)
|
|||
|
||||
if (needed_size > mSize || needed_size <= mSize/2)
|
||||
{
|
||||
sucsess &= createGLBuffer(needed_size);
|
||||
success &= createGLBuffer(needed_size);
|
||||
}
|
||||
|
||||
sVertexCount -= mNumVerts;
|
||||
mNumVerts = nverts;
|
||||
sVertexCount += mNumVerts;
|
||||
|
||||
return sucsess;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool LLVertexBuffer::updateNumIndices(S32 nindices)
|
||||
{
|
||||
llassert(nindices >= 0);
|
||||
|
||||
bool sucsess = true;
|
||||
bool success = true;
|
||||
|
||||
U32 needed_size = sizeof(U16) * nindices;
|
||||
|
||||
if (needed_size > mIndicesSize || needed_size <= mIndicesSize/2)
|
||||
{
|
||||
sucsess &= createGLIndices(needed_size);
|
||||
success &= createGLIndices(needed_size);
|
||||
}
|
||||
|
||||
sIndexCount -= mNumIndices;
|
||||
mNumIndices = nindices;
|
||||
sIndexCount += mNumIndices;
|
||||
|
||||
return sucsess;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
|
||||
|
|
@ -1358,10 +1358,10 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
|
|||
LL_ERRS() << "Bad vertex buffer allocation: " << nverts << " : " << nindices << LL_ENDL;
|
||||
}
|
||||
|
||||
bool sucsess = true;
|
||||
bool success = true;
|
||||
|
||||
sucsess &= updateNumVerts(nverts);
|
||||
sucsess &= updateNumIndices(nindices);
|
||||
success &= updateNumVerts(nverts);
|
||||
success &= updateNumIndices(nindices);
|
||||
|
||||
if (create && (nverts || nindices))
|
||||
{
|
||||
|
|
@ -1377,7 +1377,7 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
|
|||
}
|
||||
}
|
||||
|
||||
return sucsess;
|
||||
return success;
|
||||
}
|
||||
|
||||
static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO");
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
|
|||
, mTabComparator( NULL )
|
||||
, mNoVisibleTabsHelpText(NULL)
|
||||
, mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
|
||||
, mSkipScrollToChild(false)
|
||||
{
|
||||
initNoTabsWidget(params.no_matched_tabs_text);
|
||||
|
||||
|
|
@ -659,7 +660,7 @@ void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*)
|
|||
// virtual
|
||||
void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl)
|
||||
{
|
||||
if (mScrollbar && mScrollbar->getVisible())
|
||||
if (mScrollbar && mScrollbar->getVisible() && !mSkipScrollToChild)
|
||||
{
|
||||
// same as scrollToShowRect
|
||||
LLRect rect;
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ public:
|
|||
|
||||
bool getFitParent() const {return mFitParent;}
|
||||
|
||||
void setSkipScrollToChild(bool skip) { mSkipScrollToChild = skip; }
|
||||
|
||||
private:
|
||||
void initNoTabsWidget(const LLTextBox::Params& tb_params);
|
||||
void updateNoTabsHelpTextVisibility();
|
||||
|
|
@ -183,6 +185,8 @@ private:
|
|||
F32 mAutoScrollRate;
|
||||
LLTextBox* mNoVisibleTabsHelpText;
|
||||
|
||||
bool mSkipScrollToChild;
|
||||
|
||||
std::string mNoMatchedTabsOrigString;
|
||||
std::string mNoVisibleTabsOrigString;
|
||||
|
||||
|
|
|
|||
|
|
@ -643,7 +643,8 @@ void LLButton::draw()
|
|||
LLColor4 highlighting_color = LLColor4::white;
|
||||
LLColor4 glow_color = LLColor4::white;
|
||||
LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA;
|
||||
LLUIImage* imagep = NULL;
|
||||
LLUIImage* imagep = NULL;
|
||||
LLUIImage* image_glow = NULL;
|
||||
|
||||
// Cancel sticking of color, if the button is pressed,
|
||||
// or when a flashing of the previously selected button is ended
|
||||
|
|
@ -710,17 +711,18 @@ void LLButton::draw()
|
|||
imagep = mImageDisabled;
|
||||
}
|
||||
|
||||
image_glow = imagep;
|
||||
|
||||
if (mFlashing)
|
||||
{
|
||||
// if button should flash and we have icon for flashing, use it as image for button
|
||||
if(flash && mImageFlash)
|
||||
if (flash && mImageFlash)
|
||||
{
|
||||
// setting flash to false to avoid its further influence on glow
|
||||
flash = false;
|
||||
imagep = mImageFlash;
|
||||
// if button should flash and we have icon for flashing, use it as image for button
|
||||
image_glow = mImageFlash;
|
||||
}
|
||||
// else use usual flashing via flash_color
|
||||
else if (mFlashingTimer)
|
||||
|
||||
// provide fade-in and fade-out via flash_color
|
||||
if (mFlashingTimer)
|
||||
{
|
||||
LLColor4 flash_color = mFlashBgColor.get();
|
||||
use_glow_effect = TRUE;
|
||||
|
|
@ -734,6 +736,11 @@ void LLButton::draw()
|
|||
{
|
||||
glow_color = highlighting_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
// will fade from highlight color
|
||||
glow_color = flash_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -806,7 +813,7 @@ void LLButton::draw()
|
|||
if (mCurGlowStrength > 0.01f)
|
||||
{
|
||||
gGL.setSceneBlendType(glow_type);
|
||||
imagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % (mCurGlowStrength * alpha));
|
||||
image_glow->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % (mCurGlowStrength * alpha));
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
}
|
||||
}
|
||||
|
|
@ -817,7 +824,7 @@ void LLButton::draw()
|
|||
if (mCurGlowStrength > 0.01f)
|
||||
{
|
||||
gGL.setSceneBlendType(glow_type);
|
||||
imagep->drawSolid(0, y, glow_color % (mCurGlowStrength * alpha));
|
||||
image_glow->drawSolid(0, y, glow_color % (mCurGlowStrength * alpha));
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ public:
|
|||
void setFlashing( bool b, bool force_flashing = false );
|
||||
BOOL getFlashing() const { return mFlashing; }
|
||||
LLFlashTimer* getFlashTimer() {return mFlashingTimer;}
|
||||
void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; };
|
||||
|
||||
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
|
||||
LLFontGL::HAlign getHAlign() const { return mHAlign; }
|
||||
|
|
|
|||
|
|
@ -342,7 +342,9 @@ static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View");
|
|||
void LLFolderView::filter( LLFolderViewFilter& filter )
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FTM_FILTER);
|
||||
filter.resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
|
||||
static LLCachedControl<S32> filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
|
||||
static LLCachedControl<S32> filter_hidden(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible", 1);
|
||||
filter.resetTime(llclamp(mParentPanel.get()->getVisible() ? filter_visible() : filter_hidden(), 1, 100));
|
||||
|
||||
// Note: we filter the model, not the view
|
||||
getViewModelItem()->filter(filter);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
|
|||
: LLView(p),
|
||||
mLabelWidth(0),
|
||||
mLabelWidthDirty(false),
|
||||
mSuffixNeedsRefresh(false),
|
||||
mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT),
|
||||
mParentFolder( NULL ),
|
||||
mIsSelected( FALSE ),
|
||||
|
|
@ -181,11 +182,25 @@ LLFolderViewItem::~LLFolderViewItem()
|
|||
|
||||
BOOL LLFolderViewItem::postBuild()
|
||||
{
|
||||
refresh();
|
||||
LLFolderViewModelItem& vmi = *getViewModelItem();
|
||||
// getDisplayName() is expensive (due to internal getLabelSuffix() and name building)
|
||||
// it also sets search strings so it requires a filter reset
|
||||
mLabel = vmi.getDisplayName();
|
||||
setToolTip(vmi.getName());
|
||||
|
||||
// Dirty the filter flag of the model from the view (CHUI-849)
|
||||
vmi.dirtyFilter();
|
||||
|
||||
// Don't do full refresh on constructor if it is possible to avoid
|
||||
// it significantly slows down bulk view creation.
|
||||
// Todo: Ideally we need to move getDisplayName() out of constructor as well.
|
||||
// Like: make a logic that will let filter update search string,
|
||||
// while LLFolderViewItem::arrange() updates visual part
|
||||
mSuffixNeedsRefresh = true;
|
||||
mLabelWidthDirty = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
LLFolderView* LLFolderViewItem::getRoot()
|
||||
{
|
||||
return mRoot;
|
||||
|
|
@ -280,24 +295,51 @@ BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation)
|
|||
|
||||
void LLFolderViewItem::refresh()
|
||||
{
|
||||
LLFolderViewModelItem& vmi = *getViewModelItem();
|
||||
LLFolderViewModelItem& vmi = *getViewModelItem();
|
||||
|
||||
mLabel = vmi.getDisplayName();
|
||||
mLabel = vmi.getDisplayName();
|
||||
setToolTip(vmi.getName());
|
||||
// icons are slightly expensive to get, can be optimized
|
||||
// see LLInventoryIcon::getIcon()
|
||||
mIcon = vmi.getIcon();
|
||||
mIconOpen = vmi.getIconOpen();
|
||||
mIconOverlay = vmi.getIconOverlay();
|
||||
|
||||
setToolTip(vmi.getName());
|
||||
mIcon = vmi.getIcon();
|
||||
mIconOpen = vmi.getIconOpen();
|
||||
mIconOverlay = vmi.getIconOverlay();
|
||||
if (mRoot->useLabelSuffix())
|
||||
{
|
||||
// Very Expensive!
|
||||
// Can do a number of expensive checks, like checking active motions, wearables or friend list
|
||||
mLabelStyle = vmi.getLabelStyle();
|
||||
mLabelSuffix = vmi.getLabelSuffix();
|
||||
}
|
||||
|
||||
// Dirty the filter flag of the model from the view (CHUI-849)
|
||||
vmi.dirtyFilter();
|
||||
|
||||
mLabelWidthDirty = true;
|
||||
mSuffixNeedsRefresh = false;
|
||||
}
|
||||
|
||||
void LLFolderViewItem::refreshSuffix()
|
||||
{
|
||||
LLFolderViewModelItem const* vmi = getViewModelItem();
|
||||
|
||||
// icons are slightly expensive to get, can be optimized
|
||||
// see LLInventoryIcon::getIcon()
|
||||
mIcon = vmi->getIcon();
|
||||
mIconOpen = vmi->getIconOpen();
|
||||
mIconOverlay = vmi->getIconOverlay();
|
||||
|
||||
if (mRoot->useLabelSuffix())
|
||||
{
|
||||
mLabelStyle = vmi.getLabelStyle();
|
||||
mLabelSuffix = vmi.getLabelSuffix();
|
||||
// Very Expensive!
|
||||
// Can do a number of expensive checks, like checking active motions, wearables or friend list
|
||||
mLabelStyle = vmi->getLabelStyle();
|
||||
mLabelSuffix = vmi->getLabelSuffix();
|
||||
}
|
||||
|
||||
mLabelWidthDirty = true;
|
||||
// Dirty the filter flag of the model from the view (CHUI-849)
|
||||
vmi.dirtyFilter();
|
||||
mLabelWidthDirty = true;
|
||||
mSuffixNeedsRefresh = false;
|
||||
}
|
||||
|
||||
// Utility function for LLFolderView
|
||||
|
|
@ -348,6 +390,12 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height )
|
|||
: 0;
|
||||
if (mLabelWidthDirty)
|
||||
{
|
||||
if (mSuffixNeedsRefresh)
|
||||
{
|
||||
// Expensive. But despite refreshing label,
|
||||
// it is purely visual, so it is fine to do at our laisure
|
||||
refreshSuffix();
|
||||
}
|
||||
mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight;
|
||||
mLabelWidthDirty = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ protected:
|
|||
LLPointer<LLFolderViewModelItem> mViewModelItem;
|
||||
LLFontGL::StyleFlags mLabelStyle;
|
||||
std::string mLabelSuffix;
|
||||
bool mSuffixNeedsRefresh; //suffix and icons
|
||||
LLUIImagePtr mIcon,
|
||||
mIconOpen,
|
||||
mIconOverlay;
|
||||
|
|
@ -266,8 +267,13 @@ public:
|
|||
virtual BOOL passedFilter(S32 filter_generation = -1);
|
||||
virtual BOOL isPotentiallyVisible(S32 filter_generation = -1);
|
||||
|
||||
// refresh information from the object being viewed.
|
||||
virtual void refresh();
|
||||
// refresh information from the object being viewed.
|
||||
// refreshes label, suffixes and sets icons. Expensive!
|
||||
// Causes filter update
|
||||
virtual void refresh();
|
||||
// refreshes suffixes and sets icons. Expensive!
|
||||
// Does not need filter update
|
||||
virtual void refreshSuffix();
|
||||
|
||||
// LLView functionality
|
||||
virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ std::string LLFolderViewModelCommon::getStatusText()
|
|||
|
||||
void LLFolderViewModelCommon::filter()
|
||||
{
|
||||
getFilter().resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
|
||||
static LLCachedControl<S32> filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
|
||||
getFilter().resetTime(llclamp(filter_visible(), 1, 100));
|
||||
mFolderView->getViewModelItem()->filter(getFilter());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -285,17 +285,7 @@ public:
|
|||
typedef std::list<LLFolderViewModelItem*> child_list_t;
|
||||
|
||||
virtual void addChild(LLFolderViewModelItem* child)
|
||||
{
|
||||
// Avoid duplicates: bail out if that child is already present in the list
|
||||
// Note: this happens when models are created before views
|
||||
child_list_t::const_iterator iter;
|
||||
for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
|
||||
{
|
||||
if (child == *iter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
mChildren.push_back(child);
|
||||
child->setParent(this);
|
||||
dirtyFilter();
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ LLScrollListCtrl::Params::Params()
|
|||
sort_ascending("sort_ascending", true),
|
||||
mouse_wheel_opaque("mouse_wheel_opaque", false),
|
||||
commit_on_keyboard_movement("commit_on_keyboard_movement", true),
|
||||
commit_on_selection_change("commit_on_selection_change", false),
|
||||
heading_height("heading_height"),
|
||||
page_lines("page_lines", 0),
|
||||
background_visible("background_visible"),
|
||||
|
|
@ -162,7 +163,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
|
|||
mMaxSelectable(0),
|
||||
mAllowKeyboardMovement(true),
|
||||
mCommitOnKeyboardMovement(p.commit_on_keyboard_movement),
|
||||
mCommitOnSelectionChange(false),
|
||||
mCommitOnSelectionChange(p.commit_on_selection_change),
|
||||
mSelectionChanged(false),
|
||||
mNeedsScroll(false),
|
||||
mCanSelect(true),
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ public:
|
|||
// behavioral flags
|
||||
Optional<bool> multi_select,
|
||||
commit_on_keyboard_movement,
|
||||
commit_on_selection_change,
|
||||
mouse_wheel_opaque;
|
||||
|
||||
// display flags
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
|
|||
LLSpellChecker::LLSpellChecker()
|
||||
: mHunspell(NULL)
|
||||
{
|
||||
// Load initial dictionary information
|
||||
refreshDictionaryMap();
|
||||
}
|
||||
|
||||
LLSpellChecker::~LLSpellChecker()
|
||||
|
|
@ -58,6 +56,12 @@ LLSpellChecker::~LLSpellChecker()
|
|||
delete mHunspell;
|
||||
}
|
||||
|
||||
void LLSpellChecker::initSingleton()
|
||||
{
|
||||
// Load initial dictionary information
|
||||
refreshDictionaryMap();
|
||||
}
|
||||
|
||||
bool LLSpellChecker::checkSpelling(const std::string& word) const
|
||||
{
|
||||
if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word.c_str())) )
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public:
|
|||
protected:
|
||||
void addToDictFile(const std::string& dict_path, const std::string& word);
|
||||
void initHunspell(const std::string& dict_language);
|
||||
void initSingleton();
|
||||
|
||||
public:
|
||||
typedef std::list<std::string> dict_list_t;
|
||||
|
|
|
|||
|
|
@ -220,6 +220,8 @@ LLTabContainer::Params::Params()
|
|||
last_tab("last_tab"),
|
||||
use_custom_icon_ctrl("use_custom_icon_ctrl", false),
|
||||
open_tabs_on_drag_and_drop("open_tabs_on_drag_and_drop", false),
|
||||
enable_tabs_flashing("enable_tabs_flashing", false),
|
||||
tabs_flashing_color("tabs_flashing_color"),
|
||||
tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0),
|
||||
use_ellipses("use_ellipses"),
|
||||
font_halign("halign")
|
||||
|
|
@ -259,6 +261,8 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
|
|||
mCustomIconCtrlUsed(p.use_custom_icon_ctrl),
|
||||
mOpenTabsOnDragAndDrop(p.open_tabs_on_drag_and_drop),
|
||||
mTabIconCtrlPad(p.tab_icon_ctrl_pad),
|
||||
mEnableTabsFlashing(p.enable_tabs_flashing),
|
||||
mTabsFlashingColor(p.tabs_flashing_color),
|
||||
mUseTabEllipses(p.use_ellipses)
|
||||
{
|
||||
static LLUICachedControl<S32> tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0);
|
||||
|
|
@ -280,6 +284,11 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
|
|||
mMinTabWidth = tabcntr_vert_tab_min_width;
|
||||
}
|
||||
|
||||
if (p.tabs_flashing_color.isProvided())
|
||||
{
|
||||
mEnableTabsFlashing = true;
|
||||
}
|
||||
|
||||
initButtons( );
|
||||
}
|
||||
|
||||
|
|
@ -1102,6 +1111,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
|
|||
p.pad_left( mLabelPadLeft );
|
||||
p.pad_right(2);
|
||||
}
|
||||
|
||||
// inits flash timer
|
||||
p.button_flash_enable = mEnableTabsFlashing;
|
||||
p.flash_color = mTabsFlashingColor;
|
||||
|
||||
// *TODO : It seems wrong not to use p in both cases considering the way p is initialized
|
||||
if (mCustomIconCtrlUsed)
|
||||
|
|
|
|||
|
|
@ -109,6 +109,12 @@ public:
|
|||
* Open tabs on hover in drag and drop situations
|
||||
*/
|
||||
Optional<bool> open_tabs_on_drag_and_drop;
|
||||
|
||||
/**
|
||||
* Enable tab flashing
|
||||
*/
|
||||
Optional<bool> enable_tabs_flashing;
|
||||
Optional<LLUIColor> tabs_flashing_color;
|
||||
|
||||
/**
|
||||
* Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true)
|
||||
|
|
@ -310,6 +316,8 @@ private:
|
|||
|
||||
bool mCustomIconCtrlUsed;
|
||||
bool mOpenTabsOnDragAndDrop;
|
||||
bool mEnableTabsFlashing;
|
||||
LLUIColor mTabsFlashingColor;
|
||||
S32 mTabIconCtrlPad;
|
||||
bool mUseTabEllipses;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2259,6 +2259,18 @@ void LLTextBase::needsReflow(S32 index)
|
|||
mReflowIndex = llmin(mReflowIndex, index);
|
||||
}
|
||||
|
||||
S32 LLTextBase::removeFirstLine()
|
||||
{
|
||||
if (!mLineInfoList.empty())
|
||||
{
|
||||
S32 length = getLineEnd(0);
|
||||
deselect();
|
||||
removeStringNoUndo(0, length);
|
||||
return length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params)
|
||||
{
|
||||
segment_vec_t segments;
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ public:
|
|||
virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
|
||||
virtual std::string getText() const;
|
||||
void setMaxTextLength(S32 length) { mMaxTextByteLength = length; }
|
||||
S32 getMaxTextLength() { return mMaxTextByteLength; }
|
||||
|
||||
// wide-char versions
|
||||
void setWText(const LLWString& text);
|
||||
|
|
@ -432,6 +433,7 @@ public:
|
|||
|
||||
S32 getLength() const { return getWText().length(); }
|
||||
S32 getLineCount() const { return mLineInfoList.size(); }
|
||||
S32 removeFirstLine(); // returns removed length
|
||||
|
||||
void addDocumentChild(LLView* view);
|
||||
void removeDocumentChild(LLView* view);
|
||||
|
|
|
|||
|
|
@ -454,13 +454,17 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const
|
|||
}
|
||||
|
||||
//
|
||||
// LLUrlEntrySeconlifeURL Describes *secondlife.com/ *lindenlab.com/ and *tilia-inc.com/ urls to substitute icon 'hand.png' before link
|
||||
// LLUrlEntrySeconlifeURL Describes *secondlife.com/ *lindenlab.com/ *secondlifegrid.net/ and *tilia-inc.com/ urls to substitute icon 'hand.png' before link
|
||||
//
|
||||
LLUrlEntrySecondlifeURL::LLUrlEntrySecondlifeURL()
|
||||
{
|
||||
mPattern = boost::regex("((http://([-\\w\\.]*\\.)?(secondlife|lindenlab|tilia-inc)\\.com)"
|
||||
"|"
|
||||
"(https://([-\\w\\.]*\\.)?(secondlife|lindenlab|tilia-inc)\\.com(:\\d{1,5})?))"
|
||||
"(http://([-\\w\\.]*\\.)?secondlifegrid\\.net)"
|
||||
"|"
|
||||
"(https://([-\\w\\.]*\\.)?(secondlife|lindenlab|tilia-inc)\\.com(:\\d{1,5})?)"
|
||||
"|"
|
||||
"(https://([-\\w\\.]*\\.)?secondlifegrid\\.net(:\\d{1,5})?))"
|
||||
"\\/\\S*",
|
||||
boost::regex::perl|boost::regex::icase);
|
||||
|
||||
|
|
@ -495,12 +499,14 @@ std::string LLUrlEntrySecondlifeURL::getTooltip(const std::string &url) const
|
|||
}
|
||||
|
||||
//
|
||||
// LLUrlEntrySimpleSecondlifeURL Describes *secondlife.com *lindenlab.com and *tilia-inc.com urls to substitute icon 'hand.png' before link
|
||||
// LLUrlEntrySimpleSecondlifeURL Describes *secondlife.com *lindenlab.com *secondlifegrid.net and *tilia-inc.com urls to substitute icon 'hand.png' before link
|
||||
//
|
||||
LLUrlEntrySimpleSecondlifeURL::LLUrlEntrySimpleSecondlifeURL()
|
||||
{
|
||||
mPattern = boost::regex("https?://([-\\w\\.]*\\.)?(secondlife|lindenlab|tilia-inc)\\.com(?!\\S)",
|
||||
boost::regex::perl|boost::regex::icase);
|
||||
mPattern = boost::regex("https?://([-\\w\\.]*\\.)?(secondlife|lindenlab|tilia-inc)\\.com(?!\\S)"
|
||||
"|"
|
||||
"https?://([-\\w\\.]*\\.)?secondlifegrid\\.net(?!\\S)",
|
||||
boost::regex::perl|boost::regex::icase);
|
||||
|
||||
mIcon = "Hand";
|
||||
mMenuName = "menu_url_http.xml";
|
||||
|
|
|
|||
|
|
@ -784,9 +784,6 @@ void LLWindowWin32::close()
|
|||
resetDisplayResolution();
|
||||
}
|
||||
|
||||
// Don't process events in our mainWindowProc any longer.
|
||||
SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL);
|
||||
|
||||
// Make sure cursor is visible and we haven't mangled the clipping state.
|
||||
showCursor();
|
||||
setMouseClipping(FALSE);
|
||||
|
|
@ -832,16 +829,24 @@ void LLWindowWin32::close()
|
|||
|
||||
LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
|
||||
|
||||
// Make sure we don't leave a blank toolbar button.
|
||||
ShowWindow(mWindowHandle, SW_HIDE);
|
||||
if (IsWindow(mWindowHandle))
|
||||
{
|
||||
// Make sure we don't leave a blank toolbar button.
|
||||
ShowWindow(mWindowHandle, SW_HIDE);
|
||||
|
||||
// This causes WM_DESTROY to be sent *immediately*
|
||||
if (!destroy_window_handler(mWindowHandle))
|
||||
{
|
||||
OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
|
||||
mCallbacks->translateString("MBShutdownErr"),
|
||||
OSMB_OK);
|
||||
}
|
||||
// This causes WM_DESTROY to be sent *immediately*
|
||||
if (!destroy_window_handler(mWindowHandle))
|
||||
{
|
||||
OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
|
||||
mCallbacks->translateString("MBShutdownErr"),
|
||||
OSMB_OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something killed the window while we were busy destroying gl or handle somehow got broken
|
||||
LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL;
|
||||
}
|
||||
|
||||
mWindowHandle = NULL;
|
||||
}
|
||||
|
|
@ -1133,7 +1138,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||
<< " Height: " << (window_rect.bottom - window_rect.top)
|
||||
<< " Fullscreen: " << mFullscreen
|
||||
<< LL_ENDL;
|
||||
DestroyWindow(mWindowHandle);
|
||||
if (!destroy_window_handler(mWindowHandle))
|
||||
{
|
||||
LL_WARNS("Window") << "Failed to properly close window before recreating it!" << LL_ENDL;
|
||||
}
|
||||
mWindowHandle = CreateWindowEx(dw_ex_style,
|
||||
mWindowClassName,
|
||||
mWindowTitle,
|
||||
|
|
@ -1453,8 +1461,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||
ReleaseDC (mWindowHandle, mhDC); // Release The Device Context
|
||||
mhDC = 0; // Zero The Device Context
|
||||
}
|
||||
DestroyWindow (mWindowHandle); // Destroy The Window
|
||||
|
||||
|
||||
// Destroy The Window
|
||||
if (!destroy_window_handler(mWindowHandle))
|
||||
{
|
||||
LL_WARNS("Window") << "Failed to properly close window!" << LL_ENDL;
|
||||
}
|
||||
|
||||
mWindowHandle = CreateWindowEx(dw_ex_style,
|
||||
mWindowClassName,
|
||||
|
|
@ -3397,7 +3409,10 @@ void LLSplashScreenWin32::hideImpl()
|
|||
{
|
||||
if (mWindow)
|
||||
{
|
||||
DestroyWindow(mWindow);
|
||||
if (!destroy_window_handler(mWindow))
|
||||
{
|
||||
LL_WARNS("Window") << "Failed to properly close splash screen window!" << LL_ENDL;
|
||||
}
|
||||
mWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ private:
|
|||
bool mCanCut;
|
||||
bool mCanCopy;
|
||||
bool mCanPaste;
|
||||
std::string mRootCachePath;
|
||||
std::string mCachePath;
|
||||
std::string mContextCachePath;
|
||||
std::string mCefLogFile;
|
||||
bool mCefLogVerbose;
|
||||
std::vector<std::string> mPickedFiles;
|
||||
|
|
@ -458,7 +460,6 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
|
|||
}
|
||||
else if (message_name == "cleanup")
|
||||
{
|
||||
mVolumeCatcher.setVolume(0); // Hack: masks CEF exit issues
|
||||
mCEFLib->requestExit();
|
||||
}
|
||||
else if (message_name == "force_exit")
|
||||
|
|
@ -527,7 +528,9 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
|
|||
settings.accept_language_list = mHostLanguage;
|
||||
settings.background_color = 0xffffffff;
|
||||
settings.cache_enabled = true;
|
||||
settings.root_cache_path = mRootCachePath;
|
||||
settings.cache_path = mCachePath;
|
||||
settings.context_cache_path = mContextCachePath;
|
||||
settings.cookies_enabled = mCookiesEnabled;
|
||||
settings.disable_gpu = mDisableGPU;
|
||||
#if LL_DARWIN
|
||||
|
|
@ -583,9 +586,25 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
|
|||
else if (message_name == "set_user_data_path")
|
||||
{
|
||||
std::string user_data_path_cache = message_in.getValue("cache_path");
|
||||
std::string user_data_path_cookies = message_in.getValue("cookies_path");
|
||||
std::string subfolder = message_in.getValue("username");
|
||||
|
||||
mCachePath = user_data_path_cache + "cef_cache";
|
||||
mRootCachePath = user_data_path_cache + "cef_cache";
|
||||
if (!subfolder.empty())
|
||||
{
|
||||
std::string delim;
|
||||
#if LL_WINDOWS
|
||||
// media plugin doesn't have access to gDirUtilp
|
||||
delim = "\\";
|
||||
#else
|
||||
delim = "/";
|
||||
#endif
|
||||
mCachePath = mRootCachePath + delim + subfolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCachePath = mRootCachePath;
|
||||
}
|
||||
mContextCachePath = ""; // disabled by ""
|
||||
mCefLogFile = message_in.getValue("cef_log_file");
|
||||
mCefLogVerbose = message_in.getValueBoolean("cef_verbose_log");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,6 +401,7 @@ set(viewer_SOURCE_FILES
|
|||
llmenuoptionpathfindingrebakenavmesh.cpp
|
||||
llmeshrepository.cpp
|
||||
llmimetypes.cpp
|
||||
llmodelpreview.cpp
|
||||
llmorphview.cpp
|
||||
llmoveview.cpp
|
||||
llmutelist.cpp
|
||||
|
|
@ -1043,6 +1044,7 @@ set(viewer_HEADER_FILES
|
|||
llmenuoptionpathfindingrebakenavmesh.h
|
||||
llmeshrepository.h
|
||||
llmimetypes.h
|
||||
llmodelpreview.h
|
||||
llmorphview.h
|
||||
llmoveview.h
|
||||
llmutelist.h
|
||||
|
|
@ -2172,7 +2174,7 @@ if (DARWIN)
|
|||
set(MACOSX_BUNDLE_BUNDLE_NAME "SecondLife")
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}")
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION "${VIEWER_SHORT_VERSION}${VIEWER_MACOSX_PHASE}${VIEWER_REVISION}")
|
||||
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © Linden Research, Inc. 2019")
|
||||
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © Linden Research, Inc. 2020")
|
||||
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "SecondLife.nib")
|
||||
set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "LLApplication")
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
6.4.9
|
||||
6.4.12
|
||||
|
|
|
|||
|
|
@ -1120,17 +1120,6 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>FramePerSecondLimit</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Controls upper limit of frames per second</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>120</integer>
|
||||
</map>
|
||||
<key>BackgroundYieldTime</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7049,7 +7038,7 @@
|
|||
<integer>600</integer>
|
||||
</map>
|
||||
<key>MigrateCacheDirectory</key>
|
||||
<map>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Check for old version of disk cache to migrate to current location</string>
|
||||
<key>Persist</key>
|
||||
|
|
@ -8310,7 +8299,6 @@
|
|||
<key>Value</key>
|
||||
<integer>13</integer>
|
||||
</map>
|
||||
|
||||
<key>PreviewAmbientColor</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8327,8 +8315,6 @@
|
|||
<real>1.0</real>
|
||||
</array>
|
||||
</map>
|
||||
|
||||
|
||||
<key>PreviewDiffuse0</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -16970,3 +16956,4 @@
|
|||
</map>
|
||||
</llsd>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file WLCloudsV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0;
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Output parameters
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING float vary_CloudDensity;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
VARYING float altitude_blend_factor;
|
||||
|
||||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ uniform float cloud_shadow;
|
|||
uniform float density_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
|
@ -70,133 +70,123 @@ uniform float cloud_scale;
|
|||
// NOTE: Keep these in sync!
|
||||
// indra\newview\app_settings\shaders\class1\deferred\skyV.glsl
|
||||
// indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl
|
||||
// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl
|
||||
// indra\newview\lllegacyatmospherics.cpp
|
||||
// indra\newview\llsettingsvo.cpp
|
||||
void main()
|
||||
{
|
||||
// World / view / projection
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
// World / view / projection
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
// Texture coords
|
||||
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
|
||||
vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial
|
||||
|
||||
// Texture coords
|
||||
vary_texcoord0 = texcoord0;
|
||||
vary_texcoord0.xy -= 0.5;
|
||||
vary_texcoord0.xy /= cloud_scale;
|
||||
vary_texcoord0.xy += 0.5;
|
||||
vary_texcoord0.xy -= 0.5;
|
||||
vary_texcoord0.xy /= cloud_scale;
|
||||
vary_texcoord0.xy += 0.5;
|
||||
|
||||
vary_texcoord1 = vary_texcoord0;
|
||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||
vary_texcoord1 = vary_texcoord0;
|
||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||
|
||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
// Get relative position
|
||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
||||
|
||||
altitude_blend_factor = clamp((P.y + 512.0) / max_y, 0.0, 1.0);
|
||||
altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0);
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
{
|
||||
P *= (max_y / P.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
|
||||
P *= (-32000. / P.y);
|
||||
}
|
||||
// Set altitude
|
||||
if (rel_pos.y > 0)
|
||||
{
|
||||
rel_pos *= (max_y / rel_pos.y);
|
||||
}
|
||||
if (rel_pos.y < 0)
|
||||
{
|
||||
altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon
|
||||
rel_pos *= (-32000. / rel_pos.y);
|
||||
}
|
||||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
float Plen = length(P);
|
||||
// Can normalize then
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
// Initialize temp variables
|
||||
vec4 temp1 = vec4(0.);
|
||||
vec4 temp2 = vec4(0.);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
//vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 sunlight = sunlight_color;
|
||||
vec4 light_atten;
|
||||
// Initialize temp variables
|
||||
vec4 sunlight = sunlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
// Calculate relative weights
|
||||
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = haze_density / combined_haze;
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
// Compute sunlight from rel_pos & lightnorm (for long rays like sky)
|
||||
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Distance
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
||||
// compiler gets confused.
|
||||
combined_haze = exp(-combined_haze * density_dist);
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
// Compute haze glow
|
||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
haze_glow *= sun_moon_glow_factor;
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
temp2.x = 1. - temp2.x;
|
||||
// temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
// Add "minimum anti-solar illumination"
|
||||
// For sun, add to glow. For moon, remove glow entirely. SL-13768
|
||||
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud =
|
||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
// CLOUDS
|
||||
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
// Cloud color out
|
||||
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||
|
||||
// CLOUDS
|
||||
temp2.y = max(0., lightnorm.y * 2.);
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Attenuate cloud color by atmosphere
|
||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||
vary_CloudColorSun *= combined_haze;
|
||||
vary_CloudColorAmbient *= combined_haze;
|
||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
||||
|
||||
// Cloud color out
|
||||
vary_CloudColorSun = (sunlight * temp2.x) * cloud_color;
|
||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
vary_CloudColorSun *= temp1;
|
||||
vary_CloudColorAmbient *= temp1;
|
||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
|
||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||
|
||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||
// Combine these to minimize register use
|
||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||
|
||||
// needs this to compile on mac
|
||||
// vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
|
||||
// Combine these to minimize register use
|
||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||
|
||||
// needs this to compile on mac
|
||||
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
|
||||
// END CLOUDS
|
||||
// END CLOUDS
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ VARYING vec4 vary_position;
|
|||
|
||||
uniform samplerCube environmentMap;
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass()
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 fullbrightShinyAtmosTransport(vec3 light);
|
||||
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
|
@ -51,7 +54,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
|
|||
vec3 linear_to_srgb(vec3 c);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
|
||||
// See:
|
||||
// class1\deferred\fullbrightShinyF.glsl
|
||||
// class1\lighting\lightFullbrightShinyF.glsl
|
||||
void main()
|
||||
{
|
||||
#ifdef HAS_DIFFUSE_LOOKUP
|
||||
|
|
@ -59,25 +64,39 @@ void main()
|
|||
#else
|
||||
vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
#endif
|
||||
|
||||
|
||||
color.rgb *= vertex_color.rgb;
|
||||
vec3 pos = vary_position.xyz/vary_position.w;
|
||||
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 0)
|
||||
{
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
vec3 pos = vary_position.xyz/vary_position.w;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
float env_intensity = vertex_color.a;
|
||||
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
|
||||
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
float env_intensity = vertex_color.a;
|
||||
|
||||
//color.rgb = srgb_to_linear(color.rgb);
|
||||
|
||||
color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
|
||||
|
||||
color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten);
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
}
|
||||
|
||||
/*
|
||||
// NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects.
|
||||
else
|
||||
{
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
float env_intensity = vertex_color.a;
|
||||
color.rgb = mix(color.rgb, envColor.rgb, env_intensity);
|
||||
}
|
||||
*/
|
||||
|
||||
color.a = 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,439 +1,443 @@
|
|||
/**
|
||||
* @file materialF.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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
//class1/deferred/materialF.glsl
|
||||
|
||||
// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass.
|
||||
|
||||
#define DIFFUSE_ALPHA_MODE_NONE 0
|
||||
#define DIFFUSE_ALPHA_MODE_BLEND 1
|
||||
#define DIFFUSE_ALPHA_MODE_MASK 2
|
||||
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
|
||||
|
||||
uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise
|
||||
uniform int sun_up_factor;
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 applyWaterFogView(vec3 pos, vec4 color);
|
||||
#endif
|
||||
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
|
||||
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cs);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
|
||||
#endif
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
// Inputs
|
||||
uniform vec4 morphFactor;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform mat3 env_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
|
||||
uniform mat4 proj_mat;
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
uniform vec4 light_attenuation[8];
|
||||
uniform vec3 light_diffuse[8];
|
||||
|
||||
float getAmbientClamp();
|
||||
|
||||
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance)
|
||||
{
|
||||
vec3 col = vec3(0);
|
||||
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz - v;
|
||||
|
||||
//get distance
|
||||
float dist = length(lv);
|
||||
float da = 1.0;
|
||||
|
||||
dist /= la;
|
||||
|
||||
if (dist > 0.0 && la > 0.0)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist_atten = clamp(1.0 - (dist - 1.0*(1.0 - fa)) / fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0f;
|
||||
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= dot(n, lv);
|
||||
|
||||
float lit = 0.0f;
|
||||
|
||||
float amb_da = ambiance;
|
||||
if (da >= 0)
|
||||
{
|
||||
lit = max(da * dist_atten, 0.0);
|
||||
col = lit * light_col * diffuse;
|
||||
amb_da += (da*0.5 + 0.5) * ambiance;
|
||||
}
|
||||
amb_da += (da*da*0.5 + 0.5) * ambiance;
|
||||
amb_da *= dist_atten;
|
||||
amb_da = min(amb_da, 1.0f - lit);
|
||||
|
||||
// SL-10969 need to see why these are blown out
|
||||
//col.rgb += amb_da * light_col * diffuse;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv + npos);
|
||||
float nh = dot(n, h);
|
||||
float nv = dot(n, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da);
|
||||
vec3 speccol = lit*scol*light_col.rgb*spec.rgb;
|
||||
speccol = clamp(speccol, vec3(0), vec3(1));
|
||||
col += speccol;
|
||||
|
||||
float cur_glare = max(speccol.r, speccol.g);
|
||||
cur_glare = max(cur_glare, speccol.b);
|
||||
glare = max(glare, speccol.r);
|
||||
glare += max(cur_glare, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max(col, vec3(0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_data[3];
|
||||
#else
|
||||
#define frag_data gl_FragData
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap; //always in sRGB space
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
uniform sampler2D bumpMap;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
uniform sampler2D specularMap;
|
||||
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
|
||||
uniform float env_intensity;
|
||||
uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
|
||||
uniform float minimum_alpha;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#else
|
||||
VARYING vec3 vary_normal;
|
||||
#endif
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec2 encode_normal(vec3 n);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos_screen = vary_texcoord0.xy;
|
||||
|
||||
vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
diffcol.rgb *= vertex_color.rgb;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
|
||||
|
||||
// Comparing floats cast from 8-bit values, produces acne right at the 8-bit transition points
|
||||
float bias = 0.001953125; // 1/512, or half an 8-bit quantization
|
||||
if (diffcol.a < minimum_alpha-bias)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vec3 gamma_diff = diffcol.rgb;
|
||||
diffcol.rgb = srgb_to_linear(diffcol.rgb);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec4 spec = texture2D(specularMap, vary_texcoord2.xy);
|
||||
spec.rgb *= specular_color.rgb;
|
||||
#else
|
||||
vec4 spec = vec4(specular_color.rgb, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec4 norm = texture2D(bumpMap, vary_texcoord1.xy);
|
||||
|
||||
norm.xyz = norm.xyz * 2 - 1;
|
||||
|
||||
vec3 tnorm = vec3(dot(norm.xyz,vary_mat0),
|
||||
dot(norm.xyz,vary_mat1),
|
||||
dot(norm.xyz,vary_mat2));
|
||||
#else
|
||||
vec4 norm = vec4(0,0,0,1.0);
|
||||
vec3 tnorm = vary_normal;
|
||||
#endif
|
||||
|
||||
norm.xyz = normalize(tnorm.xyz);
|
||||
|
||||
vec2 abnormal = encode_normal(norm.xyz);
|
||||
|
||||
vec4 final_color = diffcol;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE)
|
||||
final_color.a = emissive_brightness;
|
||||
#else
|
||||
final_color.a = max(final_color.a, emissive_brightness);
|
||||
#endif
|
||||
|
||||
vec4 final_specular = spec;
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity * spec.a, 0.0);
|
||||
final_specular.a = specular_color.a * norm.a;
|
||||
#else
|
||||
vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0);
|
||||
final_specular.a = specular_color.a;
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
//forward rendering, output just lit sRGBA
|
||||
vec3 pos = vary_position;
|
||||
|
||||
float shadow = 1.0f;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen);
|
||||
#endif
|
||||
|
||||
spec = final_specular;
|
||||
vec4 diffuse = final_color;
|
||||
float envIntensity = final_normal.z;
|
||||
|
||||
vec3 color = vec3(0,0,0);
|
||||
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
|
||||
float bloom = 0.0;
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
// This call breaks the Mac GLSL compiler/linker for unknown reasons (17Mar2020)
|
||||
// The call is either a no-op or a pure (pow) gamma adjustment, depending on GPU level
|
||||
// TODO: determine if we want to re-apply the gamma adjustment, and if so understand & fix Mac breakage
|
||||
//color = fullbrightScaleSoftClip(color);
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
//we're in sRGB space, so gamma correct this dot product so
|
||||
// lighting from the sun stays sharp
|
||||
float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0);
|
||||
da = pow(da, 1.0 / 1.3);
|
||||
|
||||
color = amblit;
|
||||
|
||||
//darken ambient for normals perpendicular to light vector so surfaces in shadow
|
||||
// and facing away from light still have some definition to them.
|
||||
// do NOT gamma correct this dot product so ambient lighting stays soft
|
||||
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(da, shadow) * sunlit;
|
||||
|
||||
color *= ambient;
|
||||
|
||||
color += sun_contrib;
|
||||
|
||||
color *= gamma_diff.rgb;
|
||||
|
||||
float glare = 0.0;
|
||||
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
#if 1 //EEP
|
||||
|
||||
vec3 npos = -normalize(pos.xyz);
|
||||
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(light_dir.xyz + npos);
|
||||
float nh = dot(norm.xyz, h);
|
||||
float nv = dot(norm.xyz, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da);
|
||||
vec3 sp = sun_contrib*scol / 6.0f;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom = dot(sp, sp) / 4.0;
|
||||
color += sp * spec.rgb;
|
||||
}
|
||||
#else // PRODUCTION
|
||||
float sa = dot(refnormpersp, sun_dir.xyz);
|
||||
vec3 dumbshiny = sunlit*shadow*(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) / 6;
|
||||
|
||||
glare = max(spec_contrib.r, spec_contrib.g);
|
||||
glare = max(glare, spec_contrib.b);
|
||||
|
||||
color += spec_contrib;
|
||||
#endif
|
||||
}
|
||||
|
||||
color = mix(color.rgb, diffcol.rgb, diffuse.a);
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
//add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
|
||||
color = mix(color, reflected_color, envIntensity);
|
||||
|
||||
float cur_glare = max(reflected_color.r, reflected_color.g);
|
||||
cur_glare = max(cur_glare, reflected_color.b);
|
||||
cur_glare *= envIntensity*4.0;
|
||||
glare += cur_glare;
|
||||
}
|
||||
|
||||
color = atmosFragLighting(color, additive, atten);
|
||||
color = scaleSoftClipFrag(color);
|
||||
|
||||
//convert to linear before adding local lights
|
||||
color = srgb_to_linear(color);
|
||||
|
||||
vec3 npos = normalize(-pos.xyz);
|
||||
|
||||
vec3 light = vec3(0, 0, 0);
|
||||
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
LIGHT_LOOP(3)
|
||||
LIGHT_LOOP(4)
|
||||
LIGHT_LOOP(5)
|
||||
LIGHT_LOOP(6)
|
||||
LIGHT_LOOP(7)
|
||||
|
||||
color += light;
|
||||
|
||||
glare = min(glare, 1.0);
|
||||
float al = max(diffcol.a, glare)*vertex_color.a;
|
||||
|
||||
//convert to srgb as this color is being written post gamma correction
|
||||
color = linear_to_srgb(color);
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 temp = applyWaterFogView(pos, vec4(color, al));
|
||||
color = temp.rgb;
|
||||
al = temp.a;
|
||||
#endif
|
||||
|
||||
frag_color = vec4(color, al);
|
||||
|
||||
#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
|
||||
|
||||
// deferred path
|
||||
frag_data[0] = final_color; //gbuffer is sRGB
|
||||
frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent.
|
||||
frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity.
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @file materialF.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$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
//class1/deferred/materialF.glsl
|
||||
|
||||
// This shader is used for both writing opaque/masked content to the gbuffer and writing blended content to the framebuffer during the alpha pass.
|
||||
|
||||
#define DIFFUSE_ALPHA_MODE_NONE 0
|
||||
#define DIFFUSE_ALPHA_MODE_BLEND 1
|
||||
#define DIFFUSE_ALPHA_MODE_MASK 2
|
||||
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
|
||||
|
||||
uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise
|
||||
uniform int sun_up_factor;
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 applyWaterFogView(vec3 pos, vec4 color);
|
||||
#endif
|
||||
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
|
||||
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cs);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
|
||||
#endif
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
// Inputs
|
||||
uniform vec4 morphFactor;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform mat3 env_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
|
||||
uniform mat4 proj_mat;
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
uniform vec4 light_attenuation[8];
|
||||
uniform vec3 light_diffuse[8];
|
||||
|
||||
float getAmbientClamp();
|
||||
|
||||
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance)
|
||||
{
|
||||
vec3 col = vec3(0);
|
||||
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz - v;
|
||||
|
||||
//get distance
|
||||
float dist = length(lv);
|
||||
float da = 1.0;
|
||||
|
||||
dist /= la;
|
||||
|
||||
if (dist > 0.0 && la > 0.0)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist_atten = clamp(1.0 - (dist - 1.0*(1.0 - fa)) / fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0f;
|
||||
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= dot(n, lv);
|
||||
|
||||
float lit = 0.0f;
|
||||
|
||||
float amb_da = ambiance;
|
||||
if (da >= 0)
|
||||
{
|
||||
lit = max(da * dist_atten, 0.0);
|
||||
col = lit * light_col * diffuse;
|
||||
amb_da += (da*0.5 + 0.5) * ambiance;
|
||||
}
|
||||
amb_da += (da*da*0.5 + 0.5) * ambiance;
|
||||
amb_da *= dist_atten;
|
||||
amb_da = min(amb_da, 1.0f - lit);
|
||||
|
||||
// SL-10969 need to see why these are blown out
|
||||
//col.rgb += amb_da * light_col * diffuse;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv + npos);
|
||||
float nh = dot(n, h);
|
||||
float nv = dot(n, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da);
|
||||
vec3 speccol = lit*scol*light_col.rgb*spec.rgb;
|
||||
speccol = clamp(speccol, vec3(0), vec3(1));
|
||||
col += speccol;
|
||||
|
||||
float cur_glare = max(speccol.r, speccol.g);
|
||||
cur_glare = max(cur_glare, speccol.b);
|
||||
glare = max(glare, speccol.r);
|
||||
glare += max(cur_glare, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max(col, vec3(0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_data[3];
|
||||
#else
|
||||
#define frag_data gl_FragData
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap; //always in sRGB space
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
uniform sampler2D bumpMap;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
uniform sampler2D specularMap;
|
||||
|
||||
VARYING vec2 vary_texcoord2;
|
||||
#endif
|
||||
|
||||
uniform float env_intensity;
|
||||
uniform vec4 specular_color; // specular color RGB and specular exponent (glossiness) in alpha
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
|
||||
uniform float minimum_alpha;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
#else
|
||||
VARYING vec3 vary_normal;
|
||||
#endif
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec2 encode_normal(vec3 n);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos_screen = vary_texcoord0.xy;
|
||||
|
||||
vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
diffcol.rgb *= vertex_color.rgb;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
|
||||
|
||||
// Comparing floats cast from 8-bit values, produces acne right at the 8-bit transition points
|
||||
float bias = 0.001953125; // 1/512, or half an 8-bit quantization
|
||||
if (diffcol.a < minimum_alpha-bias)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vec3 gamma_diff = diffcol.rgb;
|
||||
diffcol.rgb = srgb_to_linear(diffcol.rgb);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec4 spec = texture2D(specularMap, vary_texcoord2.xy);
|
||||
spec.rgb *= specular_color.rgb;
|
||||
#else
|
||||
vec4 spec = vec4(specular_color.rgb, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
vec4 norm = texture2D(bumpMap, vary_texcoord1.xy);
|
||||
|
||||
norm.xyz = norm.xyz * 2 - 1;
|
||||
|
||||
vec3 tnorm = vec3(dot(norm.xyz,vary_mat0),
|
||||
dot(norm.xyz,vary_mat1),
|
||||
dot(norm.xyz,vary_mat2));
|
||||
#else
|
||||
vec4 norm = vec4(0,0,0,1.0);
|
||||
vec3 tnorm = vary_normal;
|
||||
#endif
|
||||
|
||||
norm.xyz = normalize(tnorm.xyz);
|
||||
|
||||
vec2 abnormal = encode_normal(norm.xyz);
|
||||
|
||||
vec4 final_color = diffcol;
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE)
|
||||
final_color.a = emissive_brightness;
|
||||
#else
|
||||
final_color.a = max(final_color.a, emissive_brightness);
|
||||
#endif
|
||||
|
||||
vec4 final_specular = spec;
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity * spec.a, 0.0);
|
||||
final_specular.a = specular_color.a * norm.a;
|
||||
#else
|
||||
vec4 final_normal = vec4(encode_normal(normalize(tnorm)), env_intensity, 0.0);
|
||||
final_specular.a = specular_color.a;
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
//forward rendering, output just lit sRGBA
|
||||
vec3 pos = vary_position;
|
||||
|
||||
float shadow = 1.0f;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen);
|
||||
#endif
|
||||
|
||||
spec = final_specular;
|
||||
vec4 diffuse = final_color;
|
||||
float envIntensity = final_normal.z;
|
||||
|
||||
vec3 color = vec3(0,0,0);
|
||||
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
|
||||
float bloom = 0.0;
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, light_dir, 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
// This call breaks the Mac GLSL compiler/linker for unknown reasons (17Mar2020)
|
||||
// The call is either a no-op or a pure (pow) gamma adjustment, depending on GPU level
|
||||
// TODO: determine if we want to re-apply the gamma adjustment, and if so understand & fix Mac breakage
|
||||
//color = fullbrightScaleSoftClip(color);
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
//we're in sRGB space, so gamma correct this dot product so
|
||||
// lighting from the sun stays sharp
|
||||
float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0);
|
||||
da = pow(da, 1.0 / 1.3);
|
||||
|
||||
color = amblit;
|
||||
|
||||
//darken ambient for normals perpendicular to light vector so surfaces in shadow
|
||||
// and facing away from light still have some definition to them.
|
||||
// do NOT gamma correct this dot product so ambient lighting stays soft
|
||||
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(da, shadow) * sunlit;
|
||||
|
||||
color *= ambient;
|
||||
|
||||
color += sun_contrib;
|
||||
|
||||
color *= gamma_diff.rgb;
|
||||
|
||||
float glare = 0.0;
|
||||
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
/* // Reverting this specular calculation to previous 'dumbshiny' version - DJH 6/17/2020
|
||||
// Preserving the refactored version as a comment for potential reconsideration,
|
||||
// overriding the general rule to avoid pollutiong the source with commented code.
|
||||
//
|
||||
// If you're reading this in 2021+, feel free to obliterate.
|
||||
|
||||
vec3 npos = -normalize(pos.xyz);
|
||||
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(light_dir.xyz + npos);
|
||||
float nh = dot(norm.xyz, h);
|
||||
float nv = dot(norm.xyz, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4 + 0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da);
|
||||
vec3 sp = sun_contrib*scol / 6.0f;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom = dot(sp, sp) / 4.0;
|
||||
color += sp * spec.rgb;
|
||||
}
|
||||
*/
|
||||
|
||||
float sa = dot(refnormpersp, sun_dir.xyz);
|
||||
vec3 dumbshiny = sunlit * shadow * (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) / 6;
|
||||
|
||||
glare = max(spec_contrib.r, spec_contrib.g);
|
||||
glare = max(glare, spec_contrib.b);
|
||||
|
||||
color += spec_contrib;
|
||||
}
|
||||
|
||||
color = mix(color.rgb, diffcol.rgb, diffuse.a);
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
//add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
|
||||
color = mix(color, reflected_color, envIntensity);
|
||||
|
||||
float cur_glare = max(reflected_color.r, reflected_color.g);
|
||||
cur_glare = max(cur_glare, reflected_color.b);
|
||||
cur_glare *= envIntensity*4.0;
|
||||
glare += cur_glare;
|
||||
}
|
||||
|
||||
color = atmosFragLighting(color, additive, atten);
|
||||
color = scaleSoftClipFrag(color);
|
||||
|
||||
//convert to linear before adding local lights
|
||||
color = srgb_to_linear(color);
|
||||
|
||||
vec3 npos = normalize(-pos.xyz);
|
||||
|
||||
vec3 light = vec3(0, 0, 0);
|
||||
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
LIGHT_LOOP(3)
|
||||
LIGHT_LOOP(4)
|
||||
LIGHT_LOOP(5)
|
||||
LIGHT_LOOP(6)
|
||||
LIGHT_LOOP(7)
|
||||
|
||||
color += light;
|
||||
|
||||
glare = min(glare, 1.0);
|
||||
float al = max(diffcol.a, glare)*vertex_color.a;
|
||||
|
||||
//convert to srgb as this color is being written post gamma correction
|
||||
color = linear_to_srgb(color);
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 temp = applyWaterFogView(pos, vec4(color, al));
|
||||
color = temp.rgb;
|
||||
al = temp.a;
|
||||
#endif
|
||||
|
||||
frag_color = vec4(color, al);
|
||||
|
||||
#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
|
||||
|
||||
// deferred path
|
||||
frag_data[0] = final_color; //gbuffer is sRGB
|
||||
frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent.
|
||||
frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* @file moonF.glsl
|
||||
* @file class1\deferred\moonF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
* Copyright (C) 2005, 2020 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
|
||||
|
|
@ -36,34 +36,33 @@ out vec4 frag_data[3];
|
|||
uniform vec4 color;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform vec3 lumWeights;
|
||||
uniform vec3 moon_dir;
|
||||
uniform float moon_brightness;
|
||||
uniform float minLuminance;
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2D altDiffuseMap;
|
||||
uniform float blend_factor; // interp factor between moon A/B
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
/// Soft clips the light with a gamma correction
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
|
||||
vec4 c = mix(moonA, moonB, blend_factor);
|
||||
// Restore Pre-EEP alpha fade moon near horizon
|
||||
float fade = 1.0;
|
||||
if( moon_dir.z > 0 )
|
||||
fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 );
|
||||
|
||||
c.rgb = srgb_to_linear(c.rgb);
|
||||
vec4 c = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
// c.rgb = srgb_to_linear(c.rgb);
|
||||
c.rgb *= moonlight_color.rgb;
|
||||
c.rgb *= moon_brightness;
|
||||
|
||||
// mix factor which blends when sunlight is brighter
|
||||
// and shows true moon color at night
|
||||
vec3 luma_weights = vec3(0.3, 0.5, 0.3);
|
||||
c.rgb *= fade;
|
||||
c.a *= fade;
|
||||
|
||||
vec4 light_color = max(sunlight_color, moonlight_color);
|
||||
float mix = 1.0 - dot(normalize(light_color.rgb), luma_weights);
|
||||
|
||||
vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
|
||||
c.rgb = pow(c.rgb, exp);
|
||||
|
||||
//c.rgb *= moonlight_color.rgb;
|
||||
c.rgb = scaleSoftClip(c.rgb);
|
||||
|
||||
frag_data[0] = vec4(c.rgb, c.a);
|
||||
frag_data[1] = vec4(0.0);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* @file moonV.glsl
|
||||
* @file class1\deferred\moonV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
* Copyright (C) 2007, 2020 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
|
||||
|
|
@ -32,18 +32,13 @@ ATTRIBUTE vec2 texcoord0;
|
|||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void calcAtmospherics(vec3 eye_pos);
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec3 offset = vec3(0, 0, 50);
|
||||
vec4 vert = vec4(position.xyz - offset, 1.0);
|
||||
vec4 vert = vec4(position.xyz, 1.0);
|
||||
vec4 pos = (modelview_matrix * vert);
|
||||
|
||||
gl_Position = modelview_projection_matrix*vert;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
* @file multiPointLightF.glsl
|
||||
/**
|
||||
* @file class1/deferred/multiPointLightF.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$
|
||||
*/
|
||||
|
|
@ -36,119 +36,112 @@ out vec4 frag_color;
|
|||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
|
||||
uniform vec3 env_mat[3];
|
||||
uniform vec3 env_mat[3];
|
||||
uniform float sun_wash;
|
||||
uniform int light_count;
|
||||
uniform vec4 light[LIGHT_COUNT];
|
||||
uniform vec4 light_col[LIGHT_COUNT];
|
||||
|
||||
uniform int light_count;
|
||||
|
||||
uniform vec4 light[LIGHT_COUNT];
|
||||
uniform vec4 light_col[LIGHT_COUNT];
|
||||
uniform vec2 screen_res;
|
||||
uniform float far_z;
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float far_z;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen);
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
void main()
|
||||
void main()
|
||||
{
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
if (pos.z < far_z)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = getNorm(frag.xy);
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
diff.rgb = srgb_to_linear(diff.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 npos = normalize(-pos);
|
||||
|
||||
// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
|
||||
for (int i = 0; i < LIGHT_COUNT; ++i)
|
||||
{
|
||||
vec3 lv = light[i].xyz-pos;
|
||||
float dist = length(lv);
|
||||
dist /= light[i].w;
|
||||
if (dist <= 1.0)
|
||||
{
|
||||
float da = dot(norm, lv);
|
||||
if (da > 0.0)
|
||||
{
|
||||
lv = normalize(lv);
|
||||
da = dot(norm, lv);
|
||||
|
||||
float fa = light_col[i].a+1.0;
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
|
||||
// Tweak falloff slightly to match pre-EEP attenuation
|
||||
// NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit
|
||||
dist_atten *= 2.0;
|
||||
|
||||
dist_atten *= noise;
|
||||
|
||||
float lit = da * dist_atten;
|
||||
|
||||
vec3 col = light_col[i].rgb*lit*diff;
|
||||
|
||||
//vec3 col = vec3(dist2, light_col[i].a, lit);
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
lit = min(da*6.0, 1.0) * dist_atten;
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv+npos);
|
||||
float nh = dot(norm, h);
|
||||
float nv = dot(norm, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
col += lit*scol*light_col[i].rgb*spec.rgb;
|
||||
//col += spec.rgb;
|
||||
}
|
||||
}
|
||||
|
||||
out_col += col;
|
||||
}
|
||||
}
|
||||
}
|
||||
discard; // Bail immediately
|
||||
#endif
|
||||
|
||||
frag_color.rgb = out_col;
|
||||
frag_color.a = 0.0;
|
||||
|
||||
vec3 out_col = vec3(0, 0, 0);
|
||||
vec2 frag = (vary_fragcoord.xy * 0.5 + 0.5) * screen_res;
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
if (pos.z < far_z)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = getNorm(frag.xy);
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
diff.rgb = srgb_to_linear(diff.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy / 128.0).b;
|
||||
vec3 npos = normalize(-pos);
|
||||
|
||||
// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
|
||||
for (int i = 0; i < LIGHT_COUNT; ++i)
|
||||
{
|
||||
vec3 lv = light[i].xyz - pos;
|
||||
float dist = length(lv);
|
||||
dist /= light[i].w;
|
||||
if (dist <= 1.0)
|
||||
{
|
||||
float da = dot(norm, lv);
|
||||
if (da > 0.0)
|
||||
{
|
||||
lv = normalize(lv);
|
||||
da = dot(norm, lv);
|
||||
|
||||
float fa = light_col[i].a + 1.0;
|
||||
float dist_atten = clamp(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
|
||||
// Tweak falloff slightly to match pre-EEP attenuation
|
||||
// NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit
|
||||
dist_atten *= 2.0;
|
||||
|
||||
dist_atten *= noise;
|
||||
|
||||
float lit = da * dist_atten;
|
||||
|
||||
vec3 col = light_col[i].rgb * lit * diff;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
lit = min(da * 6.0, 1.0) * dist_atten;
|
||||
vec3 h = normalize(lv + npos);
|
||||
float nh = dot(norm, h);
|
||||
float nv = dot(norm, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5) * 0.4 + 0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt / (nh * da);
|
||||
col += lit * scol * light_col[i].rgb * spec.rgb;
|
||||
}
|
||||
}
|
||||
|
||||
out_col += col;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frag_color.rgb = out_col;
|
||||
frag_color.a = 0.0;
|
||||
|
||||
#ifdef IS_AMD_CARD
|
||||
// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
|
||||
vec4 dummy1 = light[0];
|
||||
vec4 dummy2 = light_col[0];
|
||||
vec4 dummy3 = light[LIGHT_COUNT-1];
|
||||
vec4 dummy4 = light_col[LIGHT_COUNT-1];
|
||||
// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage
|
||||
// awawy which leads to unfun crashes and artifacts.
|
||||
vec4 dummy1 = light[0];
|
||||
vec4 dummy2 = light_col[0];
|
||||
vec4 dummy3 = light[LIGHT_COUNT - 1];
|
||||
vec4 dummy4 = light_col[LIGHT_COUNT - 1];
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file WLSkyV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
@ -37,13 +37,13 @@ VARYING vec4 vary_HazeColor;
|
|||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ uniform float density_multiplier;
|
|||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
|
@ -63,103 +63,91 @@ uniform vec4 cloud_color;
|
|||
// indra\newview\lllegacyatmospherics.cpp
|
||||
void main()
|
||||
{
|
||||
|
||||
// World / view / projection
|
||||
// World / view / projection
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
gl_Position = pos;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
gl_Position = pos;
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
{
|
||||
P *= (max_y / P.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
P *= (-32000. / P.y);
|
||||
}
|
||||
// Get relative position
|
||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
||||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
// Adj position vector to clamp altitude
|
||||
if (rel_pos.y > 0)
|
||||
{
|
||||
rel_pos *= (max_y / rel_pos.y);
|
||||
}
|
||||
if (rel_pos.y < 0)
|
||||
{
|
||||
rel_pos *= (-32000. / rel_pos.y);
|
||||
}
|
||||
|
||||
float Plen = length(P);
|
||||
// Can normalize then
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
|
||||
// Initialize temp variables
|
||||
vec4 temp1 = vec4(0.);
|
||||
vec4 temp2 = vec4(0.);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
// Initialize temp variables
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
// Calculate relative weights
|
||||
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = haze_density / combined_haze;
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Compute sunlight from rel_pos & lightnorm (for long rays like sky)
|
||||
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
// Distance
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
combined_haze = exp(-combined_haze * density_dist);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
temp2.x = 1. - temp2.x;
|
||||
// temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
// Compute haze glow
|
||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
// Add "minimum anti-solar illumination"
|
||||
// For sun, add to glow. For moon, remove glow entirely. SL-13768
|
||||
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||
|
||||
vec4 color =
|
||||
(blue_horizon * blue_weight * (sunlight + ambient_color) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color));
|
||||
|
||||
// Final atmosphere additive
|
||||
color *= (1. - temp1);
|
||||
color *= (1. - combined_haze);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud =
|
||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
// Attenuate cloud color by atmosphere
|
||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(temp1));
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(combined_haze));
|
||||
|
||||
// Haze color above cloud
|
||||
vary_HazeColor = color;
|
||||
vary_HazeColor = color;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,41 +124,15 @@ void main()
|
|||
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
float sa = dot(refnormpersp, light_dir.xyz);
|
||||
vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r);
|
||||
|
||||
#if 1 //EEP
|
||||
vec3 npos = -normalize(pos.xyz);
|
||||
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(light_dir.xyz+npos);
|
||||
float nh = dot(norm.xyz, h);
|
||||
float nv = dot(norm.xyz, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
vec3 sp = sun_contrib*scontrib / 6.0;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom += dot(sp, sp) / 4.0;
|
||||
color += sp * spec.rgb;
|
||||
}
|
||||
#else //PRODUCTION
|
||||
float sa = dot(refnormpersp, light_dir.xyz);
|
||||
vec3 dumbshiny = sunlit*(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) / 6;
|
||||
bloom = dot(spec_contrib, spec_contrib) / 6;
|
||||
color.rgb += spec_contrib;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a);
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
// Lambert Azimuthal Equal-Area projection
|
||||
// See: https://aras-p.info/texts/CompactNormalStorage.html
|
||||
// Also see: A_bit_more_deferred_-_CryEngine3.ppt
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
float f = sqrt(8 * n.z + 8);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ out vec4 frag_color;
|
|||
|
||||
uniform float minimum_alpha;
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO;
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 atmosLighting(vec3 light);
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
|
||||
|
|
@ -41,16 +44,19 @@ void default_lighting()
|
|||
{
|
||||
vec4 color = diffuseLookup(vary_texcoord0.xy);
|
||||
|
||||
color *= vertex_color;
|
||||
|
||||
if (color.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
color *= vertex_color;
|
||||
|
||||
color.rgb = atmosLighting(color.rgb);
|
||||
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 0)
|
||||
{
|
||||
color.rgb = atmosLighting(color.rgb);
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
}
|
||||
|
||||
frag_color = color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ out vec4 frag_color;
|
|||
#endif
|
||||
|
||||
uniform float minimum_alpha;
|
||||
uniform float texture_gamma;
|
||||
uniform float texture_gamma; // either 1.0 or 2.2; see: "::TEXTURE_GAMMA"
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass()
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 fullbrightAtmosTransport(vec3 light);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
|
@ -50,9 +53,17 @@ void fullbright_lighting()
|
|||
color.rgb *= vertex_color.rgb;
|
||||
|
||||
color.rgb = pow(color.rgb, vec3(texture_gamma));
|
||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
||||
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 0)
|
||||
{
|
||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
}
|
||||
|
||||
//*TODO: Are we missing an inverse pow() here?
|
||||
// class1\lighting\lightFullbrightF.glsl has:
|
||||
// color.rgb = pow(color.rgb, vec3(1.0/texture_gamma));
|
||||
|
||||
frag_color = color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ VARYING vec2 vary_texcoord0;
|
|||
|
||||
uniform float texture_gamma;
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO;
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 fullbrightAtmosTransport(vec3 light);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
||||
|
|
@ -43,9 +46,12 @@ void fullbright_lighting()
|
|||
|
||||
color.rgb = pow(color.rgb, vec3(texture_gamma));
|
||||
|
||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
||||
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 0)
|
||||
{
|
||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
}
|
||||
|
||||
color.rgb = pow(color.rgb, vec3(1.0/texture_gamma));
|
||||
|
||||
|
|
|
|||
|
|
@ -35,20 +35,37 @@ VARYING vec3 vary_texcoord1;
|
|||
|
||||
uniform samplerCube environmentMap;
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass()
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 fullbrightShinyAtmosTransport(vec3 light);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
||||
// See:
|
||||
// class1\deferred\fullbrightShinyF.glsl
|
||||
// class1\lighting\lightFullbrightShinyF.glsl
|
||||
void fullbright_shiny_lighting()
|
||||
{
|
||||
vec4 color = diffuseLookup(vary_texcoord0.xy);
|
||||
color.rgb *= vertex_color.rgb;
|
||||
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low
|
||||
|
||||
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 0)
|
||||
{
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low
|
||||
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
}
|
||||
/*
|
||||
// NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects.
|
||||
else
|
||||
{
|
||||
vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
|
||||
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low
|
||||
}
|
||||
*/
|
||||
|
||||
color.a = 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,5 @@ void main()
|
|||
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
|
||||
col.rgb += light_diffuse[2].rgb*calcLocalLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
|
||||
col.rgb += light_diffuse[3].rgb*calcLocalLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
|
||||
|
||||
vertex_color = col*color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
* @file simpleV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
|
|
@ -28,6 +28,9 @@ uniform mat4 texture_matrix0;
|
|||
uniform mat4 modelview_matrix;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass()
|
||||
uniform int no_atmo;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
void passTextureIndex();
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
|
@ -46,19 +49,23 @@ void main()
|
|||
{
|
||||
//transform vertex
|
||||
vec4 vert = vec4(position.xyz,1.0);
|
||||
passTextureIndex();
|
||||
vec4 pos = (modelview_matrix * vert);
|
||||
gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
|
||||
|
||||
passTextureIndex();
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
|
||||
|
||||
|
||||
|
||||
vec3 norm = normalize(normal_matrix * normal);
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
// SL-9632 HUDs are affected by Atmosphere
|
||||
if (no_atmo == 1)
|
||||
{
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec4 pos = (modelview_matrix * vert);
|
||||
vec3 norm = normalize(normal_matrix * normal);
|
||||
|
||||
vec4 color = calcLighting(pos.xyz, norm, diffuse_color);
|
||||
vertex_color = color;
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
|
||||
vertex_color = calcLighting(pos.xyz, norm, diffuse_color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,154 +1,134 @@
|
|||
/**
|
||||
/**
|
||||
* @file class1\windlight\atmosphericsFuncs.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2019, 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 vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
uniform float cloud_shadow;
|
||||
uniform float density_multiplier;
|
||||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float scene_light_strength;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
uniform int no_atmo;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
uniform int no_atmo;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
float getAmbientClamp()
|
||||
float getAmbientClamp() { return 1.0f; }
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
|
||||
out vec3 atten, bool use_ao)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
vec3 rel_pos = inPositionEye;
|
||||
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) {
|
||||
|
||||
vec3 P = inPositionEye;
|
||||
|
||||
//(TERRAIN) limit altitude
|
||||
if (P.y > max_y) P *= (max_y / P.y);
|
||||
if (P.y < -max_y) P *= (-max_y / P.y);
|
||||
if (abs(rel_pos.y) > max_y) rel_pos *= (max_y / rel_pos.y);
|
||||
|
||||
vec3 tmpLightnorm = lightnorm.xyz;
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
float rel_pos_len = length(rel_pos);
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
|
||||
vec3 Pn = normalize(P);
|
||||
float Plen = length(P);
|
||||
// sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
vec4 light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
// I had thought blue_density and haze_density should have equal weighting,
|
||||
// but attenuation due to haze_density tends to seem too strong
|
||||
|
||||
vec4 temp1 = vec4(0);
|
||||
vec3 temp2 = vec3(0);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
vec4 combined_haze = blue_density + vec4(haze_density);
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = vec4(haze_density) / combined_haze;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = distance_multiplier;
|
||||
|
||||
//sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
//this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
//I had thought blue_density and haze_density should have equal weighting,
|
||||
//but attenuation due to haze_density tends to seem too strong
|
||||
|
||||
temp1 = blue_density + vec4(haze_density);
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = vec4(haze_density) / temp1;
|
||||
|
||||
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
|
||||
temp2.y = max(0.0, tmpLightnorm.y);
|
||||
if (abs(temp2.y) > 0.000001f)
|
||||
{
|
||||
temp2.y = 1. / abs(temp2.y);
|
||||
}
|
||||
temp2.y = max(0.0000001f, temp2.y);
|
||||
sunlight *= exp(-light_atten * temp2.y);
|
||||
//(TERRAIN) compute sunlight from lightnorm y component. Factor is roughly cosecant(sun elevation) (for short rays like terrain)
|
||||
float above_horizon_factor = 1.0 / max(1e-6, lightnorm.y);
|
||||
sunlight *= exp(-light_atten * above_horizon_factor); // for sun [horizon..overhead] this maps to an exp curve [0..1]
|
||||
|
||||
// main atmospheric scattering line integral
|
||||
temp2.z = Plen * dens_mul;
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z*dist_mul in a variable because the ati
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist*distance_multiplier in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
combined_haze = exp(-combined_haze * density_dist * distance_multiplier);
|
||||
|
||||
//final atmosphere attenuation factor
|
||||
atten = temp1.rgb;
|
||||
|
||||
//compute haze glow
|
||||
//(can use temp2.x as temp because we haven't used it yet)
|
||||
temp2.x = dot(Pn, tmpLightnorm.xyz);
|
||||
// final atmosphere attenuation factor
|
||||
atten = combined_haze.rgb;
|
||||
|
||||
// compute haze glow
|
||||
float haze_glow = dot(rel_pos_norm, lightnorm.xyz);
|
||||
|
||||
// dampen sun additive contrib when not facing it...
|
||||
if (length(light_dir) > 0.01)
|
||||
{
|
||||
temp2.x *= max(0.0f, dot(light_dir, Pn));
|
||||
}
|
||||
temp2.x = 1. - temp2.x;
|
||||
//temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001); //was glow.y
|
||||
//set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
//higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
//glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
// SL-13539: This "if" clause causes an "additive" white artifact at roughly 77 degreees.
|
||||
// if (length(light_dir) > 0.01)
|
||||
haze_glow *= max(0.0f, dot(light_dir, rel_pos_norm));
|
||||
|
||||
//add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
haze_glow = 1. - haze_glow;
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001); // set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
|
||||
vec4 amb_color = ambient_color;
|
||||
|
||||
//increase ambient when there are more clouds
|
||||
// add "minimum anti-solar illumination"
|
||||
haze_glow += .25;
|
||||
|
||||
haze_glow *= sun_moon_glow_factor;
|
||||
|
||||
vec4 amb_color = ambient_color;
|
||||
|
||||
// increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * cloud_shadow * 0.5;
|
||||
|
||||
|
||||
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
|
||||
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
|
||||
* // The following line of code performs the equivalent of:
|
||||
* float ambAlpha = tmpAmbient.a;
|
||||
* float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
|
||||
* vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
|
||||
* tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
|
||||
* tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat,
|
||||
* ambAlpha);
|
||||
*/
|
||||
if (use_ao)
|
||||
{
|
||||
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
|
||||
}
|
||||
|
||||
//haze color
|
||||
additive =
|
||||
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
|
||||
+ tmpAmbient));
|
||||
// Similar/Shared Algorithms:
|
||||
// indra\llinventory\llsettingssky.cpp -- LLSettingsSky::calculateLightSettings()
|
||||
// indra\newview\app_settings\shaders\class1\windlight\atmosphericsFuncs.glsl -- calcAtmosphericVars()
|
||||
// haze color
|
||||
vec3 cs = sunlight.rgb * (1. - cloud_shadow);
|
||||
additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
|
||||
|
||||
//brightness of surface both sunlight and ambient
|
||||
// brightness of surface both sunlight and ambient
|
||||
sunlit = sunlight.rgb * 0.5;
|
||||
amblit = tmpAmbient.rgb * .25;
|
||||
additive *= vec3(1.0 - temp1);
|
||||
additive *= vec3(1.0 - combined_haze);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
* Copyright (C) 2005, 2020 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
|
||||
|
|
@ -36,28 +36,30 @@ out vec4 frag_color;
|
|||
uniform vec4 color;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform vec3 lumWeights;
|
||||
uniform vec3 moon_dir;
|
||||
uniform float moon_brightness;
|
||||
uniform float minLuminance;
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2D altDiffuseMap;
|
||||
uniform float blend_factor; // interp factor between moon A/B
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
|
||||
vec4 c = mix(moonA, moonB, blend_factor);
|
||||
// Restore Pre-EEP alpha fade moon near horizon
|
||||
float fade = 1.0;
|
||||
if( moon_dir.z > 0 )
|
||||
fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 );
|
||||
|
||||
// mix factor which blends when sunlight is brighter
|
||||
// and shows true moon color at night
|
||||
vec3 luma_weights = vec3(0.3, 0.5, 0.3);
|
||||
float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
|
||||
vec4 c = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
// c.rgb = pow(c.rgb, vec3(0.7f)); // can't use "srgb_to_linear(color.rgb)" as that is a deferred only function
|
||||
c.rgb *= moonlight_color.rgb;
|
||||
c.rgb *= moon_brightness;
|
||||
|
||||
vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
|
||||
c.rgb = pow(c.rgb, exp);
|
||||
//c.rgb *= moonlight_color.rgb;
|
||||
c.rgb *= fade;
|
||||
c.a *= fade;
|
||||
|
||||
c.rgb = scaleSoftClip(c.rgb);
|
||||
|
||||
frag_color = vec4(c.rgb, c.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
* Copyright (C) 2007, 2020 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
|
||||
|
|
@ -30,20 +30,15 @@ uniform mat4 modelview_projection_matrix;
|
|||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec3 offset = vec3(0, 0, 50);
|
||||
vec4 vert = vec4(position.xyz - offset, 1.0);
|
||||
vec4 vert = vec4(position.xyz, 1.0);
|
||||
vec4 pos = (modelview_matrix * vert);
|
||||
|
||||
gl_Position = modelview_projection_matrix*vert;
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file class2/deferred/skyF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
@ -32,13 +32,13 @@ uniform mat4 modelview_projection_matrix;
|
|||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ uniform float density_multiplier;
|
|||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
|
@ -73,16 +73,16 @@ uniform float ice_level;
|
|||
|
||||
vec3 rainbow(float d)
|
||||
{
|
||||
d = clamp(d, -1.0, 0.0);
|
||||
float rad = (droplet_radius - 5.0f) / 1024.0f;
|
||||
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
|
||||
d = clamp(d, -1.0, 0.0);
|
||||
float rad = (droplet_radius - 5.0f) / 1024.0f;
|
||||
return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
|
||||
}
|
||||
|
||||
vec3 halo22(float d)
|
||||
{
|
||||
d = clamp(d, 0.1, 1.0);
|
||||
float v = sqrt(clamp(1 - (d * d), 0, 1));
|
||||
return texture2D(halo_map, vec2(0, v)).rgb * ice_level;
|
||||
d = clamp(d, 0.1, 1.0);
|
||||
float v = sqrt(clamp(1 - (d * d), 0, 1));
|
||||
return texture2D(halo_map, vec2(0, v)).rgb * ice_level;
|
||||
}
|
||||
|
||||
/// Soft clips the light with a gamma correction
|
||||
|
|
@ -90,115 +90,96 @@ vec3 scaleSoftClip(vec3 light);
|
|||
|
||||
void main()
|
||||
{
|
||||
|
||||
// World / view / projection
|
||||
// Get relative position
|
||||
vec3 P = pos.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
// Get relative position (offset why?)
|
||||
vec3 rel_pos = pos.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
// Adj position vector to clamp altitude
|
||||
if (rel_pos.y > 0.)
|
||||
{
|
||||
P *= (max_y / P.y);
|
||||
rel_pos *= (max_y / rel_pos.y);
|
||||
}
|
||||
else
|
||||
if (rel_pos.y < 0.)
|
||||
{
|
||||
P *= (-32000. / P.y);
|
||||
rel_pos *= (-32000. / rel_pos.y);
|
||||
}
|
||||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
float Plen = length(P);
|
||||
// Normalized
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
// Initialize temp variables
|
||||
vec4 temp1 = vec4(0.);
|
||||
vec4 temp2 = vec4(0.);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
vec4 light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = haze_density / combined_haze;
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Compute sunlight from rel_pos & lightnorm (for long rays like sky)
|
||||
float off_axis = 1.0 / max(1e-6, max(0, rel_pos_norm.y) + lightnorm.y);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
combined_haze = exp(-combined_haze * density_dist);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
temp2.x = 1. - temp2.x;
|
||||
// temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
float haze_glow = dot(rel_pos_norm, lightnorm.xyz);
|
||||
haze_glow = 1. - haze_glow;
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
// For sun, add to glow. For moon, remove glow entirely. SL-13768
|
||||
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (sun_moon_glow_factor * (haze_glow + 0.25));
|
||||
|
||||
// Haze color above cloud
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
vec4 color = blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ haze_horizon * haze_weight * (sunlight * haze_glow + ambient_color);
|
||||
|
||||
// Final atmosphere additive
|
||||
color *= (1. - temp1);
|
||||
color *= (1. - combined_haze);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
// TODO 9/20: DJH what does this do? max(0,(1-ambient)) will change the color
|
||||
vec4 ambient = ambient_color + max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
vec4 add_below_cloud = blue_horizon * blue_weight * (sunlight + ambient)
|
||||
+ haze_horizon * haze_weight * (sunlight * haze_glow + ambient);
|
||||
|
||||
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(temp1));
|
||||
|
||||
float optic_d = dot(Pn, lightnorm.xyz);
|
||||
|
||||
vec3 halo_22 = halo22(optic_d);
|
||||
color += (add_below_cloud - color) * (1. - sqrt(combined_haze));
|
||||
|
||||
float optic_d = dot(rel_pos_norm, lightnorm.xyz);
|
||||
vec3 halo_22 = halo22(optic_d);
|
||||
color.rgb += rainbow(optic_d);
|
||||
|
||||
color.rgb += halo_22;
|
||||
|
||||
color.rgb *= 2.;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(color.rgb, 1.0);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0.0,0.0,0.0,1.0); //1.0 in norm.w masks off fog
|
||||
frag_data[1] = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
frag_data[2] = vec4(0.0, 0.0, 0.0, 1.0); // 1.0 in norm.w masks off fog
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file class2/deferred/softenLightF.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$
|
||||
*/
|
||||
|
|
@ -39,7 +39,7 @@ uniform sampler2DRect specularRect;
|
|||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
uniform float blur_size;
|
||||
|
|
@ -50,7 +50,7 @@ uniform mat3 env_mat;
|
|||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
uniform int sun_up_factor;
|
||||
uniform int sun_up_factor;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
|
@ -61,10 +61,10 @@ vec4 getPositionWithDepth(vec2 pos_screen, float depth);
|
|||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
float getAmbientClamp();
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
|
||||
vec3 fullbrightScaleSoftClip(vec3 light);
|
||||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
|
@ -73,128 +73,85 @@ vec3 srgb_to_linear(vec3 c);
|
|||
vec4 applyWaterFogView(vec3 pos, vec4 color);
|
||||
#endif
|
||||
|
||||
void main()
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
float depth = texture2DRect(depthMap, tc.xy).r;
|
||||
vec4 pos = getPositionWithDepth(tc, depth);
|
||||
vec4 norm = texture2DRect(normalMap, tc);
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
float depth = texture2DRect(depthMap, tc.xy).r;
|
||||
vec4 pos = getPositionWithDepth(tc, depth);
|
||||
vec4 norm = texture2DRect(normalMap, tc);
|
||||
float envIntensity = norm.z;
|
||||
norm.xyz = getNorm(tc);
|
||||
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
|
||||
float light_gamma = 1.0/1.3;
|
||||
da = pow(da, light_gamma);
|
||||
|
||||
norm.xyz = getNorm(tc);
|
||||
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
|
||||
float light_gamma = 1.0 / 1.3;
|
||||
da = pow(da, light_gamma);
|
||||
|
||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
|
||||
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
||||
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
float ambocc = scol_ambocc.g;
|
||||
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
|
||||
float ambocc = scol_ambocc.g;
|
||||
|
||||
vec3 color = vec3(0);
|
||||
vec3 color = vec3(0);
|
||||
float bloom = 0.0;
|
||||
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true);
|
||||
|
||||
color.rgb = amblit;
|
||||
|
||||
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = (1.0 - ambient);
|
||||
color.rgb *= ambient;
|
||||
|
||||
vec3 sun_contrib = min(da, scol) * sunlit;
|
||||
color.rgb += sun_contrib;
|
||||
color.rgb *= diffuse.rgb;
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true);
|
||||
|
||||
color.rgb = amblit;
|
||||
|
||||
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
color.rgb *= ambient;
|
||||
|
||||
vec3 sun_contrib = min(da, scol) * sunlit;
|
||||
|
||||
color.rgb += sun_contrib;
|
||||
|
||||
color.rgb *= diffuse.rgb;
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
|
||||
#if 1 //EEP
|
||||
vec3 npos = -normalize(pos.xyz);
|
||||
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(light_dir.xyz+npos);
|
||||
float nh = dot(norm.xyz, h);
|
||||
float nv = dot(norm.xyz, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
vec3 sp = sun_contrib*scontrib / 6.0;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom += dot(sp, sp) / 4.0;
|
||||
color += sp * spec.rgb;
|
||||
}
|
||||
#else //PRODUCTION
|
||||
float sa = dot(refnormpersp, light_dir.xyz);
|
||||
vec3 dumbshiny = sunlit*(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) / 6;
|
||||
color.rgb += spec_contrib;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a);
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{ //add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
color = mix(color.rgb, reflected_color, envIntensity);
|
||||
}
|
||||
|
||||
if (norm.w < 0.5)
|
||||
{
|
||||
color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a);
|
||||
color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a);
|
||||
}
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 fogged = applyWaterFogView(pos.xyz,vec4(color, bloom));
|
||||
color = fogged.rgb;
|
||||
bloom = fogged.a;
|
||||
#endif
|
||||
float sa = dot(refnormpersp, light_dir.xyz);
|
||||
vec3 dumbshiny = sunlit * scol * (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) / 6;
|
||||
color.rgb += spec_contrib;
|
||||
}
|
||||
|
||||
// linear debuggables
|
||||
//color.rgb = vec3(final_da);
|
||||
//color.rgb = vec3(ambient);
|
||||
//color.rgb = vec3(scol);
|
||||
//color.rgb = diffuse_srgb.rgb;
|
||||
color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a);
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{ // add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
color = mix(color.rgb, reflected_color, envIntensity);
|
||||
}
|
||||
|
||||
if (norm.w < 0.5)
|
||||
{
|
||||
color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a);
|
||||
color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a);
|
||||
}
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 fogged = applyWaterFogView(pos.xyz, vec4(color, bloom));
|
||||
color = fogged.rgb;
|
||||
bloom = fogged.a;
|
||||
#endif
|
||||
|
||||
// convert to linear as fullscreen lights need to sum in linear colorspace
|
||||
// and will be gamma (re)corrected downstream...
|
||||
|
||||
frag_color.rgb = srgb_to_linear(color.rgb);
|
||||
frag_color.a = bloom;
|
||||
frag_color.a = bloom;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file class2\wl\cloudsV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
@ -33,25 +33,26 @@ ATTRIBUTE vec2 texcoord0;
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Output parameters
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING float vary_CloudDensity;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
VARYING float altitude_blend_factor;
|
||||
|
||||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
|
||||
|
|
@ -59,141 +60,133 @@ uniform float cloud_shadow;
|
|||
uniform float density_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
||||
uniform float cloud_scale;
|
||||
|
||||
// NOTE: Keep these in sync!
|
||||
// indra\newview\app_settings\shaders\class1\deferred\skyV.glsl
|
||||
// indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl
|
||||
// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl
|
||||
// indra\newview\lllegacyatmospherics.cpp
|
||||
// indra\newview\llsettingsvo.cpp
|
||||
void main()
|
||||
{
|
||||
// World / view / projection
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
// World / view / projection
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
// Texture coords
|
||||
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
|
||||
vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial
|
||||
|
||||
vary_texcoord0 = texcoord0;
|
||||
vary_texcoord0.xy -= 0.5;
|
||||
vary_texcoord0.xy /= cloud_scale;
|
||||
vary_texcoord0.xy += 0.5;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
vary_texcoord1 = vary_texcoord0;
|
||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||
|
||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||
|
||||
// Get relative position
|
||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
||||
|
||||
// fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude
|
||||
altitude_blend_factor = clamp((P.y + 512.0) / max_y, 0.0, 1.0);
|
||||
altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0);
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
{
|
||||
P *= (max_y / P.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
P *= (-32000. / P.y);
|
||||
}
|
||||
// Adj position vector to clamp altitude
|
||||
if (rel_pos.y > 0.)
|
||||
{
|
||||
rel_pos *= (max_y / rel_pos.y);
|
||||
}
|
||||
if (rel_pos.y < 0.)
|
||||
{
|
||||
rel_pos *= (-32000. / rel_pos.y);
|
||||
}
|
||||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
float Plen = length(P);
|
||||
// Can normalize then
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
// Initialize temp variables
|
||||
vec4 temp1 = vec4(0.);
|
||||
vec4 temp2 = vec4(0.);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
//vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 sunlight = sunlight_color;
|
||||
vec4 light_atten;
|
||||
// Initialize temp variables
|
||||
vec4 sunlight = sunlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
// Calculate relative weights
|
||||
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = haze_density / combined_haze;
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
// Compute sunlight from rel_pos & lightnorm (for long rays like sky)
|
||||
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Distance
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
||||
// compiler gets confused.
|
||||
combined_haze = exp(-combined_haze * density_dist);
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
// Compute haze glow
|
||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
haze_glow *= sun_moon_glow_factor;
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
temp2.x = 1. - temp2.x;
|
||||
// temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
// Add "minimum anti-solar illumination"
|
||||
// For sun, add to glow. For moon, remove glow entirely. SL-13768
|
||||
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud =
|
||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
// CLOUDS
|
||||
off_axis = 1.0 / max(1e-6, lightnorm.y * 2.);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
// Cloud color out
|
||||
vary_CloudColorSun = (sunlight * haze_glow) * cloud_color;
|
||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||
|
||||
// CLOUDS
|
||||
temp2.y = max(0., lightnorm.y * 2.);
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Attenuate cloud color by atmosphere
|
||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||
vary_CloudColorSun *= combined_haze;
|
||||
vary_CloudColorAmbient *= combined_haze;
|
||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze);
|
||||
|
||||
// Cloud color out
|
||||
vary_CloudColorSun = (sunlight * temp2.x) * cloud_color;
|
||||
vary_CloudColorAmbient = tmpAmbient * cloud_color;
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
vary_CloudColorSun *= temp1;
|
||||
vary_CloudColorAmbient *= temp1;
|
||||
vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1);
|
||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||
|
||||
// Make a nice cloud density based on the cloud_shadow value that was passed in.
|
||||
vary_CloudDensity = 2. * (cloud_shadow - 0.25);
|
||||
// Combine these to minimize register use
|
||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||
|
||||
// needs this to compile on mac
|
||||
// vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
|
||||
// Texture coords
|
||||
vary_texcoord0 = texcoord0;
|
||||
vary_texcoord0.xy -= 0.5;
|
||||
vary_texcoord0.xy /= cloud_scale;
|
||||
vary_texcoord0.xy += 0.5;
|
||||
|
||||
vary_texcoord1 = vary_texcoord0;
|
||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||
|
||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||
|
||||
// Combine these to minimize register use
|
||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||
|
||||
// needs this to compile on mac
|
||||
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
|
||||
// END CLOUDS
|
||||
// END CLOUDS
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
/**
|
||||
/**
|
||||
* @file class2\wl\skyV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2005, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
|
@ -37,13 +37,13 @@ VARYING vec4 vary_HazeColor;
|
|||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
|
||||
|
|
@ -52,110 +52,98 @@ uniform float density_multiplier;
|
|||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
// World / view / projection
|
||||
// World / view / projection
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
gl_Position = pos;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
gl_Position = pos;
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
{
|
||||
P *= (max_y / P.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
P *= (-32000. / P.y);
|
||||
}
|
||||
// Get relative position
|
||||
vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0);
|
||||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
// Adj position vector to clamp altitude
|
||||
if (rel_pos.y > 0.)
|
||||
{
|
||||
rel_pos *= (max_y / rel_pos.y);
|
||||
}
|
||||
if (rel_pos.y < 0.)
|
||||
{
|
||||
rel_pos *= (-32000. / rel_pos.y);
|
||||
}
|
||||
|
||||
float Plen = length(P);
|
||||
// Can normalize then
|
||||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
|
||||
// Initialize temp variables
|
||||
vec4 temp1 = vec4(0.);
|
||||
vec4 temp2 = vec4(0.);
|
||||
vec4 blue_weight;
|
||||
vec4 haze_weight;
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
// Initialize temp variables
|
||||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
// Calculate relative weights
|
||||
vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density));
|
||||
vec4 blue_weight = blue_density / combined_haze;
|
||||
vec4 haze_weight = haze_density / combined_haze;
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
// Compute sunlight from rel_pos & lightnorm (for long rays like sky)
|
||||
float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y);
|
||||
sunlight *= exp(-light_atten * off_axis);
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
// Distance
|
||||
float density_dist = rel_pos_len * density_multiplier;
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// Transparency (-> combined_haze)
|
||||
// ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
combined_haze = exp(-combined_haze * density_dist);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
temp2.x = 1. - temp2.x;
|
||||
// temp2.x is 0 at the sun and increases away from sun
|
||||
temp2.x = max(temp2.x, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
temp2.x *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
temp2.x = pow(temp2.x, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
// Compute haze glow
|
||||
float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz);
|
||||
// haze_glow is 0 at the sun and increases away from sun
|
||||
haze_glow = max(haze_glow, .001);
|
||||
// Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// Higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = pow(haze_glow, glow.z);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
// Add "minimum anti-solar illumination"
|
||||
// For sun, add to glow. For moon, remove glow entirely. SL-13768
|
||||
haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25);
|
||||
|
||||
vec4 color =
|
||||
(blue_horizon * blue_weight * (sunlight + ambient_color) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color));
|
||||
|
||||
// Final atmosphere additive
|
||||
color *= (1. - temp1);
|
||||
color *= (1. - combined_haze);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud =
|
||||
(blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient));
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
// Attenuate cloud color by atmosphere
|
||||
combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds
|
||||
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(temp1));
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(combined_haze));
|
||||
|
||||
// Haze color above cloud
|
||||
vary_HazeColor = color;
|
||||
vary_HazeColor = color;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,6 @@
|
|||
#include "llhandle.h"
|
||||
|
||||
#include "llaccountingcost.h"
|
||||
#include "httpcommon.h"
|
||||
#include "llcoros.h"
|
||||
#include "lleventcoro.h"
|
||||
#include "httprequest.h"
|
||||
#include "httpheaders.h"
|
||||
#include "httpoptions.h"
|
||||
|
||||
//===============================================================================
|
||||
// An interface class for panels which display the parcel accounting information.
|
||||
|
|
|
|||
|
|
@ -143,6 +143,10 @@ public:
|
|||
EStatus getStatus() const {return mStatus;};
|
||||
void setStatus(EStatus pStatus) {mStatus = pStatus;};
|
||||
|
||||
static std::map<S32, std::string> sTeleportStatusName;
|
||||
static const std::string& statusName(EStatus status);
|
||||
virtual void toOstream(std::ostream& os) const;
|
||||
|
||||
virtual bool canRestartTeleport();
|
||||
|
||||
virtual void startTeleport() = 0;
|
||||
|
|
@ -154,12 +158,19 @@ private:
|
|||
EStatus mStatus;
|
||||
};
|
||||
|
||||
std::map<S32, std::string> LLTeleportRequest::sTeleportStatusName = { { kPending, "kPending" },
|
||||
{ kStarted, "kStarted" },
|
||||
{ kFailed, "kFailed" },
|
||||
{ kRestartPending, "kRestartPending"} };
|
||||
|
||||
class LLTeleportRequestViaLandmark : public LLTeleportRequest
|
||||
{
|
||||
public:
|
||||
LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId);
|
||||
virtual ~LLTeleportRequestViaLandmark();
|
||||
|
||||
virtual void toOstream(std::ostream& os) const;
|
||||
|
||||
virtual bool canRestartTeleport();
|
||||
|
||||
virtual void startTeleport();
|
||||
|
|
@ -178,6 +189,8 @@ public:
|
|||
LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike);
|
||||
virtual ~LLTeleportRequestViaLure();
|
||||
|
||||
virtual void toOstream(std::ostream& os) const;
|
||||
|
||||
virtual bool canRestartTeleport();
|
||||
|
||||
virtual void startTeleport();
|
||||
|
|
@ -195,6 +208,8 @@ public:
|
|||
LLTeleportRequestViaLocation(const LLVector3d &pPosGlobal);
|
||||
virtual ~LLTeleportRequestViaLocation();
|
||||
|
||||
virtual void toOstream(std::ostream& os) const;
|
||||
|
||||
virtual bool canRestartTeleport();
|
||||
|
||||
virtual void startTeleport();
|
||||
|
|
@ -217,6 +232,8 @@ public:
|
|||
// LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal);
|
||||
virtual ~LLTeleportRequestViaLocationLookAt();
|
||||
|
||||
virtual void toOstream(std::ostream& os) const;
|
||||
|
||||
virtual bool canRestartTeleport();
|
||||
|
||||
virtual void startTeleport();
|
||||
|
|
@ -510,6 +527,8 @@ void LLAgent::init()
|
|||
void LLAgent::cleanup()
|
||||
{
|
||||
mRegionp = NULL;
|
||||
mTeleportRequest = NULL;
|
||||
mTeleportCanceled = NULL;
|
||||
if (mTeleportFinishedSlot.connected())
|
||||
{
|
||||
mTeleportFinishedSlot.disconnect();
|
||||
|
|
@ -912,7 +931,12 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
|
|||
if (mRegionp != regionp)
|
||||
{
|
||||
|
||||
LL_INFOS("AgentLocation") << "Moving agent into region: " << regionp->getName() << LL_ENDL;
|
||||
LL_INFOS("AgentLocation","Teleport") << "Moving agent into region: handle " << regionp->getHandle()
|
||||
<< " id " << regionp->getRegionID()
|
||||
<< " name " << regionp->getName()
|
||||
<< " previous region "
|
||||
<< (mRegionp ? mRegionp->getRegionID() : LLUUID::null)
|
||||
<< LL_ENDL;
|
||||
if (mRegionp)
|
||||
{
|
||||
// We've changed regions, we're now going to change our agent coordinate frame.
|
||||
|
|
@ -2699,6 +2723,7 @@ void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity)
|
|||
else
|
||||
{
|
||||
mMaturityPreferenceNumRetries = 0;
|
||||
LL_WARNS() << "Too many retries for maturity preference" << LL_ENDL;
|
||||
reportPreferredMaturityError();
|
||||
}
|
||||
}
|
||||
|
|
@ -2750,6 +2775,7 @@ void LLAgent::reportPreferredMaturityError()
|
|||
mIsMaturityRatingChangingDuringTeleport = false;
|
||||
if (hasPendingTeleportRequest())
|
||||
{
|
||||
LL_WARNS("Teleport") << "Teleport failing due to preferred maturity error" << LL_ENDL;
|
||||
setTeleportState(LLAgent::TELEPORT_NONE);
|
||||
}
|
||||
|
||||
|
|
@ -3877,7 +3903,7 @@ void LLAgent::clearVisualParams(void *data)
|
|||
// protected
|
||||
bool LLAgent::teleportCore(bool is_local)
|
||||
{
|
||||
LL_INFOS("Teleport") << "In teleport core!" << LL_ENDL;
|
||||
LL_DEBUGS("Teleport") << "In teleport core" << LL_ENDL;
|
||||
if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING))
|
||||
{
|
||||
LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL;
|
||||
|
|
@ -3943,11 +3969,13 @@ bool LLAgent::teleportCore(bool is_local)
|
|||
add(LLStatViewer::TELEPORT, 1);
|
||||
if (is_local)
|
||||
{
|
||||
LL_INFOS("Teleport") << "Setting teleport state to TELEPORT_LOCAL" << LL_ENDL;
|
||||
gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL );
|
||||
}
|
||||
else
|
||||
{
|
||||
gTeleportDisplay = TRUE;
|
||||
LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL;
|
||||
gAgent.setTeleportState( LLAgent::TELEPORT_START );
|
||||
|
||||
//release geometry from old location
|
||||
|
|
@ -4014,6 +4042,7 @@ void LLAgent::startTeleportRequest()
|
|||
if (!isMaturityPreferenceSyncedWithServer())
|
||||
{
|
||||
gTeleportDisplay = TRUE;
|
||||
LL_INFOS("Teleport") << "Maturity preference not synced yet, setting teleport state to TELEPORT_PENDING" << LL_ENDL;
|
||||
setTeleportState(TELEPORT_PENDING);
|
||||
}
|
||||
else
|
||||
|
|
@ -4057,10 +4086,19 @@ void LLAgent::handleTeleportFinished()
|
|||
{
|
||||
if (mRegionp->capabilitiesReceived())
|
||||
{
|
||||
LL_DEBUGS("Teleport") << "capabilities have been received for region handle "
|
||||
<< mRegionp->getHandle()
|
||||
<< " id " << mRegionp->getRegionID()
|
||||
<< ", calling onCapabilitiesReceivedAfterTeleport()"
|
||||
<< LL_ENDL;
|
||||
onCapabilitiesReceivedAfterTeleport();
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("Teleport") << "Capabilities not yet received for region handle "
|
||||
<< mRegionp->getHandle()
|
||||
<< " id " << mRegionp->getRegionID()
|
||||
<< LL_ENDL;
|
||||
mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::onCapabilitiesReceivedAfterTeleport));
|
||||
}
|
||||
}
|
||||
|
|
@ -4098,6 +4136,18 @@ void LLAgent::handleTeleportFailed()
|
|||
/*static*/
|
||||
void LLAgent::onCapabilitiesReceivedAfterTeleport()
|
||||
{
|
||||
if (gAgent.getRegion())
|
||||
{
|
||||
LL_DEBUGS("Teleport") << "running after capabilities received callback has been triggered, agent region "
|
||||
<< gAgent.getRegion()->getHandle()
|
||||
<< " id " << gAgent.getRegion()->getRegionID()
|
||||
<< " name " << gAgent.getRegion()->getName()
|
||||
<< LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Teleport") << "called when agent region is null!" << LL_ENDL;
|
||||
}
|
||||
|
||||
check_merchant_status();
|
||||
}
|
||||
|
|
@ -4114,8 +4164,8 @@ void LLAgent::teleportRequest(const U64& region_handle, const LLVector3& pos_loc
|
|||
LLViewerRegion* regionp = getRegion();
|
||||
if (regionp && teleportCore(region_handle == regionp->getHandle()))
|
||||
{
|
||||
LL_INFOS("") << "TeleportLocationRequest: '" << region_handle << "':"
|
||||
<< pos_local << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "Sending TeleportLocationRequest: '" << region_handle << "':"
|
||||
<< pos_local << LL_ENDL;
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessage("TeleportLocationRequest");
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
|
|
@ -4158,6 +4208,11 @@ void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id)
|
|||
LLViewerRegion *regionp = getRegion();
|
||||
if(regionp && teleportCore())
|
||||
{
|
||||
LL_INFOS("Teleport") << "Sending TeleportLandmarkRequest. Current region handle " << regionp->getHandle()
|
||||
<< " region id " << regionp->getRegionID()
|
||||
<< " requested landmark id " << landmark_asset_id
|
||||
<< LL_ENDL;
|
||||
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_TeleportLandmarkRequest);
|
||||
msg->nextBlockFast(_PREHASH_Info);
|
||||
|
|
@ -4190,6 +4245,11 @@ void LLAgent::doTeleportViaLure(const LLUUID& lure_id, BOOL godlike)
|
|||
teleport_flags |= TELEPORT_FLAGS_VIA_LURE;
|
||||
}
|
||||
|
||||
LL_INFOS("Teleport") << "Sending TeleportLureRequest."
|
||||
<< " Current region handle " << regionp->getHandle()
|
||||
<< " region id " << regionp->getRegionID()
|
||||
<< " lure id " << lure_id
|
||||
<< LL_ENDL;
|
||||
// send the message
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_TeleportLureRequest);
|
||||
|
|
@ -4212,6 +4272,8 @@ void LLAgent::teleportCancel()
|
|||
LLViewerRegion* regionp = getRegion();
|
||||
if(regionp)
|
||||
{
|
||||
LL_INFOS("Teleport") << "Sending TeleportCancel" << LL_ENDL;
|
||||
|
||||
// send the message
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessage("TeleportCancel");
|
||||
|
|
@ -4224,13 +4286,14 @@ void LLAgent::teleportCancel()
|
|||
}
|
||||
clearTeleportRequest();
|
||||
gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
|
||||
gPipeline.resetVertexBuffers();
|
||||
gPipeline.resetVertexBuffers();
|
||||
}
|
||||
|
||||
void LLAgent::restoreCanceledTeleportRequest()
|
||||
{
|
||||
if (mTeleportCanceled != NULL)
|
||||
{
|
||||
LL_INFOS() << "Restoring canceled teleport request, setting state to TELEPORT_REQUESTED" << LL_ENDL;
|
||||
gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
|
||||
mTeleportRequest = mTeleportCanceled;
|
||||
mTeleportCanceled.reset();
|
||||
|
|
@ -4284,7 +4347,6 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
|
|||
else if(regionp &&
|
||||
teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
|
||||
{
|
||||
LL_WARNS() << "Using deprecated teleportlocationrequest." << LL_ENDL;
|
||||
// send the message
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_TeleportLocationRequest);
|
||||
|
|
@ -4304,6 +4366,14 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
|
|||
msg->addVector3Fast(_PREHASH_Position, pos);
|
||||
pos.mV[VX] += 1;
|
||||
msg->addVector3Fast(_PREHASH_LookAt, pos);
|
||||
|
||||
LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest."
|
||||
<< " pos_global " << pos_global
|
||||
<< " region_x " << region_x
|
||||
<< " region_y " << region_y
|
||||
<< " region_handle " << region_handle
|
||||
<< LL_ENDL;
|
||||
|
||||
sendReliableMessage();
|
||||
}
|
||||
}
|
||||
|
|
@ -4382,7 +4452,11 @@ void LLAgent::setTeleportState(ETeleportState state)
|
|||
" for previously failed teleport. Ignore!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LL_DEBUGS("Teleport") << "Setting teleport state to " << state << " Previous state: " << mTeleportState << LL_ENDL;
|
||||
LL_DEBUGS("Teleport") << "Setting teleport state to "
|
||||
<< LLAgent::teleportStateName(state) << "(" << state << ")"
|
||||
<< " Previous state: "
|
||||
<< teleportStateName(mTeleportState) << "(" << mTeleportState << ")"
|
||||
<< LL_ENDL;
|
||||
mTeleportState = state;
|
||||
if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime"))
|
||||
{
|
||||
|
|
@ -4719,6 +4793,34 @@ void LLAgent::observeFriends()
|
|||
}
|
||||
}
|
||||
|
||||
std::map<S32, std::string> LLAgent::sTeleportStateName = { { TELEPORT_NONE, "TELEPORT_NONE" },
|
||||
{ TELEPORT_START, "TELEPORT_START" },
|
||||
{ TELEPORT_REQUESTED, "TELEPORT_REQUESTED" },
|
||||
{ TELEPORT_MOVING, "TELEPORT_MOVING" },
|
||||
{ TELEPORT_START_ARRIVAL, "TELEPORT_START_ARRIVAL" },
|
||||
{ TELEPORT_ARRIVING, "TELEPORT_ARRIVING" },
|
||||
{ TELEPORT_LOCAL, "TELEPORT_LOCAL" },
|
||||
{ TELEPORT_PENDING, "TELEPORT_PENDING" } };
|
||||
|
||||
const std::string& LLAgent::teleportStateName(S32 state)
|
||||
{
|
||||
static std::string invalid_state_str("INVALID");
|
||||
auto iter = LLAgent::sTeleportStateName.find(state);
|
||||
if (iter != LLAgent::sTeleportStateName.end())
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return invalid_state_str;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& LLAgent::getTeleportStateName() const
|
||||
{
|
||||
return teleportStateName(getTeleportState());
|
||||
}
|
||||
|
||||
void LLAgent::parseTeleportMessages(const std::string& xml_filename)
|
||||
{
|
||||
LLXMLNodePtr root;
|
||||
|
|
@ -4842,40 +4944,70 @@ void LLTeleportRequest::restartTeleport()
|
|||
llassert(0);
|
||||
}
|
||||
|
||||
// TODO this enum -> name idiom should be in a common class rather than repeated various places.
|
||||
const std::string& LLTeleportRequest::statusName(EStatus status)
|
||||
{
|
||||
static std::string invalid_status_str("INVALID");
|
||||
auto iter = LLTeleportRequest::sTeleportStatusName.find(status);
|
||||
if (iter != LLTeleportRequest::sTeleportStatusName.end())
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return invalid_status_str;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const LLTeleportRequest& req)
|
||||
{
|
||||
req.toOstream(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
void LLTeleportRequest::toOstream(std::ostream& os) const
|
||||
{
|
||||
os << "status " << statusName(mStatus) << "(" << mStatus << ")";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTeleportRequestViaLandmark
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLTeleportRequestViaLandmark::LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId)
|
||||
: LLTeleportRequest(),
|
||||
mLandmarkId(pLandmarkId)
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark created." << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark created, " << *this << LL_ENDL;
|
||||
}
|
||||
|
||||
LLTeleportRequestViaLandmark::~LLTeleportRequestViaLandmark()
|
||||
{
|
||||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLandmark" << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLandmark, " << *this << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLandmark::toOstream(std::ostream& os) const
|
||||
{
|
||||
os << "landmark " << mLandmarkId << " ";
|
||||
LLTeleportRequest::toOstream(os);
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLandmark::canRestartTeleport()
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::canRestartTeleport? -> true" << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::canRestartTeleport? -> true, " << *this << LL_ENDL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLandmark::startTeleport()
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::startTeleport" << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::startTeleport, " << *this << LL_ENDL;
|
||||
gAgent.doTeleportViaLandmark(getLandmarkId());
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLandmark::restartTeleport()
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::restartTeleport" << LL_ENDL;
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLandmark::restartTeleport, " << *this << LL_ENDL;
|
||||
gAgent.doTeleportViaLandmark(getLandmarkId());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTeleportRequestViaLure
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -4892,6 +5024,12 @@ LLTeleportRequestViaLure::~LLTeleportRequestViaLure()
|
|||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLure" << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLure::toOstream(std::ostream& os) const
|
||||
{
|
||||
os << "mIsLureGodLike " << (S32) mIsLureGodLike << " ";
|
||||
LLTeleportRequestViaLandmark::toOstream(os);
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLure::canRestartTeleport()
|
||||
{
|
||||
// stinson 05/17/2012 : cannot restart a teleport via lure because of server-side restrictions
|
||||
|
|
@ -4932,6 +5070,12 @@ LLTeleportRequestViaLocation::~LLTeleportRequestViaLocation()
|
|||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLocation" << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLocation::toOstream(std::ostream& os) const
|
||||
{
|
||||
os << "mPosGlobal " << mPosGlobal << " ";
|
||||
LLTeleportRequest::toOstream(os);
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLocation::canRestartTeleport()
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLocation::canRestartTeleport -> true" << LL_ENDL;
|
||||
|
|
@ -4972,6 +5116,11 @@ LLTeleportRequestViaLocationLookAt::~LLTeleportRequestViaLocationLookAt()
|
|||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLocationLookAt" << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLTeleportRequestViaLocationLookAt::toOstream(std::ostream& os) const
|
||||
{
|
||||
LLTeleportRequestViaLocation::toOstream(os);
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLocationLookAt::canRestartTeleport()
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLocationLookAt::canRestartTeleport -> true" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -47,20 +47,15 @@ extern const BOOL ANIMATE;
|
|||
extern const U8 AGENT_STATE_TYPING; // Typing indication
|
||||
extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected
|
||||
|
||||
class LLChat;
|
||||
class LLViewerRegion;
|
||||
class LLMotion;
|
||||
class LLToolset;
|
||||
class LLMessageSystem;
|
||||
class LLPermissions;
|
||||
class LLHost;
|
||||
class LLFriendObserver;
|
||||
class LLPickInfo;
|
||||
class LLViewerObject;
|
||||
class LLAgentDropGroupViewerNode;
|
||||
class LLAgentAccess;
|
||||
class LLSLURL;
|
||||
class LLPauseRequestHandle;
|
||||
class LLUIColor;
|
||||
class LLTeleportRequest;
|
||||
|
||||
|
|
@ -91,8 +86,6 @@ struct LLGroupData
|
|||
|
||||
class LLAgentListener;
|
||||
|
||||
class LLAgentImpl;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// LLAgent
|
||||
//------------------------------------------------------------------------
|
||||
|
|
@ -631,6 +624,10 @@ public:
|
|||
TELEPORT_PENDING = 7
|
||||
};
|
||||
|
||||
static std::map<S32, std::string> sTeleportStateName;
|
||||
static const std::string& teleportStateName(S32);
|
||||
const std::string& getTeleportStateName() const;
|
||||
|
||||
public:
|
||||
static void parseTeleportMessages(const std::string& xml_filename);
|
||||
const void getTeleportSourceSLURL(LLSLURL& slurl) const;
|
||||
|
|
|
|||
|
|
@ -919,13 +919,6 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
|
|||
|
||||
void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
|
||||
{
|
||||
if (gAgent.isTeen() &&
|
||||
(type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS))
|
||||
{
|
||||
// Can't take off underclothing in simple UI mode or on PG accounts
|
||||
// TODO: enable the removing of a single undershirt/underpants if multiple are worn. - Nyx
|
||||
return;
|
||||
}
|
||||
if (getWearableCount(type) == 0)
|
||||
{
|
||||
// no wearables to remove
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@
|
|||
const std::string AISAPI::INVENTORY_CAP_NAME("InventoryAPIv3");
|
||||
const std::string AISAPI::LIBRARY_CAP_NAME("LibraryAPIv3");
|
||||
|
||||
std::list<AISAPI::ais_query_item_t> AISAPI::sPostponedQuery;
|
||||
|
||||
const S32 MAX_SIMULTANEOUS_COROUTINES = 2048;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/*static*/
|
||||
bool AISAPI::isAvailable()
|
||||
|
|
@ -366,9 +370,51 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t
|
|||
/*static*/
|
||||
void AISAPI::EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc)
|
||||
{
|
||||
LLCoprocedureManager &inst = LLCoprocedureManager::instance();
|
||||
S32 pending_in_pool = inst.countPending("AIS");
|
||||
std::string procFullName = "AIS(" + procName + ")";
|
||||
LLCoprocedureManager::instance().enqueueCoprocedure("AIS", procFullName, proc);
|
||||
if (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES)
|
||||
{
|
||||
inst.enqueueCoprocedure("AIS", procFullName, proc);
|
||||
}
|
||||
else
|
||||
{
|
||||
// As I understand it, coroutines have built-in 'pending' pool
|
||||
// but unfortunately it has limited size which inventory often goes over
|
||||
// so this is a workaround to not overfill it.
|
||||
if (sPostponedQuery.empty())
|
||||
{
|
||||
sPostponedQuery.push_back(ais_query_item_t(procFullName, proc));
|
||||
gIdleCallbacks.addFunction(onIdle, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
sPostponedQuery.push_back(ais_query_item_t(procFullName, proc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/
|
||||
void AISAPI::onIdle(void *userdata)
|
||||
{
|
||||
if (!sPostponedQuery.empty())
|
||||
{
|
||||
LLCoprocedureManager &inst = LLCoprocedureManager::instance();
|
||||
S32 pending_in_pool = inst.countPending("AIS");
|
||||
while (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES && !sPostponedQuery.empty())
|
||||
{
|
||||
ais_query_item_t &item = sPostponedQuery.front();
|
||||
inst.enqueueCoprocedure("AIS", item.first, item.second);
|
||||
sPostponedQuery.pop_front();
|
||||
pending_in_pool++;
|
||||
}
|
||||
}
|
||||
|
||||
if (sPostponedQuery.empty())
|
||||
{
|
||||
// Nothing to do anymore
|
||||
gIdleCallbacks.deleteFunction(onIdle, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "llhttpretrypolicy.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "llcorehttputil.h"
|
||||
#include "llcoproceduremanager.h"
|
||||
|
|
@ -72,6 +71,7 @@ private:
|
|||
const std::string, LLSD, LLCore::HttpOptions::ptr_t, LLCore::HttpHeaders::ptr_t) > invokationFn_t;
|
||||
|
||||
static void EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc);
|
||||
static void onIdle(void *userdata); // launches postponed AIS commands
|
||||
|
||||
static std::string getInvCap();
|
||||
static std::string getLibCap();
|
||||
|
|
@ -80,6 +80,8 @@ private:
|
|||
invokationFn_t invoke, std::string url, LLUUID targetId, LLSD body,
|
||||
completion_t callback, COMMAND_TYPE type);
|
||||
|
||||
typedef std::pair<std::string, LLCoprocedureManager::CoProcedure_t> ais_query_item_t;
|
||||
static std::list<ais_query_item_t> sPostponedQuery;
|
||||
};
|
||||
|
||||
class AISUpdate
|
||||
|
|
|
|||
|
|
@ -3637,6 +3637,50 @@ void update_base_outfit_after_ordering()
|
|||
bool copy_folder_links = false;
|
||||
app_mgr.slamCategoryLinks(app_mgr.getCOF(), base_outfit_id, copy_folder_links, dirty_state_updater);
|
||||
|
||||
if (base_outfit_id.notNull())
|
||||
{
|
||||
LLIsValidItemLink collector;
|
||||
|
||||
LLInventoryModel::cat_array_t cof_cats;
|
||||
LLInventoryModel::item_array_t cof_item_array;
|
||||
gInventory.collectDescendentsIf(app_mgr.getCOF(), cof_cats, cof_item_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH, collector);
|
||||
|
||||
for (U32 i = 0; i < outfit_item_array.size(); ++i)
|
||||
{
|
||||
LLViewerInventoryItem* linked_item = outfit_item_array.at(i)->getLinkedItem();
|
||||
if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
|
||||
{
|
||||
outfit_item_array.erase(outfit_item_array.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outfit_item_array.size() != cof_item_array.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::sort(cof_item_array.begin(), cof_item_array.end(), sort_by_linked_uuid);
|
||||
std::sort(outfit_item_array.begin(), outfit_item_array.end(), sort_by_linked_uuid);
|
||||
|
||||
for (U32 i = 0; i < cof_item_array.size(); ++i)
|
||||
{
|
||||
LLViewerInventoryItem *cof_it = cof_item_array.at(i);
|
||||
LLViewerInventoryItem *base_it = outfit_item_array.at(i);
|
||||
|
||||
if (cof_it->getActualDescription() != base_it->getActualDescription())
|
||||
{
|
||||
if (cof_it->getLinkedUUID() == base_it->getLinkedUUID())
|
||||
{
|
||||
base_it->setDescription(cof_it->getActualDescription());
|
||||
gInventory.updateItem(base_it);
|
||||
}
|
||||
}
|
||||
}
|
||||
LLAppearanceMgr::getInstance()->updateIsDirty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Save COF changes - update the contents of the current base outfit
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@
|
|||
#include "llviewermedia.h"
|
||||
#include "llviewerparcelaskplay.h"
|
||||
#include "llviewerparcelmedia.h"
|
||||
#include "llviewershadermgr.h"
|
||||
#include "llviewermediafocus.h"
|
||||
#include "llviewermessage.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
|
|
@ -541,7 +542,8 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base)
|
|||
|
||||
LLIconCtrl* icon;
|
||||
|
||||
if(gAgent.isInGroup(match_id, TRUE))
|
||||
if( match->getMenuName() == "menu_url_group.xml" // See LLUrlEntryGroup constructor
|
||||
|| gAgent.isInGroup(match_id, TRUE)) //This check seems unfiting, urls are either /agent or /group
|
||||
{
|
||||
LLGroupIconCtrl::Params icon_params;
|
||||
icon_params.group_id = match_id;
|
||||
|
|
@ -619,8 +621,9 @@ static void settings_to_globals()
|
|||
static void settings_modify()
|
||||
{
|
||||
LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderDeferred");
|
||||
LLPipeline::sRenderTransparentWater = gSavedSettings.getBOOL("RenderTransparentWater");
|
||||
LLPipeline::sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
|
||||
LLPipeline::sRenderDeferred = LLPipeline::sRenderBump && gSavedSettings.getBOOL("RenderDeferred");
|
||||
LLPipeline::sRenderDeferred = LLPipeline::sRenderTransparentWater && LLPipeline::sRenderBump && gSavedSettings.getBOOL("RenderDeferred");
|
||||
LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor");
|
||||
LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4]
|
||||
gDebugGL = gSavedSettings.getBOOL("RenderDebugGL") || gDebugSession;
|
||||
|
|
@ -703,8 +706,7 @@ LLAppViewer::LLAppViewer()
|
|||
mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
|
||||
mFastTimerLogThread(NULL),
|
||||
mSettingsLocationList(NULL),
|
||||
mIsFirstRun(false),
|
||||
mMinMicroSecPerFrame(0.f)
|
||||
mIsFirstRun(false)
|
||||
{
|
||||
if(NULL != sInstance)
|
||||
{
|
||||
|
|
@ -796,7 +798,7 @@ bool LLAppViewer::init()
|
|||
|
||||
// initialize the LLSettingsType translation bridge.
|
||||
LLTranslationBridge::ptr_t trans = std::make_shared<LLUITranslationBridge>();
|
||||
LLSettingsType::initClass(trans);
|
||||
LLSettingsType::initParamSingleton(trans);
|
||||
|
||||
// initialize SSE options
|
||||
LLVector4a::initClass();
|
||||
|
|
@ -1039,13 +1041,27 @@ bool LLAppViewer::init()
|
|||
{
|
||||
// can't use an alert here since we're exiting and
|
||||
// all hell breaks lose.
|
||||
LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedGLRequirements");
|
||||
OSMessageBox(
|
||||
LLNotifications::instance().getGlobalString("UnsupportedGLRequirements"),
|
||||
details.getString(),
|
||||
LLStringUtil::null,
|
||||
OSMB_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If we don't have the right shader requirements.
|
||||
if (!gGLManager.mHasShaderObjects
|
||||
|| !gGLManager.mHasVertexShader
|
||||
|| !gGLManager.mHasFragmentShader)
|
||||
{
|
||||
LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedShaderRequirements");
|
||||
OSMessageBox(
|
||||
details.getString(),
|
||||
LLStringUtil::null,
|
||||
OSMB_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Without SSE2 support we will crash almost immediately, warn here.
|
||||
if (!gSysCPU.hasSSE2())
|
||||
{
|
||||
|
|
@ -1273,10 +1289,6 @@ bool LLAppViewer::init()
|
|||
|
||||
joystick = LLViewerJoystick::getInstance();
|
||||
joystick->setNeedsReset(true);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
gSavedSettings.getControl("FramePerSecondLimit")->getSignal()->connect(boost::bind(&LLAppViewer::onChangeFrameLimit, this, _2));
|
||||
onChangeFrameLimit(gSavedSettings.getLLSD("FramePerSecondLimit"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1496,21 +1508,6 @@ bool LLAppViewer::doFrame()
|
|||
|
||||
display();
|
||||
|
||||
static U64 last_call = 0;
|
||||
if (!gTeleportDisplay || gGLManager.mIsIntel) // SL-10625...throttle early, throttle often with Intel
|
||||
{
|
||||
// Frame/draw throttling
|
||||
U64 elapsed_time = LLTimer::getTotalTime() - last_call;
|
||||
if (elapsed_time < mMinMicroSecPerFrame)
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FTM_SLEEP);
|
||||
// llclamp for when time function gets funky
|
||||
U64 sleep_time = llclamp(mMinMicroSecPerFrame - elapsed_time, (U64)1, (U64)1e6);
|
||||
micro_sleep(sleep_time, 0);
|
||||
}
|
||||
}
|
||||
last_call = LLTimer::getTotalTime();
|
||||
|
||||
pingMainloopTimeout("Main:Snapshot");
|
||||
LLFloaterSnapshot::update(); // take snapshots
|
||||
LLFloaterOutfitSnapshot::update();
|
||||
|
|
@ -1535,8 +1532,10 @@ bool LLAppViewer::doFrame()
|
|||
}
|
||||
|
||||
// yield cooperatively when not running as foreground window
|
||||
if ( (gViewerWindow && !gViewerWindow->getWindow()->getVisible())
|
||||
|| !gFocusMgr.getAppHasFocus())
|
||||
// and when not quiting (causes trouble at mac's cleanup stage)
|
||||
if (!LLApp::isExiting()
|
||||
&& ((gViewerWindow && !gViewerWindow->getWindow()->getVisible())
|
||||
|| !gFocusMgr.getAppHasFocus()))
|
||||
{
|
||||
// Sleep if we're not rendering, or the window is minimized.
|
||||
static LLCachedControl<S32> s_bacground_yeild_time(gSavedSettings, "BackgroundYieldTime", 40);
|
||||
|
|
@ -2134,8 +2133,6 @@ bool LLAppViewer::cleanup()
|
|||
|
||||
LLError::LLCallStacks::cleanup();
|
||||
|
||||
removeMarkerFiles();
|
||||
|
||||
// It's not at first obvious where, in this long sequence, a generic cleanup
|
||||
// call OUGHT to go. So let's say this: as we migrate cleanup from
|
||||
// explicit hand-placed calls into the generic mechanism, eventually
|
||||
|
|
@ -2143,14 +2140,12 @@ bool LLAppViewer::cleanup()
|
|||
// still see above are calls that MUST happen before the generic cleanup
|
||||
// kicks in.
|
||||
|
||||
// The logging subsystem depends on an LLSingleton. Any logging after
|
||||
// LLSingletonBase::deleteAll() won't be recorded.
|
||||
LL_INFOS() << "Goodbye!" << LL_ENDL;
|
||||
|
||||
// This calls every remaining LLSingleton's cleanupSingleton() and
|
||||
// deleteSingleton() methods.
|
||||
LLSingletonBase::deleteAll();
|
||||
|
||||
LL_INFOS() << "Goodbye!" << LL_ENDL;
|
||||
|
||||
removeDumpDir();
|
||||
|
||||
// return 0;
|
||||
|
|
@ -5500,19 +5495,6 @@ void LLAppViewer::disconnectViewer()
|
|||
LLUrlEntryParcel::setDisconnected(gDisconnected);
|
||||
}
|
||||
|
||||
bool LLAppViewer::onChangeFrameLimit(LLSD const & evt)
|
||||
{
|
||||
if (evt.asInteger() > 0)
|
||||
{
|
||||
mMinMicroSecPerFrame = (U64)(1000000.0f / F32(evt.asInteger()));
|
||||
}
|
||||
else
|
||||
{
|
||||
mMinMicroSecPerFrame = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLAppViewer::forceErrorLLError()
|
||||
{
|
||||
LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -255,8 +255,6 @@ private:
|
|||
void sendLogoutRequest();
|
||||
void disconnectViewer();
|
||||
|
||||
bool onChangeFrameLimit(LLSD const & evt);
|
||||
|
||||
// *FIX: the app viewer class should be some sort of singleton, no?
|
||||
// Perhaps its child class is the singleton and this should be an abstract base.
|
||||
static LLAppViewer* sInstance;
|
||||
|
|
@ -313,10 +311,7 @@ private:
|
|||
// llcorehttp library init/shutdown helper
|
||||
LLAppCoreHttp mAppCoreHttp;
|
||||
|
||||
bool mIsFirstRun;
|
||||
U64 mMinMicroSecPerFrame; // frame throttling
|
||||
|
||||
|
||||
bool mIsFirstRun;
|
||||
};
|
||||
|
||||
// consts from viewer.h
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLViewerInventoryItem;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// LLAttachmentsMgr
|
||||
//
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "lliconctrl.h"
|
||||
#include "llavatarpropertiesprocessor.h"
|
||||
#include "llviewermenu.h"
|
||||
|
||||
class LLAvatarName;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <boost/signals2.hpp>
|
||||
|
||||
#include "llpanel.h"
|
||||
#include "lloutputmonitorctrl.h"
|
||||
#include "llbutton.h"
|
||||
#include "lltextbox.h"
|
||||
#include "llstyle.h"
|
||||
|
|
@ -38,6 +37,7 @@
|
|||
#include "llcallingcard.h" // for LLFriendObserver
|
||||
|
||||
class LLAvatarIconCtrl;
|
||||
class LLOutputMonitorCtrl;
|
||||
class LLAvatarName;
|
||||
class LLIconCtrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@
|
|||
#include "llinventorymodel.h"
|
||||
#include "llmultigesture.h"
|
||||
#include "llui.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "lluictrlfactory.h"
|
||||
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b)
|
||||
#include "rlvactions.h"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
#include "llstring.h"
|
||||
#include "llurlaction.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f)
|
||||
#include "rlvactions.h"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llchatitemscontainerctrl.h"
|
||||
#include "llchatmsgbox.h"
|
||||
#include "lltextbox.h"
|
||||
|
||||
#include "llavataractions.h"
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue