aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldisplay.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llpaneldisplay.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llpaneldisplay.cpp')
-rw-r--r--linden/indra/newview/llpaneldisplay.cpp850
1 files changed, 575 insertions, 275 deletions
diff --git a/linden/indra/newview/llpaneldisplay.cpp b/linden/indra/newview/llpaneldisplay.cpp
index 81b173a..5bc1f7e 100644
--- a/linden/indra/newview/llpaneldisplay.cpp
+++ b/linden/indra/newview/llpaneldisplay.cpp
@@ -45,7 +45,6 @@
45#include "llbutton.h" 45#include "llbutton.h"
46#include "llcheckboxctrl.h" 46#include "llcheckboxctrl.h"
47#include "llcombobox.h" 47#include "llcombobox.h"
48#include "lldrawpoolterrain.h"
49#include "llflexibleobject.h" 48#include "llflexibleobject.h"
50#include "lllineeditor.h" 49#include "lllineeditor.h"
51#include "llradiogroup.h" 50#include "llradiogroup.h"
@@ -71,18 +70,22 @@
71#include "llvieweruictrlfactory.h" 70#include "llvieweruictrlfactory.h"
72#include "llfeaturemanager.h" 71#include "llfeaturemanager.h"
73#include "llglslshader.h" 72#include "llglslshader.h"
73#include "llfloaterhardwaresettings.h"
74#include "llboost.h"
74 75
75//RN temporary includes for resolution switching 76//RN temporary includes for resolution switching
76#include "llglheaders.h" 77#include "llglheaders.h"
77#include "llviewercontrol.h" 78#include "llviewercontrol.h"
78#include "llsky.h" 79#include "llsky.h"
79 80
81// parent
82#include "llfloaterpreference.h"
83
80const F32 MAX_USER_FAR_CLIP = 512.f; 84const F32 MAX_USER_FAR_CLIP = 512.f;
81const F32 MIN_USER_FAR_CLIP = 64.f; 85const F32 MIN_USER_FAR_CLIP = 64.f;
82 86
83const S32 ASPECT_RATIO_STR_LEN = 100; 87const S32 ASPECT_RATIO_STR_LEN = 100;
84 88
85
86LLPanelDisplay::LLPanelDisplay() 89LLPanelDisplay::LLPanelDisplay()
87{ 90{
88 gUICtrlFactory->buildPanel(this, "panel_preferences_graphics1.xml"); 91 gUICtrlFactory->buildPanel(this, "panel_preferences_graphics1.xml");
@@ -92,20 +95,65 @@ BOOL LLPanelDisplay::postBuild()
92{ 95{
93 requires("windowed mode", WIDGET_TYPE_CHECKBOX); 96 requires("windowed mode", WIDGET_TYPE_CHECKBOX);
94 requires("fullscreen combo", WIDGET_TYPE_COMBO_BOX); 97 requires("fullscreen combo", WIDGET_TYPE_COMBO_BOX);
95 requires("resolution_format", WIDGET_TYPE_TEXT_BOX);
96 requires("aspect_ratio_text", WIDGET_TYPE_TEXT_BOX);
97 requires("aspect_ratio", WIDGET_TYPE_COMBO_BOX); 98 requires("aspect_ratio", WIDGET_TYPE_COMBO_BOX);
98 requires("aspect_auto_detect", WIDGET_TYPE_CHECKBOX); 99 requires("aspect_auto_detect", WIDGET_TYPE_CHECKBOX);
99 requires("UI Scale", WIDGET_TYPE_SLIDER); 100 requires("AspectRatioLabel1", WIDGET_TYPE_TEXT_BOX);
100 requires("ui_auto_scale", WIDGET_TYPE_CHECKBOX); 101 requires("DisplayResLabel", WIDGET_TYPE_TEXT_BOX);
101 requires("draw_distance", WIDGET_TYPE_SPINNER); 102 requires("FullScreenInfo", WIDGET_TYPE_TEXT_EDITOR);
102 requires("avfp", WIDGET_TYPE_CHECKBOX); 103
104 requires("QualityPerformanceSelection", WIDGET_TYPE_SLIDER);
105 requires("CustomSettings", WIDGET_TYPE_CHECKBOX);
106
107 requires("GraphicsHardwareButton", WIDGET_TYPE_BUTTON);
108 requires("Defaults", WIDGET_TYPE_BUTTON);
109
110 requires("BumpShiny", WIDGET_TYPE_CHECKBOX);
111 requires("BasicShaders", WIDGET_TYPE_CHECKBOX);
112 requires("AvatarVertexProgram", WIDGET_TYPE_CHECKBOX);
113 requires("WindLightUseAtmosShaders", WIDGET_TYPE_CHECKBOX);
114 requires("Reflections", WIDGET_TYPE_CHECKBOX);
115
116 requires("AvatarImpostors", WIDGET_TYPE_CHECKBOX);
117 requires("AvatarCloth", WIDGET_TYPE_CHECKBOX);
118
119 requires("DrawDistance", WIDGET_TYPE_SLIDER);
120 requires("DrawDistanceMeterText1", WIDGET_TYPE_TEXT_BOX);
121 requires("DrawDistanceMeterText2", WIDGET_TYPE_TEXT_BOX);
122
123 requires("ObjectMeshDetail", WIDGET_TYPE_SLIDER);
124 requires("FlexibleMeshDetail", WIDGET_TYPE_SLIDER);
125 requires("TreeMeshDetail", WIDGET_TYPE_SLIDER);
126 requires("AvatarMeshDetail", WIDGET_TYPE_SLIDER);
127 requires("TerrainMeshDetail", WIDGET_TYPE_SLIDER);
128 requires("SkyMeshDetail", WIDGET_TYPE_SLIDER);
129 requires("MaxParticleCount", WIDGET_TYPE_SLIDER);
130 requires("RenderPostProcess", WIDGET_TYPE_SLIDER);
131
132 requires("ObjectMeshDetailText", WIDGET_TYPE_TEXT_BOX);
133 requires("FlexibleMeshDetailText", WIDGET_TYPE_TEXT_BOX);
134 requires("TreeMeshDetailText", WIDGET_TYPE_TEXT_BOX);
135 requires("AvatarMeshDetailText", WIDGET_TYPE_TEXT_BOX);
136 requires("TerrainMeshDetailText", WIDGET_TYPE_TEXT_BOX);
137 requires("SkyMeshDetailText", WIDGET_TYPE_TEXT_BOX);
138 requires("PostProcessText", WIDGET_TYPE_TEXT_BOX);
139
140 requires("LightingDetailRadio", WIDGET_TYPE_RADIO_GROUP);
141 requires("TerrainDetailRadio", WIDGET_TYPE_RADIO_GROUP);
103 142
104 if (!checkRequirements()) 143 if (!checkRequirements())
105 { 144 {
106 return FALSE; 145 return FALSE;
107 } 146 }
108 147
148 // return to default values
149 childSetAction("Defaults", setHardwareDefaults, NULL);
150
151 // Help button
152 childSetAction("GraphicsPreferencesHelpButton", onOpenHelp, this);
153
154 // Hardware settings button
155 childSetAction("GraphicsHardwareButton", onOpenHardwareSettings, NULL);
156
109 //============================================================================ 157 //============================================================================
110 // Resolution 158 // Resolution
111 159
@@ -115,6 +163,10 @@ BOOL LLPanelDisplay::postBuild()
115 mCtrlWindowed->setCommitCallback(onCommitWindowedMode); 163 mCtrlWindowed->setCommitCallback(onCommitWindowedMode);
116 mCtrlWindowed->setCallbackUserData(this); 164 mCtrlWindowed->setCallbackUserData(this);
117 165
166 mAspectRatioLabel1 = LLUICtrlFactory::getTextBoxByName(this, "AspectRatioLabel1");
167 mFullScreenInfo = LLUICtrlFactory::getTextEditorByName(this, "FullScreenInfo");
168 mDisplayResLabel = LLUICtrlFactory::getTextBoxByName(this, "DisplayResLabel");
169
118 S32 num_resolutions = 0; 170 S32 num_resolutions = 0;
119 LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); 171 LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions);
120 172
@@ -122,7 +174,7 @@ BOOL LLPanelDisplay::postBuild()
122 174
123 mCtrlFullScreen = LLUICtrlFactory::getComboBoxByName(this, "fullscreen combo"); 175 mCtrlFullScreen = LLUICtrlFactory::getComboBoxByName(this, "fullscreen combo");
124 176
125 LLUIString resolution_label = childGetText("resolution_format"); 177 LLUIString resolution_label = getUIString("resolution_format");
126 178
127 for (S32 i = 0; i < num_resolutions; i++) 179 for (S32 i = 0; i < num_resolutions; i++)
128 { 180 {
@@ -151,7 +203,7 @@ BOOL LLPanelDisplay::postBuild()
151 } 203 }
152 mCtrlFullScreen->setCurrentByIndex(fullscreen_mode); 204 mCtrlFullScreen->setCurrentByIndex(fullscreen_mode);
153 mCtrlWindowed->set(FALSE); 205 mCtrlWindowed->set(FALSE);
154 mCtrlFullScreen->setEnabled(TRUE); 206 mCtrlFullScreen->setVisible(TRUE);
155 } 207 }
156 else 208 else
157 { 209 {
@@ -159,7 +211,7 @@ BOOL LLPanelDisplay::postBuild()
159 //fullscreen_mode = mCtrlFullScreen->getItemCount() - 1; 211 //fullscreen_mode = mCtrlFullScreen->getItemCount() - 1;
160 mCtrlWindowed->set(TRUE); 212 mCtrlWindowed->set(TRUE);
161 mCtrlFullScreen->setCurrentByIndex(0); 213 mCtrlFullScreen->setCurrentByIndex(0);
162 mCtrlFullScreen->setEnabled(FALSE); 214 mCtrlFullScreen->setVisible(FALSE);
163 } 215 }
164 } 216 }
165 217
@@ -176,7 +228,7 @@ BOOL LLPanelDisplay::postBuild()
176 S32 denominator = 0; 228 S32 denominator = 0;
177 fractionFromDecimal(mAspectRatio, numerator, denominator); 229 fractionFromDecimal(mAspectRatio, numerator, denominator);
178 230
179 LLUIString aspect_ratio_text = childGetText("aspect_ratio_text"); 231 LLUIString aspect_ratio_text = getUIString("aspect_ratio_text");
180 if (numerator != 0) 232 if (numerator != 0)
181 { 233 {
182 aspect_ratio_text.setArg("[NUM]", llformat("%d", numerator)); 234 aspect_ratio_text.setArg("[NUM]", llformat("%d", numerator));
@@ -199,6 +251,122 @@ BOOL LLPanelDisplay::postBuild()
199 mCtrlAutoDetectAspect->setCommitCallback(onCommitAutoDetectAspect); 251 mCtrlAutoDetectAspect->setCommitCallback(onCommitAutoDetectAspect);
200 mCtrlAutoDetectAspect->setCallbackUserData(this); 252 mCtrlAutoDetectAspect->setCallbackUserData(this);
201 253
254 // radio performance box
255 mCtrlSliderQuality = LLUICtrlFactory::getSliderByName(this,
256 "QualityPerformanceSelection");
257 mCtrlSliderQuality->setSliderMouseUpCallback(onChangeQuality);
258 mCtrlSliderQuality->setCallbackUserData(this);
259
260 mCtrlCustomSettings = LLUICtrlFactory::getCheckBoxByName(this, "CustomSettings");
261 mCtrlCustomSettings->setCommitCallback(onChangeCustom);
262 mCtrlCustomSettings->setCallbackUserData(this);
263
264 mGraphicsBorder = static_cast<LLViewBorder*>(getChildByName("GraphicsBorder"));
265 llassert(mGraphicsBorder != NULL);
266
267 //----------------------------------------------------------------------------
268 // Enable Bump/Shiny
269 mCtrlBumpShiny = LLUICtrlFactory::getCheckBoxByName(this, "BumpShiny");
270
271 //----------------------------------------------------------------------------
272 // Enable Reflections
273 mCtrlReflections = LLUICtrlFactory::getCheckBoxByName(this, "Reflections");
274 mCtrlReflections->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable);
275 mCtrlReflections->setCallbackUserData(this);
276 mRadioReflectionDetail = LLUICtrlFactory::getRadioGroupByName(this, "ReflectionDetailRadio");
277
278 // WindLight
279 mCtrlWindLight = LLUICtrlFactory::getCheckBoxByName(this, "WindLightUseAtmosShaders");
280 mCtrlWindLight->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable);
281 mCtrlWindLight->setCallbackUserData(this);
282
283 //----------------------------------------------------------------------------
284 // Enable Avatar Shaders
285 mCtrlAvatarVP = LLUICtrlFactory::getCheckBoxByName(this, "AvatarVertexProgram");
286 mCtrlAvatarVP->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable);
287 mCtrlAvatarVP->setCallbackUserData(this);
288
289 //----------------------------------------------------------------------------
290 // Avatar Render Mode
291 mCtrlAvatarCloth = LLUICtrlFactory::getCheckBoxByName(this, "AvatarCloth");
292 mCtrlAvatarImpostors = LLUICtrlFactory::getCheckBoxByName(this, "AvatarImpostors");
293
294 //----------------------------------------------------------------------------
295 // radio set for lighting detail
296 mRadioLightingDetail2 = LLUICtrlFactory::getRadioGroupByName(this, "LightingDetailRadio");
297
298 //----------------------------------------------------------------------------
299 // radio set for terrain detail mode
300 mRadioTerrainDetail = LLUICtrlFactory::getRadioGroupByName(this, "TerrainDetailRadio");
301
302 //----------------------------------------------------------------------------
303 // Global Shader Enable
304 mCtrlShaderEnable = LLUICtrlFactory::getCheckBoxByName(this, "BasicShaders");
305 mCtrlShaderEnable->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable);
306 mCtrlShaderEnable->setCallbackUserData(this);
307
308 //============================================================================
309
310 // Object detail slider
311 mCtrlDrawDistance = LLUICtrlFactory::getSliderByName(this, "DrawDistance");
312 mDrawDistanceMeterText1 = LLUICtrlFactory::getTextBoxByName(this, "DrawDistanceMeterText1");
313 mDrawDistanceMeterText2 = LLUICtrlFactory::getTextBoxByName(this, "DrawDistanceMeterText2");
314 mCtrlDrawDistance->setCommitCallback(&LLPanelDisplay::updateMeterText);
315 mCtrlDrawDistance->setCallbackUserData(this);
316
317 // Object detail slider
318 mCtrlLODFactor = LLUICtrlFactory::getSliderByName(this, "ObjectMeshDetail");
319 mLODFactorText = LLUICtrlFactory::getTextBoxByName(this, "ObjectMeshDetailText");
320 mCtrlLODFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
321 mCtrlLODFactor->setCallbackUserData(mLODFactorText);
322
323 // Flex object detail slider
324 mCtrlFlexFactor = LLUICtrlFactory::getSliderByName(this, "FlexibleMeshDetail");
325 mFlexFactorText = LLUICtrlFactory::getTextBoxByName(this, "FlexibleMeshDetailText");
326 mCtrlFlexFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
327 mCtrlFlexFactor->setCallbackUserData(mFlexFactorText);
328
329 // Tree detail slider
330 mCtrlTreeFactor = LLUICtrlFactory::getSliderByName(this, "TreeMeshDetail");
331 mTreeFactorText = LLUICtrlFactory::getTextBoxByName(this, "TreeMeshDetailText");
332 mCtrlTreeFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
333 mCtrlTreeFactor->setCallbackUserData(mTreeFactorText);
334
335 // Avatar detail slider
336 mCtrlAvatarFactor = LLUICtrlFactory::getSliderByName(this, "AvatarMeshDetail");
337 mAvatarFactorText = LLUICtrlFactory::getTextBoxByName(this, "AvatarMeshDetailText");
338 mCtrlAvatarFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
339 mCtrlAvatarFactor->setCallbackUserData(mAvatarFactorText);
340
341 // Terrain detail slider
342 mCtrlTerrainFactor = LLUICtrlFactory::getSliderByName(this, "TerrainMeshDetail");
343 mTerrainFactorText = LLUICtrlFactory::getTextBoxByName(this, "TerrainMeshDetailText");
344 mCtrlTerrainFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
345 mCtrlTerrainFactor->setCallbackUserData(mTerrainFactorText);
346
347 // Terrain detail slider
348 mCtrlSkyFactor = LLUICtrlFactory::getSliderByName(this, "SkyMeshDetail");
349 mSkyFactorText = LLUICtrlFactory::getTextBoxByName(this, "SkyMeshDetailText");
350 mCtrlSkyFactor->setCommitCallback(&LLPanelDisplay::updateSliderText);
351 mCtrlSkyFactor->setCallbackUserData(mSkyFactorText);
352
353 // Particle detail slider
354 mCtrlMaxParticle = LLUICtrlFactory::getSliderByName(this, "MaxParticleCount");
355
356 // Glow detail slider
357 mCtrlPostProcess = LLUICtrlFactory::getSliderByName(this, "RenderPostProcess");
358 mPostProcessText = LLUICtrlFactory::getTextBoxByName(this, "PostProcessText");
359 mCtrlPostProcess->setCommitCallback(&LLPanelDisplay::updateSliderText);
360 mCtrlPostProcess->setCallbackUserData(mPostProcessText);
361
362 // Text boxes (for enabling/disabling)
363 mShaderText = LLUICtrlFactory::getTextBoxByName(this, "ShadersText");
364 mReflectionText = LLUICtrlFactory::getTextBoxByName(this, "ReflectionDetailText");
365 mAvatarText = LLUICtrlFactory::getTextBoxByName(this, "AvatarRenderingText");
366 mTerrainText = LLUICtrlFactory::getTextBoxByName(this, "TerrainDetailText");
367 mLightingText = LLUICtrlFactory::getTextBoxByName(this, "LightingDetailText");
368 mMeshDetailText = LLUICtrlFactory::getTextBoxByName(this, "MeshDetailText");
369
202 refresh(); 370 refresh();
203 371
204 return TRUE; 372 return TRUE;
@@ -220,24 +388,322 @@ void LLPanelDisplay::refresh()
220 388
221 mFSAutoDetectAspect = gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"); 389 mFSAutoDetectAspect = gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio");
222 390
223 mUIScaleFactor = gSavedSettings.getF32("UIScaleFactor"); 391 mQualityPerformance = gSavedSettings.getU32("RenderQualityPerformance");
224 mUIAutoScale = gSavedSettings.getBOOL("UIAutoScale"); 392 mCustomSettings = gSavedSettings.getBOOL("RenderCustomSettings");
225 393
226 // First Person Visibility 394 // shader settings
227 mFirstPersonAvatarVisible = gSavedSettings.getBOOL("FirstPersonAvatarVisible"); 395 mBumpShiny = gSavedSettings.getBOOL("RenderObjectBump");
396 mShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable");
397 mWindLight = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
398 mReflections = gSavedSettings.getBOOL("RenderWaterReflections");
399 mAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP");
400
401 // reflection radio
402 mReflectionDetail = gSavedSettings.getS32("RenderReflectionDetail");
403
404 // avatar settings
405 mAvatarImpostors = gSavedSettings.getBOOL("RenderUseImpostors");
406 mAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth");
228 407
229 // Draw distance 408 // Draw distance
230 mRenderFarClip = gSavedSettings.getF32("RenderFarClip"); 409 mRenderFarClip = gSavedSettings.getF32("RenderFarClip");
410
411 // sliders and their text boxes
412 mPrimLOD = gSavedSettings.getF32("RenderVolumeLODFactor");
413 mFlexLOD = gSavedSettings.getF32("RenderFlexTimeFactor");
414 mTreeLOD = gSavedSettings.getF32("RenderTreeLODFactor");
415 mAvatarLOD = gSavedSettings.getF32("RenderAvatarLODFactor");
416 mTerrainLOD = gSavedSettings.getF32("RenderTerrainLODFactor");
417 mSkyLOD = gSavedSettings.getU32("WLSkyDetail");
418 mParticleCount = gSavedSettings.getS32("RenderMaxPartCount");
419 mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
231 420
421 // lighting and terrain radios
422 mLightingDetail = gSavedSettings.getS32("RenderLightingDetail");
423 mTerrainDetail = gSavedSettings.getS32("RenderTerrainDetail");
424
425 // slider text boxes
426 updateSliderText(mCtrlLODFactor, mLODFactorText);
427 updateSliderText(mCtrlFlexFactor, mFlexFactorText);
428 updateSliderText(mCtrlTreeFactor, mTreeFactorText);
429 updateSliderText(mCtrlAvatarFactor, mAvatarFactorText);
430 updateSliderText(mCtrlTerrainFactor, mTerrainFactorText);
431 updateSliderText(mCtrlPostProcess, mPostProcessText);
432 updateSliderText(mCtrlSkyFactor, mSkyFactorText);
433
434 refreshEnabledState();
435}
436
437void LLPanelDisplay::refreshEnabledState()
438{
439 // if in windowed mode, disable full screen options
440 bool isFullScreen = !mCtrlWindowed->get();
441
442 mDisplayResLabel->setVisible(isFullScreen);
443 mCtrlFullScreen->setVisible(isFullScreen);
444 mCtrlAspectRatio->setVisible(isFullScreen);
445 mAspectRatioLabel1->setVisible(isFullScreen);
446 mCtrlAutoDetectAspect->setVisible(isFullScreen);
447 mFullScreenInfo->setVisible(!isFullScreen);
448
449 // disable graphics settings and exit if it's not set to custom
450 if(!gSavedSettings.getBOOL("RenderCustomSettings"))
451 {
452 setHiddenGraphicsState(true);
453 return;
454 }
455
456 // otherwise turn them all on and selectively turn off others
457 else
458 {
459 setHiddenGraphicsState(false);
460 }
461
462 // Reflections
463 BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable")
464 && gGLManager.mHasCubeMap
465 && gFeatureManagerp->isFeatureAvailable("RenderCubeMap");
466 mCtrlReflections->setEnabled(reflections);
467
468 // Bump & Shiny
469 bool bumpshiny = gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap") && gFeatureManagerp->isFeatureAvailable("RenderObjectBump");
470 mCtrlBumpShiny->setEnabled(bumpshiny ? TRUE : FALSE);
471
472 for (S32 i = 0; i < mRadioReflectionDetail->getItemCount(); ++i)
473 {
474 mRadioReflectionDetail->setIndexEnabled(i, mCtrlReflections->get() && reflections);
475 }
476
477 // Avatar Mode
478 S32 max_avatar_shader = LLShaderMgr::sMaxAvatarShaderLevel;
479 mCtrlAvatarVP->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE);
480
481 if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE ||
482 gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
483 {
484 mCtrlAvatarCloth->setEnabled(false);
485 }
486 else
487 {
488 mCtrlAvatarCloth->setEnabled(true);
489 }
490
491 // Vertex Shaders
492 mCtrlShaderEnable->setEnabled(gFeatureManagerp->isFeatureAvailable("VertexShaderEnable"));
493
494 BOOL shaders = mCtrlShaderEnable->get();
495 if (shaders)
496 {
497 mRadioTerrainDetail->setValue(1);
498 mRadioTerrainDetail->setEnabled(FALSE);
499 }
500 else
501 {
502 mRadioTerrainDetail->setEnabled(TRUE);
503 }
504
505 // *HACK just checks to see if we can use shaders...
506 // maybe some cards that use shaders, but don't support windlight
507 mCtrlWindLight->setEnabled(mCtrlShaderEnable->getEnabled() && shaders);
508
509 // turn off sky detail if atmostpherics isn't on
510 mCtrlSkyFactor->setEnabled(gSavedSettings.getBOOL("WindLightUseAtmosShaders"));
511 mSkyFactorText->setEnabled(gSavedSettings.getBOOL("WindLightUseAtmosShaders"));
512
513 // now turn off any features that are unavailable
514 disableUnavailableSettings();
515}
516
517void LLPanelDisplay::disableUnavailableSettings()
518{
519 // if vertex shaders off, disable all shader related products
520 if(!gFeatureManagerp->isFeatureAvailable("VertexShaderEnable"))
521 {
522 mCtrlShaderEnable->setEnabled(FALSE);
523 mCtrlShaderEnable->setValue(FALSE);
524
525 mCtrlWindLight->setEnabled(FALSE);
526 mCtrlWindLight->setValue(FALSE);
527
528 mCtrlReflections->setEnabled(FALSE);
529 mCtrlReflections->setValue(FALSE);
530
531 mCtrlAvatarVP->setEnabled(FALSE);
532 mCtrlAvatarVP->setValue(FALSE);
533
534 mCtrlAvatarCloth->setEnabled(FALSE);
535 mCtrlAvatarCloth->setValue(FALSE);
536 }
537
538 // disabled windlight
539 if(!gFeatureManagerp->isFeatureAvailable("WindLightUseAtmosShaders"))
540 {
541 mCtrlWindLight->setEnabled(FALSE);
542 mCtrlWindLight->setValue(FALSE);
543 }
544
545 // disabled reflections
546 if(!gFeatureManagerp->isFeatureAvailable("RenderWaterReflections"))
547 {
548 mCtrlReflections->setEnabled(FALSE);
549 mCtrlReflections->setValue(FALSE);
550 }
551
552 // disabled av
553 if(!gFeatureManagerp->isFeatureAvailable("RenderAvatarVP"))
554 {
555 mCtrlAvatarVP->setEnabled(FALSE);
556 mCtrlAvatarVP->setValue(FALSE);
557
558 mCtrlAvatarCloth->setEnabled(FALSE);
559 mCtrlAvatarCloth->setValue(FALSE);
560 }
561 // disabled cloth
562 if(!gFeatureManagerp->isFeatureAvailable("RenderAvatarCloth"))
563 {
564 mCtrlAvatarCloth->setEnabled(FALSE);
565 mCtrlAvatarCloth->setValue(FALSE);
566 }
567 // disabled impostors
568 if(!gFeatureManagerp->isFeatureAvailable("RenderUseImpostors"))
569 {
570 mCtrlAvatarImpostors->setEnabled(FALSE);
571 mCtrlAvatarImpostors->setValue(FALSE);
572 }
573}
574
575void LLPanelDisplay::setHiddenGraphicsState(bool isHidden)
576{
577 // quick check
578 llassert(mGraphicsBorder != NULL);
579
580 llassert(mCtrlDrawDistance != NULL);
581 llassert(mCtrlLODFactor != NULL);
582 llassert(mCtrlFlexFactor != NULL);
583 llassert(mCtrlTreeFactor != NULL);
584 llassert(mCtrlAvatarFactor != NULL);
585 llassert(mCtrlTerrainFactor != NULL);
586 llassert(mCtrlSkyFactor != NULL);
587 llassert(mCtrlMaxParticle != NULL);
588 llassert(mCtrlPostProcess != NULL);
589
590 llassert(mLODFactorText != NULL);
591 llassert(mFlexFactorText != NULL);
592 llassert(mTreeFactorText != NULL);
593 llassert(mAvatarFactorText != NULL);
594 llassert(mTerrainFactorText != NULL);
595 llassert(mSkyFactorText != NULL);
596 llassert(mPostProcessText != NULL);
597
598 llassert(mCtrlBumpShiny != NULL);
599 llassert(mCtrlReflections != NULL);
600 llassert(mCtrlWindLight != NULL);
601 llassert(mCtrlAvatarVP != NULL);
602 llassert(mCtrlShaderEnable != NULL);
603 llassert(mCtrlAvatarImpostors != NULL);
604 llassert(mCtrlAvatarCloth != NULL);
605 llassert(mRadioLightingDetail2 != NULL);
606
607 llassert(mRadioTerrainDetail != NULL);
608 llassert(mRadioReflectionDetail != NULL);
609
610 llassert(mMeshDetailText != NULL);
611 llassert(mShaderText != NULL);
612 llassert(mReflectionText != NULL);
613 llassert(mAvatarText != NULL);
614 llassert(mLightingText != NULL);
615 llassert(mTerrainText != NULL);
616 llassert(mDrawDistanceMeterText1 != NULL);
617 llassert(mDrawDistanceMeterText2 != NULL);
618
619 // enable/disable the states
620 mGraphicsBorder->setVisible(!isHidden);
621 /*
622 LLColor4 light(.45098f, .51765f, .6078f, 1.0f);
623 LLColor4 dark(.10196f, .10196f, .10196f, 1.0f);
624 b ? mGraphicsBorder->setColors(dark, light) : mGraphicsBorder->setColors(dark, dark);
625 */
626
627 mCtrlDrawDistance->setVisible(!isHidden);
628 mCtrlLODFactor->setVisible(!isHidden);
629 mCtrlFlexFactor->setVisible(!isHidden);
630 mCtrlTreeFactor->setVisible(!isHidden);
631 mCtrlAvatarFactor->setVisible(!isHidden);
632 mCtrlTerrainFactor->setVisible(!isHidden);
633 mCtrlSkyFactor->setVisible(!isHidden);
634 mCtrlMaxParticle->setVisible(!isHidden);
635 mCtrlPostProcess->setVisible(!isHidden);
636
637 mLODFactorText->setVisible(!isHidden);
638 mFlexFactorText->setVisible(!isHidden);
639 mTreeFactorText->setVisible(!isHidden);
640 mAvatarFactorText->setVisible(!isHidden);
641 mTerrainFactorText->setVisible(!isHidden);
642 mSkyFactorText->setVisible(!isHidden);
643 mPostProcessText->setVisible(!isHidden);
644
645 mCtrlBumpShiny->setVisible(!isHidden);
646 mCtrlReflections->setVisible(!isHidden);
647 mCtrlWindLight->setVisible(!isHidden);
648 mCtrlAvatarVP->setVisible(!isHidden);
649 mCtrlShaderEnable->setVisible(!isHidden);
650 mCtrlAvatarImpostors->setVisible(!isHidden);
651 mCtrlAvatarCloth->setVisible(!isHidden);
652 mRadioLightingDetail2->setVisible(!isHidden);
653
654 mRadioTerrainDetail->setVisible(!isHidden);
655 mRadioReflectionDetail->setVisible(!isHidden);
656
657 // text boxes
658 mShaderText->setVisible(!isHidden);
659 mReflectionText->setVisible(!isHidden);
660 mAvatarText->setVisible(!isHidden);
661 mLightingText->setVisible(!isHidden);
662 mTerrainText->setVisible(!isHidden);
663 mDrawDistanceMeterText1->setVisible(!isHidden);
664 mDrawDistanceMeterText2->setVisible(!isHidden);
665
666 // hide one meter text if we're making things visible
667 if(!isHidden)
668 {
669 updateMeterText(mCtrlDrawDistance, this);
670 }
671
672 mMeshDetailText->setVisible(!isHidden);
232} 673}
233 674
234void LLPanelDisplay::cancel() 675void LLPanelDisplay::cancel()
235{ 676{
236 gSavedSettings.setBOOL("FullScreenAutoDetectAspectRatio", mFSAutoDetectAspect); 677 gSavedSettings.setBOOL("FullScreenAutoDetectAspectRatio", mFSAutoDetectAspect);
237 gSavedSettings.setF32("UIScaleFactor", mUIScaleFactor); 678 gSavedSettings.setF32("FullScreenAspectRatio", mAspectRatio);
238 gSavedSettings.setBOOL("UIAutoScale", mUIAutoScale); 679
239 gSavedSettings.setBOOL("FirstPersonAvatarVisible", mFirstPersonAvatarVisible); 680 gSavedSettings.setU32("RenderQualityPerformance", mQualityPerformance);
681
682 gSavedSettings.setBOOL("RenderCustomSettings", mCustomSettings);
683
684 gSavedSettings.setBOOL("RenderObjectBump", mBumpShiny);
685 gSavedSettings.setBOOL("VertexShaderEnable", mShaderEnable);
686 gSavedSettings.setBOOL("WindLightUseAtmosShaders", mWindLight);
687 gSavedSettings.setBOOL("RenderWaterReflections", mReflections);
688 gSavedSettings.setBOOL("RenderAvatarVP", mAvatarVP);
689
690 gSavedSettings.setS32("RenderReflectionDetail", mReflectionDetail);
691
692 gSavedSettings.setBOOL("RenderUseImpostors", mAvatarImpostors);
693 gSavedSettings.setBOOL("RenderAvatarCloth", mAvatarCloth);
694
695 gSavedSettings.setS32("RenderLightingDetail", mLightingDetail);
696 gSavedSettings.setS32("RenderTerrainDetail", mTerrainDetail);
697
240 gSavedSettings.setF32("RenderFarClip", mRenderFarClip); 698 gSavedSettings.setF32("RenderFarClip", mRenderFarClip);
699 gSavedSettings.setF32("RenderVolumeLODFactor", mPrimLOD);
700 gSavedSettings.setF32("RenderFlexTimeFactor", mFlexLOD);
701 gSavedSettings.setF32("RenderTreeLODFactor", mTreeLOD);
702 gSavedSettings.setF32("RenderAvatarLODFactor", mAvatarLOD);
703 gSavedSettings.setF32("RenderTerrainLODFactor", mTerrainLOD);
704 gSavedSettings.setU32("WLSkyDetail", mSkyLOD);
705 gSavedSettings.setS32("RenderMaxPartCount", mParticleCount);
706 gSavedSettings.setS32("RenderGlowResolutionPow", mPostProcess);
241} 707}
242 708
243void LLPanelDisplay::apply() 709void LLPanelDisplay::apply()
@@ -245,6 +711,49 @@ void LLPanelDisplay::apply()
245 applyResolution(); 711 applyResolution();
246} 712}
247 713
714void LLPanelDisplay::onChangeQuality(LLUICtrl *ctrl, void *data)
715{
716 LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
717 LLPanelDisplay* cur_panel = static_cast<LLPanelDisplay*>(data);
718
719 if(sldr == NULL || cur_panel == NULL)
720 {
721 return;
722 }
723
724 U32 set = (U32)sldr->getValueF32();
725 gFeatureManagerp->setGraphicsLevel(set, true);
726
727 LLFloaterPreference::refreshEnabledGraphics();
728 cur_panel->refresh();
729}
730
731void LLPanelDisplay::onChangeCustom(LLUICtrl *ctrl, void *data)
732{
733 LLFloaterPreference::refreshEnabledGraphics();
734}
735
736void LLPanelDisplay::onOpenHelp(void* user_data)
737{
738 LLPanelDisplay* self = static_cast<LLPanelDisplay*>(user_data);
739
740 const char* xml_alert = "GraphicsPreferencesHelp";
741 LLAlertDialog* dialogp = gViewerWindow->alertXml(xml_alert);
742 if (dialogp)
743 {
744 LLFloater* root_floater = gFloaterView->getParentFloater(self);
745 if (root_floater)
746 {
747 root_floater->addDependentFloater(dialogp);
748 }
749 }
750}
751
752void LLPanelDisplay::onOpenHardwareSettings(void* user_data)
753{
754 LLFloaterHardwareSettings::show();
755}
756
248void LLPanelDisplay::onApplyResolution(LLUICtrl* src, void* user_data) 757void LLPanelDisplay::onApplyResolution(LLUICtrl* src, void* user_data)
249{ 758{
250 ((LLPanelDisplay*) src)->applyResolution(); 759 ((LLPanelDisplay*) src)->applyResolution();
@@ -369,16 +878,7 @@ void LLPanelDisplay::onCommitWindowedMode(LLUICtrl* ctrl, void *data)
369{ 878{
370 LLPanelDisplay *panel = (LLPanelDisplay*)data; 879 LLPanelDisplay *panel = (LLPanelDisplay*)data;
371 880
372 BOOL windowed_mode = ((LLCheckBoxCtrl*)ctrl)->get(); 881 panel->refresh();
373
374 if (windowed_mode)
375 {
376 panel->mCtrlFullScreen->setEnabled(FALSE);
377 }
378 else
379 {
380 panel->mCtrlFullScreen->setEnabled(TRUE);
381 }
382} 882}
383 883
384//static 884//static
@@ -387,11 +887,13 @@ void LLPanelDisplay::onCommitAutoDetectAspect(LLUICtrl *ctrl, void *data)
387 LLPanelDisplay *panel = (LLPanelDisplay*)data; 887 LLPanelDisplay *panel = (LLPanelDisplay*)data;
388 888
389 BOOL auto_detect = ((LLCheckBoxCtrl*)ctrl)->get(); 889 BOOL auto_detect = ((LLCheckBoxCtrl*)ctrl)->get();
890 F32 ratio;
390 891
391 if (auto_detect) 892 if (auto_detect)
392 { 893 {
393 S32 numerator = 0; 894 S32 numerator = 0;
394 S32 denominator = 0; 895 S32 denominator = 0;
896
395 // clear any aspect ratio override 897 // clear any aspect ratio override
396 gViewerWindow->mWindow->setNativeAspectRatio(0.f); 898 gViewerWindow->mWindow->setNativeAspectRatio(0.f);
397 fractionFromDecimal(gViewerWindow->mWindow->getNativeAspectRatio(), numerator, denominator); 899 fractionFromDecimal(gViewerWindow->mWindow->getNativeAspectRatio(), numerator, denominator);
@@ -407,6 +909,9 @@ void LLPanelDisplay::onCommitAutoDetectAspect(LLUICtrl *ctrl, void *data)
407 } 909 }
408 910
409 panel->mCtrlAspectRatio->setLabel(aspect); 911 panel->mCtrlAspectRatio->setLabel(aspect);
912
913 ratio = gViewerWindow->mWindow->getNativeAspectRatio();
914 gSavedSettings.setF32("FullScreenAspectRatio", ratio);
410 } 915 }
411} 916}
412 917
@@ -442,276 +947,71 @@ void LLPanelDisplay::fractionFromDecimal(F32 decimal_val, S32& numerator, S32& d
442 } 947 }
443} 948}
444 949
445//============================================================================ 950//static
446 951void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data)
447LLPanelDisplay2::LLPanelDisplay2()
448{ 952{
449 gUICtrlFactory->buildPanel(this, "panel_preferences_graphics3.xml"); 953 LLFloaterPreference::refreshEnabledGraphics();
450} 954}
451 955
452BOOL LLPanelDisplay2::postBuild() 956void LLPanelDisplay::setHardwareDefaults(void* user_data)
453{ 957{
454 requires("ani", WIDGET_TYPE_CHECKBOX); 958 if (gFeatureManagerp)
455 requires("gamma", WIDGET_TYPE_SPINNER);
456 requires("vbo", WIDGET_TYPE_CHECKBOX);
457 requires("video card memory radio", WIDGET_TYPE_RADIO_GROUP);
458 requires("fog", WIDGET_TYPE_SPINNER);
459 requires("particles", WIDGET_TYPE_SPINNER);
460 requires("comp limit", WIDGET_TYPE_SPINNER);
461 requires("debug beacon line width", WIDGET_TYPE_SPINNER);
462
463 if (!checkRequirements())
464 { 959 {
465 return FALSE; 960 gFeatureManagerp->applyRecommendedSettings();
961 LLFloaterPreference::refreshEnabledGraphics();
466 } 962 }
467
468 // Graphics Card Memory
469 mRadioVideoCardMem = LLUICtrlFactory::getRadioGroupByName(this, "video card memory radio");
470
471#if !LL_WINDOWS
472 // The probe_hardware_checkbox setting is only used in the Windows build
473 // (It apparently controls a time-consuming DX9 hardware probe.)
474 // Disable the checkbox everywhere else
475 gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE );
476 childSetEnabled("probe_hardware_checkbox", false);
477#endif // !LL_WINDOWS
478
479 refresh();
480
481 return TRUE;
482} 963}
483 964
484 965void LLPanelDisplay::updateSliderText(LLUICtrl* ctrl, void* user_data)
485LLPanelDisplay2::~LLPanelDisplay2()
486{ 966{
487 // Children all cleaned up by default view destructor. 967 // get our UI widgets
488} 968 LLTextBox* text_box = (LLTextBox*)user_data;
489 969 LLSliderCtrl* slider = (LLSliderCtrl*) ctrl;
490void LLPanelDisplay2::refresh() 970 if(text_box == NULL || slider == NULL)
491{
492 LLPanel::refresh();
493
494 mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable");
495 mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic");
496 mGamma = gSavedSettings.getF32("RenderGamma");
497 mBrightness = gSavedSettings.getF32("RenderNightBrightness");
498 mVideoCardMem = gSavedSettings.getS32("GraphicsCardMemorySetting");
499 mFogRatio = gSavedSettings.getF32("RenderFogRatio");
500 mParticleCount = gSavedSettings.getS32("RenderMaxPartCount");
501 mCompositeLimit = gSavedSettings.getS32("AvatarCompositeLimit");
502 mDebugBeaconLineWidth = gSavedSettings.getS32("DebugBeaconLineWidth");
503 mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup");
504
505 refreshEnabledState();
506}
507
508void LLPanelDisplay2::refreshEnabledState()
509{
510 S32 max_setting = LLViewerImageList::getMaxVideoRamSetting();
511 max_setting = llclamp(max_setting, 0, 5);
512 for (S32 i=max_setting+1; i < mRadioVideoCardMem->getItemCount(); i++)
513 {
514 mRadioVideoCardMem->getRadioButton(i)->setEnabled(FALSE);
515 }
516
517 if (!gFeatureManagerp->isFeatureAvailable("RenderVBO") ||
518 !gGLManager.mHasVertexBufferObject)
519 { 971 {
520 childSetEnabled("vbo", FALSE); 972 return;
521 } 973 }
522}
523 974
524void LLPanelDisplay2::apply() 975 // get range and points when text should change
525{ 976 F32 range = slider->getMaxValue() - slider->getMinValue();
977 llassert(range > 0);
978 F32 midPoint = slider->getMinValue() + range / 3.0f;
979 F32 highPoint = slider->getMinValue() + (2.0f * range / 3.0f);
526 980
527 // Anisotropic rendering 981 // choose the right text
528 BOOL old_anisotropic = LLImageGL::sGlobalUseAnisotropic; 982 if(slider->getValueF32() < midPoint)
529 LLImageGL::sGlobalUseAnisotropic = childGetValue("ani");
530 if (old_anisotropic != LLImageGL::sGlobalUseAnisotropic)
531 { 983 {
532 BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); 984 text_box->setText(LLString("Low"));
533 gViewerWindow->restartDisplay(logged_in); 985 }
986 else if (slider->getValueF32() < highPoint)
987 {
988 text_box->setText(LLString("Mid"));
534 } 989 }
535 990 else
536 refresh();
537}
538
539
540void LLPanelDisplay2::cancel()
541{
542 gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO);
543 gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso);
544 gSavedSettings.setF32("RenderGamma", mGamma);
545 gSavedSettings.setF32("RenderNightBrightness", mBrightness);
546 gSavedSettings.setS32("GraphicsCardMemorySetting", mVideoCardMem);
547 gSavedSettings.setF32("RenderFogRatio", mFogRatio);
548 gSavedSettings.setS32("RenderMaxPartCount", mParticleCount);
549 gSavedSettings.setS32("AvatarCompositeLimit", mCompositeLimit);
550 gSavedSettings.setS32("DebugBeaconLineWidth", mDebugBeaconLineWidth);
551 gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup );
552}
553
554//============================================================================
555
556LLPanelDisplay3::LLPanelDisplay3()
557{
558 gUICtrlFactory->buildPanel(this, "panel_preferences_graphics2.xml");
559}
560
561BOOL LLPanelDisplay3::postBuild()
562{
563 requires("bumpshiny", WIDGET_TYPE_CHECKBOX);
564 requires("ripple", WIDGET_TYPE_CHECKBOX);
565 requires("avatarvp", WIDGET_TYPE_CHECKBOX);
566 requires("shaders", WIDGET_TYPE_CHECKBOX);
567
568 requires("Avatar Appearance", WIDGET_TYPE_RADIO_GROUP);
569 requires("lighting detail radio", WIDGET_TYPE_RADIO_GROUP);
570 requires("terrain detail radio", WIDGET_TYPE_RADIO_GROUP);
571
572 requires("Prim LOD Factor", WIDGET_TYPE_SLIDER_BAR);
573 requires("Flex Factor", WIDGET_TYPE_SLIDER_BAR);
574 requires("Tree LOD Factor", WIDGET_TYPE_SLIDER_BAR);
575 requires("Avatar LOD Factor", WIDGET_TYPE_SLIDER_BAR);
576
577 if (!checkRequirements())
578 { 991 {
579 return FALSE; 992 text_box->setText(LLString("High"));
580 } 993 }
581
582 //----------------------------------------------------------------------------
583 // Enable Bump/Shiny
584 mCtrlBumpShiny = LLUICtrlFactory::getCheckBoxByName(this, "bumpshiny");
585
586 //----------------------------------------------------------------------------
587 // Enable Ripple Water
588 mCtrlRippleWater = LLUICtrlFactory::getCheckBoxByName(this, "ripple");
589
590 //----------------------------------------------------------------------------
591 // Enable Avatar Shaders
592 mCtrlAvatarVP = LLUICtrlFactory::getCheckBoxByName(this, "avatarvp");
593 mCtrlAvatarVP->setCommitCallback(&LLPanelDisplay3::onVertexShaderEnable);
594 mCtrlAvatarVP->setCallbackUserData(this);
595
596 //----------------------------------------------------------------------------
597 // Avatar Render Mode
598 mCtrlAvatarMode = LLUICtrlFactory::getRadioGroupByName(this, "Avatar Appearance");
599
600 //----------------------------------------------------------------------------
601 // radio set for lighting detail
602 mRadioLightingDetail2 = LLUICtrlFactory::getRadioGroupByName(this, "lighting detail radio");
603
604 //----------------------------------------------------------------------------
605 // radio set for terrain detail mode
606 mRadioTerrainDetail = LLUICtrlFactory::getRadioGroupByName(this, "terrain detail radio");
607
608 //----------------------------------------------------------------------------
609 // Global Shader Enable
610 mCtrlShaderEnable = LLUICtrlFactory::getCheckBoxByName(this, "shaders");
611 mCtrlShaderEnable->setCommitCallback(&LLPanelDisplay3::onVertexShaderEnable);
612 mCtrlShaderEnable->setCallbackUserData(this);
613
614
615 //============================================================================
616
617 // Object detail slider
618 mCtrlLODFactor = LLUICtrlFactory::getSliderBarByName(this, "Prim LOD Factor");
619
620 // Flex object detail slider
621 mCtrlFlexFactor = LLUICtrlFactory::getSliderBarByName(this, "Flex Factor");
622
623 // Tree detail slider
624 mCtrlTreeFactor = LLUICtrlFactory::getSliderBarByName(this, "Tree LOD Factor");
625
626 // Avatar detail slider
627 mCtrlAvatarFactor = LLUICtrlFactory::getSliderBarByName(this, "Avatar LOD Factor");
628
629 refresh();
630
631 return TRUE;
632}
633
634
635LLPanelDisplay3::~LLPanelDisplay3()
636{
637}
638
639void LLPanelDisplay3::refresh()
640{
641 LLPanel::refresh();
642
643 mBumpShiny = gSavedSettings.getBOOL("RenderObjectBump");
644 mRippleWater = gSavedSettings.getBOOL("RenderRippleWater");
645 mAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP");
646 mShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable");
647 mAvatarMode = gSavedSettings.getS32("RenderAvatarMode");
648 mLightingDetail = gSavedSettings.getS32("RenderLightingDetail");
649 mTerrainDetail = gSavedSettings.getS32("RenderTerrainDetail");
650 mPrimLOD = gSavedSettings.getF32("RenderVolumeLODFactor");
651 mFlexLOD = gSavedSettings.getF32("RenderFlexTimeFactor");
652 mTreeLOD = gSavedSettings.getF32("RenderTreeLODFactor");
653 mAvatarLOD = gSavedSettings.getF32("RenderAvatarLODFactor");
654
655 refreshEnabledState();
656} 994}
657 995
658void LLPanelDisplay3::refreshEnabledState() 996void LLPanelDisplay::updateMeterText(LLUICtrl* ctrl, void* user_data)
659{ 997{
660 // Ripple Water 998 // get our UI widgets
661 bool ripple = (LLShaderMgr::getMaxVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) >= 2) && gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap"); 999 LLPanelDisplay* panel = (LLPanelDisplay*)user_data;
662 mCtrlRippleWater->setEnabled(ripple ? TRUE : FALSE); 1000 LLSliderCtrl* slider = (LLSliderCtrl*) ctrl;
663
664 // Bump & Shiny
665 bool bumpshiny = gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap") && gFeatureManagerp->isFeatureAvailable("RenderObjectBump");
666 mCtrlBumpShiny->setEnabled(bumpshiny ? TRUE : FALSE);
667 1001
668 // Avatar Mode 1002 LLTextBox* m1 = LLUICtrlFactory::getTextBoxByName(panel, "DrawDistanceMeterText1");
669 S32 max_avatar_shader = LLShaderMgr::getMaxVertexShaderLevel(LLShaderMgr::SHADER_AVATAR); 1003 LLTextBox* m2 = LLUICtrlFactory::getTextBoxByName(panel, "DrawDistanceMeterText2");
670 mCtrlAvatarVP->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE); 1004 if(m1 == NULL || m2 == NULL || slider == NULL)
671
672 if (gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
673 { 1005 {
674 max_avatar_shader = 1; 1006 return;
675 } 1007 }
676 max_avatar_shader = llmax(max_avatar_shader, 1);
677 for (S32 i = 0; i < mCtrlAvatarMode->getItemCount(); i++)
678 {
679 mCtrlAvatarMode->setIndexEnabled(i, i < max_avatar_shader);
680 }
681 if (mCtrlAvatarMode->getSelectedIndex() >= max_avatar_shader)
682 {
683 mCtrlAvatarMode->setSelectedIndex(llmax(max_avatar_shader-1,0));
684 }
685 // Vertex Shaders
686 mCtrlShaderEnable->setEnabled(gPipeline.canUseVertexShaders());
687}
688 1008
689void LLPanelDisplay3::apply() 1009 // toggle the two text boxes based on whether we have 1 or two digits
690{ 1010 F32 val = slider->getValueF32();
691 1011 bool two_digits = val < 100;
1012 m1->setVisible(two_digits);
1013 m2->setVisible(!two_digits);
692} 1014}
693 1015
694void LLPanelDisplay3::setDefaults()
695{
696 1016
697}
698 1017
699void LLPanelDisplay3::cancel()
700{
701 gSavedSettings.setBOOL("RenderObjectBump", mBumpShiny);
702 gSavedSettings.setBOOL("RenderRippleWater", mRippleWater);
703 gSavedSettings.setBOOL("RenderAvatarVP", mAvatarVP);
704 gSavedSettings.setS32("RenderAvatarMode", mAvatarMode);
705 gSavedSettings.setS32("RenderLightingDetail", mLightingDetail);
706 gSavedSettings.setS32("RenderTerrainDetail", mTerrainDetail);
707 gSavedSettings.setF32("RenderVolumeLODFactor", mPrimLOD);
708 gSavedSettings.setF32("RenderFlexTimeFactor", mFlexLOD);
709 gSavedSettings.setF32("RenderTreeLODFactor", mTreeLOD);
710 gSavedSettings.setF32("RenderAvatarLODFactor", mAvatarLOD);
711}
712
713//static
714void LLPanelDisplay3::onVertexShaderEnable(LLUICtrl* self, void* data)
715{
716 ((LLPanelDisplay3*) data)->refreshEnabledState();
717}