Merge branch 'develop' of https://github.com/secondlife/viewer
# Conflicts: # indra/cmake/CMakeLists.txt # indra/llprimitive/lldaeloader.cpp # indra/llprimitive/llmodelloader.cpp # indra/llrender/llgl.h # indra/llrender/llrender.h # indra/llui/llurlentry.cpp # indra/llui/llurlentry.h # indra/newview/llviewerdisplay.cpp # indra/newview/llvoavatar.cppmaster
commit
1cca913ba7
|
|
@ -84,9 +84,12 @@ if (WINDOWS)
|
|||
/NODEFAULTLIB:LIBCMT
|
||||
/IGNORE:4099)
|
||||
|
||||
add_definitions(
|
||||
-DNOMINMAX
|
||||
# /DDOM_DYNAMIC # For shared library colladadom
|
||||
add_compile_definitions(
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
# DOM_DYNAMIC # For shared library colladadom
|
||||
_CRT_SECURE_NO_WARNINGS # Allow use of sprintf etc
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS # Disable deprecated WinSock API warnings
|
||||
)
|
||||
add_compile_options(
|
||||
/Zo
|
||||
|
|
@ -132,9 +135,6 @@ if (WINDOWS)
|
|||
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
endif()
|
||||
|
||||
# Allow use of sprintf etc
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif (WINDOWS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ set(cmake_SOURCE_FILES
|
|||
FreeType.cmake
|
||||
GLEXT.cmake
|
||||
GLH.cmake
|
||||
GLM.cmake
|
||||
GLOD.cmake # <FS:Ansariel> Bring back GLOD
|
||||
Havok.cmake
|
||||
Hunspell.cmake
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ set(llcommon_HEADER_FILES
|
|||
lluriparser.h
|
||||
lluuid.h
|
||||
llwin32headers.h
|
||||
llwin32headerslean.h
|
||||
llworkerthread.h
|
||||
hbxxh.h
|
||||
lockstatic.h
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_getopt.h"
|
||||
#include "apr_signal.h"
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace {
|
|||
virtual void recordMessage(LLError::ELevel level,
|
||||
const std::string& message) override
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
|
||||
int syslogPriority = LOG_CRIT;
|
||||
switch (level) {
|
||||
case LLError::LEVEL_DEBUG: syslogPriority = LOG_DEBUG; break;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "stringize.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <stdlib.h> // Windows errno
|
||||
#include <vector>
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -114,15 +114,6 @@
|
|||
# define LL_THREAD_LOCAL __thread
|
||||
#endif
|
||||
|
||||
// Static linking with apr on windows needs to be declared.
|
||||
#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
|
||||
#ifndef APR_DECLARE_STATIC
|
||||
#define APR_DECLARE_STATIC // For APR on Windows
|
||||
#endif
|
||||
#ifndef APU_DECLARE_STATIC
|
||||
#define APU_DECLARE_STATIC // For APR util on Windows
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LL_WINDOWS)
|
||||
#define BOOST_REGEX_NO_LIB 1
|
||||
|
|
@ -135,13 +126,6 @@
|
|||
|
||||
// Deal with VC++ problems
|
||||
#if LL_MSVC
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe
|
||||
#endif
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings
|
||||
#endif
|
||||
|
||||
// level 4 warnings that we need to disable:
|
||||
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
|
||||
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "llinitparam.h"
|
||||
#include "llsdparam.h"
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llexception.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
|
@ -38,7 +37,7 @@
|
|||
#include <iosfwd> // std::ostream
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headerslean.h" // for HANDLE
|
||||
#include "llwin32headers.h" // for HANDLE
|
||||
#elif LL_LINUX
|
||||
#if defined(Status)
|
||||
#undef Status
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
//#include <memory>
|
||||
|
||||
#if LL_WINDOWS
|
||||
# include "llwin32headerslean.h"
|
||||
# include "llwin32headers.h"
|
||||
# define _interlockedbittestandset _renamed_interlockedbittestandset
|
||||
# define _interlockedbittestandreset _renamed_interlockedbittestandreset
|
||||
# include <intrin.h>
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@
|
|||
#include <sstream>
|
||||
|
||||
#if LL_WINDOWS
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <winsock2.h> // for htonl
|
||||
# include "llwin32headers.h" // for htonl
|
||||
#elif LL_LINUX
|
||||
# include <netinet/in.h>
|
||||
#elif LL_DARWIN
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <dbghelp.h>
|
||||
|
||||
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@
|
|||
#include <vector>
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headerslean.h"
|
||||
#include <winnls.h> // for WideCharToMultiByte
|
||||
#include "llwin32headers.h"
|
||||
#endif
|
||||
|
||||
std::string ll_safe_string(const char* in)
|
||||
|
|
@ -1482,6 +1481,14 @@ bool LLStringUtil::simpleReplacement(std::string &replacement, std::string token
|
|||
template<>
|
||||
void LLStringUtil::setLocale(std::string inLocale)
|
||||
{
|
||||
if(startsWith(inLocale, "MissingString"))
|
||||
{
|
||||
// it seems this hasn't been working for some time, and I'm not sure how it is intentded to
|
||||
// properly discover the correct locale. early out now to avoid failures later in
|
||||
// formatNumber()
|
||||
LL_WARNS() << "Failed attempting to set invalid locale: " << inLocale << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
sLocale = inLocale;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
using namespace llsd;
|
||||
|
||||
#if LL_WINDOWS
|
||||
# include "llwin32headerslean.h"
|
||||
# include "llwin32headers.h"
|
||||
# include <psapi.h> // GetPerformanceInfo() et al.
|
||||
# include <VersionHelpers.h>
|
||||
#elif LL_DARWIN
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include <thread>
|
||||
|
||||
#if LL_WINDOWS
|
||||
# include "llwin32headerslean.h"
|
||||
# include "llwin32headers.h"
|
||||
#elif LL_LINUX || LL_DARWIN
|
||||
# include <errno.h>
|
||||
# include <sys/time.h>
|
||||
|
|
|
|||
|
|
@ -25,11 +25,8 @@
|
|||
|
||||
#include "linden_common.h"
|
||||
|
||||
// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headers.h"
|
||||
// ugh, this is ugly. We need to straighten out our linking for this library
|
||||
#pragma comment(lib, "IPHLPAPI.lib")
|
||||
#include <iphlpapi.h>
|
||||
#include <nb30.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,15 +28,8 @@
|
|||
#define LL_LLWINDOWS_H
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
// reset to default, which is lean
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#undef NOMINMAX
|
||||
#include <windows.h> // Does not include winsock.h because WIN32_LEAN_AND_MEAN is defined
|
||||
#include <winsock2.h> // Requires windows.h
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* @file llwin32headerslean.h
|
||||
* @brief sanitized include of windows header files
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLWINDOWS_H
|
||||
#define LL_LLWINDOWS_H
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#undef NOMINMAX
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -69,25 +69,99 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0);
|
|||
LLSettingsBase::LLSettingsBase():
|
||||
mSettings(LLSD::emptyMap()),
|
||||
mDirty(true),
|
||||
mBlendedFactor(0.0)
|
||||
mLLSDDirty(true),
|
||||
mReplaced(false),
|
||||
mBlendedFactor(0.0),
|
||||
mSettingFlags(0)
|
||||
{
|
||||
}
|
||||
|
||||
LLSettingsBase::LLSettingsBase(const LLSD setting) :
|
||||
mSettings(setting),
|
||||
mLLSDDirty(true),
|
||||
mDirty(true),
|
||||
mBlendedFactor(0.0)
|
||||
mReplaced(false),
|
||||
mBlendedFactor(0.0),
|
||||
mSettingFlags(0)
|
||||
{
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLSettingsBase::loadValuesFromLLSD()
|
||||
{
|
||||
mLLSDDirty = false;
|
||||
|
||||
mAssetId = mSettings[SETTING_ASSETID].asUUID();
|
||||
mSettingId = getValue(SETTING_ID).asUUID();
|
||||
mSettingName = getValue(SETTING_NAME).asString();
|
||||
if (mSettings.has(SETTING_FLAGS))
|
||||
{
|
||||
mSettingFlags = (U32)mSettings[SETTING_FLAGS].asInteger();
|
||||
}
|
||||
else
|
||||
{
|
||||
mSettingFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLSettingsBase::saveValuesToLLSD()
|
||||
{
|
||||
mLLSDDirty = false;
|
||||
|
||||
mSettings[SETTING_NAME] = mSettingName;
|
||||
if (mAssetId.isNull())
|
||||
{
|
||||
mSettings.erase(SETTING_ASSETID);
|
||||
}
|
||||
else
|
||||
{
|
||||
mSettings[SETTING_ASSETID] = mAssetId;
|
||||
}
|
||||
mSettings[SETTING_FLAGS] = LLSD::Integer(mSettingFlags);
|
||||
}
|
||||
|
||||
void LLSettingsBase::saveValuesIfNeeded()
|
||||
{
|
||||
if (mLLSDDirty)
|
||||
{
|
||||
saveValuesToLLSD();
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix)
|
||||
void LLSettingsBase::lerpSettings(LLSettingsBase &other, F64 mix)
|
||||
{
|
||||
mSettings = interpolateSDMap(mSettings, other.mSettings, other.getParameterMap(), mix);
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
|
||||
saveValuesIfNeeded();
|
||||
stringset_t skip = getSkipInterpolateKeys();
|
||||
stringset_t slerps = getSlerpKeys();
|
||||
mSettings = interpolateSDMap(mSettings, other.getSettings(), other.getParameterMap(), mix, skip, slerps);
|
||||
setDirtyFlag(true);
|
||||
loadValuesFromLLSD();
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) const
|
||||
void LLSettingsBase::lerpVector2(LLVector2& a, const LLVector2& b, F32 mix)
|
||||
{
|
||||
a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
|
||||
a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
|
||||
}
|
||||
|
||||
void LLSettingsBase::lerpVector3(LLVector3& a, const LLVector3& b, F32 mix)
|
||||
{
|
||||
a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
|
||||
a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
|
||||
a.mV[2] = lerp(a.mV[2], b.mV[2], mix);
|
||||
}
|
||||
|
||||
void LLSettingsBase::lerpColor(LLColor3& a, const LLColor3& b, F32 mix)
|
||||
{
|
||||
a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
|
||||
a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
|
||||
a.mV[2] = lerp(a.mV[2], b.mV[2], mix);
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other)
|
||||
{
|
||||
LLSD newSettings;
|
||||
|
||||
|
|
@ -161,13 +235,10 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
|
|||
return newSettings;
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix) const
|
||||
LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix, const stringset_t& skip, const stringset_t& slerps)
|
||||
{
|
||||
LLSD newSettings;
|
||||
|
||||
stringset_t skip = getSkipInterpolateKeys();
|
||||
stringset_t slerps = getSlerpKeys();
|
||||
|
||||
llassert(mix >= 0.0f && mix <= 1.0f);
|
||||
|
||||
for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it)
|
||||
|
|
@ -204,7 +275,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
|
|||
}
|
||||
}
|
||||
|
||||
newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, slerps);
|
||||
newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, skip, slerps);
|
||||
}
|
||||
|
||||
// Special handling cases
|
||||
|
|
@ -233,12 +304,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
|
|||
if (def_iter != defaults.end())
|
||||
{
|
||||
// Blend against default value
|
||||
newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps);
|
||||
newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, skip, slerps);
|
||||
}
|
||||
else if ((*it).second.type() == LLSD::TypeMap)
|
||||
{
|
||||
// interpolate in case there are defaults inside (part of legacy)
|
||||
newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, slerps);
|
||||
newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, skip, slerps);
|
||||
}
|
||||
// else do nothing when no known defaults
|
||||
// TODO: Should I blend this out instead?
|
||||
|
|
@ -260,7 +331,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
|
|||
return newSettings;
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const
|
||||
LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps)
|
||||
{
|
||||
LLSD new_value;
|
||||
|
||||
|
|
@ -286,7 +357,7 @@ LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD
|
|||
break;
|
||||
case LLSD::TypeMap:
|
||||
// deep copy.
|
||||
new_value = interpolateSDMap(value, other_value, defaults, mix);
|
||||
new_value = interpolateSDMap(value, other_value, defaults, mix, skip, slerps);
|
||||
break;
|
||||
|
||||
case LLSD::TypeArray:
|
||||
|
|
@ -348,13 +419,15 @@ LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const
|
|||
return skipSet;
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::getSettings() const
|
||||
LLSD& LLSettingsBase::getSettings()
|
||||
{
|
||||
saveValuesIfNeeded();
|
||||
return mSettings;
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::cloneSettings() const
|
||||
LLSD LLSettingsBase::cloneSettings()
|
||||
{
|
||||
saveValuesIfNeeded();
|
||||
LLSD settings(combineSDMaps(getSettings(), LLSD()));
|
||||
if (U32 flags = getFlags())
|
||||
{
|
||||
|
|
@ -363,7 +436,7 @@ LLSD LLSettingsBase::cloneSettings() const
|
|||
return settings;
|
||||
}
|
||||
|
||||
size_t LLSettingsBase::getHash() const
|
||||
size_t LLSettingsBase::getHash()
|
||||
{ // get a shallow copy of the LLSD filtering out values to not include in the hash
|
||||
LLSD hash_settings = llsd_shallow(getSettings(),
|
||||
LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true));
|
||||
|
|
@ -381,7 +454,9 @@ bool LLSettingsBase::validate()
|
|||
mSettings[SETTING_TYPE] = getSettingsType();
|
||||
}
|
||||
|
||||
saveValuesIfNeeded();
|
||||
LLSD result = LLSettingsBase::settingValidation(mSettings, validations);
|
||||
loadValuesFromLLSD();
|
||||
|
||||
if (result["errors"].size() > 0)
|
||||
{
|
||||
|
|
@ -704,7 +779,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_
|
|||
|
||||
if (mTarget)
|
||||
{
|
||||
mTarget->replaceSettings(mInitial->getSettings());
|
||||
mTarget->replaceSettings(mInitial);
|
||||
mTarget->blend(mFinal, blendf);
|
||||
}
|
||||
else
|
||||
|
|
@ -719,7 +794,7 @@ void LLSettingsBlender::triggerComplete()
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
|
||||
if (mTarget)
|
||||
mTarget->replaceSettings(mFinal->getSettings());
|
||||
mTarget->replaceSettings(mFinal);
|
||||
LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon
|
||||
mTarget->update();
|
||||
mOnFinished(shared_from_this());
|
||||
|
|
|
|||
|
|
@ -109,72 +109,59 @@ public:
|
|||
virtual bool isDirty() const { return mDirty; }
|
||||
virtual bool isVeryDirty() const { return mReplaced; }
|
||||
inline void setDirtyFlag(bool dirty) { mDirty = dirty; clearAssetId(); }
|
||||
inline void setReplaced() { mReplaced = true; }
|
||||
|
||||
size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash
|
||||
size_t getHash(); // Hash will not include Name, ID or a previously stored Hash
|
||||
|
||||
inline LLUUID getId() const
|
||||
{
|
||||
return getValue(SETTING_ID).asUUID();
|
||||
return mSettingId;
|
||||
}
|
||||
|
||||
inline std::string getName() const
|
||||
{
|
||||
return getValue(SETTING_NAME).asString();
|
||||
return mSettingName;
|
||||
}
|
||||
|
||||
inline void setName(std::string val)
|
||||
{
|
||||
setValue(SETTING_NAME, val);
|
||||
mSettingName = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
inline LLUUID getAssetId() const
|
||||
{
|
||||
if (mSettings.has(SETTING_ASSETID))
|
||||
return mSettings[SETTING_ASSETID].asUUID();
|
||||
return LLUUID();
|
||||
return mAssetId;
|
||||
}
|
||||
|
||||
inline U32 getFlags() const
|
||||
{
|
||||
if (mSettings.has(SETTING_FLAGS))
|
||||
return static_cast<U32>(mSettings[SETTING_FLAGS].asInteger());
|
||||
return 0;
|
||||
return mSettingFlags;
|
||||
}
|
||||
|
||||
inline void setFlags(U32 value)
|
||||
{
|
||||
setLLSD(SETTING_FLAGS, LLSD::Integer(value));
|
||||
mSettingFlags = value;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
inline bool getFlag(U32 flag) const
|
||||
{
|
||||
if (mSettings.has(SETTING_FLAGS))
|
||||
return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag;
|
||||
return false;
|
||||
return (mSettingFlags & flag) == flag;
|
||||
}
|
||||
|
||||
inline void setFlag(U32 flag)
|
||||
{
|
||||
U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
|
||||
|
||||
flags |= flag;
|
||||
|
||||
if (flags)
|
||||
mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
|
||||
else
|
||||
mSettings.erase(SETTING_FLAGS);
|
||||
mSettingFlags |= flag;
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
inline void clearFlag(U32 flag)
|
||||
{
|
||||
U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
|
||||
|
||||
flags &= ~flag;
|
||||
|
||||
if (flags)
|
||||
mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
|
||||
else
|
||||
mSettings.erase(SETTING_FLAGS);
|
||||
mSettingFlags &= ~flag;
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
virtual void replaceSettings(LLSD settings)
|
||||
|
|
@ -183,14 +170,41 @@ public:
|
|||
setDirtyFlag(true);
|
||||
mReplaced = true;
|
||||
mSettings = settings;
|
||||
loadValuesFromLLSD();
|
||||
}
|
||||
|
||||
virtual LLSD getSettings() const;
|
||||
virtual void replaceSettings(const ptr_t& other)
|
||||
{
|
||||
mBlendedFactor = 0.0;
|
||||
setDirtyFlag(true);
|
||||
mReplaced = true;
|
||||
mSettingFlags = other->getFlags();
|
||||
mSettingName = other->getName();
|
||||
mSettingId = other->getId();
|
||||
mAssetId = other->getAssetId();
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
void setSettings(LLSD settings)
|
||||
{
|
||||
setDirtyFlag(true);
|
||||
mSettings = settings;
|
||||
loadValuesFromLLSD();
|
||||
}
|
||||
|
||||
// if you are using getSettings to edit them, call setSettings(settings),
|
||||
// replaceSettings(settings) or loadValuesFromLLSD() afterwards
|
||||
virtual LLSD& getSettings();
|
||||
virtual void setLLSDDirty()
|
||||
{
|
||||
mLLSDDirty = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
inline void setLLSD(const std::string &name, const LLSD &value)
|
||||
{
|
||||
saveValuesIfNeeded();
|
||||
mSettings[name] = value;
|
||||
mDirty = true;
|
||||
if (name != SETTING_ASSETID)
|
||||
|
|
@ -202,8 +216,9 @@ public:
|
|||
setLLSD(name, value);
|
||||
}
|
||||
|
||||
inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const
|
||||
inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD())
|
||||
{
|
||||
saveValuesIfNeeded();
|
||||
if (!mSettings.has(name))
|
||||
return deflt;
|
||||
return mSettings[name];
|
||||
|
|
@ -259,11 +274,11 @@ public:
|
|||
(const_cast<LLSettingsBase *>(this))->updateSettings();
|
||||
}
|
||||
|
||||
virtual void blend(const ptr_t &end, BlendFactor blendf) = 0;
|
||||
virtual void blend(ptr_t &end, BlendFactor blendf) = 0;
|
||||
|
||||
virtual bool validate();
|
||||
|
||||
virtual ptr_t buildDerivedClone() const = 0;
|
||||
virtual ptr_t buildDerivedClone() = 0;
|
||||
|
||||
class Validator
|
||||
{
|
||||
|
|
@ -310,17 +325,24 @@ public:
|
|||
|
||||
inline void setAssetId(LLUUID value)
|
||||
{ // note that this skips setLLSD
|
||||
mSettings[SETTING_ASSETID] = value;
|
||||
mAssetId = value;
|
||||
mLLSDDirty = true;
|
||||
}
|
||||
|
||||
inline void clearAssetId()
|
||||
{
|
||||
if (mSettings.has(SETTING_ASSETID))
|
||||
mSettings.erase(SETTING_ASSETID);
|
||||
mAssetId.setNull();
|
||||
mLLSDDirty = true;
|
||||
}
|
||||
|
||||
// Calculate any custom settings that may need to be cached.
|
||||
virtual void updateSettings() { mDirty = false; mReplaced = false; }
|
||||
LLSD cloneSettings();
|
||||
|
||||
static void lerpVector2(LLVector2& a, const LLVector2& b, F32 mix);
|
||||
static void lerpVector3(LLVector3& a, const LLVector3& b, F32 mix);
|
||||
static void lerpColor(LLColor3& a, const LLColor3& b, F32 mix);
|
||||
|
||||
protected:
|
||||
|
||||
LLSettingsBase();
|
||||
|
|
@ -331,7 +353,7 @@ protected:
|
|||
typedef std::set<std::string> stringset_t;
|
||||
|
||||
// combining settings objects. Customize for specific setting types
|
||||
virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix);
|
||||
virtual void lerpSettings(LLSettingsBase &other, BlendFactor mix);
|
||||
|
||||
// combining settings maps where it can based on mix rate
|
||||
// @settings initial value (mix==0)
|
||||
|
|
@ -339,8 +361,8 @@ protected:
|
|||
// @defaults list of default values for legacy fields and (re)setting shaders
|
||||
// @mix from 0 to 1, ratio or rate of transition from initial 'settings' to 'other'
|
||||
// return interpolated and combined LLSD map
|
||||
LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix) const;
|
||||
LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const;
|
||||
static LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
|
||||
static LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
|
||||
|
||||
/// when lerping between settings, some may require special handling.
|
||||
/// Get a list of these key to be skipped by the default settings lerp.
|
||||
|
|
@ -353,32 +375,40 @@ protected:
|
|||
|
||||
virtual validation_list_t getValidationList() const = 0;
|
||||
|
||||
// Apply any settings that need special handling.
|
||||
virtual void applySpecial(void *, bool force = false) { };
|
||||
// Apply settings.
|
||||
virtual void applyToUniforms(void *) { };
|
||||
virtual void applySpecial(void*, bool force = false) { };
|
||||
|
||||
virtual parammapping_t getParameterMap() const { return parammapping_t(); }
|
||||
|
||||
LLSD mSettings;
|
||||
|
||||
LLSD cloneSettings() const;
|
||||
|
||||
inline void setBlendFactor(BlendFactor blendfactor)
|
||||
{
|
||||
mBlendedFactor = blendfactor;
|
||||
}
|
||||
|
||||
void replaceWith(LLSettingsBase::ptr_t other)
|
||||
virtual void replaceWith(const LLSettingsBase::ptr_t other)
|
||||
{
|
||||
replaceSettings(other->cloneSettings());
|
||||
replaceSettings(other);
|
||||
setBlendFactor(other->getBlendFactor());
|
||||
}
|
||||
|
||||
virtual void loadValuesFromLLSD();
|
||||
virtual void saveValuesToLLSD();
|
||||
void saveValuesIfNeeded();
|
||||
|
||||
LLUUID mAssetId;
|
||||
LLUUID mSettingId;
|
||||
std::string mSettingName;
|
||||
U32 mSettingFlags;
|
||||
|
||||
private:
|
||||
bool mLLSDDirty;
|
||||
bool mDirty;
|
||||
bool mReplaced; // super dirty!
|
||||
|
||||
LLSD combineSDMaps(const LLSD &first, const LLSD &other) const;
|
||||
static LLSD combineSDMaps(const LLSD &first, const LLSD &other);
|
||||
|
||||
LLSD mSettings;
|
||||
BlendFactor mBlendedFactor;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -125,33 +125,42 @@ static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f);
|
|||
//=========================================================================
|
||||
LLSettingsDay::LLSettingsDay(const LLSD &data) :
|
||||
LLSettingsBase(data),
|
||||
mInitialized(false)
|
||||
mInitialized(false),
|
||||
mDaySettings(LLSD::emptyMap())
|
||||
{
|
||||
mDayTracks.resize(TRACK_MAX);
|
||||
loadValuesFromLLSD();
|
||||
}
|
||||
|
||||
LLSettingsDay::LLSettingsDay() :
|
||||
LLSettingsBase(),
|
||||
mInitialized(false)
|
||||
mInitialized(false),
|
||||
mDaySettings(LLSD::emptyMap())
|
||||
{
|
||||
mDayTracks.resize(TRACK_MAX);
|
||||
replaceSettings(defaults());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
LLSD LLSettingsDay::getSettings() const
|
||||
LLSD& LLSettingsDay::getSettings()
|
||||
{
|
||||
LLSD settings(LLSD::emptyMap());
|
||||
if (!mDaySettings.emptyMap())
|
||||
{
|
||||
return mDaySettings;
|
||||
}
|
||||
mDaySettings = LLSD::emptyMap();
|
||||
LLSD& settings = LLSettingsBase::getSettings();
|
||||
|
||||
if (mSettings.has(SETTING_NAME))
|
||||
settings[SETTING_NAME] = mSettings[SETTING_NAME];
|
||||
if (settings.has(SETTING_NAME))
|
||||
mDaySettings[SETTING_NAME] = settings[SETTING_NAME];
|
||||
|
||||
if (mSettings.has(SETTING_ID))
|
||||
settings[SETTING_ID] = mSettings[SETTING_ID];
|
||||
if (settings.has(SETTING_ID))
|
||||
mDaySettings[SETTING_ID] = settings[SETTING_ID];
|
||||
|
||||
if (mSettings.has(SETTING_ASSETID))
|
||||
settings[SETTING_ASSETID] = mSettings[SETTING_ASSETID];
|
||||
if (settings.has(SETTING_ASSETID))
|
||||
mDaySettings[SETTING_ASSETID] = settings[SETTING_ASSETID];
|
||||
|
||||
settings[SETTING_TYPE] = getSettingsType();
|
||||
mDaySettings[SETTING_TYPE] = getSettingsType();
|
||||
|
||||
std::map<std::string, LLSettingsBase::ptr_t> in_use;
|
||||
|
||||
|
|
@ -175,7 +184,7 @@ LLSD LLSettingsDay::getSettings() const
|
|||
}
|
||||
tracks.append(trackout);
|
||||
}
|
||||
settings[SETTING_TRACKS] = tracks;
|
||||
mDaySettings[SETTING_TRACKS] = tracks;
|
||||
|
||||
LLSD frames(LLSD::emptyMap());
|
||||
for (std::map<std::string, LLSettingsBase::ptr_t>::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame)
|
||||
|
|
@ -185,9 +194,15 @@ LLSD LLSettingsDay::getSettings() const
|
|||
|
||||
frames[(*itFrame).first] = framesettings;
|
||||
}
|
||||
settings[SETTING_FRAMES] = frames;
|
||||
mDaySettings[SETTING_FRAMES] = frames;
|
||||
|
||||
return settings;
|
||||
return mDaySettings;
|
||||
}
|
||||
|
||||
void LLSettingsDay::setLLSDDirty()
|
||||
{
|
||||
mDaySettings = LLSD::emptyMap();
|
||||
LLSettingsBase::setLLSDDirty();
|
||||
}
|
||||
|
||||
bool LLSettingsDay::initialize(bool validate_frames)
|
||||
|
|
@ -393,6 +408,8 @@ bool LLSettingsDay::initialize(bool validate_frames)
|
|||
mSettings[SETTING_ASSETID] = assetid;
|
||||
}
|
||||
|
||||
loadValuesFromLLSD();
|
||||
|
||||
mInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -450,7 +467,7 @@ LLSD LLSettingsDay::defaults()
|
|||
return dfltsetting;
|
||||
}
|
||||
|
||||
void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)
|
||||
void LLSettingsDay::blend(LLSettingsBase::ptr_t &other, F64 mix)
|
||||
{
|
||||
LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,10 @@ public:
|
|||
|
||||
bool initialize(bool validate_frames = false);
|
||||
|
||||
virtual ptr_t buildClone() const = 0;
|
||||
virtual ptr_t buildDeepCloneAndUncompress() const = 0;
|
||||
virtual LLSD getSettings() const SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildClone() = 0;
|
||||
virtual ptr_t buildDeepCloneAndUncompress() = 0;
|
||||
virtual LLSD& getSettings() SETTINGS_OVERRIDE;
|
||||
virtual void setLLSDDirty() override;
|
||||
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; }
|
||||
|
||||
|
||||
|
|
@ -92,7 +93,7 @@ public:
|
|||
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("daycycle"); }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
|
||||
virtual void blend(LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
|
||||
|
||||
static LLSD defaults();
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ public:
|
|||
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
|
||||
static validation_list_t validationList();
|
||||
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
|
||||
|
||||
LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
|
||||
LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
|
||||
|
|
@ -144,6 +145,7 @@ protected:
|
|||
|
||||
private:
|
||||
CycleList_t mDayTracks;
|
||||
LLSD mDaySettings;
|
||||
|
||||
LLSettingsBase::Seconds mLastUpdateTime;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -111,20 +111,24 @@ public:
|
|||
LLSettingsSky(const LLSD &data);
|
||||
virtual ~LLSettingsSky() { };
|
||||
|
||||
virtual ptr_t buildClone() const = 0;
|
||||
virtual ptr_t buildClone() = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); }
|
||||
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
|
||||
virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
|
||||
|
||||
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
|
||||
virtual void replaceSettings(const LLSettingsBase::ptr_t& other_sky) override;
|
||||
|
||||
void replaceWithSky(LLSettingsSky::ptr_t pother);
|
||||
void replaceWithSky(const LLSettingsSky::ptr_t& pother);
|
||||
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
|
||||
|
||||
void loadValuesFromLLSD() override;
|
||||
void saveValuesToLLSD() override;
|
||||
|
||||
F32 getPlanetRadius() const;
|
||||
F32 getSkyBottomRadius() const;
|
||||
F32 getSkyTopRadius() const;
|
||||
|
|
@ -306,7 +310,7 @@ public:
|
|||
LLColor3 getSunlightColorClamped() const;
|
||||
LLColor3 getAmbientColorClamped() const;
|
||||
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
|
||||
|
||||
static LLUUID GetDefaultAssetId();
|
||||
static LLUUID GetDefaultSunTextureId();
|
||||
|
|
@ -348,6 +352,12 @@ protected:
|
|||
virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE;
|
||||
virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE;
|
||||
|
||||
LLUUID mSunTextureId;
|
||||
LLUUID mMoonTextureId;
|
||||
LLUUID mCloudTextureId;
|
||||
LLUUID mBloomTextureId;
|
||||
LLUUID mRainbowTextureId;
|
||||
LLUUID mHaloTextureId;
|
||||
LLUUID mNextSunTextureId;
|
||||
LLUUID mNextMoonTextureId;
|
||||
LLUUID mNextCloudTextureId;
|
||||
|
|
@ -355,17 +365,64 @@ protected:
|
|||
LLUUID mNextRainbowTextureId;
|
||||
LLUUID mNextHaloTextureId;
|
||||
|
||||
bool mCanAutoAdjust;
|
||||
LLQuaternion mSunRotation;
|
||||
LLQuaternion mMoonRotation;
|
||||
LLColor3 mSunlightColor;
|
||||
LLColor3 mGlow;
|
||||
F32 mReflectionProbeAmbiance;
|
||||
F32 mSunScale;
|
||||
F32 mStarBrightness;
|
||||
F32 mMoonBrightness;
|
||||
F32 mMoonScale;
|
||||
F32 mMaxY;
|
||||
F32 mGamma;
|
||||
F32 mCloudVariance;
|
||||
F32 mCloudShadow;
|
||||
F32 mCloudScale;
|
||||
LLVector2 mScrollRate;
|
||||
LLColor3 mCloudPosDensity1;
|
||||
LLColor3 mCloudPosDensity2;
|
||||
LLColor3 mCloudColor;
|
||||
LLSD mAbsorptionConfigs;
|
||||
LLSD mMieConfigs;
|
||||
LLSD mRayleighConfigs;
|
||||
F32 mSunArcRadians;
|
||||
F32 mSkyTopRadius;
|
||||
F32 mSkyBottomRadius;
|
||||
F32 mSkyMoistureLevel;
|
||||
F32 mSkyDropletRadius;
|
||||
F32 mSkyIceLevel;
|
||||
F32 mPlanetRadius;
|
||||
|
||||
F32 mHazeHorizon;
|
||||
F32 mHazeDensity;
|
||||
F32 mDistanceMultiplier;
|
||||
F32 mDensityMultiplier;
|
||||
LLColor3 mBlueHorizon;
|
||||
LLColor3 mBlueDensity;
|
||||
LLColor3 mAmbientColor;
|
||||
|
||||
bool mHasLegacyHaze;
|
||||
bool mLegacyHazeHorizon;
|
||||
bool mLegacyHazeDensity;
|
||||
bool mLegacyDistanceMultiplier;
|
||||
bool mLegacyDensityMultiplier;
|
||||
bool mLegacyBlueHorizon;
|
||||
bool mLegacyBlueDensity;
|
||||
bool mLegacyAmbientColor;
|
||||
|
||||
private:
|
||||
static LLSD rayleighConfigDefault();
|
||||
static LLSD absorptionConfigDefault();
|
||||
static LLSD mieConfigDefault();
|
||||
|
||||
LLColor3 getColor(const std::string& key, const LLColor3& default_value) const;
|
||||
F32 getFloat(const std::string& key, F32 default_value) const;
|
||||
LLColor3 getColor(const std::string& key, const LLColor3& default_value);
|
||||
F32 getFloat(const std::string& key, F32 default_value);
|
||||
|
||||
void calculateHeavenlyBodyPositions() const;
|
||||
void calculateLightSettings() const;
|
||||
void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f) const;
|
||||
static void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f);
|
||||
|
||||
mutable LLVector3 mSunDirection;
|
||||
mutable LLVector3 mMoonDirection;
|
||||
|
|
|
|||
|
|
@ -68,14 +68,18 @@ static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf8631
|
|||
//=========================================================================
|
||||
LLSettingsWater::LLSettingsWater(const LLSD &data) :
|
||||
LLSettingsBase(data),
|
||||
mNextNormalMapID()
|
||||
mNextNormalMapID(),
|
||||
mNextTransparentTextureID()
|
||||
{
|
||||
loadValuesFromLLSD();
|
||||
}
|
||||
|
||||
LLSettingsWater::LLSettingsWater() :
|
||||
LLSettingsBase(),
|
||||
mNextNormalMapID()
|
||||
mNextNormalMapID(),
|
||||
mNextTransparentTextureID()
|
||||
{
|
||||
replaceSettings(defaults());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
|
@ -109,6 +113,53 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position)
|
|||
return dfltsetting;
|
||||
}
|
||||
|
||||
void LLSettingsWater::loadValuesFromLLSD()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
|
||||
|
||||
LLSettingsBase::loadValuesFromLLSD();
|
||||
|
||||
LLSD& settings = getSettings();
|
||||
|
||||
mBlurMultiplier = (F32)settings[SETTING_BLUR_MULTIPLIER].asReal();
|
||||
mWaterFogColor = LLColor3(settings[SETTING_FOG_COLOR]);
|
||||
mWaterFogDensity = (F32)settings[SETTING_FOG_DENSITY].asReal();
|
||||
mFogMod = (F32)settings[SETTING_FOG_MOD].asReal();
|
||||
mFresnelOffset = (F32)settings[SETTING_FRESNEL_OFFSET].asReal();
|
||||
mFresnelScale = (F32)settings[SETTING_FRESNEL_SCALE].asReal();
|
||||
mNormalScale = LLVector3(settings[SETTING_NORMAL_SCALE]);
|
||||
mScaleAbove = (F32)settings[SETTING_SCALE_ABOVE].asReal();
|
||||
mScaleBelow = (F32)settings[SETTING_SCALE_BELOW].asReal();
|
||||
mWave1Dir = LLVector2(settings[SETTING_WAVE1_DIR]);
|
||||
mWave2Dir = LLVector2(settings[SETTING_WAVE2_DIR]);
|
||||
|
||||
mNormalMapID = getNormalMapID();
|
||||
mTransparentTextureID = getTransparentTextureID();
|
||||
}
|
||||
|
||||
void LLSettingsWater::saveValuesToLLSD()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
|
||||
|
||||
LLSettingsBase::saveValuesToLLSD();
|
||||
|
||||
LLSD & settings = getSettings();
|
||||
settings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(mBlurMultiplier);
|
||||
settings[SETTING_FOG_COLOR] = mWaterFogColor.getValue();
|
||||
settings[SETTING_FOG_DENSITY] = LLSD::Real(mWaterFogDensity);
|
||||
settings[SETTING_FOG_MOD] = LLSD::Real(mFogMod);
|
||||
settings[SETTING_FRESNEL_OFFSET] = LLSD::Real(mFresnelOffset);
|
||||
settings[SETTING_FRESNEL_SCALE] = LLSD::Real(mFresnelScale);
|
||||
settings[SETTING_NORMAL_SCALE] = mNormalScale.getValue();
|
||||
settings[SETTING_SCALE_ABOVE] = LLSD::Real(mScaleAbove);
|
||||
settings[SETTING_SCALE_BELOW] = LLSD::Real(mScaleBelow);
|
||||
settings[SETTING_WAVE1_DIR] = mWave1Dir.getValue();
|
||||
settings[SETTING_WAVE2_DIR] = mWave2Dir.getValue();
|
||||
|
||||
settings[SETTING_NORMAL_MAP] = mNormalMapID;
|
||||
settings[SETTING_TRANSPARENT_TEXTURE] = mTransparentTextureID;
|
||||
}
|
||||
|
||||
LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
|
||||
{
|
||||
bool converted_something(false);
|
||||
|
|
@ -180,13 +231,30 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
|
|||
return newsettings;
|
||||
}
|
||||
|
||||
void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
|
||||
void LLSettingsWater::blend(LLSettingsBase::ptr_t &end, F64 blendf)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
|
||||
LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast<LLSettingsWater>(end);
|
||||
if (other)
|
||||
{
|
||||
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf);
|
||||
replaceSettings(blenddata);
|
||||
mSettingFlags |= other->mSettingFlags;
|
||||
|
||||
mBlurMultiplier = lerp((F32)blendf, mBlurMultiplier, other->mBlurMultiplier);
|
||||
lerpColor(mWaterFogColor, other->mWaterFogColor, (F32)blendf);
|
||||
mWaterFogDensity = lerp((F32)blendf, mWaterFogDensity, other->mWaterFogDensity);
|
||||
mFogMod = lerp((F32)blendf, mFogMod, other->mFogMod);
|
||||
mFresnelOffset = lerp((F32)blendf, mFresnelOffset, other->mFresnelOffset);
|
||||
mFresnelScale = lerp((F32)blendf, mFresnelScale, other->mFresnelScale);
|
||||
lerpVector3(mNormalScale, other->mNormalScale, (F32)blendf);
|
||||
mScaleAbove = lerp((F32)blendf, mScaleAbove, other->mScaleAbove);
|
||||
mScaleBelow = lerp((F32)blendf, mScaleBelow, other->mScaleBelow);
|
||||
lerpVector2(mWave1Dir, other->mWave1Dir, (F32)blendf);
|
||||
lerpVector2(mWave2Dir, other->mWave2Dir, (F32)blendf);
|
||||
|
||||
setDirtyFlag(true);
|
||||
setReplaced();
|
||||
setLLSDDirty();
|
||||
|
||||
mNextNormalMapID = other->getNormalMapID();
|
||||
mNextTransparentTextureID = other->getTransparentTextureID();
|
||||
}
|
||||
|
|
@ -204,7 +272,34 @@ void LLSettingsWater::replaceSettings(LLSD settings)
|
|||
mNextTransparentTextureID.setNull();
|
||||
}
|
||||
|
||||
void LLSettingsWater::replaceWithWater(LLSettingsWater::ptr_t other)
|
||||
void LLSettingsWater::replaceSettings(const LLSettingsBase::ptr_t& other_water)
|
||||
{
|
||||
LLSettingsBase::replaceSettings(other_water);
|
||||
|
||||
llassert(getSettingsType() == other_water->getSettingsType());
|
||||
|
||||
LLSettingsWater::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsWater>(other_water);
|
||||
|
||||
mBlurMultiplier = other->mBlurMultiplier;
|
||||
mWaterFogColor = other->mWaterFogColor;
|
||||
mWaterFogDensity = other->mWaterFogDensity;
|
||||
mFogMod = other->mFogMod;
|
||||
mFresnelOffset = other->mFresnelOffset;
|
||||
mFresnelScale = other->mFresnelScale;
|
||||
mNormalScale = other->mNormalScale;
|
||||
mScaleAbove = other->mScaleAbove;
|
||||
mScaleBelow = other->mScaleBelow;
|
||||
mWave1Dir = other->mWave1Dir;
|
||||
mWave2Dir = other->mWave2Dir;
|
||||
|
||||
mNormalMapID = other->mNormalMapID;
|
||||
mTransparentTextureID = other->mTransparentTextureID;
|
||||
|
||||
mNextNormalMapID.setNull();
|
||||
mNextTransparentTextureID.setNull();
|
||||
}
|
||||
|
||||
void LLSettingsWater::replaceWithWater(const LLSettingsWater::ptr_t& other)
|
||||
{
|
||||
replaceWith(other);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,151 +55,181 @@ public:
|
|||
LLSettingsWater(const LLSD &data);
|
||||
virtual ~LLSettingsWater() { };
|
||||
|
||||
virtual ptr_t buildClone() const = 0;
|
||||
virtual ptr_t buildClone() = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); }
|
||||
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
|
||||
virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
|
||||
|
||||
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
|
||||
void replaceWithWater(LLSettingsWater::ptr_t other);
|
||||
virtual void replaceSettings(const LLSettingsBase::ptr_t& other_water) override;
|
||||
void replaceWithWater(const LLSettingsWater::ptr_t& other);
|
||||
|
||||
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
|
||||
|
||||
void loadValuesFromLLSD() override;
|
||||
void saveValuesToLLSD() override;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
F32 getBlurMultiplier() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_BLUR_MULTIPLIER].asReal();
|
||||
return mBlurMultiplier;
|
||||
}
|
||||
|
||||
void setBlurMultiplier(F32 val)
|
||||
{
|
||||
setValue(SETTING_BLUR_MULTIPLIER, val);
|
||||
mBlurMultiplier = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLColor3 getWaterFogColor() const
|
||||
{
|
||||
return LLColor3(mSettings[SETTING_FOG_COLOR]);
|
||||
return mWaterFogColor;
|
||||
}
|
||||
|
||||
void setWaterFogColor(LLColor3 val)
|
||||
{
|
||||
setValue(SETTING_FOG_COLOR, val);
|
||||
mWaterFogColor = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getWaterFogDensity() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_FOG_DENSITY].asReal();
|
||||
return mWaterFogDensity;
|
||||
}
|
||||
|
||||
F32 getModifiedWaterFogDensity(bool underwater) const;
|
||||
|
||||
void setWaterFogDensity(F32 val)
|
||||
{
|
||||
setValue(SETTING_FOG_DENSITY, val);
|
||||
mWaterFogDensity = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getFogMod() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_FOG_MOD].asReal();
|
||||
return mFogMod;
|
||||
}
|
||||
|
||||
void setFogMod(F32 val)
|
||||
{
|
||||
setValue(SETTING_FOG_MOD, val);
|
||||
mFogMod = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getFresnelOffset() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_FRESNEL_OFFSET].asReal();
|
||||
return mFresnelOffset;
|
||||
}
|
||||
|
||||
void setFresnelOffset(F32 val)
|
||||
{
|
||||
setValue(SETTING_FRESNEL_OFFSET, val);
|
||||
mFresnelOffset = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getFresnelScale() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_FRESNEL_SCALE].asReal();
|
||||
return mFresnelScale;
|
||||
}
|
||||
|
||||
void setFresnelScale(F32 val)
|
||||
{
|
||||
setValue(SETTING_FRESNEL_SCALE, val);
|
||||
mFresnelScale = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLUUID getTransparentTextureID() const
|
||||
{
|
||||
return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID();
|
||||
return mTransparentTextureID;
|
||||
}
|
||||
|
||||
void setTransparentTextureID(LLUUID val)
|
||||
{
|
||||
setValue(SETTING_TRANSPARENT_TEXTURE, val);
|
||||
mTransparentTextureID = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLUUID getNormalMapID() const
|
||||
{
|
||||
return mSettings[SETTING_NORMAL_MAP].asUUID();
|
||||
return mNormalMapID;
|
||||
}
|
||||
|
||||
void setNormalMapID(LLUUID val)
|
||||
{
|
||||
setValue(SETTING_NORMAL_MAP, val);
|
||||
mNormalMapID = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLVector3 getNormalScale() const
|
||||
{
|
||||
return LLVector3(mSettings[SETTING_NORMAL_SCALE]);
|
||||
return mNormalScale;
|
||||
}
|
||||
|
||||
void setNormalScale(LLVector3 val)
|
||||
{
|
||||
setValue(SETTING_NORMAL_SCALE, val);
|
||||
mNormalScale = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getScaleAbove() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_SCALE_ABOVE].asReal();
|
||||
return mScaleAbove;
|
||||
}
|
||||
|
||||
void setScaleAbove(F32 val)
|
||||
{
|
||||
setValue(SETTING_SCALE_ABOVE, val);
|
||||
mScaleAbove = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
F32 getScaleBelow() const
|
||||
{
|
||||
return (F32)mSettings[SETTING_SCALE_BELOW].asReal();
|
||||
return mScaleBelow;
|
||||
}
|
||||
|
||||
void setScaleBelow(F32 val)
|
||||
{
|
||||
setValue(SETTING_SCALE_BELOW, val);
|
||||
mScaleBelow = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLVector2 getWave1Dir() const
|
||||
{
|
||||
return LLVector2(mSettings[SETTING_WAVE1_DIR]);
|
||||
return mWave1Dir;
|
||||
}
|
||||
|
||||
void setWave1Dir(LLVector2 val)
|
||||
{
|
||||
setValue(SETTING_WAVE1_DIR, val);
|
||||
mWave1Dir = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
LLVector2 getWave2Dir() const
|
||||
{
|
||||
return LLVector2(mSettings[SETTING_WAVE2_DIR]);
|
||||
return mWave2Dir;
|
||||
}
|
||||
|
||||
void setWave2Dir(LLVector2 val)
|
||||
{
|
||||
setValue(SETTING_WAVE2_DIR, val);
|
||||
mWave2Dir = val;
|
||||
setDirtyFlag(true);
|
||||
setLLSDDirty();
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
|
|
@ -218,7 +248,7 @@ public:
|
|||
|
||||
static LLSD translateLegacySettings(LLSD legacy);
|
||||
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
|
||||
virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
|
||||
|
||||
static LLUUID GetDefaultAssetId();
|
||||
static LLUUID GetDefaultWaterNormalAssetId();
|
||||
|
|
@ -241,9 +271,22 @@ protected:
|
|||
|
||||
LLSettingsWater();
|
||||
|
||||
LLUUID mTransparentTextureID;
|
||||
LLUUID mNormalMapID;
|
||||
LLUUID mNextTransparentTextureID;
|
||||
LLUUID mNextNormalMapID;
|
||||
|
||||
F32 mBlurMultiplier;
|
||||
LLColor3 mWaterFogColor;
|
||||
F32 mWaterFogDensity;
|
||||
F32 mFogMod;
|
||||
F32 mFresnelOffset;
|
||||
F32 mFresnelScale;
|
||||
LLVector3 mNormalScale;
|
||||
F32 mScaleAbove;
|
||||
F32 mScaleBelow;
|
||||
LLVector2 mWave1Dir;
|
||||
LLVector2 mWave2Dir;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@
|
|||
#include "v4color.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <winsock2.h> // for htonl
|
||||
# include "llwin32headers.h" // for htonl
|
||||
#elif LL_LINUX
|
||||
# include <netinet/in.h>
|
||||
#elif LL_DARWIN
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@
|
|||
#include "llerror.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <llwin32headers.h>
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> // ntonl()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#define LL_LLIOPIPE_H
|
||||
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include "apr_poll.h"
|
||||
|
||||
#include "llsd.h"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include "lliopipe.h"
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "llchainio.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include "llmail.h"
|
||||
|
||||
// APR on Windows needs full windows headers
|
||||
#include "llwin32headers.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ include(LLCommon)
|
|||
include(LLCoreHttp)
|
||||
include(LLPhysicsExtensions)
|
||||
include(LLPrimitive)
|
||||
include(GLH)
|
||||
include(GLM)
|
||||
include(TinyGLTF)
|
||||
include(ColladaDom)
|
||||
|
|
@ -71,7 +70,7 @@ target_link_libraries(llprimitive
|
|||
llrender
|
||||
llphysicsextensions_impl
|
||||
ll::colladadom
|
||||
ll::glh_linear
|
||||
ll::glm
|
||||
)
|
||||
|
||||
if(LINUX)
|
||||
|
|
|
|||
|
|
@ -53,20 +53,10 @@
|
|||
#include "llsdserialize.h"
|
||||
#include "lljoint.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#endif
|
||||
|
||||
#include "glh/glh_linear.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#endif
|
||||
|
||||
#include "glm/mat4x4.hpp"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
|
|
@ -1282,9 +1272,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
|
|||
mesh_scale *= normalized_transformation;
|
||||
normalized_transformation = mesh_scale;
|
||||
|
||||
glh::matrix4f inv_mat((F32*) normalized_transformation.mMatrix);
|
||||
inv_mat = inv_mat.inverse();
|
||||
LLMatrix4 inverse_normalized_transformation(inv_mat.m);
|
||||
glm::mat4 inv_mat = glm::make_mat4((F32*)normalized_transformation.mMatrix);
|
||||
inv_mat = glm::inverse(inv_mat);
|
||||
LLMatrix4 inverse_normalized_transformation(glm::value_ptr(inv_mat));
|
||||
|
||||
domSkin::domBind_shape_matrix* bind_mat = skin->getBind_shape_matrix();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
#include "llsdserialize.h"
|
||||
#include "lljoint.h"
|
||||
|
||||
#include "glh/glh_linear.h"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
|
|
|||
|
|
@ -31,17 +31,6 @@
|
|||
#include "lljoint.h"
|
||||
#include "llcallbacklist.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#endif
|
||||
|
||||
#include "glh/glh_linear.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#endif
|
||||
|
||||
#include "llmatrix4a.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@
|
|||
#include "llglheaders.h"
|
||||
#include "llglslshader.h"
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "lldxhardware.h"
|
||||
#endif
|
||||
|
|
@ -2772,7 +2776,7 @@ void parse_glsl_version(S32& major, S32& minor)
|
|||
LLStringUtil::convertToS32(minor_str, minor);
|
||||
}
|
||||
|
||||
LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply)
|
||||
LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glm::mat4& modelview, const glm::mat4& projection, bool apply)
|
||||
{
|
||||
mApply = apply;
|
||||
|
||||
|
|
@ -2799,13 +2803,12 @@ void LLGLUserClipPlane::disable()
|
|||
|
||||
void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
|
||||
{
|
||||
glh::matrix4f& P = mProjection;
|
||||
glh::matrix4f& M = mModelview;
|
||||
const glm::mat4& P = mProjection;
|
||||
const glm::mat4& M = mModelview;
|
||||
|
||||
glh::matrix4f invtrans_MVP = (P * M).inverse().transpose();
|
||||
glh::vec4f oplane(a,b,c,d);
|
||||
glh::vec4f cplane;
|
||||
invtrans_MVP.mult_matrix_vec(oplane, cplane);
|
||||
glm::mat4 invtrans_MVP = glm::transpose(glm::inverse(P*M));
|
||||
glm::vec4 oplane(a,b,c,d);
|
||||
glm::vec4 cplane = invtrans_MVP * oplane;
|
||||
|
||||
cplane /= fabs(cplane[2]); // normalize such that depth is not scaled
|
||||
cplane[3] -= 1;
|
||||
|
|
@ -2813,13 +2816,13 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
|
|||
if(cplane[2] < 0)
|
||||
cplane *= -1;
|
||||
|
||||
glh::matrix4f suffix;
|
||||
suffix.set_row(2, cplane);
|
||||
glh::matrix4f newP = suffix * P;
|
||||
glm::mat4 suffix;
|
||||
suffix = glm::row(suffix, 2, cplane);
|
||||
glm::mat4 newP = suffix * P;
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(newP.m);
|
||||
gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
|
||||
gGL.loadMatrix(glm::value_ptr(newP));
|
||||
gGLObliqueProjectionInverse = LLMatrix4(glm::value_ptr(glm::transpose(glm::inverse(newP))));
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
|
|
@ -2916,31 +2919,27 @@ void LLGLDepthTest::checkState()
|
|||
|
||||
LLGLSquashToFarClip::LLGLSquashToFarClip()
|
||||
{
|
||||
glh::matrix4f proj = get_current_projection();
|
||||
glm::mat4 proj = get_current_projection();
|
||||
setProjectionMatrix(proj, 0);
|
||||
}
|
||||
|
||||
LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f& P, U32 layer)
|
||||
LLGLSquashToFarClip::LLGLSquashToFarClip(const glm::mat4& P, U32 layer)
|
||||
{
|
||||
setProjectionMatrix(P, layer);
|
||||
}
|
||||
|
||||
|
||||
void LLGLSquashToFarClip::setProjectionMatrix(glh::matrix4f& projection, U32 layer)
|
||||
void LLGLSquashToFarClip::setProjectionMatrix(glm::mat4 projection, U32 layer)
|
||||
{
|
||||
|
||||
F32 depth = 0.99999f - 0.0001f * layer;
|
||||
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
projection.element(2, i) = projection.element(3, i) * depth;
|
||||
}
|
||||
glm::vec4 P_row_3 = glm::row(projection, 3) * depth;
|
||||
projection = glm::row(projection, 2, P_row_3);
|
||||
|
||||
LLRender::eMatrixMode last_matrix_mode = gGL.getMatrixMode();
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(projection.m);
|
||||
gGL.loadMatrix(glm::value_ptr(projection));
|
||||
|
||||
gGL.matrixMode(last_matrix_mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,17 +43,7 @@
|
|||
#include "llinstancetracker.h"
|
||||
|
||||
#include "llglheaders.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#endif
|
||||
|
||||
#include "glh/glh_linear.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#endif
|
||||
#include "glm/mat4x4.hpp"
|
||||
|
||||
extern bool gDebugGL;
|
||||
extern bool gDebugSession;
|
||||
|
|
@ -330,7 +320,7 @@ class LLGLUserClipPlane
|
|||
{
|
||||
public:
|
||||
|
||||
LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true);
|
||||
LLGLUserClipPlane(const LLPlane& plane, const glm::mat4& modelview, const glm::mat4& projection, bool apply = true);
|
||||
~LLGLUserClipPlane();
|
||||
|
||||
void setPlane(F32 a, F32 b, F32 c, F32 d);
|
||||
|
|
@ -339,8 +329,8 @@ public:
|
|||
private:
|
||||
bool mApply;
|
||||
|
||||
glh::matrix4f mProjection;
|
||||
glh::matrix4f mModelview;
|
||||
glm::mat4 mProjection;
|
||||
glm::mat4 mModelview;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -354,9 +344,9 @@ class LLGLSquashToFarClip
|
|||
{
|
||||
public:
|
||||
LLGLSquashToFarClip();
|
||||
LLGLSquashToFarClip(glh::matrix4f& projection, U32 layer = 0);
|
||||
LLGLSquashToFarClip(const glm::mat4& projection, U32 layer = 0);
|
||||
|
||||
void setProjectionMatrix(glh::matrix4f& projection, U32 layer);
|
||||
void setProjectionMatrix(glm::mat4 projection, U32 layer);
|
||||
|
||||
~LLGLSquashToFarClip();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
// LL_WINDOWS
|
||||
|
||||
// windows gl headers depend on things like APIENTRY, so include windows.
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#include <GL/gl.h>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "lltexture.h"
|
||||
#include "llshadermgr.h"
|
||||
#include "hbxxh.h"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
|
||||
#if LL_WINDOWS
|
||||
extern void APIENTRY gl_debug_callback(GLenum source,
|
||||
|
|
@ -57,8 +58,8 @@ F32 gGLLastProjection[16];
|
|||
F32 gGLProjection[16];
|
||||
|
||||
// transform from last frame's camera space to this frame's camera space (and inverse)
|
||||
F32 gGLDeltaModelView[16];
|
||||
F32 gGLInverseDeltaModelView[16];
|
||||
glm::mat4 gGLDeltaModelView;
|
||||
glm::mat4 gGLInverseDeltaModelView;
|
||||
|
||||
S32 gGLViewport[4];
|
||||
|
||||
|
|
@ -735,10 +736,10 @@ void LLLightState::setPosition(const LLVector4& position)
|
|||
++gGL.mLightHash;
|
||||
mPosition = position;
|
||||
//transform position by current modelview matrix
|
||||
glh::vec4f pos(position.mV);
|
||||
const glh::matrix4f& mat = gGL.getModelviewMatrix();
|
||||
mat.mult_matrix_vec(pos);
|
||||
mPosition.set(pos.v);
|
||||
glm::vec4 pos(glm::make_vec4(position.mV));
|
||||
const glm::mat4& mat = gGL.getModelviewMatrix();
|
||||
pos = mat * pos;
|
||||
mPosition.set(glm::value_ptr(pos));
|
||||
}
|
||||
|
||||
void LLLightState::setConstantAttenuation(const F32& atten)
|
||||
|
|
@ -790,13 +791,13 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
|
|||
{
|
||||
//always set direction because modelview matrix may have changed
|
||||
++gGL.mLightHash;
|
||||
mSpotDirection = direction;
|
||||
//transform direction by current modelview matrix
|
||||
glh::vec3f dir(direction.mV);
|
||||
const glh::matrix4f& mat = gGL.getModelviewMatrix();
|
||||
mat.mult_matrix_dir(dir);
|
||||
|
||||
mSpotDirection.set(dir.v);
|
||||
//transform direction by current modelview matrix
|
||||
glm::vec3 dir(glm::make_vec3(direction.mV));
|
||||
const glm::mat3 mat(gGL.getModelviewMatrix());
|
||||
dir = mat * dir;
|
||||
|
||||
mSpotDirection.set(glm::value_ptr(dir));
|
||||
}
|
||||
|
||||
LLRender::LLRender()
|
||||
|
|
@ -835,6 +836,10 @@ LLRender::LLRender()
|
|||
|
||||
for (U32 i = 0; i < NUM_MATRIX_MODES; ++i)
|
||||
{
|
||||
for (U32 j = 0; j < LL_MATRIX_STACK_DEPTH; ++j)
|
||||
{
|
||||
mMatrix[i][j] = glm::identity<glm::mat4>();
|
||||
}
|
||||
mMatIdx[i] = 0;
|
||||
mMatHash[i] = 0;
|
||||
mCurMatHash[i] = 0xFFFFFFFF;
|
||||
|
|
@ -1013,12 +1018,12 @@ void LLRender::syncMatrices()
|
|||
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
static glh::matrix4f cached_mvp;
|
||||
static glh::matrix4f cached_inv_mdv;
|
||||
static glm::mat4 cached_mvp;
|
||||
static glm::mat4 cached_inv_mdv;
|
||||
static U32 cached_mvp_mdv_hash = 0xFFFFFFFF;
|
||||
static U32 cached_mvp_proj_hash = 0xFFFFFFFF;
|
||||
|
||||
static glh::matrix4f cached_normal;
|
||||
static glm::mat4 cached_normal;
|
||||
static U32 cached_normal_hash = 0xFFFFFFFF;
|
||||
|
||||
if (shader)
|
||||
|
|
@ -1028,15 +1033,15 @@ void LLRender::syncMatrices()
|
|||
U32 i = MM_MODELVIEW;
|
||||
if (mMatHash[MM_MODELVIEW] != shader->mMatHash[MM_MODELVIEW])
|
||||
{ //update modelview, normal, and MVP
|
||||
glh::matrix4f& mat = mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]];
|
||||
const glm::mat4& mat = mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]];
|
||||
|
||||
// if MDV has changed, update the cached inverse as well
|
||||
if (cached_mvp_mdv_hash != mMatHash[MM_MODELVIEW])
|
||||
{
|
||||
cached_inv_mdv = mat.inverse();
|
||||
cached_inv_mdv = glm::inverse(mat);
|
||||
}
|
||||
|
||||
shader->uniformMatrix4fv(name[MM_MODELVIEW], 1, GL_FALSE, mat.m);
|
||||
shader->uniformMatrix4fv(name[MM_MODELVIEW], 1, GL_FALSE, glm::value_ptr(mat));
|
||||
shader->mMatHash[MM_MODELVIEW] = mMatHash[MM_MODELVIEW];
|
||||
|
||||
//update normal matrix
|
||||
|
|
@ -1045,17 +1050,17 @@ void LLRender::syncMatrices()
|
|||
{
|
||||
if (cached_normal_hash != mMatHash[i])
|
||||
{
|
||||
cached_normal = cached_inv_mdv.transpose();
|
||||
cached_normal = glm::transpose(cached_inv_mdv);
|
||||
cached_normal_hash = mMatHash[i];
|
||||
}
|
||||
|
||||
glh::matrix4f& norm = cached_normal;
|
||||
auto norm = glm::value_ptr(cached_normal);
|
||||
|
||||
F32 norm_mat[] =
|
||||
{
|
||||
norm.m[0], norm.m[1], norm.m[2],
|
||||
norm.m[4], norm.m[5], norm.m[6],
|
||||
norm.m[8], norm.m[9], norm.m[10]
|
||||
norm[0], norm[1], norm[2],
|
||||
norm[4], norm[5], norm[6],
|
||||
norm[8], norm[9], norm[10]
|
||||
};
|
||||
|
||||
shader->uniformMatrix3fv(LLShaderMgr::NORMAL_MATRIX, 1, GL_FALSE, norm_mat);
|
||||
|
|
@ -1063,7 +1068,7 @@ void LLRender::syncMatrices()
|
|||
|
||||
if (shader->getUniformLocation(LLShaderMgr::INVERSE_MODELVIEW_MATRIX))
|
||||
{
|
||||
shader->uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_MATRIX, 1, GL_FALSE, cached_inv_mdv.m);
|
||||
shader->uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_MATRIX, 1, GL_FALSE, glm::value_ptr(cached_inv_mdv));
|
||||
}
|
||||
|
||||
//update MVP matrix
|
||||
|
|
@ -1076,36 +1081,36 @@ void LLRender::syncMatrices()
|
|||
if (cached_mvp_mdv_hash != mMatHash[i] || cached_mvp_proj_hash != mMatHash[MM_PROJECTION])
|
||||
{
|
||||
cached_mvp = mat;
|
||||
cached_mvp.mult_left(mMatrix[proj][mMatIdx[proj]]);
|
||||
cached_mvp = mMatrix[proj][mMatIdx[proj]] * cached_mvp;
|
||||
cached_mvp_mdv_hash = mMatHash[i];
|
||||
cached_mvp_proj_hash = mMatHash[MM_PROJECTION];
|
||||
}
|
||||
|
||||
shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m);
|
||||
shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, glm::value_ptr(cached_mvp));
|
||||
}
|
||||
}
|
||||
|
||||
i = MM_PROJECTION;
|
||||
if (mMatHash[MM_PROJECTION] != shader->mMatHash[MM_PROJECTION])
|
||||
{ //update projection matrix, normal, and MVP
|
||||
glh::matrix4f& mat = mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]];
|
||||
const glm::mat4& mat = mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]];
|
||||
|
||||
// GZ: This was previously disabled seemingly due to a bug involving the deferred renderer's regular pushing and popping of mats.
|
||||
// We're reenabling this and cleaning up the code around that - that would've been the appropriate course initially.
|
||||
// Anything beyond the standard proj and inv proj mats are special cases. Please setup special uniforms accordingly in the future.
|
||||
if (shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX))
|
||||
{
|
||||
glh::matrix4f inv_proj = mat.inverse();
|
||||
shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, false, inv_proj.m);
|
||||
glm::mat4 inv_proj = glm::inverse(mat);
|
||||
shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, false, glm::value_ptr(inv_proj));
|
||||
}
|
||||
|
||||
// Used by some full screen effects - such as full screen lights, glow, etc.
|
||||
if (shader->getUniformLocation(LLShaderMgr::IDENTITY_MATRIX))
|
||||
{
|
||||
shader->uniformMatrix4fv(LLShaderMgr::IDENTITY_MATRIX, 1, GL_FALSE, glh::matrix4f::identity().m);
|
||||
shader->uniformMatrix4fv(LLShaderMgr::IDENTITY_MATRIX, 1, GL_FALSE, glm::value_ptr(glm::identity<glm::mat4>()));
|
||||
}
|
||||
|
||||
shader->uniformMatrix4fv(name[MM_PROJECTION], 1, GL_FALSE, mat.m);
|
||||
shader->uniformMatrix4fv(name[MM_PROJECTION], 1, GL_FALSE, glm::value_ptr(mat));
|
||||
shader->mMatHash[MM_PROJECTION] = mMatHash[MM_PROJECTION];
|
||||
|
||||
if (!mvp_done)
|
||||
|
|
@ -1118,12 +1123,12 @@ void LLRender::syncMatrices()
|
|||
{
|
||||
U32 mdv = MM_MODELVIEW;
|
||||
cached_mvp = mat;
|
||||
cached_mvp.mult_right(mMatrix[mdv][mMatIdx[mdv]]);
|
||||
cached_mvp *= mMatrix[mdv][mMatIdx[mdv]];
|
||||
cached_mvp_mdv_hash = mMatHash[MM_MODELVIEW];
|
||||
cached_mvp_proj_hash = mMatHash[MM_PROJECTION];
|
||||
}
|
||||
|
||||
shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, cached_mvp.m);
|
||||
shader->uniformMatrix4fv(LLShaderMgr::MODELVIEW_PROJECTION_MATRIX, 1, GL_FALSE, glm::value_ptr(cached_mvp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1132,7 +1137,7 @@ void LLRender::syncMatrices()
|
|||
{
|
||||
if (mMatHash[i] != shader->mMatHash[i])
|
||||
{
|
||||
shader->uniformMatrix4fv(name[i], 1, GL_FALSE, mMatrix[i][mMatIdx[i]].m);
|
||||
shader->uniformMatrix4fv(name[i], 1, GL_FALSE, glm::value_ptr(mMatrix[i][mMatIdx[i]]));
|
||||
shader->mMatHash[i] = mMatHash[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -1151,12 +1156,7 @@ void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
|||
flush();
|
||||
|
||||
{
|
||||
glh::matrix4f trans_mat(1,0,0,x,
|
||||
0,1,0,y,
|
||||
0,0,1,z,
|
||||
0,0,0,1);
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(trans_mat);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::translate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z));
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1166,12 +1166,7 @@ void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
|||
flush();
|
||||
|
||||
{
|
||||
glh::matrix4f scale_mat(x,0,0,0,
|
||||
0,y,0,0,
|
||||
0,0,z,0,
|
||||
0,0,0,1);
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(scale_mat);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::scale(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z));
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1181,13 +1176,7 @@ void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zF
|
|||
flush();
|
||||
|
||||
{
|
||||
|
||||
glh::matrix4f ortho_mat(2.f/(right-left),0,0, -(right+left)/(right-left),
|
||||
0,2.f/(top-bottom),0, -(top+bottom)/(top-bottom),
|
||||
0,0,-2.f/(zFar-zNear), -(zFar+zNear)/(zFar-zNear),
|
||||
0,0,0,1);
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(ortho_mat);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::ortho(left, right, bottom, top, zNear, zFar);
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1197,19 +1186,7 @@ void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, con
|
|||
flush();
|
||||
|
||||
{
|
||||
F32 r = a * DEG_TO_RAD;
|
||||
|
||||
F32 c = cosf(r);
|
||||
F32 s = sinf(r);
|
||||
|
||||
F32 ic = 1.f-c;
|
||||
|
||||
glh::matrix4f rot_mat(x*x*ic+c, x*y*ic-z*s, x*z*ic+y*s, 0,
|
||||
x*y*ic+z*s, y*y*ic+c, y*z*ic-x*s, 0,
|
||||
x*z*ic-y*s, y*z*ic+x*s, z*z*ic+c, 0,
|
||||
0,0,0,1);
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(rot_mat);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::rotate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::radians(a), glm::vec3(x,y,z));
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1251,7 +1228,7 @@ void LLRender::loadMatrix(const GLfloat* m)
|
|||
{
|
||||
flush();
|
||||
{
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].set_value((GLfloat*) m);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::make_mat4((GLfloat*) m);
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1260,9 +1237,7 @@ void LLRender::multMatrix(const GLfloat* m)
|
|||
{
|
||||
flush();
|
||||
{
|
||||
glh::matrix4f mat((GLfloat*) m);
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(mat);
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::make_mat4(m);
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1305,17 +1280,17 @@ void LLRender::loadIdentity()
|
|||
{
|
||||
llassert_always(mMatrixMode < NUM_MATRIX_MODES) ;
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity();
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::identity<glm::mat4>();
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
}
|
||||
|
||||
const glh::matrix4f& LLRender::getModelviewMatrix()
|
||||
const glm::mat4& LLRender::getModelviewMatrix()
|
||||
{
|
||||
return mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]];
|
||||
}
|
||||
|
||||
const glh::matrix4f& LLRender::getProjectionMatrix()
|
||||
const glm::mat4& LLRender::getProjectionMatrix()
|
||||
{
|
||||
return mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]];
|
||||
}
|
||||
|
|
@ -2270,85 +2245,90 @@ void LLRender::debugTexUnits(void)
|
|||
LL_INFOS("TextureUnit") << "Active TexUnit Enabled : " << active_enabled << LL_ENDL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
glh::matrix4f copy_matrix(F32* src)
|
||||
glm::mat4 get_current_modelview()
|
||||
{
|
||||
glh::matrix4f ret;
|
||||
ret.set_value(src);
|
||||
return ret;
|
||||
return glm::make_mat4(gGLModelView);
|
||||
}
|
||||
|
||||
glh::matrix4f get_current_modelview()
|
||||
glm::mat4 get_current_projection()
|
||||
{
|
||||
return copy_matrix(gGLModelView);
|
||||
return glm::make_mat4(gGLProjection);
|
||||
}
|
||||
|
||||
glh::matrix4f get_current_projection()
|
||||
glm::mat4 get_last_modelview()
|
||||
{
|
||||
return copy_matrix(gGLProjection);
|
||||
return glm::make_mat4(gGLLastModelView);
|
||||
}
|
||||
|
||||
glh::matrix4f get_last_modelview()
|
||||
glm::mat4 get_last_projection()
|
||||
{
|
||||
return copy_matrix(gGLLastModelView);
|
||||
return glm::make_mat4(gGLLastProjection);
|
||||
}
|
||||
|
||||
glh::matrix4f get_last_projection()
|
||||
{
|
||||
return copy_matrix(gGLLastProjection);
|
||||
}
|
||||
|
||||
void copy_matrix(const glh::matrix4f& src, F32* dst)
|
||||
void copy_matrix(const glm::mat4& src, F32* dst)
|
||||
{
|
||||
auto matp = glm::value_ptr(src);
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
dst[i] = src.m[i];
|
||||
dst[i] = matp[i];
|
||||
}
|
||||
}
|
||||
|
||||
void set_current_modelview(const glh::matrix4f& mat)
|
||||
void set_current_modelview(const glm::mat4& mat)
|
||||
{
|
||||
copy_matrix(mat, gGLModelView);
|
||||
}
|
||||
|
||||
void set_current_projection(glh::matrix4f& mat)
|
||||
void set_current_projection(const glm::mat4& mat)
|
||||
{
|
||||
copy_matrix(mat, gGLProjection);
|
||||
}
|
||||
|
||||
glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar)
|
||||
void set_last_modelview(const glm::mat4& mat)
|
||||
{
|
||||
glh::matrix4f ret(
|
||||
2.f/(right-left), 0.f, 0.f, -(right+left)/(right-left),
|
||||
0.f, 2.f/(top-bottom), 0.f, -(top+bottom)/(top-bottom),
|
||||
0.f, 0.f, -2.f/(zfar-znear), -(zfar+znear)/(zfar-znear),
|
||||
0.f, 0.f, 0.f, 1.f);
|
||||
|
||||
return ret;
|
||||
copy_matrix(mat, gGLLastModelView);
|
||||
}
|
||||
|
||||
glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
|
||||
void set_last_projection(const glm::mat4& mat)
|
||||
{
|
||||
GLfloat f = 1.f/tanf(DEG_TO_RAD*fovy/2.f);
|
||||
|
||||
return glh::matrix4f(f/aspect, 0, 0, 0,
|
||||
0, f, 0, 0,
|
||||
0, 0, (zFar+zNear)/(zNear-zFar), (2.f*zFar*zNear)/(zNear-zFar),
|
||||
0, 0, -1.f, 0);
|
||||
copy_matrix(mat, gGLLastProjection);
|
||||
}
|
||||
|
||||
glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up)
|
||||
glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec)
|
||||
{
|
||||
LLVector3 f = center-eye;
|
||||
f.normVec();
|
||||
up.normVec();
|
||||
LLVector3 s = f % up;
|
||||
LLVector3 u = s % f;
|
||||
//const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
|
||||
//return glm::vec3(
|
||||
// (vec[0] * mat[0][0] + vec[1] * mat[1][0] + vec[2] * mat[2][0] + mat[3][0]) / w,
|
||||
// (vec[0] * mat[0][1] + vec[1] * mat[1][1] + vec[2] * mat[2][1] + mat[3][1]) / w,
|
||||
// (vec[0] * mat[0][2] + vec[1] * mat[1][2] + vec[2] * mat[2][2] + mat[3][2]) / w
|
||||
//);
|
||||
LLVector4a x, y, z, s, t, p, q;
|
||||
|
||||
return glh::matrix4f(s[0], s[1], s[2], 0,
|
||||
u[0], u[1], u[2], 0,
|
||||
-f[0], -f[1], -f[2], 0,
|
||||
0, 0, 0, 1);
|
||||
x.splat(vec.x);
|
||||
y.splat(vec.y);
|
||||
z.splat(vec.z);
|
||||
|
||||
s.splat<3>(mat[0].data);
|
||||
t.splat<3>(mat[1].data);
|
||||
p.splat<3>(mat[2].data);
|
||||
q.splat<3>(mat[3].data);
|
||||
|
||||
s.mul(x);
|
||||
t.mul(y);
|
||||
p.mul(z);
|
||||
q.add(s);
|
||||
t.add(p);
|
||||
q.add(t);
|
||||
|
||||
x.mul(mat[0].data);
|
||||
y.mul(mat[1].data);
|
||||
z.mul(mat[2].data);
|
||||
|
||||
x.add(y);
|
||||
z.add(mat[3].data);
|
||||
LLVector4a res;
|
||||
res.load3(glm::value_ptr(vec));
|
||||
res.setAdd(x, z);
|
||||
res.div(q);
|
||||
return glm::make_vec3(res.getF32ptr());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,17 +42,7 @@
|
|||
#include "llpointer.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llmatrix4a.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#endif
|
||||
|
||||
#include "glh/glh_linear.h"
|
||||
|
||||
#if LL_LINUX && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) >= 70000
|
||||
#pragma GCC diagnostic push
|
||||
#endif
|
||||
#include "glm/mat4x4.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <list>
|
||||
|
|
@ -412,8 +402,8 @@ public:
|
|||
void matrixMode(eMatrixMode mode);
|
||||
eMatrixMode getMatrixMode();
|
||||
|
||||
const glh::matrix4f& getModelviewMatrix();
|
||||
const glh::matrix4f& getProjectionMatrix();
|
||||
const glm::mat4& getModelviewMatrix();
|
||||
const glm::mat4& getProjectionMatrix();
|
||||
|
||||
void syncMatrices();
|
||||
void syncLightState();
|
||||
|
|
@ -515,7 +505,7 @@ private:
|
|||
eMatrixMode mMatrixMode;
|
||||
U32 mMatIdx[NUM_MATRIX_MODES];
|
||||
U32 mMatHash[NUM_MATRIX_MODES];
|
||||
glh::matrix4f mMatrix[NUM_MATRIX_MODES][LL_MATRIX_STACK_DEPTH];
|
||||
glm::mat4 mMatrix[NUM_MATRIX_MODES][LL_MATRIX_STACK_DEPTH];
|
||||
U32 mCurMatHash[NUM_MATRIX_MODES];
|
||||
U32 mLightHash;
|
||||
LLColor4 mAmbientLightColor;
|
||||
|
|
@ -555,8 +545,8 @@ extern F32 gGLLastModelView[16];
|
|||
extern F32 gGLLastProjection[16];
|
||||
extern F32 gGLProjection[16];
|
||||
extern S32 gGLViewport[4];
|
||||
extern F32 gGLDeltaModelView[16];
|
||||
extern F32 gGLInverseDeltaModelView[16];
|
||||
extern glm::mat4 gGLDeltaModelView;
|
||||
extern glm::mat4 gGLInverseDeltaModelView;
|
||||
|
||||
extern thread_local LLRender gGL;
|
||||
|
||||
|
|
@ -567,19 +557,20 @@ const F32 OGL_TO_CFR_ROTATION[16] = { 0.f, 0.f, -1.f, 0.f, // -Z becomes X
|
|||
0.f, 1.f, 0.f, 0.f, // Y becomes Z
|
||||
0.f, 0.f, 0.f, 1.f };
|
||||
|
||||
glh::matrix4f copy_matrix(F32* src);
|
||||
glh::matrix4f get_current_modelview();
|
||||
glh::matrix4f get_current_projection();
|
||||
glh::matrix4f get_last_modelview();
|
||||
glh::matrix4f get_last_projection();
|
||||
glm::mat4 copy_matrix(F32* src);
|
||||
glm::mat4 get_current_modelview();
|
||||
glm::mat4 get_current_projection();
|
||||
glm::mat4 get_last_modelview();
|
||||
glm::mat4 get_last_projection();
|
||||
|
||||
void copy_matrix(const glh::matrix4f& src, F32* dst);
|
||||
void set_current_modelview(const glh::matrix4f& mat);
|
||||
void set_current_projection(glh::matrix4f& mat);
|
||||
void copy_matrix(const glm::mat4& src, F32* dst);
|
||||
void set_current_modelview(const glm::mat4& mat);
|
||||
void set_current_projection(const glm::mat4& mat);
|
||||
void set_last_modelview(const glm::mat4& mat);
|
||||
void set_last_projection(const glm::mat4& mat);
|
||||
|
||||
glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar);
|
||||
glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
|
||||
glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up);
|
||||
// glh compat
|
||||
glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec);
|
||||
|
||||
#define LL_SHADER_LOADING_WARNS(...) LL_WARNS()
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "llshadermgr.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llmemory.h"
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
//Next Highest Power Of Two
|
||||
//helper function, returns first number > v that is a power of 2, or v if v is already a power of 2
|
||||
|
|
@ -591,13 +592,13 @@ void LLVertexBufferData::draw()
|
|||
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(mModelView.m);
|
||||
gGL.loadMatrix(glm::value_ptr(mModelView));
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(mProjection.m);
|
||||
gGL.loadMatrix(glm::value_ptr(mProjection));
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE0);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(mTexture0.m);
|
||||
gGL.loadMatrix(glm::value_ptr(mTexture0));
|
||||
|
||||
mVB->setBuffer();
|
||||
|
||||
|
|
@ -1320,6 +1321,9 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count)
|
|||
void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8* dst)
|
||||
{
|
||||
#if LL_DARWIN
|
||||
// on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call
|
||||
// _mapBuffer to tag the buffer for flushing to GL
|
||||
_mapBuffer();
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy");
|
||||
STOP_GLERROR;
|
||||
// copy into mapped buffer
|
||||
|
|
@ -1621,16 +1625,10 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4a>& strider, U32 i
|
|||
void LLVertexBuffer::setBuffer()
|
||||
{
|
||||
STOP_GLERROR;
|
||||
#if LL_DARWIN
|
||||
if (!mGLBuffer)
|
||||
{ // OS X doesn't allocate a buffer until we call unmapBuffer
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mMapped)
|
||||
{
|
||||
LL_WARNS() << "Missing call to unmapBuffer or flushBuffers" << LL_ENDL;
|
||||
LL_WARNS_ONCE() << "Missing call to unmapBuffer or flushBuffers" << LL_ENDL;
|
||||
_unmapBuffer();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#define LL_MAX_VERTEX_ATTRIB_LOCATION 64
|
||||
|
||||
|
|
@ -63,8 +64,11 @@ public:
|
|||
, mMode(0)
|
||||
, mCount(0)
|
||||
, mTexName(0)
|
||||
, mProjection(glm::identity<glm::mat4>())
|
||||
, mModelView(glm::identity<glm::mat4>())
|
||||
, mTexture0(glm::identity<glm::mat4>())
|
||||
{}
|
||||
LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, glh::matrix4f model_view, glh::matrix4f projection, glh::matrix4f texture0)
|
||||
LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, const glm::mat4& model_view, const glm::mat4& projection, const glm::mat4& texture0)
|
||||
: mVB(buffer)
|
||||
, mMode(mode)
|
||||
, mCount(count)
|
||||
|
|
@ -78,9 +82,9 @@ public:
|
|||
U8 mMode;
|
||||
U32 mCount;
|
||||
U32 mTexName;
|
||||
glh::matrix4f mProjection;
|
||||
glh::matrix4f mModelView;
|
||||
glh::matrix4f mTexture0;
|
||||
glm::mat4 mProjection;
|
||||
glm::mat4 mModelView;
|
||||
glm::mat4 mTexture0;
|
||||
};
|
||||
typedef std::list<LLVertexBufferData> buffer_data_list_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -668,18 +668,7 @@ void LLUrlEntryAgent::callObservers(const std::string &id,
|
|||
void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,
|
||||
const LLAvatarName& av_name)
|
||||
{
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
|
||||
//if (it != mAvatarNameCacheConnections.end())
|
||||
//{
|
||||
// if (it->second.connected())
|
||||
// {
|
||||
// it->second.disconnect();
|
||||
// }
|
||||
// mAvatarNameCacheConnections.erase(it);
|
||||
//}
|
||||
std::pair<avatar_name_cache_connection_map_t::iterator, avatar_name_cache_connection_map_t::iterator> range;
|
||||
range = mAvatarNameCacheConnections.equal_range(id);
|
||||
auto range = mAvatarNameCacheConnections.equal_range(id);
|
||||
for (avatar_name_cache_connection_map_t::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (it->second.connected())
|
||||
|
|
@ -688,7 +677,6 @@ void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,
|
|||
}
|
||||
}
|
||||
mAvatarNameCacheConnections.erase(range.first, range.second);
|
||||
// </FS:Ansariel>
|
||||
|
||||
std::string label = av_name.getCompleteName();
|
||||
|
||||
|
|
@ -775,20 +763,8 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
|
|||
}
|
||||
else
|
||||
{
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
|
||||
//if (it != mAvatarNameCacheConnections.end())
|
||||
//{
|
||||
// if (it->second.connected())
|
||||
// {
|
||||
// it->second.disconnect();
|
||||
// }
|
||||
// mAvatarNameCacheConnections.erase(it);
|
||||
//}
|
||||
//mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
|
||||
boost::signals2::connection connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
|
||||
mAvatarNameCacheConnections.insert(std::make_pair(agent_id, connection));
|
||||
// </FS:Ansariel>
|
||||
mAvatarNameCacheConnections.emplace(agent_id, LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)));
|
||||
|
||||
addObserver(agent_id_string, url, cb);
|
||||
return LLTrans::getString("AvatarNameWaiting");
|
||||
}
|
||||
|
|
@ -853,20 +829,9 @@ LLUrlEntryAgentName::LLUrlEntryAgentName()
|
|||
{}
|
||||
|
||||
void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id,
|
||||
const LLAvatarName& av_name)
|
||||
const LLAvatarName& av_name)
|
||||
{
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
|
||||
//if (it != mAvatarNameCacheConnections.end())
|
||||
//{
|
||||
// if (it->second.connected())
|
||||
// {
|
||||
// it->second.disconnect();
|
||||
// }
|
||||
// mAvatarNameCacheConnections.erase(it);
|
||||
//}
|
||||
std::pair<avatar_name_cache_connection_map_t::iterator, avatar_name_cache_connection_map_t::iterator> range;
|
||||
range = mAvatarNameCacheConnections.equal_range(id);
|
||||
auto range = mAvatarNameCacheConnections.equal_range(id);
|
||||
for (avatar_name_cache_connection_map_t::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (it->second.connected())
|
||||
|
|
@ -875,7 +840,6 @@ void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id,
|
|||
}
|
||||
}
|
||||
mAvatarNameCacheConnections.erase(range.first, range.second);
|
||||
// </FS:Ansariel>
|
||||
|
||||
std::string label = getName(av_name);
|
||||
// received the agent name from the server - tell our observers
|
||||
|
|
@ -910,20 +874,8 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab
|
|||
}
|
||||
else
|
||||
{
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
|
||||
//if (it != mAvatarNameCacheConnections.end())
|
||||
//{
|
||||
// if (it->second.connected())
|
||||
// {
|
||||
// it->second.disconnect();
|
||||
// }
|
||||
// mAvatarNameCacheConnections.erase(it);
|
||||
//}
|
||||
//mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2));
|
||||
boost::signals2::connection connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2));
|
||||
mAvatarNameCacheConnections.insert(std::make_pair(agent_id, connection));
|
||||
// </FS:Ansariel>
|
||||
mAvatarNameCacheConnections.emplace(agent_id, LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)));
|
||||
|
||||
addObserver(agent_id_string, url, cb);
|
||||
return LLTrans::getString("AvatarNameWaiting");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,10 +246,8 @@ protected:
|
|||
/*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon);
|
||||
private:
|
||||
void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
|
||||
|
||||
typedef std::multimap<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
|
||||
// </FS:Ansariel>
|
||||
avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
|
||||
};
|
||||
|
||||
|
|
@ -280,10 +278,8 @@ protected:
|
|||
virtual std::string getName(const LLAvatarName& avatar_name) = 0;
|
||||
private:
|
||||
void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
|
||||
// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
|
||||
//typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
|
||||
|
||||
typedef std::multimap<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
|
||||
// </FS:Ansariel>
|
||||
avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ include(LLImage)
|
|||
include(LLWindow)
|
||||
include(UI)
|
||||
include(ViewerMiscLibs)
|
||||
include(GLM)
|
||||
|
||||
set(llwindow_SOURCE_FILES
|
||||
llcursortypes.cpp
|
||||
|
|
@ -54,7 +55,7 @@ set(llwindow_LINK_LIBRARIES
|
|||
llrender
|
||||
llfilesystem
|
||||
llxml
|
||||
ll::glh_linear
|
||||
ll::glm
|
||||
ll::glext
|
||||
ll::uilibraries
|
||||
ll::SDL
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef LL_LLDRAGDROP32_H
|
||||
#define LL_LLDRAGDROP32_H
|
||||
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <ole2.h>
|
||||
|
||||
class LLDragDropWin32
|
||||
|
|
@ -54,7 +54,7 @@ class LLDragDropWin32
|
|||
#ifndef LL_LLDRAGDROP32_H
|
||||
#define LL_LLDRAGDROP32_H
|
||||
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <ole2.h>
|
||||
|
||||
// impostor class that does nothing
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include "llkeyboardwin32.h"
|
||||
|
||||
#include "llwindowcallbacks.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#define LL_LLWINDOWWIN32_H
|
||||
|
||||
// Limit Windows API to small and manageable set.
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
|
|
|||
|
|
@ -807,10 +807,10 @@ void GLTFSceneManager::bind(Asset& asset, Material& material)
|
|||
|
||||
LLMatrix4a inverse(const LLMatrix4a& mat)
|
||||
{
|
||||
glh::matrix4f m((F32*)mat.mMatrix);
|
||||
m = m.inverse();
|
||||
glm::mat4 m = glm::make_mat4((F32*)mat.mMatrix);
|
||||
m = glm::inverse(m);
|
||||
LLMatrix4a ret;
|
||||
ret.loadu(m.m);
|
||||
ret.loadu(glm::value_ptr(m));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ bool LLAttachmentsMgr::isAttachmentStateComplete() const
|
|||
//
|
||||
void LLAttachmentsMgr::checkInvalidCOFLinks()
|
||||
{
|
||||
if (!gInventory.isInventoryUsable())
|
||||
if (!gInventory.isInventoryUsable() || mQuestionableCOFLinks.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "lltrans.h"
|
||||
#include "llwindow.h" // beforeDialog()
|
||||
#include "llviewercontrol.h"
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
|
||||
#if LL_LINUX || LL_DARWIN
|
||||
# include "llfilepicker.h"
|
||||
|
|
|
|||
|
|
@ -460,11 +460,11 @@ namespace
|
|||
|
||||
void applyInjections(LLSettingsBase::Seconds delta)
|
||||
{
|
||||
this->mSettings = this->mSource->getSettings();
|
||||
LLSD settings = this->mSource->cloneSettings();
|
||||
|
||||
for (auto ito = mOverrideValues.beginMap(); ito != mOverrideValues.endMap(); ++ito)
|
||||
{
|
||||
this->mSettings[(*ito).first] = (*ito).second;
|
||||
settings[(*ito).first] = (*ito).second;
|
||||
}
|
||||
|
||||
const LLSettingsBase::stringset_t &slerps = this->getSlerpKeys();
|
||||
|
|
@ -476,7 +476,7 @@ namespace
|
|||
{
|
||||
std::string key_name = (*it)->mKeyName;
|
||||
|
||||
LLSD value = this->mSettings[key_name];
|
||||
LLSD value = settings[key_name];
|
||||
LLSD target = (*it)->mValue;
|
||||
|
||||
if ((*it)->mFirstTime)
|
||||
|
|
@ -492,11 +492,11 @@ namespace
|
|||
{
|
||||
mOverrideValues[key_name] = target;
|
||||
mOverrideExps[key_name] = (*it)->mExperience;
|
||||
this->mSettings[key_name] = target;
|
||||
settings[key_name] = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->mSettings.erase(key_name);
|
||||
settings.erase(key_name);
|
||||
}
|
||||
}
|
||||
else if (specials.find(key_name) != specials.end())
|
||||
|
|
@ -507,8 +507,8 @@ namespace
|
|||
{
|
||||
if (!(*it)->mBlendIn)
|
||||
mix = 1.0 - mix;
|
||||
(*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, slerps);
|
||||
this->mSettings[key_name] = (*it)->mLastValue;
|
||||
(*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, skips, slerps);
|
||||
settings[key_name] = (*it)->mLastValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -527,7 +527,7 @@ namespace
|
|||
{
|
||||
mInjections.erase(mInjections.begin(), mInjections.end());
|
||||
}
|
||||
|
||||
this->setSettings(settings);
|
||||
}
|
||||
|
||||
bool hasInjections() const
|
||||
|
|
@ -692,7 +692,8 @@ namespace
|
|||
if (!injection->mBlendIn)
|
||||
mix = 1.0 - mix;
|
||||
stringset_t dummy;
|
||||
F64 value = this->mSettings[injection->mKeyName].asReal();
|
||||
LLSD settings = this->cloneSettings();
|
||||
F64 value = settings[injection->mKeyName].asReal();
|
||||
if (this->getCloudNoiseTextureId().isNull())
|
||||
{
|
||||
value = 0; // there was no texture so start from zero coverage
|
||||
|
|
@ -702,7 +703,8 @@ namespace
|
|||
// with different transitions, don't ignore it
|
||||
F64 result = lerp((F32)value, (F32)injection->mValue.asReal(), (F32)mix);
|
||||
injection->mLastValue = LLSD::Real(result);
|
||||
this->mSettings[injection->mKeyName] = injection->mLastValue;
|
||||
settings[injection->mKeyName] = injection->mLastValue;
|
||||
this->setSettings(settings);
|
||||
}
|
||||
|
||||
// Unfortunately I don't have a per texture blend factor. We'll just pick the one that is furthest along.
|
||||
|
|
@ -1875,90 +1877,9 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
|
|||
{
|
||||
uniforms[i].clear();
|
||||
}
|
||||
|
||||
LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
|
||||
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
|
||||
LLSettingsBase::parammapping_t params = psetting->getParameterMap();
|
||||
for (auto &it: params)
|
||||
{
|
||||
LLSD value;
|
||||
// legacy first since it contains ambient color and we prioritize value from legacy, see getAmbientColor()
|
||||
if (psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first))
|
||||
{
|
||||
value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
|
||||
}
|
||||
else if (psetting->mSettings.has(it.first))
|
||||
{
|
||||
value = psetting->mSettings[it.first];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need to reset shaders, use defaults
|
||||
value = it.second.getDefaultValue();
|
||||
}
|
||||
|
||||
LLSD::Type setting_type = value.type();
|
||||
stop_glerror();
|
||||
switch (setting_type)
|
||||
{
|
||||
case LLSD::TypeInteger:
|
||||
shader->uniform1i(it.second.getShaderKey(), value.asInteger());
|
||||
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
|
||||
break;
|
||||
case LLSD::TypeReal:
|
||||
shader->uniform1f(it.second.getShaderKey(), (F32)value.asReal());
|
||||
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
|
||||
break;
|
||||
|
||||
case LLSD::TypeBoolean:
|
||||
shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0);
|
||||
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
|
||||
break;
|
||||
|
||||
case LLSD::TypeArray:
|
||||
{
|
||||
LLVector4 vect4(value);
|
||||
// always identify as a radiance pass if desaturating irradiance is disabled
|
||||
static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
|
||||
|
||||
if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
|
||||
{ // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
|
||||
auto max_vec = [](LLVector4 col)
|
||||
{
|
||||
LLColor3 color(col);
|
||||
F32 h, s, l;
|
||||
color.calcHSL(&h, &s, &l);
|
||||
|
||||
col.mV[0] = col.mV[1] = col.mV[2] = l;
|
||||
return col;
|
||||
};
|
||||
|
||||
switch (it.second.getShaderKey())
|
||||
{
|
||||
case LLShaderMgr::BLUE_HORIZON:
|
||||
case LLShaderMgr::BLUE_DENSITY:
|
||||
vect4 = max_vec(vect4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
|
||||
shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) );
|
||||
break;
|
||||
}
|
||||
|
||||
// case LLSD::TypeMap:
|
||||
// case LLSD::TypeString:
|
||||
// case LLSD::TypeUUID:
|
||||
// case LLSD::TypeURI:
|
||||
// case LLSD::TypeBinary:
|
||||
// case LLSD::TypeDate:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
|
||||
|
||||
psetting->applyToUniforms(uniforms);
|
||||
psetting->applySpecial(uniforms);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1558,9 +1558,9 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
}
|
||||
|
||||
//TODO -- cache this (check profile marker above)?
|
||||
glh::matrix4f m((F32*) skin->mBindShapeMatrix.getF32ptr());
|
||||
m = m.inverse().transpose();
|
||||
mat_normal.loadu(m.m);
|
||||
glm::mat4 m = glm::make_mat4((F32*)skin->mBindShapeMatrix.getF32ptr());
|
||||
m = glm::transpose(glm::inverse(m));
|
||||
mat_normal.loadu(glm::value_ptr(m));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -471,10 +471,10 @@ bool LLGLTFPreviewTexture::render()
|
|||
PreviewSphere& preview_sphere = get_preview_sphere(mGLTFMaterial, object_transform);
|
||||
|
||||
gPipeline.setupHWLights();
|
||||
glh::matrix4f mat = copy_matrix(gGLModelView);
|
||||
glh::vec4f transformed_light_dir(light_dir.mV);
|
||||
mat.mult_matrix_vec(transformed_light_dir);
|
||||
SetTemporarily<LLVector4> force_sun_direction_high_graphics(&gPipeline.mTransformedSunDir, LLVector4(transformed_light_dir.v));
|
||||
glm::mat4 mat = get_current_modelview();
|
||||
glm::vec4 transformed_light_dir = glm::make_vec4(light_dir.mV);
|
||||
transformed_light_dir = mat * transformed_light_dir;
|
||||
SetTemporarily<LLVector4> force_sun_direction_high_graphics(&gPipeline.mTransformedSunDir, LLVector4(glm::value_ptr(transformed_light_dir)));
|
||||
// Override lights to ensure the sun is always shining from a certain direction (low graphics)
|
||||
// See also force_sun_direction_high_graphics and fixup_shader_constants
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@
|
|||
#include "llviewerwindow.h"
|
||||
#include "llui.h"
|
||||
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
|
||||
LLFontVertexBuffer *font_buffer,
|
||||
const LLFontGL &font,
|
||||
|
|
@ -102,26 +105,10 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
|
|||
|
||||
//get the render_pos in screen space
|
||||
|
||||
F64 winX, winY, winZ;
|
||||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
S32 viewport[4];
|
||||
viewport[0] = world_view_rect.mLeft;
|
||||
viewport[1] = world_view_rect.mBottom;
|
||||
viewport[2] = world_view_rect.getWidth();
|
||||
viewport[3] = world_view_rect.getHeight();
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
|
||||
F64 mdlv[16];
|
||||
F64 proj[16];
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
mdlv[i] = (F64) gGLModelView[i];
|
||||
proj[i] = (F64) gGLProjection[i];
|
||||
}
|
||||
|
||||
gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2],
|
||||
mdlv, proj, (GLint*) viewport,
|
||||
&winX, &winY, &winZ);
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(render_pos.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
//fonts all render orthographically, set up projection``
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
|
|
@ -133,11 +120,11 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
|
|||
gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
gViewerWindow->setup3DViewport();
|
||||
|
||||
winX -= world_view_rect.mLeft;
|
||||
winY -= world_view_rect.mBottom;
|
||||
win_coord.x -= world_view_rect.mLeft;
|
||||
win_coord.y -= world_view_rect.mBottom;
|
||||
LLUI::loadIdentity();
|
||||
gGL.loadIdentity();
|
||||
LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
|
||||
LLUI::translate((F32) win_coord.x*1.0f/LLFontGL::sScaleX, (F32) win_coord.y*1.0f/(LLFontGL::sScaleY), -(((F32) win_coord.z*2.f)-1.f));
|
||||
F32 right_x;
|
||||
|
||||
if (font_buffer)
|
||||
|
|
|
|||
|
|
@ -1704,9 +1704,9 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
|
|||
normal = -normal;
|
||||
}
|
||||
F32 d = -(selection_center * normal);
|
||||
glh::vec4f plane(normal.mV[0], normal.mV[1], normal.mV[2], d );
|
||||
glm::vec4 plane(normal.mV[0], normal.mV[1], normal.mV[2], d );
|
||||
|
||||
gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane);
|
||||
plane = glm::inverse(gGL.getModelviewMatrix()) * plane;
|
||||
|
||||
static LLStaticHashedString sClipPlane("clip_plane");
|
||||
gClipProgram.uniform4fv(sClipPlane, 1, plane.v);
|
||||
|
|
|
|||
|
|
@ -3844,9 +3844,9 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
|
|||
LLMatrix4a mat_normal;
|
||||
if (skinned)
|
||||
{
|
||||
glh::matrix4f m((F32*)mdl->mSkinInfo.mBindShapeMatrix.getF32ptr());
|
||||
m = m.inverse().transpose();
|
||||
mat_normal.loadu(m.m);
|
||||
glm::mat4 m = glm::make_mat4((F32*)mdl->mSkinInfo.mBindShapeMatrix.getF32ptr());
|
||||
m = glm::transpose(glm::inverse(m));
|
||||
mat_normal.loadu(glm::value_ptr(m));
|
||||
}
|
||||
|
||||
S32 num_faces = mdl->getNumVolumeFaces();
|
||||
|
|
|
|||
|
|
@ -63,11 +63,10 @@
|
|||
#include "llfloatertools.h" // to enable hide if build tools are up
|
||||
#include "llvector4a.h"
|
||||
|
||||
// Functions pulled from pipeline.cpp
|
||||
glh::matrix4f get_current_modelview();
|
||||
glh::matrix4f get_current_projection();
|
||||
#include <glm/gtx/transform2.hpp>
|
||||
|
||||
// Functions pulled from llviewerdisplay.cpp
|
||||
bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model);
|
||||
bool get_hud_matrices(glm::mat4 &proj, glm::mat4 &model);
|
||||
|
||||
// Warning: make sure these two match!
|
||||
const LLPanelPrimMediaControls::EZoomLevel LLPanelPrimMediaControls::kZoomLevels[] = { ZOOM_NONE, ZOOM_MEDIUM };
|
||||
|
|
@ -648,13 +647,13 @@ void LLPanelPrimMediaControls::updateShape()
|
|||
vert_it = vect_face.begin();
|
||||
vert_end = vect_face.end();
|
||||
|
||||
glh::matrix4f mat;
|
||||
glm::mat4 mat;
|
||||
if (!is_hud)
|
||||
{
|
||||
mat = get_current_projection() * get_current_modelview();
|
||||
}
|
||||
else {
|
||||
glh::matrix4f proj, modelview;
|
||||
glm::mat4 proj, modelview;
|
||||
if (get_hud_matrices(proj, modelview))
|
||||
mat = proj * modelview;
|
||||
}
|
||||
|
|
@ -663,11 +662,11 @@ void LLPanelPrimMediaControls::updateShape()
|
|||
for(; vert_it != vert_end; ++vert_it)
|
||||
{
|
||||
// project silhouette vertices into screen space
|
||||
glh::vec3f screen_vert = glh::vec3f(vert_it->mV);
|
||||
mat.mult_matrix_vec(screen_vert);
|
||||
glm::vec3 screen_vert(glm::make_vec3(vert_it->mV));
|
||||
screen_vert = mul_mat4_vec3(mat, screen_vert);
|
||||
|
||||
// add to screenspace bounding box
|
||||
update_min_max(min, max, LLVector3(screen_vert.v));
|
||||
update_min_max(min, max, LLVector3(glm::value_ptr(screen_vert)));
|
||||
}
|
||||
|
||||
// convert screenspace bbox to pixels (in screen coords)
|
||||
|
|
|
|||
|
|
@ -253,23 +253,22 @@ bool LLReflectionMap::getBox(LLMatrix4& box)
|
|||
LLVolume* volume = mViewerObject->getVolume();
|
||||
if (volume && mViewerObject->getReflectionProbeIsBox())
|
||||
{
|
||||
glh::matrix4f mv(gGLModelView);
|
||||
glh::matrix4f scale;
|
||||
glm::mat4 mv(get_current_modelview());
|
||||
LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f));
|
||||
mRadius = s.magVec();
|
||||
scale.set_scale(glh::vec3f(s.mV));
|
||||
glm::mat4 scale = glm::scale(glm::make_vec3(s.mV));
|
||||
if (mViewerObject->mDrawable != nullptr)
|
||||
{
|
||||
// object to agent space (no scale)
|
||||
glh::matrix4f rm((F32*)mViewerObject->mDrawable->getWorldMatrix().mMatrix);
|
||||
glm::mat4 rm(glm::make_mat4((F32*)mViewerObject->mDrawable->getWorldMatrix().mMatrix));
|
||||
|
||||
// construct object to camera space (with scale)
|
||||
mv = mv * rm * scale;
|
||||
|
||||
// inverse is camera space to object unit cube
|
||||
mv = mv.inverse();
|
||||
mv = glm::inverse(mv);
|
||||
|
||||
box = LLMatrix4(mv.m);
|
||||
box = LLMatrix4(glm::value_ptr(mv));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#ifndef LLSECAPI_H
|
||||
#define LLSECAPI_H
|
||||
#include <vector>
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <ostream>
|
||||
#include "llpointer.h"
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
|
|||
return skyp;
|
||||
}
|
||||
|
||||
LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const
|
||||
LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
|
||||
{
|
||||
LLSD settings = cloneSettings();
|
||||
U32 flags = getFlags();
|
||||
|
|
@ -684,6 +684,67 @@ void LLSettingsVOSky::updateSettings()
|
|||
gSky.setMoonScale(getMoonScale());
|
||||
}
|
||||
|
||||
void draw_color(LLShaderUniforms* shader, const LLColor3& col, S32 shader_key)
|
||||
{
|
||||
// always identify as a radiance pass if desaturating irradiance is disabled
|
||||
static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
|
||||
|
||||
LLVector4 vect4(col.mV[0], col.mV[1], col.mV[2]);
|
||||
|
||||
if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
|
||||
{ // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
|
||||
auto max_vec = [](LLVector4 col)
|
||||
{
|
||||
LLColor3 color(col);
|
||||
F32 h, s, l;
|
||||
color.calcHSL(&h, &s, &l);
|
||||
|
||||
col.mV[0] = col.mV[1] = col.mV[2] = l;
|
||||
return col;
|
||||
};
|
||||
|
||||
switch (shader_key)
|
||||
{
|
||||
case LLShaderMgr::BLUE_HORIZON:
|
||||
case LLShaderMgr::BLUE_DENSITY:
|
||||
vect4 = max_vec(vect4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
|
||||
shader->uniform3fv(shader_key, LLVector3(vect4.mV));
|
||||
}
|
||||
|
||||
inline void draw_real(LLShaderUniforms* shader, F32 value, S32 shader_key)
|
||||
{
|
||||
shader->uniform1f(shader_key, value);
|
||||
}
|
||||
|
||||
void LLSettingsVOSky::applyToUniforms(void* ptarget)
|
||||
{
|
||||
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_ANY];
|
||||
|
||||
draw_color(shader, getAmbientColor(), LLShaderMgr::AMBIENT);
|
||||
draw_color(shader, getBlueDensity(), LLShaderMgr::BLUE_DENSITY);
|
||||
draw_color(shader, getBlueHorizon(), LLShaderMgr::BLUE_HORIZON);
|
||||
draw_real(shader, getHazeDensity(), LLShaderMgr::HAZE_DENSITY);
|
||||
draw_real(shader, getHazeHorizon(), LLShaderMgr::HAZE_HORIZON);
|
||||
draw_real(shader, getDensityMultiplier(), LLShaderMgr::DENSITY_MULTIPLIER);
|
||||
draw_real(shader, getDistanceMultiplier(), LLShaderMgr::DISTANCE_MULTIPLIER);
|
||||
draw_color(shader, getCloudPosDensity2(), LLShaderMgr::CLOUD_POS_DENSITY2);
|
||||
draw_real(shader, getCloudScale(), LLShaderMgr::CLOUD_SCALE);
|
||||
draw_real(shader, getCloudShadow(), LLShaderMgr::CLOUD_SHADOW);
|
||||
draw_real(shader, getCloudVariance(), LLShaderMgr::CLOUD_VARIANCE);
|
||||
draw_color(shader, getGlow(), LLShaderMgr::GLOW);
|
||||
draw_real(shader, getMaxY(), LLShaderMgr::MAX_Y);
|
||||
draw_real(shader, getMoonBrightness(), LLShaderMgr::MOON_BRIGHTNESS);
|
||||
draw_real(shader, getSkyMoistureLevel(), LLShaderMgr::MOISTURE_LEVEL);
|
||||
draw_real(shader, getSkyDropletRadius(), LLShaderMgr::DROPLET_RADIUS);
|
||||
draw_real(shader, getSkyIceLevel(), LLShaderMgr::ICE_LEVEL);
|
||||
draw_real(shader, getReflectionProbeAmbiance(), LLShaderMgr::REFLECTION_PROBE_AMBIANCE);
|
||||
}
|
||||
|
||||
void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
|
@ -702,7 +763,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
|||
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
|
||||
|
||||
// Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
|
||||
LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
|
||||
LLVector4 vect_c_p_d1(mCloudPosDensity1.mV[0], mCloudPosDensity1.mV[1], mCloudPosDensity1.mV[2]);
|
||||
LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
|
||||
|
||||
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
|
||||
|
|
@ -935,7 +996,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
|
|||
return waterp;
|
||||
}
|
||||
|
||||
LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const
|
||||
LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
|
||||
{
|
||||
LLSD settings = cloneSettings();
|
||||
U32 flags = getFlags();
|
||||
|
|
@ -974,6 +1035,12 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
|
|||
}
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void LLSettingsVOWater::applyToUniforms(void*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
|
@ -996,38 +1063,33 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
|
|||
}
|
||||
|
||||
//transform water plane to eye space
|
||||
glh::vec3f norm(0.f, 0.f, 1.f);
|
||||
glh::vec3f p(0.f, 0.f, water_height);
|
||||
glm::vec3 norm(0.f, 0.f, 1.f);
|
||||
glm::vec3 p(0.f, 0.f, water_height);
|
||||
|
||||
F32 modelView[16];
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
modelView[i] = (F32)gGLModelView[i];
|
||||
}
|
||||
glm::mat4 mat = get_current_modelview();
|
||||
glm::mat4 invtrans = glm::transpose(glm::inverse(mat));
|
||||
invtrans[0][3] = invtrans[1][3] = invtrans[2][3] = 0.f;
|
||||
|
||||
glh::matrix4f mat(modelView);
|
||||
glh::matrix4f invtrans = mat.inverse().transpose();
|
||||
invtrans.m[3] = invtrans.m[7] = invtrans.m[11] = 0.f;
|
||||
glh::vec3f enorm;
|
||||
glh::vec3f ep;
|
||||
invtrans.mult_matrix_vec(norm, enorm);
|
||||
enorm.normalize();
|
||||
mat.mult_matrix_vec(p, ep);
|
||||
glm::vec3 enorm;
|
||||
glm::vec3 ep;
|
||||
enorm = mul_mat4_vec3(invtrans, norm);
|
||||
enorm = glm::normalize(enorm);
|
||||
ep = mul_mat4_vec3(mat, p);
|
||||
|
||||
LLVector4 waterPlane(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm));
|
||||
LLVector4 waterPlane(enorm.x, enorm.y, enorm.z, -glm::dot(ep, enorm));
|
||||
|
||||
norm = glh::vec3f(gPipeline.mHeroProbeManager.mMirrorNormal.mV);
|
||||
p = glh::vec3f(gPipeline.mHeroProbeManager.mMirrorPosition.mV);
|
||||
invtrans.mult_matrix_vec(norm, enorm);
|
||||
enorm.normalize();
|
||||
mat.mult_matrix_vec(p, ep);
|
||||
norm = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorNormal.mV);
|
||||
p = glm::make_vec3(gPipeline.mHeroProbeManager.mMirrorPosition.mV);
|
||||
enorm = mul_mat4_vec3(invtrans, norm);
|
||||
enorm = glm::normalize(enorm);
|
||||
ep = mul_mat4_vec3(mat, p);
|
||||
|
||||
LLVector4 mirrorPlane(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm));
|
||||
glm::vec4 mirrorPlane(enorm, -glm::dot(ep, enorm));
|
||||
|
||||
LLDrawPoolAlpha::sWaterPlane = waterPlane;
|
||||
|
||||
shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, waterPlane.mV);
|
||||
shader->uniform4fv(LLShaderMgr::CLIP_PLANE, mirrorPlane.mV);
|
||||
shader->uniform4fv(LLShaderMgr::CLIP_PLANE, glm::value_ptr(mirrorPlane));
|
||||
LLVector4 light_direction = env.getClampedLightNorm();
|
||||
|
||||
if (gPipeline.mHeroProbeManager.isMirrorPass())
|
||||
|
|
@ -1373,7 +1435,7 @@ void LLSettingsVODay::combineIntoDayCycle(LLSettingsDay::ptr_t pday, LLSettingsB
|
|||
}
|
||||
|
||||
|
||||
LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
|
||||
LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
|
||||
{
|
||||
LLSD settings = cloneSettings();
|
||||
|
||||
|
|
@ -1398,10 +1460,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
|
|||
return dayp;
|
||||
}
|
||||
|
||||
LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const
|
||||
LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
|
||||
{
|
||||
// no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD
|
||||
LLSD settings = llsd_clone(mSettings);
|
||||
LLSD settings = llsd_clone(getSettings());
|
||||
|
||||
U32 flags = getFlags();
|
||||
LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
|
||||
static ptr_t buildDefaultSky();
|
||||
virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildClone() SETTINGS_OVERRIDE;
|
||||
|
||||
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
|
||||
|
||||
|
|
@ -110,6 +110,7 @@ protected:
|
|||
|
||||
virtual void updateSettings() override;
|
||||
|
||||
virtual void applyToUniforms(void*) override;
|
||||
virtual void applySpecial(void *, bool) override;
|
||||
|
||||
virtual parammapping_t getParameterMap() const override;
|
||||
|
|
@ -128,7 +129,7 @@ public:
|
|||
|
||||
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
|
||||
static ptr_t buildDefaultWater();
|
||||
virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildClone() SETTINGS_OVERRIDE;
|
||||
|
||||
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
|
||||
|
||||
|
|
@ -138,6 +139,7 @@ protected:
|
|||
LLSettingsVOWater();
|
||||
|
||||
virtual void updateSettings() override;
|
||||
virtual void applyToUniforms(void*) override;
|
||||
virtual void applySpecial(void *, bool) override;
|
||||
|
||||
virtual parammapping_t getParameterMap() const override;
|
||||
|
|
@ -167,8 +169,8 @@ public:
|
|||
static ptr_t buildDefaultDayCycle();
|
||||
static ptr_t buildFromEnvironmentMessage(LLSD settings);
|
||||
static void buildFromOtherSetting(LLSettingsBase::ptr_t settings, asset_built_fn cb);
|
||||
virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildClone() SETTINGS_OVERRIDE;
|
||||
virtual ptr_t buildDeepCloneAndUncompress() SETTINGS_OVERRIDE;
|
||||
|
||||
static LLSD convertToLegacy(const ptr_t &);
|
||||
|
||||
|
|
|
|||
|
|
@ -111,12 +111,12 @@ bool LLTerrainPaintMap::bakeHeightNoiseIntoPBRPaintMapRGB(const LLViewerRegion&
|
|||
const LLRect texture_rect(0, scratch_target.getHeight(), scratch_target.getWidth(), 0);
|
||||
glViewport(texture_rect.mLeft, texture_rect.mBottom, texture_rect.getWidth(), texture_rect.getHeight());
|
||||
// Manually get modelview matrix from camera orientation.
|
||||
glh::matrix4f modelview((GLfloat *) OGL_TO_CFR_ROTATION);
|
||||
glm::mat4 modelview(glm::make_mat4((GLfloat *) OGL_TO_CFR_ROTATION));
|
||||
GLfloat ogl_matrix[16];
|
||||
camera.getOpenGLTransform(ogl_matrix);
|
||||
modelview *= glh::matrix4f(ogl_matrix);
|
||||
modelview *= glm::make_mat4(ogl_matrix);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.loadMatrix(modelview.m);
|
||||
gGL.loadMatrix(glm::value_ptr(modelview));
|
||||
// Override the projection matrix from the camera
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
|
|
|
|||
|
|
@ -63,28 +63,6 @@ LLTrace::CountStatHandle<> LLViewerCamera::sAngularVelocityStat("camera_angular_
|
|||
|
||||
LLViewerCamera::eCameraID LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
//glu pick matrix implementation borrowed from Mesa3D
|
||||
glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport)
|
||||
{
|
||||
GLfloat m[16];
|
||||
GLfloat sx, sy;
|
||||
GLfloat tx, ty;
|
||||
|
||||
sx = viewport[2] / width;
|
||||
sy = viewport[3] / height;
|
||||
tx = (viewport[2] + 2.f * (viewport[0] - x)) / width;
|
||||
ty = (viewport[3] + 2.f * (viewport[1] - y)) / height;
|
||||
|
||||
#define M(row,col) m[col*4+row]
|
||||
M(0,0) = sx; M(0,1) = 0.f; M(0,2) = 0.f; M(0,3) = tx;
|
||||
M(1,0) = 0.f; M(1,1) = sy; M(1,2) = 0.f; M(1,3) = ty;
|
||||
M(2,0) = 0.f; M(2,1) = 0.f; M(2,2) = 1.f; M(2,3) = 0.f;
|
||||
M(3,0) = 0.f; M(3,1) = 0.f; M(3,2) = 0.f; M(3,3) = 1.f;
|
||||
#undef M
|
||||
|
||||
return glh::matrix4f(m);
|
||||
}
|
||||
|
||||
LLViewerCamera::LLViewerCamera() : LLCamera()
|
||||
{
|
||||
calcProjection(getFar());
|
||||
|
|
@ -213,59 +191,52 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const
|
|||
//static
|
||||
void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zflip, bool no_hacks)
|
||||
{
|
||||
GLint* viewport = (GLint*) gGLViewport;
|
||||
F64 model[16];
|
||||
F64 proj[16];
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
model[i] = (F64) gGLModelView[i];
|
||||
proj[i] = (F64) gGLProjection[i];
|
||||
}
|
||||
|
||||
GLdouble objX,objY,objZ;
|
||||
glm::ivec4 viewport = glm::make_vec4((GLint*) gGLViewport);
|
||||
glm::mat4 model = get_current_modelview();
|
||||
glm::mat4 proj = get_current_projection();
|
||||
|
||||
LLVector3 frust[8];
|
||||
|
||||
glm::vec3 obj;
|
||||
if (no_hacks)
|
||||
{
|
||||
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
obj = glm::unProject(glm::vec3(viewport[0], viewport[1], 0), model, proj, viewport);
|
||||
frust[0].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1],0),model,proj,viewport);
|
||||
frust[1].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[2].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[3].setVec(glm::value_ptr(obj));
|
||||
|
||||
gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1],1),model,proj,viewport);
|
||||
frust[4].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1],1),model,proj,viewport);
|
||||
frust[5].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1]+viewport[3],1),model,proj,viewport);
|
||||
frust[6].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1]+viewport[3],1),model,proj,viewport);
|
||||
frust[7].setVec(glm::value_ptr(obj));
|
||||
}
|
||||
else if (zflip)
|
||||
{
|
||||
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[0].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[1].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1],0),model,proj,viewport);
|
||||
frust[2].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1],0),model,proj,viewport);
|
||||
frust[3].setVec(glm::value_ptr(obj));
|
||||
|
||||
gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[4].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[5].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[6].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[7].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1]+viewport[3],1),model,proj,viewport);
|
||||
frust[4].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1]+viewport[3],1),model,proj,viewport);
|
||||
frust[5].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1],1),model,proj,viewport);
|
||||
frust[6].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1],1),model,proj,viewport);
|
||||
frust[7].setVec(glm::value_ptr(obj));
|
||||
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
@ -276,14 +247,14 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zfli
|
|||
}
|
||||
else
|
||||
{
|
||||
gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[0].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[1].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[2].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ);
|
||||
frust[3].setVec((F32)objX,(F32)objY,(F32)objZ);
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1],0),model,proj,viewport);
|
||||
frust[0].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1],0),model,proj,viewport);
|
||||
frust[1].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0]+viewport[2],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[2].setVec(glm::value_ptr(obj));
|
||||
obj = glm::unProject(glm::vec3(viewport[0],viewport[1]+viewport[3],0),model,proj,viewport);
|
||||
frust[3].setVec(glm::value_ptr(obj));
|
||||
|
||||
if (ortho)
|
||||
{
|
||||
|
|
@ -313,7 +284,7 @@ void LLViewerCamera::setPerspective(bool for_selection,
|
|||
F32 z_near, F32 z_far)
|
||||
{
|
||||
F32 fov_y, aspect;
|
||||
fov_y = RAD_TO_DEG * getView();
|
||||
fov_y = getView();
|
||||
bool z_default_far = false;
|
||||
if (z_far <= 0)
|
||||
{
|
||||
|
|
@ -330,20 +301,19 @@ void LLViewerCamera::setPerspective(bool for_selection,
|
|||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.loadIdentity();
|
||||
|
||||
glh::matrix4f proj_mat;
|
||||
glm::mat4 proj_mat = glm::identity<glm::mat4>();
|
||||
|
||||
if (for_selection)
|
||||
{
|
||||
// make a tiny little viewport
|
||||
// anything drawn into this viewport will be "selected"
|
||||
|
||||
GLint viewport[4];
|
||||
viewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
|
||||
viewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
|
||||
viewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
|
||||
viewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
|
||||
glm::ivec4 viewport(gViewerWindow->getWorldViewRectRaw().mLeft,
|
||||
gViewerWindow->getWorldViewRectRaw().mBottom,
|
||||
gViewerWindow->getWorldViewRectRaw().getWidth(),
|
||||
gViewerWindow->getWorldViewRectRaw().getHeight());
|
||||
|
||||
proj_mat = gl_pick_matrix(x+width/2.f, y_from_bot+height/2.f, (GLfloat) width, (GLfloat) height, viewport);
|
||||
proj_mat = glm::pickMatrix(glm::vec2(x + width / 2.f, y_from_bot + height / 2.f), glm::vec2((GLfloat)width, (GLfloat)height), viewport);
|
||||
|
||||
if (limit_select_distance)
|
||||
{
|
||||
|
|
@ -379,37 +349,35 @@ void LLViewerCamera::setPerspective(bool for_selection,
|
|||
float offset = mZoomFactor - 1.f;
|
||||
int pos_y = mZoomSubregion / llceil(mZoomFactor);
|
||||
int pos_x = mZoomSubregion - (pos_y*llceil(mZoomFactor));
|
||||
glh::matrix4f translate;
|
||||
translate.set_translate(glh::vec3f(offset - (F32)pos_x * 2.f, offset - (F32)pos_y * 2.f, 0.f));
|
||||
glh::matrix4f scale;
|
||||
scale.set_scale(glh::vec3f(mZoomFactor, mZoomFactor, 1.f));
|
||||
|
||||
proj_mat = scale*proj_mat;
|
||||
proj_mat = translate*proj_mat;
|
||||
glm::mat4 translate;
|
||||
translate = glm::translate(glm::vec3(offset - (F32)pos_x * 2.f, offset - (F32)pos_y * 2.f, 0.f));
|
||||
glm::mat4 scale;
|
||||
scale = glm::scale(glm::vec3(mZoomFactor, mZoomFactor, 1.f));
|
||||
|
||||
proj_mat = scale * proj_mat;
|
||||
proj_mat = translate * proj_mat;
|
||||
}
|
||||
|
||||
calcProjection(z_far); // Update the projection matrix cache
|
||||
|
||||
proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far);
|
||||
proj_mat *= glm::perspective(fov_y,aspect,z_near,z_far);
|
||||
|
||||
gGL.loadMatrix(proj_mat.m);
|
||||
gGL.loadMatrix(glm::value_ptr(proj_mat));
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
gGLProjection[i] = proj_mat.m[i];
|
||||
}
|
||||
set_current_projection(proj_mat);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
|
||||
glm::mat4 modelview(glm::make_mat4((GLfloat*) OGL_TO_CFR_ROTATION));
|
||||
|
||||
GLfloat ogl_matrix[16];
|
||||
|
||||
getOpenGLTransform(ogl_matrix);
|
||||
|
||||
modelview *= glh::matrix4f(ogl_matrix);
|
||||
modelview *= glm::make_mat4(ogl_matrix);
|
||||
|
||||
gGL.loadMatrix(modelview.m);
|
||||
gGL.loadMatrix(glm::value_ptr(modelview));
|
||||
|
||||
if (for_selection && (width > 1 || height > 1))
|
||||
{
|
||||
|
|
@ -427,10 +395,7 @@ void LLViewerCamera::setPerspective(bool for_selection,
|
|||
if (!for_selection && mZoomFactor == 1.f)
|
||||
{
|
||||
// Save GL matrices for access elsewhere in code, especially project_world_to_screen
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
gGLModelView[i] = modelview.m[i];
|
||||
}
|
||||
set_current_modelview(modelview);
|
||||
}
|
||||
|
||||
updateFrustumPlanes(*this);
|
||||
|
|
@ -441,24 +406,8 @@ void LLViewerCamera::setPerspective(bool for_selection,
|
|||
// screen coordinates to the agent's region.
|
||||
void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const
|
||||
{
|
||||
GLdouble x, y, z;
|
||||
|
||||
F64 mdlv[16];
|
||||
F64 proj[16];
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
mdlv[i] = (F64) gGLModelView[i];
|
||||
proj[i] = (F64) gGLProjection[i];
|
||||
}
|
||||
|
||||
gluUnProject(
|
||||
GLdouble(screen_x), GLdouble(screen_y), 0.0,
|
||||
mdlv, proj, (GLint*)gGLViewport,
|
||||
&x,
|
||||
&y,
|
||||
&z );
|
||||
pos_agent->setVec( (F32)x, (F32)y, (F32)z );
|
||||
glm::vec3 agent_coord = glm::unProject(glm::vec3(screen_x, screen_y, 0.f), get_current_modelview(), get_current_projection(), glm::make_vec4(gGLViewport));
|
||||
pos_agent->setVec( (F32)agent_coord.x, (F32)agent_coord.y, (F32)agent_coord.z );
|
||||
}
|
||||
|
||||
// Uses the last GL matrices set in set_perspective to project a point from
|
||||
|
|
@ -467,7 +416,6 @@ void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 scree
|
|||
bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp) const
|
||||
{
|
||||
bool in_front = true;
|
||||
GLdouble x, y, z; // object's window coords, GL-style
|
||||
|
||||
LLVector3 dir_to_point = pos_agent - getOrigin();
|
||||
dir_to_point /= dir_to_point.magVec();
|
||||
|
|
@ -485,35 +433,20 @@ bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
}
|
||||
|
||||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
S32 viewport[4];
|
||||
viewport[0] = world_view_rect.mLeft;
|
||||
viewport[1] = world_view_rect.mBottom;
|
||||
viewport[2] = world_view_rect.getWidth();
|
||||
viewport[3] = world_view_rect.getHeight();
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
F64 mdlv[16];
|
||||
F64 proj[16];
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
mdlv[i] = (F64) gGLModelView[i];
|
||||
proj[i] = (F64) gGLProjection[i];
|
||||
}
|
||||
|
||||
if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ],
|
||||
mdlv, proj, (GLint*)viewport,
|
||||
&x, &y, &z))
|
||||
{
|
||||
// convert screen coordinates to virtual UI coordinates
|
||||
x /= gViewerWindow->getDisplayScale().mV[VX];
|
||||
y /= gViewerWindow->getDisplayScale().mV[VY];
|
||||
win_coord.x /= gViewerWindow->getDisplayScale().mV[VX];
|
||||
win_coord.y /= gViewerWindow->getDisplayScale().mV[VY];
|
||||
|
||||
// should now have the x,y coords of grab_point in screen space
|
||||
LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
|
||||
|
||||
// convert to pixel coordinates
|
||||
S32 int_x = lltrunc(x);
|
||||
S32 int_y = lltrunc(y);
|
||||
S32 int_x = lltrunc(win_coord.x);
|
||||
S32 int_y = lltrunc(win_coord.y);
|
||||
|
||||
bool valid = true;
|
||||
|
||||
|
|
@ -575,10 +508,6 @@ bool LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
|
|||
return in_front && valid;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Uses the last GL matrices set in set_perspective to project a point from
|
||||
|
|
@ -597,49 +526,33 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
|
|||
}
|
||||
|
||||
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
|
||||
S32 viewport[4];
|
||||
viewport[0] = world_view_rect.mLeft;
|
||||
viewport[1] = world_view_rect.mBottom;
|
||||
viewport[2] = world_view_rect.getWidth();
|
||||
viewport[3] = world_view_rect.getHeight();
|
||||
GLdouble x, y, z; // object's window coords, GL-style
|
||||
|
||||
F64 mdlv[16];
|
||||
F64 proj[16];
|
||||
glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
|
||||
glm::vec3 win_coord = glm::project(glm::make_vec3(pos_agent.mV), get_current_modelview(), get_current_projection(), viewport);
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
mdlv[i] = (F64) gGLModelView[i];
|
||||
proj[i] = (F64) gGLProjection[i];
|
||||
}
|
||||
|
||||
if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY],
|
||||
pos_agent.mV[VZ], mdlv,
|
||||
proj, (GLint*)viewport,
|
||||
&x, &y, &z))
|
||||
{
|
||||
x /= gViewerWindow->getDisplayScale().mV[VX];
|
||||
y /= gViewerWindow->getDisplayScale().mV[VY];
|
||||
win_coord.x /= gViewerWindow->getDisplayScale().mV[VX];
|
||||
win_coord.y /= gViewerWindow->getDisplayScale().mV[VY];
|
||||
// should now have the x,y coords of grab_point in screen space
|
||||
const LLRect& world_rect = gViewerWindow->getWorldViewRectScaled();
|
||||
|
||||
// ...sanity check
|
||||
S32 int_x = lltrunc(x);
|
||||
S32 int_y = lltrunc(y);
|
||||
S32 int_x = lltrunc(win_coord.x);
|
||||
S32 int_y = lltrunc(win_coord.y);
|
||||
|
||||
// find the center
|
||||
GLdouble center_x = (GLdouble)world_rect.getCenterX();
|
||||
GLdouble center_y = (GLdouble)world_rect.getCenterY();
|
||||
F32 center_x = (F32)world_rect.getCenterX();
|
||||
F32 center_y = (F32)world_rect.getCenterY();
|
||||
|
||||
if (x == center_x && y == center_y)
|
||||
if (win_coord.x == center_x && win_coord.y == center_y)
|
||||
{
|
||||
// can't project to edge from exact center
|
||||
return false;
|
||||
}
|
||||
|
||||
// find the line from center to local
|
||||
GLdouble line_x = x - center_x;
|
||||
GLdouble line_y = y - center_y;
|
||||
F32 line_x = win_coord.x - center_x;
|
||||
F32 line_y = win_coord.y - center_y;
|
||||
|
||||
int_x = lltrunc(center_x);
|
||||
int_y = lltrunc(center_y);
|
||||
|
|
@ -660,11 +573,11 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
|
|||
else if (0 == world_rect.getWidth())
|
||||
{
|
||||
// the diagonal slope of the view is undefined
|
||||
if (y < world_rect.mBottom)
|
||||
if (win_coord.y < world_rect.mBottom)
|
||||
{
|
||||
int_y = world_rect.mBottom;
|
||||
}
|
||||
else if ( y > world_rect.mTop)
|
||||
else if (win_coord.y > world_rect.mTop)
|
||||
{
|
||||
int_y = world_rect.mTop;
|
||||
}
|
||||
|
|
@ -686,7 +599,7 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
|
|||
// top
|
||||
int_y = world_rect.mTop;
|
||||
}
|
||||
int_x = lltrunc(((GLdouble)int_y - center_y) / line_slope + center_x);
|
||||
int_x = lltrunc(((F32)int_y - center_y) / line_slope + center_x);
|
||||
}
|
||||
else if (fabs(line_slope) < rect_slope)
|
||||
{
|
||||
|
|
@ -700,7 +613,7 @@ bool LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
|
|||
// right
|
||||
int_x = world_rect.mRight;
|
||||
}
|
||||
int_y = lltrunc(((GLdouble)int_x - center_x) * line_slope + center_y);
|
||||
int_y = lltrunc(((F32)int_x - center_x) * line_slope + center_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,6 +88,10 @@
|
|||
#include "llpresetsmanager.h"
|
||||
#include "fsdata.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
extern LLPointer<LLViewerTexture> gStartTexture;
|
||||
extern bool gShiftFrame;
|
||||
|
||||
|
|
@ -867,8 +871,8 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
|
|||
|
||||
LLGLState::checkStates();
|
||||
|
||||
glh::matrix4f proj = get_current_projection();
|
||||
glh::matrix4f mod = get_current_modelview();
|
||||
glm::mat4 proj = get_current_projection();
|
||||
glm::mat4 mod = get_current_modelview();
|
||||
glViewport(0,0,512,512);
|
||||
|
||||
LLVOAvatar::updateImpostors();
|
||||
|
|
@ -876,9 +880,9 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
|
|||
set_current_projection(proj);
|
||||
set_current_modelview(mod);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.loadMatrix(proj.m);
|
||||
gGL.loadMatrix(glm::value_ptr(proj));
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.loadMatrix(mod.m);
|
||||
gGL.loadMatrix(glm::value_ptr(mod));
|
||||
gViewerWindow->setup3DViewport();
|
||||
|
||||
LLGLState::checkStates();
|
||||
|
|
@ -1266,8 +1270,8 @@ void render_hud_attachments()
|
|||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
|
||||
glh::matrix4f current_proj = get_current_projection();
|
||||
glh::matrix4f current_mod = get_current_modelview();
|
||||
glm::mat4 current_proj = get_current_projection();
|
||||
glm::mat4 current_mod = get_current_modelview();
|
||||
|
||||
// clamp target zoom level to reasonable values
|
||||
// gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
|
||||
|
|
@ -1402,7 +1406,7 @@ LLRect get_whole_screen_region()
|
|||
return whole_screen;
|
||||
}
|
||||
|
||||
bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
|
||||
bool get_hud_matrices(const LLRect& screen_region, glm::mat4 &proj, glm::mat4&model)
|
||||
{
|
||||
if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment())
|
||||
{
|
||||
|
|
@ -1412,31 +1416,32 @@ bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::mat
|
|||
F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
|
||||
|
||||
// <FS:Ansariel> Factor out calls to getInstance
|
||||
//proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
|
||||
//proj.element(2,2) = -0.01f;
|
||||
//proj = glm::ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
|
||||
//proj[2][2] = -0.01f;
|
||||
|
||||
F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect();
|
||||
proj = gl_ortho(-0.5f * aspect_ratio, 0.5f * aspect_ratio, -0.5f, 0.5f, 0.f, hud_depth);
|
||||
proj.element(2,2) = -0.01f;
|
||||
proj = glm::ortho(-0.5f * aspect_ratio, 0.5f * aspect_ratio, -0.5f, 0.5f, 0.f, hud_depth);
|
||||
proj[2][2] = -0.01f;
|
||||
// <//FS:Ansariel> Factor out calls to getInstance
|
||||
|
||||
glh::matrix4f mat;
|
||||
F32 scale_x = (F32)gViewerWindow->getWorldViewWidthScaled() / (F32)screen_region.getWidth();
|
||||
F32 scale_y = (F32)gViewerWindow->getWorldViewHeightScaled() / (F32)screen_region.getHeight();
|
||||
mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f));
|
||||
mat.set_translate(
|
||||
glh::vec3f(clamp_rescale((F32)(screen_region.getCenterX() - screen_region.mLeft), 0.f, (F32)gViewerWindow->getWorldViewWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
|
||||
clamp_rescale((F32)(screen_region.getCenterY() - screen_region.mBottom), 0.f, (F32)gViewerWindow->getWorldViewHeightScaled(), 0.5f * scale_y, -0.5f * scale_y),
|
||||
0.f));
|
||||
|
||||
glm::mat4 mat = glm::identity<glm::mat4>();
|
||||
mat = glm::translate(mat,
|
||||
glm::vec3(clamp_rescale((F32)(screen_region.getCenterX() - screen_region.mLeft), 0.f, (F32)gViewerWindow->getWorldViewWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
|
||||
clamp_rescale((F32)(screen_region.getCenterY() - screen_region.mBottom), 0.f, (F32)gViewerWindow->getWorldViewHeightScaled(), 0.5f * scale_y, -0.5f * scale_y),
|
||||
0.f));
|
||||
mat = glm::scale(mat, glm::vec3(scale_x, scale_y, 1.f));
|
||||
proj *= mat;
|
||||
|
||||
glh::matrix4f tmp_model((GLfloat*) OGL_TO_CFR_ROTATION);
|
||||
|
||||
mat.set_scale(glh::vec3f(zoom_level, zoom_level, zoom_level));
|
||||
mat.set_translate(glh::vec3f(-hud_bbox.getCenterLocal().mV[VX] + (hud_depth * 0.5f), 0.f, 0.f));
|
||||
|
||||
glm::mat4 tmp_model = glm::make_mat4(OGL_TO_CFR_ROTATION);
|
||||
mat = glm::identity<glm::mat4>();
|
||||
mat = glm::translate(mat, glm::vec3(-hud_bbox.getCenterLocal().mV[VX] + (hud_depth * 0.5f), 0.f, 0.f));
|
||||
mat = glm::scale(mat, glm::vec3(zoom_level));
|
||||
tmp_model *= mat;
|
||||
model = tmp_model;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
@ -1445,7 +1450,7 @@ bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::mat
|
|||
}
|
||||
}
|
||||
|
||||
bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model)
|
||||
bool get_hud_matrices(glm::mat4 &proj, glm::mat4&model)
|
||||
{
|
||||
LLRect whole_screen = get_whole_screen_region();
|
||||
return get_hud_matrices(whole_screen, proj, model);
|
||||
|
|
@ -1459,17 +1464,17 @@ bool setup_hud_matrices()
|
|||
|
||||
bool setup_hud_matrices(const LLRect& screen_region)
|
||||
{
|
||||
glh::matrix4f proj, model;
|
||||
glm::mat4 proj, model;
|
||||
bool result = get_hud_matrices(screen_region, proj, model);
|
||||
if (!result) return result;
|
||||
|
||||
// set up transform to keep HUD objects in front of camera
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.loadMatrix(proj.m);
|
||||
gGL.loadMatrix(glm::value_ptr(proj));
|
||||
set_current_projection(proj);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.loadMatrix(model.m);
|
||||
gGL.loadMatrix(glm::value_ptr(model));
|
||||
set_current_modelview(model);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1481,13 +1486,13 @@ void render_ui(F32 zoom_factor, int subfield)
|
|||
LL_PROFILE_GPU_ZONE("ui");
|
||||
LLGLState::checkStates();
|
||||
|
||||
glh::matrix4f saved_view = get_current_modelview();
|
||||
glm::mat4 saved_view = get_current_modelview();
|
||||
|
||||
if (!gSnapshot)
|
||||
{
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(gGLLastModelView);
|
||||
set_current_modelview(copy_matrix(gGLLastModelView));
|
||||
set_current_modelview(glm::make_mat4(gGLLastModelView));
|
||||
}
|
||||
|
||||
if(LLSceneMonitor::getInstance()->needsUpdate())
|
||||
|
|
|
|||
|
|
@ -4369,7 +4369,9 @@ void LLViewerWindow::updateKeyboardFocus()
|
|||
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
|
||||
if (cur_focus)
|
||||
{
|
||||
if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
|
||||
bool is_in_visible_chain = cur_focus->isInVisibleChain();
|
||||
bool is_in_enabled_chain = cur_focus->isInEnabledChain();
|
||||
if (!is_in_visible_chain || !is_in_enabled_chain)
|
||||
{
|
||||
// don't release focus, just reassign so that if being given
|
||||
// to a sibling won't call onFocusLost on all the ancestors
|
||||
|
|
@ -4380,11 +4382,19 @@ void LLViewerWindow::updateKeyboardFocus()
|
|||
bool new_focus_found = false;
|
||||
while(parent)
|
||||
{
|
||||
if (!is_in_visible_chain)
|
||||
{
|
||||
is_in_visible_chain = parent->isInVisibleChain();
|
||||
}
|
||||
if (!is_in_enabled_chain)
|
||||
{
|
||||
is_in_enabled_chain = parent->isInEnabledChain();
|
||||
}
|
||||
if (parent->isCtrl()
|
||||
&& (parent->hasTabStop() || parent == focus_root)
|
||||
&& !parent->getIsChrome()
|
||||
&& parent->isInVisibleChain()
|
||||
&& parent->isInEnabledChain())
|
||||
&& is_in_visible_chain
|
||||
&& is_in_enabled_chain)
|
||||
{
|
||||
if (!parent->focusFirstItem())
|
||||
{
|
||||
|
|
@ -6558,8 +6568,8 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
|
|||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
|
||||
LLViewerCamera saved_camera = LLViewerCamera::instance();
|
||||
glh::matrix4f saved_proj = get_current_projection();
|
||||
glh::matrix4f saved_mod = get_current_modelview();
|
||||
glm::mat4 saved_proj = get_current_projection();
|
||||
glm::mat4 saved_mod = get_current_modelview();
|
||||
|
||||
camera->disconnectCameraAngleSignal(); // <FS:Zi> disconnect the "CameraAngle" changed signal
|
||||
|
||||
|
|
|
|||
|
|
@ -636,7 +636,6 @@ bool LLVOAvatar::sVisibleInFirstPerson = false;
|
|||
F32 LLVOAvatar::sLODFactor = 1.f;
|
||||
F32 LLVOAvatar::sPhysicsLODFactor = 1.f;
|
||||
bool LLVOAvatar::sJointDebug = false;
|
||||
bool LLVOAvatar::sLipSyncEnabled = false;
|
||||
F32 LLVOAvatar::sUnbakedTime = 0.f;
|
||||
F32 LLVOAvatar::sUnbakedUpdateTime = 0.f;
|
||||
F32 LLVOAvatar::sGreyTime = 0.f;
|
||||
|
|
@ -1258,7 +1257,6 @@ void LLVOAvatar::initClass()
|
|||
LLControlAvatar::sRegionChangedSlot = gAgent.addRegionChangedCallback(&LLControlAvatar::onRegionChanged);
|
||||
|
||||
sCloudTexture = LLViewerTextureManager::getFetchedTextureFromFile("cloud-particle.j2c");
|
||||
gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&LLVOAvatar::handleVOAvatarPrefsChanged, _2));
|
||||
|
||||
initCloud();
|
||||
}
|
||||
|
|
@ -1268,12 +1266,6 @@ void LLVOAvatar::cleanupClass()
|
|||
{
|
||||
}
|
||||
|
||||
bool LLVOAvatar::handleVOAvatarPrefsChanged(const LLSD &newvalue)
|
||||
{
|
||||
sLipSyncEnabled = gSavedSettings.getBOOL("LipSyncEnabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
LLPartSysData LLVOAvatar::sCloud;
|
||||
void LLVOAvatar::initCloud()
|
||||
{
|
||||
|
|
@ -1972,36 +1964,36 @@ bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
|
|||
{
|
||||
mCollisionVolumes[i].updateWorldMatrix();
|
||||
|
||||
glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix);
|
||||
glh::matrix4f inverse = mat.inverse();
|
||||
glh::matrix4f norm_mat = inverse.transpose();
|
||||
glm::mat4 mat(glm::make_mat4((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix));
|
||||
glm::mat4 inverse = glm::inverse(mat);
|
||||
glm::mat4 norm_mat = glm::transpose(inverse);
|
||||
|
||||
glh::vec3f p1(start.getF32ptr());
|
||||
glh::vec3f p2(end.getF32ptr());
|
||||
glm::vec3 p1(glm::make_vec3(start.getF32ptr()));
|
||||
glm::vec3 p2(glm::make_vec3(end.getF32ptr()));
|
||||
|
||||
inverse.mult_matrix_vec(p1);
|
||||
inverse.mult_matrix_vec(p2);
|
||||
p1 = mul_mat4_vec3(inverse, p1);
|
||||
p2 = mul_mat4_vec3(inverse, p2);
|
||||
|
||||
LLVector3 position;
|
||||
LLVector3 norm;
|
||||
|
||||
if (linesegment_sphere(LLVector3(p1.v), LLVector3(p2.v), LLVector3(0,0,0), 1.f, position, norm))
|
||||
if (linesegment_sphere(LLVector3(glm::value_ptr(p1)), LLVector3(glm::value_ptr(p2)), LLVector3(0,0,0), 1.f, position, norm))
|
||||
{
|
||||
glh::vec3f res_pos(position.mV);
|
||||
mat.mult_matrix_vec(res_pos);
|
||||
glm::vec3 res_pos(glm::make_vec3(position.mV));
|
||||
res_pos = mul_mat4_vec3(mat, res_pos);
|
||||
|
||||
norm.normalize();
|
||||
glh::vec3f res_norm(norm.mV);
|
||||
norm_mat.mult_matrix_dir(res_norm);
|
||||
glm::vec3 res_norm(glm::make_vec3(norm.mV));
|
||||
res_norm = glm::normalize(res_norm);
|
||||
res_norm = glm::mat3(norm_mat) * res_norm;
|
||||
|
||||
if (intersection)
|
||||
{
|
||||
intersection->load3(res_pos.v);
|
||||
intersection->load3(glm::value_ptr(res_pos));
|
||||
}
|
||||
|
||||
if (normal)
|
||||
{
|
||||
normal->load3(res_norm.v);
|
||||
normal->load3(glm::value_ptr(res_norm));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -3050,7 +3042,7 @@ static void override_bbox(LLDrawable* drawable, LLVector4a* extents)
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
|
||||
drawable->setSpatialExtents(extents[0], extents[1]);
|
||||
drawable->setPositionGroup(LLVector4a(0, 0, 0));
|
||||
drawable->setPositionGroup(LLVector4a(0.f, 0.f, 0.f));
|
||||
drawable->movePartition();
|
||||
}
|
||||
|
||||
|
|
@ -3071,13 +3063,9 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
|||
if (detailed_update)
|
||||
{
|
||||
U32 draw_order = 0;
|
||||
S32 attachment_selected = LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment();
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end();
|
||||
++iter)
|
||||
bool attachment_selected = LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 0 && LLSelectMgr::getInstance()->getSelection()->isAttachment();
|
||||
for (const auto& [attachment_point_id, attachment] : mAttachmentPoints)
|
||||
{
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
|
||||
// <FS:Ansariel> Possible crash fix
|
||||
if (!attachment)
|
||||
{
|
||||
|
|
@ -3085,12 +3073,9 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
|||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
for (auto& attached_object : attachment->mAttachedObjects)
|
||||
{
|
||||
LLViewerObject* attached_object = attachment_iter->get();
|
||||
if (!attached_object
|
||||
if (attached_object.isNull()
|
||||
|| attached_object->isDead()
|
||||
|| !attachment->getValid()
|
||||
|| attached_object->mDrawable.isNull())
|
||||
|
|
@ -3305,7 +3290,7 @@ void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
|
|||
// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
|
||||
if ( voice_enabled
|
||||
&& mLastRezzedStatus > 0 // no point updating lip-sync for clouds
|
||||
&& sLipSyncEnabled
|
||||
&& LLVoiceVisualizer::getLipSyncEnabled()
|
||||
&& LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
|
||||
{
|
||||
F32 ooh_morph_amount = 0.0f;
|
||||
|
|
@ -4242,21 +4227,22 @@ LLVector3 LLVOAvatar::idleCalcNameTagPosition(const LLVector3 &root_pos_last)
|
|||
name_position[VZ] += fsNameTagOffset / 10.f;
|
||||
// </FS:Ansariel>
|
||||
|
||||
const F32 water_height = getRegion()->getWaterHeight();
|
||||
static const F32 WATER_HEIGHT_DELTA = 0.25f;
|
||||
if (name_position[VZ] < water_height + WATER_HEIGHT_DELTA)
|
||||
// Avoid of crossing the name tag by the water surface
|
||||
if (mNameText)
|
||||
{
|
||||
if (LLViewerCamera::getInstance()->getOrigin()[VZ] >= water_height)
|
||||
F32 water_height = getRegion()->getWaterHeight();
|
||||
static const F32 WATER_HEIGHT_ABOVE_DELTA = 0.25;
|
||||
if (name_position[VZ] < water_height + WATER_HEIGHT_ABOVE_DELTA)
|
||||
{
|
||||
name_position[VZ] = water_height;
|
||||
}
|
||||
else if (mNameText) // both camera and HUD are below watermark
|
||||
{
|
||||
F32 name_world_height = mNameText->getWorldHeight();
|
||||
F32 max_z_position = water_height - name_world_height;
|
||||
if (name_position[VZ] > max_z_position)
|
||||
F32 camera_height = LLViewerCamera::getInstance()->getOrigin()[VZ];
|
||||
if (camera_height >= water_height)
|
||||
{
|
||||
name_position[VZ] = max_z_position;
|
||||
F32 name_world_height = mNameText->getWorldHeight();
|
||||
static const F32 WATER_HEIGHT_BELOW_DELTA = 0.5;
|
||||
if (name_position[VZ] + name_world_height > water_height - WATER_HEIGHT_BELOW_DELTA)
|
||||
{
|
||||
name_position[VZ] = water_height + WATER_HEIGHT_ABOVE_DELTA;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9548,65 +9534,58 @@ void LLVOAvatar::updateMeshVisibility()
|
|||
|
||||
if (getOverallAppearance() == AOA_NORMAL)
|
||||
{
|
||||
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
|
||||
iter != mAttachmentPoints.end();
|
||||
++iter)
|
||||
for (const auto& [attachment_point_id, attachment] : mAttachmentPoints)
|
||||
{
|
||||
LLViewerJointAttachment* attachment = iter->second;
|
||||
if (attachment)
|
||||
{
|
||||
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
|
||||
attachment_iter != attachment->mAttachedObjects.end();
|
||||
++attachment_iter)
|
||||
{
|
||||
LLViewerObject *objectp = attachment_iter->get();
|
||||
if (objectp)
|
||||
{
|
||||
for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++)
|
||||
{
|
||||
LLTextureEntry* tex_entry = objectp->getTE(face_index);
|
||||
if (tex_entry)
|
||||
{
|
||||
bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
|
||||
bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
|
||||
bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
|
||||
bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
|
||||
bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
|
||||
bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
|
||||
bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
|
||||
bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
|
||||
bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
|
||||
bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
|
||||
bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!attachment)
|
||||
continue;
|
||||
|
||||
LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
|
||||
for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin();
|
||||
iter1 != child_list.end(); ++iter1)
|
||||
for (const auto& objectp : attachment->mAttachedObjects)
|
||||
{
|
||||
if (objectp.isNull())
|
||||
continue;
|
||||
|
||||
for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++)
|
||||
{
|
||||
LLTextureEntry* tex_entry = objectp->getTE(face_index);
|
||||
if (tex_entry)
|
||||
{
|
||||
LLViewerObject* objectchild = *iter1;
|
||||
if (objectchild)
|
||||
const auto& tex_id = tex_entry->getID();
|
||||
bake_flag[BAKED_HEAD] |= (tex_id == IMG_USE_BAKED_HEAD);
|
||||
bake_flag[BAKED_EYES] |= (tex_id == IMG_USE_BAKED_EYES);
|
||||
bake_flag[BAKED_HAIR] |= (tex_id == IMG_USE_BAKED_HAIR);
|
||||
bake_flag[BAKED_LOWER] |= (tex_id == IMG_USE_BAKED_LOWER);
|
||||
bake_flag[BAKED_UPPER] |= (tex_id == IMG_USE_BAKED_UPPER);
|
||||
bake_flag[BAKED_SKIRT] |= (tex_id == IMG_USE_BAKED_SKIRT);
|
||||
bake_flag[BAKED_LEFT_ARM] |= (tex_id == IMG_USE_BAKED_LEFTARM);
|
||||
bake_flag[BAKED_LEFT_LEG] |= (tex_id == IMG_USE_BAKED_LEFTLEG);
|
||||
bake_flag[BAKED_AUX1] |= (tex_id == IMG_USE_BAKED_AUX1);
|
||||
bake_flag[BAKED_AUX2] |= (tex_id == IMG_USE_BAKED_AUX2);
|
||||
bake_flag[BAKED_AUX3] |= (tex_id == IMG_USE_BAKED_AUX3);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& objectchild : objectp->getChildren())
|
||||
{
|
||||
if (objectchild.isNull())
|
||||
continue;
|
||||
|
||||
for (int face_index = 0; face_index < objectchild->getNumTEs(); face_index++)
|
||||
{
|
||||
LLTextureEntry* tex_entry = objectchild->getTE(face_index);
|
||||
if (tex_entry)
|
||||
{
|
||||
for (int face_index = 0; face_index < objectchild->getNumTEs(); face_index++)
|
||||
{
|
||||
LLTextureEntry* tex_entry = objectchild->getTE(face_index);
|
||||
if (tex_entry)
|
||||
{
|
||||
bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD);
|
||||
bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES);
|
||||
bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR);
|
||||
bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER);
|
||||
bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER);
|
||||
bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT);
|
||||
bake_flag[BAKED_LEFT_ARM] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTARM);
|
||||
bake_flag[BAKED_LEFT_LEG] |= (tex_entry->getID() == IMG_USE_BAKED_LEFTLEG);
|
||||
bake_flag[BAKED_AUX1] |= (tex_entry->getID() == IMG_USE_BAKED_AUX1);
|
||||
bake_flag[BAKED_AUX2] |= (tex_entry->getID() == IMG_USE_BAKED_AUX2);
|
||||
bake_flag[BAKED_AUX3] |= (tex_entry->getID() == IMG_USE_BAKED_AUX3);
|
||||
}
|
||||
}
|
||||
const auto& tex_id = tex_entry->getID();
|
||||
bake_flag[BAKED_HEAD] |= (tex_id == IMG_USE_BAKED_HEAD);
|
||||
bake_flag[BAKED_EYES] |= (tex_id == IMG_USE_BAKED_EYES);
|
||||
bake_flag[BAKED_HAIR] |= (tex_id == IMG_USE_BAKED_HAIR);
|
||||
bake_flag[BAKED_LOWER] |= (tex_id == IMG_USE_BAKED_LOWER);
|
||||
bake_flag[BAKED_UPPER] |= (tex_id == IMG_USE_BAKED_UPPER);
|
||||
bake_flag[BAKED_SKIRT] |= (tex_id == IMG_USE_BAKED_SKIRT);
|
||||
bake_flag[BAKED_LEFT_ARM] |= (tex_id == IMG_USE_BAKED_LEFTARM);
|
||||
bake_flag[BAKED_LEFT_LEG] |= (tex_id == IMG_USE_BAKED_LEFTLEG);
|
||||
bake_flag[BAKED_AUX1] |= (tex_id == IMG_USE_BAKED_AUX1);
|
||||
bake_flag[BAKED_AUX2] |= (tex_id == IMG_USE_BAKED_AUX2);
|
||||
bake_flag[BAKED_AUX3] |= (tex_id == IMG_USE_BAKED_AUX3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ public:
|
|||
|
||||
protected:
|
||||
virtual ~LLVOAvatar();
|
||||
static bool handleVOAvatarPrefsChanged(const LLSD &newvalue);
|
||||
|
||||
/** Initialization
|
||||
** **
|
||||
|
|
@ -385,7 +384,6 @@ public:
|
|||
static F32 sLODFactor; // user-settable LOD factor
|
||||
static F32 sPhysicsLODFactor; // user-settable physics LOD factor
|
||||
static bool sJointDebug; // output total number of joints being touched for each avatar
|
||||
static bool sLipSyncEnabled;
|
||||
|
||||
static LLPartSysData sCloud;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ class LLVoiceVisualizer : public LLHUDEffect
|
|||
void setMaxGesticulationAmplitude();
|
||||
void setMinGesticulationAmplitude();
|
||||
|
||||
static bool getLipSyncEnabled() { return sLipSyncEnabled; }
|
||||
|
||||
//---------------------------------------------------
|
||||
// private members
|
||||
//---------------------------------------------------
|
||||
|
|
@ -135,7 +137,7 @@ class LLVoiceVisualizer : public LLHUDEffect
|
|||
// private static members
|
||||
//---------------------------------------------------
|
||||
|
||||
static bool sLipSyncEnabled; // 0 disabled, 1 babble loop
|
||||
static bool sLipSyncEnabled; // false: disabled, true: babble loop
|
||||
static bool sPrefsInitialized; // the first instance will initialize the static members
|
||||
static F32* sOoh; // the babble loop of amplitudes for the ooh morph
|
||||
static F32* sAah; // the babble loop of amplitudes for the ooh morph
|
||||
|
|
|
|||
|
|
@ -5152,8 +5152,7 @@ bool LLVivoxVoiceClient::isVoiceWorking() const
|
|||
//Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
|
||||
// Condition with joining spatial num was added to take into account possible problems with connection to voice
|
||||
// server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
|
||||
return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && mIsProcessingChannels;
|
||||
// return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
|
||||
return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && mIsLoggedIn;
|
||||
}
|
||||
|
||||
// Returns true if the indicated participant in the current audio session is really an SL avatar.
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ void LLWebRTCVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESt
|
|||
status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL &&
|
||||
status != LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED)
|
||||
{
|
||||
bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
|
||||
bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && mIsProcessingChannels;
|
||||
|
||||
gAgent.setVoiceConnected(voice_status);
|
||||
|
||||
|
|
@ -1335,7 +1335,10 @@ bool LLWebRTCVoiceClient::startAdHocSession(const LLSD& channelInfo, bool notify
|
|||
|
||||
bool LLWebRTCVoiceClient::isVoiceWorking() const
|
||||
{
|
||||
return mIsProcessingChannels;
|
||||
// webrtc is working if the coroutine is active in the case of
|
||||
// webrtc. WebRTC doesn't need to connect to a secondary process
|
||||
// or a login server to become active.
|
||||
return mIsCoroutineActive;
|
||||
}
|
||||
|
||||
// Returns true if calling back the session URI after the session has closed is possible.
|
||||
|
|
@ -2995,10 +2998,9 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
|
|||
participant->mIsSpeaking = participant_obj["v"].as_bool();
|
||||
}
|
||||
|
||||
if (participant_obj.contains("v") && participant_obj["m"].is_bool())
|
||||
if (participant_obj.contains("m") && participant_obj["m"].is_bool())
|
||||
{
|
||||
participant->mIsModeratorMuted = participant_obj["m"].as_bool();
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1058,10 +1058,9 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
scale_mat.mMatrix[2][2] = scale*length;
|
||||
scale_mat *= matrix;
|
||||
|
||||
glh::matrix4f norm((F32*) scale_mat.mMatrix);
|
||||
LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
|
||||
glm::mat4 norm(glm::make_mat4((F32*) scale_mat.mMatrix));
|
||||
LLMatrix4 norm_mat = LLMatrix4(glm::value_ptr(glm::transpose(glm::inverse(norm))));
|
||||
|
||||
norm_mat.invert();
|
||||
appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat,
|
||||
sLODVertexOffset[trunk_LOD], sLODVertexCount[trunk_LOD], sLODIndexCount[trunk_LOD], sLODIndexOffset[trunk_LOD]);
|
||||
}
|
||||
|
|
@ -1108,8 +1107,8 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
|
||||
scale_mat *= matrix;
|
||||
|
||||
glh::matrix4f norm((F32*) scale_mat.mMatrix);
|
||||
LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
|
||||
glm::mat4 norm(glm::make_mat4((F32*)scale_mat.mMatrix));
|
||||
LLMatrix4 norm_mat = LLMatrix4(glm::value_ptr(glm::transpose(glm::inverse(norm))));
|
||||
|
||||
appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat, 0, LEAF_VERTICES, LEAF_INDICES, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#define LL_LLWINDEBUG_H
|
||||
|
||||
#include "stdtypes.h"
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
|
||||
#include <dbghelp.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
// include this to get winsock2 because openssl attempts to include winsock1
|
||||
#include "llwin32headerslean.h"
|
||||
#include "llwin32headers.h"
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include "llsecapi.h"
|
||||
|
|
|
|||
|
|
@ -4050,20 +4050,17 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
|
|||
if (&camera == LLViewerCamera::getInstance())
|
||||
{ // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
|
||||
// current modelview matrix
|
||||
glh::matrix4f last_modelview(gGLLastModelView);
|
||||
glh::matrix4f cur_modelview(gGLModelView);
|
||||
glm::mat4 last_modelview = get_last_modelview();
|
||||
glm::mat4 cur_modelview = get_current_modelview();
|
||||
|
||||
// goal is to have a matrix here that goes from the last frame's camera space to the current frame's camera space
|
||||
glh::matrix4f m = last_modelview.inverse(); // last camera space to world space
|
||||
m.mult_left(cur_modelview); // world space to camera space
|
||||
glm::mat4 m = glm::inverse(last_modelview); // last camera space to world space
|
||||
m = cur_modelview * m; // world space to camera space
|
||||
|
||||
glh::matrix4f n = m.inverse();
|
||||
glm::mat4 n = glm::inverse(m);
|
||||
|
||||
for (U32 i = 0; i < 16; ++i)
|
||||
{
|
||||
gGLDeltaModelView[i] = m.m[i];
|
||||
gGLInverseDeltaModelView[i] = n.m[i];
|
||||
}
|
||||
gGLDeltaModelView = m;
|
||||
gGLInverseDeltaModelView = n;
|
||||
}
|
||||
|
||||
bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion && !LLGLSLShader::sProfileEnabled;
|
||||
|
|
@ -8305,7 +8302,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
|
||||
if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX))
|
||||
{
|
||||
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, mReflectionModelView.m);
|
||||
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, glm::value_ptr(mReflectionModelView));
|
||||
}
|
||||
|
||||
channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE);
|
||||
|
|
@ -8342,12 +8339,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
F32 mat[16*6];
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
mat[i] = mSunShadowMatrix[0].m[i];
|
||||
mat[i+16] = mSunShadowMatrix[1].m[i];
|
||||
mat[i+32] = mSunShadowMatrix[2].m[i];
|
||||
mat[i+48] = mSunShadowMatrix[3].m[i];
|
||||
mat[i+64] = mSunShadowMatrix[4].m[i];
|
||||
mat[i+80] = mSunShadowMatrix[5].m[i];
|
||||
mat[i] = glm::value_ptr(mSunShadowMatrix[0])[i];
|
||||
mat[i+16] = glm::value_ptr(mSunShadowMatrix[1])[i];
|
||||
mat[i+32] = glm::value_ptr(mSunShadowMatrix[2])[i];
|
||||
mat[i+48] = glm::value_ptr(mSunShadowMatrix[3])[i];
|
||||
mat[i+64] = glm::value_ptr(mSunShadowMatrix[4])[i];
|
||||
mat[i+80] = glm::value_ptr(mSunShadowMatrix[5])[i];
|
||||
}
|
||||
|
||||
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, false, mat);
|
||||
|
|
@ -8453,15 +8450,15 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
|
||||
|
||||
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, gGLDeltaModelView);
|
||||
shader.uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, gGLInverseDeltaModelView);
|
||||
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLDeltaModelView));
|
||||
shader.uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLInverseDeltaModelView));
|
||||
|
||||
shader.uniform1i(LLShaderMgr::CUBE_SNAPSHOT, gCubeSnapshot ? 1 : 0);
|
||||
|
||||
if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
|
||||
{
|
||||
glh::matrix4f norm_mat = get_current_modelview().inverse().transpose();
|
||||
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, norm_mat.m);
|
||||
glm::mat4 norm_mat = glm::transpose(glm::inverse(get_current_modelview()));
|
||||
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, glm::value_ptr(norm_mat));
|
||||
}
|
||||
|
||||
// auto adjust legacy sun color if needed
|
||||
|
|
@ -8535,17 +8532,17 @@ void LLPipeline::renderDeferredLighting()
|
|||
LLGLEnable cull(GL_CULL_FACE);
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
|
||||
glh::matrix4f mat = copy_matrix(gGLModelView);
|
||||
glm::mat4 mat = get_current_modelview();
|
||||
|
||||
setupHWLights(); // to set mSun/MoonDir;
|
||||
|
||||
glh::vec4f tc(mSunDir.mV);
|
||||
mat.mult_matrix_vec(tc);
|
||||
mTransformedSunDir.set(tc.v);
|
||||
glm::vec4 tc(glm::make_vec4(mSunDir.mV));
|
||||
tc = mat * tc;
|
||||
mTransformedSunDir.set(glm::value_ptr(tc));
|
||||
|
||||
glh::vec4f tc_moon(mMoonDir.mV);
|
||||
mat.mult_matrix_vec(tc_moon);
|
||||
mTransformedMoonDir.set(tc_moon.v);
|
||||
glm::vec4 tc_moon(glm::make_vec4(mMoonDir.mV));
|
||||
tc_moon = mat * tc_moon;
|
||||
mTransformedMoonDir.set(glm::value_ptr(tc_moon));
|
||||
|
||||
if ((RenderDeferredSSAO && !gCubeSnapshot) || RenderShadowDetail > 0)
|
||||
{
|
||||
|
|
@ -8561,26 +8558,6 @@ void LLPipeline::renderDeferredLighting()
|
|||
deferred_light_target->clear(GL_COLOR_BUFFER_BIT);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
|
||||
glh::matrix4f inv_trans = get_current_modelview().inverse().transpose();
|
||||
|
||||
const U32 slice = 32;
|
||||
F32 offset[slice * 3];
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
{
|
||||
for (U32 j = 0; j < 8; j++)
|
||||
{
|
||||
glh::vec3f v;
|
||||
v.set_value(sinf(6.284f / 8 * j), cosf(6.284f / 8 * j), -(F32) i);
|
||||
v.normalize();
|
||||
inv_trans.mult_matrix_vec(v);
|
||||
v.normalize();
|
||||
offset[(i * 8 + j) * 3 + 0] = v.v[0];
|
||||
offset[(i * 8 + j) * 3 + 1] = v.v[2];
|
||||
offset[(i * 8 + j) * 3 + 2] = v.v[1];
|
||||
}
|
||||
}
|
||||
|
||||
sun_shader.uniform3fv(sOffset, slice, offset);
|
||||
sun_shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES,
|
||||
(GLfloat)deferred_light_target->getWidth(),
|
||||
(GLfloat)deferred_light_target->getHeight());
|
||||
|
|
@ -8819,10 +8796,10 @@ void LLPipeline::renderDeferredLighting()
|
|||
continue;
|
||||
}
|
||||
|
||||
glh::vec3f tc(c);
|
||||
mat.mult_matrix_vec(tc);
|
||||
glm::vec3 tc(glm::make_vec3(c));
|
||||
tc = mul_mat4_vec3(mat, tc);
|
||||
|
||||
fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s));
|
||||
fullscreen_lights.push_back(LLVector4(tc.x, tc.y, tc.z, s));
|
||||
light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF)));
|
||||
}
|
||||
}
|
||||
|
|
@ -8929,15 +8906,15 @@ void LLPipeline::renderDeferredLighting()
|
|||
|
||||
sVisibleLightCount++;
|
||||
|
||||
glh::vec3f tc(c);
|
||||
mat.mult_matrix_vec(tc);
|
||||
glm::vec3 tc(glm::make_vec3(c));
|
||||
tc = mul_mat4_vec3(mat, tc);
|
||||
|
||||
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
|
||||
|
||||
// send light color to shader in linear space
|
||||
LLColor3 col = volume->getLightLinearColor() * light_scale;
|
||||
|
||||
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
|
||||
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, glm::value_ptr(tc));
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final);
|
||||
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, light_falloff_final);
|
||||
|
|
@ -9180,10 +9157,10 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
|
|||
//matrix from volume space to agent space
|
||||
LLMatrix4 light_mat(quat, LLVector4(origin,1.f));
|
||||
|
||||
glh::matrix4f light_to_agent((F32*) light_mat.mMatrix);
|
||||
glh::matrix4f light_to_screen = get_current_modelview() * light_to_agent;
|
||||
glm::mat4 light_to_agent(glm::make_mat4((F32*) light_mat.mMatrix));
|
||||
glm::mat4 light_to_screen = get_current_modelview() * light_to_agent;
|
||||
|
||||
glh::matrix4f screen_to_light = light_to_screen.inverse();
|
||||
glm::mat4 screen_to_light = glm::inverse(light_to_screen);
|
||||
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
F32 near_clip = dist;
|
||||
|
|
@ -9191,34 +9168,34 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
|
|||
F32 height = scale.mV[VY];
|
||||
F32 far_clip = s+dist-scale.mV[VZ];
|
||||
|
||||
F32 fovy = fov * RAD_TO_DEG;
|
||||
F32 fovy = fov; // radians
|
||||
F32 aspect = width/height;
|
||||
|
||||
glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
|
||||
0.f, 0.5f, 0.f, 0.5f,
|
||||
0.f, 0.f, 0.5f, 0.5f,
|
||||
0.f, 0.f, 0.f, 1.f);
|
||||
glm::mat4 trans(0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.5f, 0.0f,
|
||||
0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
glh::vec3f p1(0, 0, -(near_clip+0.01f));
|
||||
glh::vec3f p2(0, 0, -(near_clip+1.f));
|
||||
glm::vec3 p1(0, 0, -(near_clip+0.01f));
|
||||
glm::vec3 p2(0, 0, -(near_clip+1.f));
|
||||
|
||||
glh::vec3f screen_origin(0, 0, 0);
|
||||
glm::vec3 screen_origin(0, 0, 0);
|
||||
|
||||
light_to_screen.mult_matrix_vec(p1);
|
||||
light_to_screen.mult_matrix_vec(p2);
|
||||
light_to_screen.mult_matrix_vec(screen_origin);
|
||||
p1 = mul_mat4_vec3(light_to_screen, p1);
|
||||
p2 = mul_mat4_vec3(light_to_screen, p2);
|
||||
screen_origin = mul_mat4_vec3(light_to_screen, screen_origin);
|
||||
|
||||
glh::vec3f n = p2-p1;
|
||||
n.normalize();
|
||||
glm::vec3 n = p2-p1;
|
||||
n = glm::normalize(n);
|
||||
|
||||
F32 proj_range = far_clip - near_clip;
|
||||
glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip);
|
||||
glm::mat4 light_proj = glm::perspective(fovy, aspect, near_clip, far_clip);
|
||||
screen_to_light = trans * light_proj * screen_to_light;
|
||||
shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, false, screen_to_light.m);
|
||||
shader.uniformMatrix4fv(LLShaderMgr::PROJECTOR_MATRIX, 1, false, glm::value_ptr(screen_to_light));
|
||||
shader.uniform1f(LLShaderMgr::PROJECTOR_NEAR, near_clip);
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, p1.v);
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, n.v);
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, screen_origin.v);
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_P, 1, glm::value_ptr(p1));
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_N, 1, glm::value_ptr(n));
|
||||
shader.uniform3fv(LLShaderMgr::PROJECTOR_ORIGIN, 1, glm::value_ptr(screen_origin));
|
||||
shader.uniform1f(LLShaderMgr::PROJECTOR_RANGE, proj_range);
|
||||
shader.uniform1f(LLShaderMgr::PROJECTOR_AMBIANCE, params.mV[2]);
|
||||
S32 s_idx = -1;
|
||||
|
|
@ -9456,10 +9433,8 @@ inline float sgn(float a)
|
|||
return (0.0F);
|
||||
}
|
||||
|
||||
glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up)
|
||||
glm::mat4 look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up)
|
||||
{
|
||||
glh::matrix4f ret;
|
||||
|
||||
LLVector3 dirN;
|
||||
LLVector3 upN;
|
||||
LLVector3 lftN;
|
||||
|
|
@ -9473,53 +9448,28 @@ glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up)
|
|||
dirN = dir;
|
||||
dirN.normVec();
|
||||
|
||||
ret.m[ 0] = lftN[0];
|
||||
ret.m[ 1] = upN[0];
|
||||
ret.m[ 2] = -dirN[0];
|
||||
ret.m[ 3] = 0.f;
|
||||
F32 ret[16];
|
||||
ret[ 0] = lftN[0];
|
||||
ret[ 1] = upN[0];
|
||||
ret[ 2] = -dirN[0];
|
||||
ret[ 3] = 0.f;
|
||||
|
||||
ret.m[ 4] = lftN[1];
|
||||
ret.m[ 5] = upN[1];
|
||||
ret.m[ 6] = -dirN[1];
|
||||
ret.m[ 7] = 0.f;
|
||||
ret[ 4] = lftN[1];
|
||||
ret[ 5] = upN[1];
|
||||
ret[ 6] = -dirN[1];
|
||||
ret[ 7] = 0.f;
|
||||
|
||||
ret.m[ 8] = lftN[2];
|
||||
ret.m[ 9] = upN[2];
|
||||
ret.m[10] = -dirN[2];
|
||||
ret.m[11] = 0.f;
|
||||
ret[ 8] = lftN[2];
|
||||
ret[ 9] = upN[2];
|
||||
ret[10] = -dirN[2];
|
||||
ret[11] = 0.f;
|
||||
|
||||
ret.m[12] = -(lftN*pos);
|
||||
ret.m[13] = -(upN*pos);
|
||||
ret.m[14] = dirN*pos;
|
||||
ret.m[15] = 1.f;
|
||||
ret[12] = -(lftN*pos);
|
||||
ret[13] = -(upN*pos);
|
||||
ret[14] = dirN*pos;
|
||||
ret[15] = 1.f;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
glh::matrix4f scale_translate_to_fit(const LLVector3 min, const LLVector3 max)
|
||||
{
|
||||
glh::matrix4f ret;
|
||||
ret.m[ 0] = 2/(max[0]-min[0]);
|
||||
ret.m[ 4] = 0;
|
||||
ret.m[ 8] = 0;
|
||||
ret.m[12] = -(max[0]+min[0])/(max[0]-min[0]);
|
||||
|
||||
ret.m[ 1] = 0;
|
||||
ret.m[ 5] = 2/(max[1]-min[1]);
|
||||
ret.m[ 9] = 0;
|
||||
ret.m[13] = -(max[1]+min[1])/(max[1]-min[1]);
|
||||
|
||||
ret.m[ 2] = 0;
|
||||
ret.m[ 6] = 0;
|
||||
ret.m[10] = 2/(max[2]-min[2]);
|
||||
ret.m[14] = -(max[2]+min[2])/(max[2]-min[2]);
|
||||
|
||||
ret.m[ 3] = 0;
|
||||
ret.m[ 7] = 0;
|
||||
ret.m[11] = 0;
|
||||
ret.m[15] = 1;
|
||||
|
||||
return ret;
|
||||
return glm::make_mat4(ret);
|
||||
}
|
||||
|
||||
static LLTrace::BlockTimerStatHandle FTM_SHADOW_RENDER("Render Shadows");
|
||||
|
|
@ -9533,7 +9483,7 @@ static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_TREE("Alpha Tree");
|
|||
static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_GRASS("Alpha Grass");
|
||||
static LLTrace::BlockTimerStatHandle FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED("Fullbright Alpha Masked");
|
||||
|
||||
void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult& result, bool depth_clamp)
|
||||
void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCamera& shadow_cam, LLCullResult& result, bool depth_clamp)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER);
|
||||
LL_PROFILE_GPU_ZONE("renderShadow");
|
||||
|
|
@ -9576,10 +9526,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
|
|||
//generate shadow map
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(proj.m);
|
||||
gGL.loadMatrix(glm::value_ptr(proj));
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(view.m);
|
||||
gGL.loadMatrix(glm::value_ptr(view));
|
||||
|
||||
stop_glerror();
|
||||
gGLLastMatrix = NULL;
|
||||
|
|
@ -9989,13 +9939,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
|
||||
}
|
||||
|
||||
F64 last_modelview[16];
|
||||
F64 last_projection[16];
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{ //store last_modelview of world camera
|
||||
last_modelview[i] = gGLLastModelView[i];
|
||||
last_projection[i] = gGLLastProjection[i];
|
||||
}
|
||||
glm::mat4 last_modelview = get_last_modelview();
|
||||
glm::mat4 last_projection = get_last_projection();
|
||||
|
||||
pushRenderTypeMask();
|
||||
andRenderTypeMask(LLPipeline::RENDER_TYPE_SIMPLE,
|
||||
|
|
@ -10074,12 +10019,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
//get sun view matrix
|
||||
|
||||
//store current projection/modelview matrix
|
||||
glh::matrix4f saved_proj = get_current_projection();
|
||||
glh::matrix4f saved_view = get_current_modelview();
|
||||
glh::matrix4f inv_view = saved_view.inverse();
|
||||
glm::mat4 saved_proj = get_current_projection();
|
||||
glm::mat4 saved_view = get_current_modelview();
|
||||
glm::mat4 inv_view = glm::inverse(saved_view);
|
||||
|
||||
glh::matrix4f view[6];
|
||||
glh::matrix4f proj[6];
|
||||
glm::mat4 view[6];
|
||||
glm::mat4 proj[6];
|
||||
|
||||
LLVector3 caster_dir(environment.getIsSunUp() ? mSunDir : mMoonDir);
|
||||
|
||||
|
|
@ -10094,7 +10039,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
LLVector3 lightDir = -caster_dir;
|
||||
lightDir.normVec();
|
||||
|
||||
glh::vec3f light_dir(lightDir.mV);
|
||||
glm::vec3 light_dir(glm::make_vec3(lightDir.mV));
|
||||
|
||||
//create light space camera matrix
|
||||
|
||||
|
|
@ -10149,9 +10094,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
//get good split distances for frustum
|
||||
for (U32 i = 0; i < fp.size(); ++i)
|
||||
{
|
||||
glh::vec3f v(fp[i].mV);
|
||||
saved_view.mult_matrix_vec(v);
|
||||
fp[i].setVec(v.v);
|
||||
glm::vec3 v(glm::make_vec3(fp[i].mV));
|
||||
v = mul_mat4_vec3(saved_view, v);
|
||||
fp[i].setVec(glm::value_ptr(v));
|
||||
}
|
||||
|
||||
min = fp[0];
|
||||
|
|
@ -10300,9 +10245,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
|
||||
for (U32 i = 0; i < fp.size(); i++)
|
||||
{
|
||||
glh::vec3f p = glh::vec3f(fp[i].mV);
|
||||
view[j].mult_matrix_vec(p);
|
||||
wpf.push_back(LLVector3(p.v));
|
||||
glm::vec3 p = glm::make_vec3(fp[i].mV);
|
||||
p = mul_mat4_vec3(view[j], p);
|
||||
wpf.push_back(LLVector3(glm::value_ptr(p)));
|
||||
}
|
||||
|
||||
min = wpf[0];
|
||||
|
|
@ -10402,7 +10347,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
{ //just use ortho projection
|
||||
mShadowFOV.mV[j] = -1.f;
|
||||
origin.clearVec();
|
||||
proj[j] = gl_ortho(min.mV[0], max.mV[0],
|
||||
proj[j] = glm::ortho(min.mV[0], max.mV[0],
|
||||
min.mV[1], max.mV[1],
|
||||
-max.mV[2], -min.mV[2]);
|
||||
}
|
||||
|
|
@ -10493,37 +10438,37 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
{ //just use ortho projection
|
||||
origin.clearVec();
|
||||
mShadowError.mV[j] = -1.f;
|
||||
proj[j] = gl_ortho(min.mV[0], max.mV[0],
|
||||
proj[j] = glm::ortho(min.mV[0], max.mV[0],
|
||||
min.mV[1], max.mV[1],
|
||||
-max.mV[2], -min.mV[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//get perspective projection
|
||||
view[j] = view[j].inverse();
|
||||
view[j] = glm::inverse(view[j]);
|
||||
//llassert(origin.isFinite());
|
||||
|
||||
glh::vec3f origin_agent(origin.mV);
|
||||
glm::vec3 origin_agent(glm::make_vec3(origin.mV));
|
||||
|
||||
//translate view to origin
|
||||
view[j].mult_matrix_vec(origin_agent);
|
||||
origin_agent = mul_mat4_vec3(view[j], origin_agent);
|
||||
|
||||
eye = LLVector3(origin_agent.v);
|
||||
eye = LLVector3(glm::value_ptr(origin_agent));
|
||||
//llassert(eye.isFinite());
|
||||
if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
|
||||
{
|
||||
mShadowFrustOrigin[j] = eye;
|
||||
}
|
||||
|
||||
view[j] = look(LLVector3(origin_agent.v), lightDir, -up);
|
||||
view[j] = look(LLVector3(glm::value_ptr(origin_agent)), lightDir, -up);
|
||||
|
||||
F32 fx = 1.f/tanf(fovx);
|
||||
F32 fz = 1.f/tanf(fovz);
|
||||
|
||||
proj[j] = glh::matrix4f(-fx, 0, 0, 0,
|
||||
0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar),
|
||||
0, 0, -fz, 0,
|
||||
0, -1.f, 0, 0);
|
||||
proj[j] = glm::mat4(-fx, 0, 0, 0,
|
||||
0, (yfar + ynear) / (ynear - yfar), 0, -1.0f,
|
||||
0, 0, -fz, 0,
|
||||
0, (2.f * yfar * ynear) / (ynear - yfar), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10542,19 +10487,16 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
|
||||
|
||||
//translate and scale to from [-1, 1] to [0, 1]
|
||||
glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
|
||||
0.f, 0.5f, 0.f, 0.5f,
|
||||
0.f, 0.f, 0.5f, 0.5f,
|
||||
0.f, 0.f, 0.f, 1.f);
|
||||
glm::mat4 trans(0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.5f, 0.0f,
|
||||
0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
set_current_modelview(view[j]);
|
||||
set_current_projection(proj[j]);
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
gGLLastModelView[i] = mShadowModelview[j].m[i];
|
||||
gGLLastProjection[i] = mShadowProjection[j].m[i];
|
||||
}
|
||||
set_last_modelview(mShadowModelview[j]);
|
||||
set_last_projection(mShadowProjection[j]);
|
||||
|
||||
mShadowModelview[j] = view[j];
|
||||
mShadowProjection[j] = proj[j];
|
||||
|
|
@ -10669,9 +10611,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
|
||||
LLMatrix4 mat(quat, LLVector4(origin, 1.f));
|
||||
|
||||
view[i + 4] = glh::matrix4f((F32*)mat.mMatrix);
|
||||
view[i + 4] = glm::make_mat4((F32*)mat.mMatrix);
|
||||
|
||||
view[i + 4] = view[i + 4].inverse();
|
||||
view[i + 4] = glm::inverse(view[i + 4]);
|
||||
|
||||
//get perspective matrix
|
||||
F32 near_clip = dist + 0.01f;
|
||||
|
|
@ -10679,27 +10621,24 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
F32 height = scale.mV[VY];
|
||||
F32 far_clip = dist + volume->getLightRadius() * 1.5f;
|
||||
|
||||
F32 fovy = fov * RAD_TO_DEG;
|
||||
F32 fovy = fov; // radians
|
||||
F32 aspect = width / height;
|
||||
|
||||
proj[i + 4] = gl_perspective(fovy, aspect, near_clip, far_clip);
|
||||
proj[i + 4] = glm::perspective(fovy, aspect, near_clip, far_clip);
|
||||
|
||||
//translate and scale to from [-1, 1] to [0, 1]
|
||||
glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
|
||||
0.f, 0.5f, 0.f, 0.5f,
|
||||
0.f, 0.f, 0.5f, 0.5f,
|
||||
0.f, 0.f, 0.f, 1.f);
|
||||
glm::mat4 trans(0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.5f, 0.0f,
|
||||
0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
set_current_modelview(view[i + 4]);
|
||||
set_current_projection(proj[i + 4]);
|
||||
|
||||
mSunShadowMatrix[i + 4] = trans * proj[i + 4] * view[i + 4] * inv_view;
|
||||
|
||||
for (U32 j = 0; j < 16; j++)
|
||||
{
|
||||
gGLLastModelView[j] = mShadowModelview[i + 4].m[j];
|
||||
gGLLastProjection[j] = mShadowProjection[i + 4].m[j];
|
||||
}
|
||||
set_last_modelview(mShadowModelview[i + 4]);
|
||||
set_last_projection(mShadowProjection[i + 4]);
|
||||
|
||||
mShadowModelview[i + 4] = view[i + 4];
|
||||
mShadowProjection[i + 4] = proj[i + 4];
|
||||
|
|
@ -10747,18 +10686,15 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
{
|
||||
set_current_modelview(view[1]);
|
||||
set_current_projection(proj[1]);
|
||||
gGL.loadMatrix(view[1].m);
|
||||
gGL.loadMatrix(glm::value_ptr(view[1]));
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.loadMatrix(proj[1].m);
|
||||
gGL.loadMatrix(glm::value_ptr(proj[1]));
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
gGL.setColorMask(true, true);
|
||||
|
||||
for (U32 i = 0; i < 16; i++)
|
||||
{
|
||||
gGLLastModelView[i] = (F32)last_modelview[i];
|
||||
gGLLastProjection[i] = (F32)last_projection[i];
|
||||
}
|
||||
set_last_modelview(last_modelview);
|
||||
set_last_projection(last_projection);
|
||||
|
||||
popRenderTypeMask();
|
||||
|
||||
|
|
@ -11064,18 +11000,18 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
|
|||
F32 distance = (pos-camera.getOrigin()).length();
|
||||
F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
|
||||
F32 aspect = tdim.mV[0]/tdim.mV[1];
|
||||
glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
|
||||
glm::mat4 persp = glm::perspective(glm::radians(fov), aspect, 1.f, 256.f);
|
||||
set_current_projection(persp);
|
||||
gGL.loadMatrix(persp.m);
|
||||
gGL.loadMatrix(glm::value_ptr(persp));
|
||||
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
glh::matrix4f mat;
|
||||
camera.getOpenGLTransform(mat.m);
|
||||
|
||||
mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat;
|
||||
F32 ogl_mat[16];
|
||||
camera.getOpenGLTransform(ogl_mat);
|
||||
glm::mat4 mat = glm::make_mat4((GLfloat*) OGL_TO_CFR_ROTATION) * glm::make_mat4(ogl_mat);
|
||||
|
||||
gGL.loadMatrix(mat.m);
|
||||
gGL.loadMatrix(glm::value_ptr(mat));
|
||||
set_current_modelview(mat);
|
||||
|
||||
glClearColor(0.0f,0.0f,0.0f,0.0f);
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ public:
|
|||
|
||||
void renderHighlight(const LLViewerObject* obj, F32 fade);
|
||||
|
||||
void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool depth_clamp);
|
||||
void renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCamera& camera, LLCullResult& result, bool depth_clamp);
|
||||
void renderSelectedFaces(const LLColor4& color);
|
||||
void renderHighlights();
|
||||
void renderVignette(LLRenderTarget* src, LLRenderTarget* dst);
|
||||
|
|
@ -776,10 +776,10 @@ public:
|
|||
LLCamera mShadowCamera[8];
|
||||
LLVector3 mShadowExtents[4][2];
|
||||
// TODO : separate Sun Shadow and Spot Shadow matrices
|
||||
glh::matrix4f mSunShadowMatrix[6];
|
||||
glh::matrix4f mShadowModelview[6];
|
||||
glh::matrix4f mShadowProjection[6];
|
||||
glh::matrix4f mReflectionModelView;
|
||||
glm::mat4 mSunShadowMatrix[6];
|
||||
glm::mat4 mShadowModelview[6];
|
||||
glm::mat4 mShadowProjection[6];
|
||||
glm::mat4 mReflectionModelView;
|
||||
|
||||
LLPointer<LLDrawable> mShadowSpotLight[2];
|
||||
F32 mSpotLightFade[2];
|
||||
|
|
|
|||
|
|
@ -312,23 +312,23 @@ void RlvSphereEffect::setShaderUniforms(LLGLSLShader* pShader)
|
|||
posSphereOrigin.setVec((isAgentAvatarValid()) ? gAgentAvatarp->getRenderPosition() : gAgent.getPositionAgent(), 1.0f);
|
||||
break;
|
||||
}
|
||||
glh::vec4f posSphereOriginGl(posSphereOrigin.mV);
|
||||
const glh::matrix4f& mvMatrix = gGLModelView;
|
||||
mvMatrix.mult_matrix_vec(posSphereOriginGl);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM1, 1, posSphereOriginGl.v);
|
||||
glm::vec4 posSphereOriginGl(glm::make_vec4(posSphereOrigin.mV));
|
||||
const glm::mat4 mvMatrix(get_current_modelview());
|
||||
posSphereOriginGl = mvMatrix * posSphereOriginGl;
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM1, 1, glm::value_ptr(posSphereOriginGl));
|
||||
|
||||
// Pack min/max distance and alpha together
|
||||
float nDistMin = m_nDistanceMin.get(), nDistMax = m_nDistanceMax.get();
|
||||
const glh::vec4f sphereParams(m_nValueMin.get(), nDistMin, m_nValueMax.get(), (nDistMax >= nDistMin) ? nDistMax : nDistMin);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM2, 1, sphereParams.v);
|
||||
const glm::vec4 sphereParams(m_nValueMin.get(), nDistMin, m_nValueMax.get(), (nDistMax >= nDistMin) ? nDistMax : nDistMin);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM2, 1, glm::value_ptr(sphereParams));
|
||||
|
||||
// Pass dist extend
|
||||
int eDistExtend = (int)m_eDistExtend;
|
||||
pShader->uniform2f(LLShaderMgr::RLV_EFFECT_PARAM3, (GLfloat)(eDistExtend & (int)ESphereDistExtend::Min), (GLfloat)(eDistExtend & (int)ESphereDistExtend::Max));
|
||||
|
||||
// Pass effect params
|
||||
const glh::vec4f effectParams(m_Params.get().mV);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM4, 1, effectParams.v);
|
||||
const glm::vec4 effectParams(glm::make_vec4(m_Params.get().mV));
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM4, 1, glm::value_ptr(effectParams));
|
||||
}
|
||||
|
||||
void RlvSphereEffect::renderPass(LLGLSLShader* pShader, const LLShaderEffectParams* pParams) const
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">danish</string>
|
||||
<string name="MacLocale">da_DK.UTF-8</string>
|
||||
<string name="macOSLocale">da_DK.UTF-8</string>
|
||||
<string name="DarwinLocale">da_DK.UTF-8</string>
|
||||
<string name="LinuxLocale">da_DK.UTF-8</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">german</string>
|
||||
<string name="MacLocale">de_DE.UTF-8</string>
|
||||
<string name="macOSLocale">de_DE.UTF-8</string>
|
||||
<string name="DarwinLocale">de_DE.UTF-8</string>
|
||||
<string name="LinuxLocale">de_DE.UTF-8</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">english</string>
|
||||
<string name="MacLocale">C</string>
|
||||
<string name="macOSLocale">C</string>
|
||||
<string name="DarwinLocale">C</string>
|
||||
<string name="LinuxLocale">C</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">spanish</string>
|
||||
<string name="MacLocale">es_ES.UTF-8</string>
|
||||
<string name="macOSLocale">es_ES.UTF-8</string>
|
||||
<string name="DarwinLocale">es_ES.UTF-8</string>
|
||||
<string name="LinuxLocale">es_ES.UTF-8</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<strings>
|
||||
<string name="MicrosoftLocale">french</string>
|
||||
<string name="MacLocale">fr_FR.UTF-8</string>
|
||||
<string name="macOSLocale">fr_FR.UTF-8</string>
|
||||
<string name="DarwinLocale">fr_FR.UTF-8</string>
|
||||
<string name="LinuxLocale">fr_FR.UTF-8</string>
|
||||
<string name="TimeHour">hour,datetime,slt</string>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">italian</string>
|
||||
<string name="MacLocale">it_IT.UTF-8</string>
|
||||
<string name="macOSLocale">it_IT.UTF-8</string>
|
||||
<string name="DarwinLocale">it_IT.UTF-8</string>
|
||||
<string name="LinuxLocale">it_IT.UTF-8</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
<string name="MacLocale">
|
||||
ja_JP.UTF-8
|
||||
</string>
|
||||
<string name="macOSLocale">
|
||||
ja_JP.UTF-8
|
||||
</string>
|
||||
<string name="DarwinLocale">
|
||||
ja_JP.UTF-8
|
||||
</string>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<strings>
|
||||
<string name="MicrosoftLocale">polish</string>
|
||||
<string name="MacLocale">pl_PL.UTF-8</string>
|
||||
<string name="macOSLocale">pl_PL.UTF-8</string>
|
||||
<string name="DarwinLocale">pl_PL.UTF-8</string>
|
||||
<string name="LinuxLocale">pl_PL.UTF-8</string>
|
||||
<string name="TimeHour">hour,datetime,slt</string>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<!-- Locale Information -->
|
||||
<string name="MicrosoftLocale">portuguese</string>
|
||||
<string name="MacLocale">pt_PT.UTF-8</string>
|
||||
<string name="macOSLocale">pt_PT.UTF-8</string>
|
||||
<string name="DarwinLocale">pt_PT.UTF-8</string>
|
||||
<string name="LinuxLocale">pt_PT.UTF-8</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -538,9 +538,9 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll
|
|||
mesh_scale *= normalized_transformation;
|
||||
normalized_transformation = mesh_scale;
|
||||
|
||||
glh::matrix4f inv_mat((F32*)normalized_transformation.mMatrix);
|
||||
inv_mat = inv_mat.inverse();
|
||||
LLMatrix4 inverse_normalized_transformation(inv_mat.m);
|
||||
glm::mat4 inv_mat = glm::make_mat4((F32*)normalized_transformation.mMatrix);
|
||||
inv_mat = glm::inverse(inv_mat);
|
||||
LLMatrix4 inverse_normalized_transformation(glm::value_ptr(inv_mat));
|
||||
|
||||
// bind shape matrix
|
||||
domSkin::domBind_shape_matrix* skin_current_bind_matrix = current_skin->getBind_shape_matrix();
|
||||
|
|
|
|||
Loading…
Reference in New Issue