summaryrefslogtreecommitdiff
path: root/indra/newview/llviewercontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewercontrol.cpp')
-rw-r--r--indra/newview/llviewercontrol.cpp99
1 files changed, 73 insertions, 26 deletions
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 7997bcfbdb..862bb3dfa9 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -81,7 +81,7 @@
#include <boost/algorithm/string.hpp>
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-BOOL gHackGodmode = FALSE;
+bool gHackGodmode = false;
#endif
// Should you contemplate changing the name "Global", please first grep for
@@ -94,9 +94,9 @@ LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warning
std::string gLastRunVersion;
-extern BOOL gResizeScreenTexture;
-extern BOOL gResizeShadowTexture;
-extern BOOL gDebugGL;
+extern bool gResizeScreenTexture;
+extern bool gResizeShadowTexture;
+extern bool gDebugGL;
////////////////////////////////////////////////////////////////////////////
// Listeners
@@ -263,12 +263,15 @@ static bool handleAnisotropicChanged(const LLSD& newvalue)
static bool handleVSyncChanged(const LLSD& newvalue)
{
LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean();
- gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
-
- if(newvalue.asBoolean() == true)
+ if (gViewerWindow && gViewerWindow->getWindow())
{
- U32 current_target = gSavedSettings.getU32("TargetFPS");
- gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
+ gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
+
+ if (newvalue.asBoolean())
+ {
+ U32 current_target = gSavedSettings.getU32("TargetFPS");
+ gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
+ }
}
return true;
@@ -295,12 +298,12 @@ static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue)
static bool handleTerrainLODChanged(const LLSD& newvalue)
{
- LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
- //sqaure lod factor to get exponential range of [0,4] and keep
- //a value of 1 in the middle of the detail slider for consistency
- //with other detail sliders (see panel_preferences_graphics1.xml)
- LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
- return true;
+ LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
+ //sqaure lod factor to get exponential range of [0,4] and keep
+ //a value of 1 in the middle of the detail slider for consistency
+ //with other detail sliders (see panel_preferences_graphics1.xml)
+ LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
+ return true;
}
static bool handleTreeLODChanged(const LLSD& newvalue)
@@ -375,7 +378,7 @@ static void handleAudioVolumeChanged(const LLSD& newvalue)
static bool handleJoystickChanged(const LLSD& newvalue)
{
- LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
+ LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
return true;
}
@@ -453,7 +456,7 @@ static bool handleRenderDebugPipelineChanged(const LLSD& newvalue)
static bool handleRenderResolutionDivisorChanged(const LLSD&)
{
- gResizeScreenTexture = TRUE;
+ gResizeScreenTexture = true;
return true;
}
@@ -468,6 +471,7 @@ static bool handleLogFileChanged(const LLSD& newvalue)
std::string log_filename = newvalue.asString();
LLFile::remove(log_filename);
LLError::logToFile(log_filename);
+ LL_INFOS() << "Logging switched to " << log_filename << LL_ENDL;
return true;
}
@@ -488,7 +492,7 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue)
// High Res Snapshot active, must uncheck RenderUIInSnapshot
if (newvalue.asBoolean())
{
- gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
+ gSavedSettings.setBOOL( "RenderUIInSnapshot", false);
}
return true;
}
@@ -667,8 +671,13 @@ void handlePerformanceStatsEnabledChanged(const LLSD& newValue)
}
void handleUserImpostorByDistEnabledChanged(const LLSD& newValue)
{
- const auto newval = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled");
- LLPerfStats::tunables.userImpostorDistanceTuningEnabled = newval;
+ bool auto_tune_newval = false;
+ S32 mode = gSavedSettings.getS32("RenderAvatarComplexityMode");
+ if (mode != LLVOAvatar::AV_RENDER_ONLY_SHOW_FRIENDS)
+ {
+ auto_tune_newval = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled");
+ }
+ LLPerfStats::tunables.userImpostorDistanceTuningEnabled = auto_tune_newval;
}
void handleUserImpostorDistanceChanged(const LLSD& newValue)
{
@@ -688,6 +697,28 @@ void handleLocalTerrainChanged(const LLSD& newValue)
const auto setting = gSavedSettings.getString(std::string("LocalTerrainAsset") + std::to_string(i + 1));
const LLUUID materialID(setting);
gLocalTerrainMaterials.setDetailAssetID(i, materialID);
+
+ // *NOTE: The GLTF spec allows for different texture infos to have their texture transforms set independently, but as a simplification, this debug setting only updates all the transforms in-sync (i.e. only one texture transform per terrain material).
+ LLGLTFMaterial::TextureTransform transform;
+ const std::string prefix = std::string("LocalTerrainTransform") + std::to_string(i + 1);
+ transform.mScale.mV[VX] = gSavedSettings.getF32(prefix + "ScaleU");
+ transform.mScale.mV[VY] = gSavedSettings.getF32(prefix + "ScaleV");
+ transform.mRotation = gSavedSettings.getF32(prefix + "Rotation") * DEG_TO_RAD;
+ transform.mOffset.mV[VX] = gSavedSettings.getF32(prefix + "OffsetU");
+ transform.mOffset.mV[VY] = gSavedSettings.getF32(prefix + "OffsetV");
+ LLPointer<LLGLTFMaterial> mat_override = new LLGLTFMaterial();
+ for (U32 info = 0; info < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++info)
+ {
+ mat_override->mTextureTransform[info] = transform;
+ }
+ if (*mat_override == LLGLTFMaterial::sDefault)
+ {
+ gLocalTerrainMaterials.setMaterialOverride(i, nullptr);
+ }
+ else
+ {
+ gLocalTerrainMaterials.setMaterialOverride(i, mat_override);
+ }
}
}
////////////////////////////////////////////////////////////////////////////
@@ -751,6 +782,7 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "RenderGlowNoise", handleSetShaderChanged);
setting_setup_signal_listener(gSavedSettings, "RenderGammaFull", handleSetShaderChanged);
setting_setup_signal_listener(gSavedSettings, "RenderVolumeLODFactor", handleVolumeLODChanged);
+ setting_setup_signal_listener(gSavedSettings, "RenderAvatarComplexityMode", handleUserImpostorByDistEnabledChanged);
setting_setup_signal_listener(gSavedSettings, "RenderAvatarLODFactor", handleAvatarLODChanged);
setting_setup_signal_listener(gSavedSettings, "RenderAvatarPhysicsLODFactor", handleAvatarPhysicsLODChanged);
setting_setup_signal_listener(gSavedSettings, "RenderTerrainLODFactor", handleTerrainLODChanged);
@@ -875,10 +907,25 @@ void settings_setup_listeners()
setting_setup_signal_listener(gSavedSettings, "AutoTuneImpostorFarAwayDistance", handleUserImpostorDistanceChanged);
setting_setup_signal_listener(gSavedSettings, "AutoTuneImpostorByDistEnabled", handleUserImpostorByDistEnabledChanged);
setting_setup_signal_listener(gSavedSettings, "TuningFPSStrategy", handleFPSTuningStrategyChanged);
- setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset1", handleLocalTerrainChanged);
- setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset2", handleLocalTerrainChanged);
- setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset3", handleLocalTerrainChanged);
- setting_setup_signal_listener(gSavedSettings, "LocalTerrainAsset4", handleLocalTerrainChanged);
+ {
+ const char* transform_suffixes[] = {
+ "ScaleU",
+ "ScaleV",
+ "Rotation",
+ "OffsetU",
+ "OffsetV"
+ };
+ for (U32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ const auto asset_setting_name = std::string("LocalTerrainAsset") + std::to_string(i + 1);
+ setting_setup_signal_listener(gSavedSettings, asset_setting_name, handleLocalTerrainChanged);
+ for (const char* ts : transform_suffixes)
+ {
+ const auto transform_setting_name = std::string("LocalTerrainTransform") + std::to_string(i + 1) + ts;
+ setting_setup_signal_listener(gSavedSettings, transform_setting_name, handleLocalTerrainChanged);
+ }
+ }
+ }
setting_setup_signal_listener(gSavedPerAccountSettings, "AvatarHoverOffsetZ", handleAvatarHoverOffsetChanged);
}
@@ -890,7 +937,7 @@ DECL_LLCC(U32, (U32)666);
DECL_LLCC(S32, (S32)-666);
DECL_LLCC(F32, (F32)-666.666);
DECL_LLCC(bool, true);
-DECL_LLCC(BOOL, FALSE);
+DECL_LLCC(bool, false);
static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value");
DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
@@ -909,7 +956,7 @@ void test_cached_control()
TEST_LLCC(S32, (S32)-666);
TEST_LLCC(F32, (F32)-666.666);
TEST_LLCC(bool, true);
- TEST_LLCC(BOOL, FALSE);
+ TEST_LLCC(bool, false);
if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL;
TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));