PageRenderTime 34ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llviewercontrol.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 750 lines | 630 code | 81 blank | 39 comment | 35 complexity | b36a878cb60ce0bfec42520a12534ada MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewercontrol.cpp
  3. * @brief Viewer configuration
  4. * @author Richard Nelson
  5. *
  6. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #include "llviewerprecompiledheaders.h"
  28. #include "llviewercontrol.h"
  29. // Library includes
  30. #include "llwindow.h" // getGamma()
  31. // For Listeners
  32. #include "llaudioengine.h"
  33. #include "llagent.h"
  34. #include "llagentcamera.h"
  35. #include "llconsole.h"
  36. #include "lldrawpoolbump.h"
  37. #include "lldrawpoolterrain.h"
  38. #include "llflexibleobject.h"
  39. #include "llfeaturemanager.h"
  40. #include "llviewershadermgr.h"
  41. #include "llsky.h"
  42. #include "llvieweraudio.h"
  43. #include "llviewermenu.h"
  44. #include "llviewertexturelist.h"
  45. #include "llviewerthrottle.h"
  46. #include "llviewerwindow.h"
  47. #include "llvoavatarself.h"
  48. #include "llvoiceclient.h"
  49. #include "llvosky.h"
  50. #include "llvotree.h"
  51. #include "llvovolume.h"
  52. #include "llworld.h"
  53. #include "pipeline.h"
  54. #include "llviewerjoystick.h"
  55. #include "llviewerobjectlist.h"
  56. #include "llviewerparcelmgr.h"
  57. #include "llparcel.h"
  58. #include "llkeyboard.h"
  59. #include "llerrorcontrol.h"
  60. #include "llappviewer.h"
  61. #include "llvosurfacepatch.h"
  62. #include "llvowlsky.h"
  63. #include "llrender.h"
  64. #include "llnavigationbar.h"
  65. #include "llfloatertools.h"
  66. #include "llpaneloutfitsinventory.h"
  67. #include "llpanellogin.h"
  68. #include "llpaneltopinfobar.h"
  69. #include "llupdaterservice.h"
  70. #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
  71. BOOL gHackGodmode = FALSE;
  72. #endif
  73. LLControlGroup gSavedSettings("Global"); // saved at end of session
  74. LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session
  75. LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session
  76. LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings
  77. std::string gLastRunVersion;
  78. extern BOOL gResizeScreenTexture;
  79. extern BOOL gDebugGL;
  80. extern BOOL gAuditTexture;
  81. ////////////////////////////////////////////////////////////////////////////
  82. // Listeners
  83. static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
  84. {
  85. LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
  86. return true;
  87. }
  88. static bool handleRenderFarClipChanged(const LLSD& newvalue)
  89. {
  90. F32 draw_distance = (F32) newvalue.asReal();
  91. gAgentCamera.mDrawDistance = draw_distance;
  92. LLWorld::getInstance()->setLandFarClip(draw_distance);
  93. return true;
  94. }
  95. static bool handleTerrainDetailChanged(const LLSD& newvalue)
  96. {
  97. LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
  98. return true;
  99. }
  100. static bool handleSetShaderChanged(const LLSD& newvalue)
  101. {
  102. // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
  103. gBumpImageList.destroyGL();
  104. gBumpImageList.restoreGL();
  105. // else, leave terrain detail as is
  106. LLViewerShaderMgr::instance()->setShaders();
  107. return true;
  108. }
  109. static bool handleRenderPerfTestChanged(const LLSD& newvalue)
  110. {
  111. bool status = !newvalue.asBoolean();
  112. if (!status)
  113. {
  114. gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_WL_SKY,
  115. LLPipeline::RENDER_TYPE_GROUND,
  116. LLPipeline::RENDER_TYPE_TERRAIN,
  117. LLPipeline::RENDER_TYPE_GRASS,
  118. LLPipeline::RENDER_TYPE_TREE,
  119. LLPipeline::RENDER_TYPE_WATER,
  120. LLPipeline::RENDER_TYPE_PASS_GRASS,
  121. LLPipeline::RENDER_TYPE_HUD,
  122. LLPipeline::RENDER_TYPE_CLOUDS,
  123. LLPipeline::RENDER_TYPE_HUD_PARTICLES,
  124. LLPipeline::END_RENDER_TYPES);
  125. gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_FEATURE_UI, false);
  126. }
  127. else
  128. {
  129. gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_WL_SKY,
  130. LLPipeline::RENDER_TYPE_GROUND,
  131. LLPipeline::RENDER_TYPE_TERRAIN,
  132. LLPipeline::RENDER_TYPE_GRASS,
  133. LLPipeline::RENDER_TYPE_TREE,
  134. LLPipeline::RENDER_TYPE_WATER,
  135. LLPipeline::RENDER_TYPE_PASS_GRASS,
  136. LLPipeline::RENDER_TYPE_HUD,
  137. LLPipeline::RENDER_TYPE_CLOUDS,
  138. LLPipeline::RENDER_TYPE_HUD_PARTICLES,
  139. LLPipeline::END_RENDER_TYPES);
  140. gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_FEATURE_UI, true);
  141. }
  142. return true;
  143. }
  144. bool handleRenderAvatarComplexityLimitChanged(const LLSD& newvalue)
  145. {
  146. return true;
  147. }
  148. bool handleRenderTransparentWaterChanged(const LLSD& newvalue)
  149. {
  150. LLWorld::getInstance()->updateWaterObjects();
  151. return true;
  152. }
  153. static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
  154. {
  155. if (gPipeline.isInit())
  156. {
  157. gPipeline.releaseGLBuffers();
  158. gPipeline.createGLBuffers();
  159. }
  160. return true;
  161. }
  162. static bool handleAnisotropicChanged(const LLSD& newvalue)
  163. {
  164. LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean();
  165. LLImageGL::dirtyTexOptions();
  166. return true;
  167. }
  168. static bool handleVolumeLODChanged(const LLSD& newvalue)
  169. {
  170. LLVOVolume::sLODFactor = (F32) newvalue.asReal();
  171. LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
  172. return true;
  173. }
  174. static bool handleAvatarLODChanged(const LLSD& newvalue)
  175. {
  176. LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
  177. return true;
  178. }
  179. static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue)
  180. {
  181. LLVOAvatar::sPhysicsLODFactor = (F32) newvalue.asReal();
  182. return true;
  183. }
  184. static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue)
  185. {
  186. LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger();
  187. return true;
  188. }
  189. static bool handleTerrainLODChanged(const LLSD& newvalue)
  190. {
  191. LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
  192. //sqaure lod factor to get exponential range of [0,4] and keep
  193. //a value of 1 in the middle of the detail slider for consistency
  194. //with other detail sliders (see panel_preferences_graphics1.xml)
  195. LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
  196. return true;
  197. }
  198. static bool handleTreeLODChanged(const LLSD& newvalue)
  199. {
  200. LLVOTree::sTreeFactor = (F32) newvalue.asReal();
  201. return true;
  202. }
  203. static bool handleFlexLODChanged(const LLSD& newvalue)
  204. {
  205. LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
  206. return true;
  207. }
  208. static bool handleGammaChanged(const LLSD& newvalue)
  209. {
  210. F32 gamma = (F32) newvalue.asReal();
  211. if (gamma == 0.0f)
  212. {
  213. gamma = 1.0f; // restore normal gamma
  214. }
  215. if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
  216. {
  217. // Only save it if it's changed
  218. if (!gViewerWindow->getWindow()->setGamma(gamma))
  219. {
  220. llwarns << "setGamma failed!" << llendl;
  221. }
  222. }
  223. return true;
  224. }
  225. const F32 MAX_USER_FOG_RATIO = 10.f;
  226. const F32 MIN_USER_FOG_RATIO = 0.5f;
  227. static bool handleFogRatioChanged(const LLSD& newvalue)
  228. {
  229. F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
  230. gSky.setFogRatio(fog_ratio);
  231. return true;
  232. }
  233. static bool handleMaxPartCountChanged(const LLSD& newvalue)
  234. {
  235. LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
  236. return true;
  237. }
  238. static bool handleVideoMemoryChanged(const LLSD& newvalue)
  239. {
  240. gTextureList.updateMaxResidentTexMem(newvalue.asInteger());
  241. return true;
  242. }
  243. static bool handleChatFontSizeChanged(const LLSD& newvalue)
  244. {
  245. if(gConsole)
  246. {
  247. gConsole->setFontSize(newvalue.asInteger());
  248. }
  249. return true;
  250. }
  251. static bool handleChatPersistTimeChanged(const LLSD& newvalue)
  252. {
  253. if(gConsole)
  254. {
  255. gConsole->setLinePersistTime((F32) newvalue.asReal());
  256. }
  257. return true;
  258. }
  259. static bool handleConsoleMaxLinesChanged(const LLSD& newvalue)
  260. {
  261. if(gConsole)
  262. {
  263. gConsole->setMaxLines(newvalue.asInteger());
  264. }
  265. return true;
  266. }
  267. static void handleAudioVolumeChanged(const LLSD& newvalue)
  268. {
  269. audio_update_volume(true);
  270. }
  271. static bool handleJoystickChanged(const LLSD& newvalue)
  272. {
  273. LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
  274. return true;
  275. }
  276. static bool handleUseOcclusionChanged(const LLSD& newvalue)
  277. {
  278. LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery
  279. && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
  280. return true;
  281. }
  282. static bool handleUploadBakedTexOldChanged(const LLSD& newvalue)
  283. {
  284. LLPipeline::sForceOldBakedUpload = newvalue.asBoolean();
  285. return true;
  286. }
  287. static bool handleNumpadControlChanged(const LLSD& newvalue)
  288. {
  289. if (gKeyboard)
  290. {
  291. gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(newvalue.asInteger()));
  292. }
  293. return true;
  294. }
  295. static bool handleWLSkyDetailChanged(const LLSD&)
  296. {
  297. if (gSky.mVOWLSkyp.notNull())
  298. {
  299. gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
  300. }
  301. return true;
  302. }
  303. static bool handleResetVertexBuffersChanged(const LLSD&)
  304. {
  305. if (gPipeline.isInit())
  306. {
  307. gPipeline.resetVertexBuffers();
  308. }
  309. return true;
  310. }
  311. static bool handleRepartition(const LLSD&)
  312. {
  313. if (gPipeline.isInit())
  314. {
  315. gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");
  316. gObjectList.repartitionObjects();
  317. }
  318. return true;
  319. }
  320. static bool handleRenderDynamicLODChanged(const LLSD& newvalue)
  321. {
  322. LLPipeline::sDynamicLOD = newvalue.asBoolean();
  323. return true;
  324. }
  325. static bool handleRenderLocalLightsChanged(const LLSD& newvalue)
  326. {
  327. gPipeline.setLightingDetail(-1);
  328. return true;
  329. }
  330. static bool handleRenderDeferredChanged(const LLSD& newvalue)
  331. {
  332. LLRenderTarget::sUseFBO = newvalue.asBoolean();
  333. if (gPipeline.isInit())
  334. {
  335. LLPipeline::refreshCachedSettings();
  336. gPipeline.updateRenderDeferred();
  337. gPipeline.releaseGLBuffers();
  338. gPipeline.createGLBuffers();
  339. gPipeline.resetVertexBuffers();
  340. if (LLPipeline::sRenderDeferred == (BOOL)LLRenderTarget::sUseFBO)
  341. {
  342. LLViewerShaderMgr::instance()->setShaders();
  343. }
  344. }
  345. return true;
  346. }
  347. static bool handleRenderUseImpostorsChanged(const LLSD& newvalue)
  348. {
  349. LLVOAvatar::sUseImpostors = newvalue.asBoolean();
  350. return true;
  351. }
  352. static bool handleAuditTextureChanged(const LLSD& newvalue)
  353. {
  354. gAuditTexture = newvalue.asBoolean();
  355. return true;
  356. }
  357. static bool handleRenderDebugGLChanged(const LLSD& newvalue)
  358. {
  359. gDebugGL = newvalue.asBoolean() || gDebugSession;
  360. gGL.clearErrors();
  361. return true;
  362. }
  363. static bool handleRenderDebugPipelineChanged(const LLSD& newvalue)
  364. {
  365. gDebugPipeline = newvalue.asBoolean();
  366. return true;
  367. }
  368. static bool handleRenderResolutionDivisorChanged(const LLSD&)
  369. {
  370. gResizeScreenTexture = TRUE;
  371. return true;
  372. }
  373. static bool handleDebugViewsChanged(const LLSD& newvalue)
  374. {
  375. LLView::sDebugRects = newvalue.asBoolean();
  376. return true;
  377. }
  378. static bool handleLogFileChanged(const LLSD& newvalue)
  379. {
  380. std::string log_filename = newvalue.asString();
  381. LLFile::remove(log_filename);
  382. LLError::logToFile(log_filename);
  383. return true;
  384. }
  385. bool handleHideGroupTitleChanged(const LLSD& newvalue)
  386. {
  387. gAgent.setHideGroupTitle(newvalue);
  388. return true;
  389. }
  390. bool handleEffectColorChanged(const LLSD& newvalue)
  391. {
  392. gAgent.setEffectColor(LLColor4(newvalue));
  393. return true;
  394. }
  395. bool handleHighResSnapshotChanged(const LLSD& newvalue)
  396. {
  397. // High Res Snapshot active, must uncheck RenderUIInSnapshot
  398. if (newvalue.asBoolean())
  399. {
  400. gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
  401. }
  402. return true;
  403. }
  404. bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
  405. {
  406. LLVoiceClient::getInstance()->updateSettings();
  407. return true;
  408. }
  409. bool handleVelocityInterpolate(const LLSD& newvalue)
  410. {
  411. LLMessageSystem* msg = gMessageSystem;
  412. if ( newvalue.asBoolean() )
  413. {
  414. msg->newMessageFast(_PREHASH_VelocityInterpolateOn);
  415. msg->nextBlockFast(_PREHASH_AgentData);
  416. msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
  417. msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
  418. gAgent.sendReliableMessage();
  419. llinfos << "Velocity Interpolation On" << llendl;
  420. }
  421. else
  422. {
  423. msg->newMessageFast(_PREHASH_VelocityInterpolateOff);
  424. msg->nextBlockFast(_PREHASH_AgentData);
  425. msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
  426. msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
  427. gAgent.sendReliableMessage();
  428. llinfos << "Velocity Interpolation Off" << llendl;
  429. }
  430. return true;
  431. }
  432. bool handleForceShowGrid(const LLSD& newvalue)
  433. {
  434. LLPanelLogin::updateServer( );
  435. return true;
  436. }
  437. bool toggle_agent_pause(const LLSD& newvalue)
  438. {
  439. if ( newvalue.asBoolean() )
  440. {
  441. send_agent_pause();
  442. }
  443. else
  444. {
  445. send_agent_resume();
  446. }
  447. return true;
  448. }
  449. bool toggle_show_navigation_panel(const LLSD& newvalue)
  450. {
  451. bool value = newvalue.asBoolean();
  452. LLNavigationBar::getInstance()->setVisible(value);
  453. gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
  454. return true;
  455. }
  456. bool toggle_show_mini_location_panel(const LLSD& newvalue)
  457. {
  458. bool value = newvalue.asBoolean();
  459. LLPanelTopInfoBar::getInstance()->setVisible(value);
  460. gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value);
  461. return true;
  462. }
  463. bool toggle_show_object_render_cost(const LLSD& newvalue)
  464. {
  465. LLFloaterTools::sShowObjectCost = newvalue.asBoolean();
  466. return true;
  467. }
  468. void toggle_updater_service_active(const LLSD& new_value)
  469. {
  470. if(new_value.asInteger())
  471. {
  472. LLUpdaterService update_service;
  473. if(!update_service.isChecking()) update_service.startChecking();
  474. }
  475. else
  476. {
  477. LLUpdaterService().stopChecking();
  478. }
  479. }
  480. ////////////////////////////////////////////////////////////////////////////
  481. void settings_setup_listeners()
  482. {
  483. gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2));
  484. gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2));
  485. gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2));
  486. gSavedSettings.getControl("OctreeStaticObjectSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
  487. gSavedSettings.getControl("OctreeDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
  488. gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2));
  489. gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
  490. gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
  491. gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  492. gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  493. gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  494. gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  495. gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  496. gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  497. gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  498. gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  499. gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  500. gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  501. gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _2));
  502. gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  503. gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  504. gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  505. gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  506. gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  507. gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  508. gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  509. gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2));
  510. gSavedSettings.getControl("RenderAvatarComplexityLimit")->getSignal()->connect(boost::bind(&handleRenderAvatarComplexityLimitChanged, _2));
  511. gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2));
  512. gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2));
  513. gSavedSettings.getControl("RenderAvatarPhysicsLODFactor")->getSignal()->connect(boost::bind(&handleAvatarPhysicsLODChanged, _2));
  514. gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2));
  515. gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _2));
  516. gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _2));
  517. gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _2));
  518. gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _2));
  519. gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _2));
  520. gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _2));
  521. gSavedSettings.getControl("RenderLocalLights")->getSignal()->connect(boost::bind(&handleRenderLocalLightsChanged, _2));
  522. gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  523. gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  524. gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  525. gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  526. gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  527. gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
  528. gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _2));
  529. gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _2));
  530. gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2));
  531. gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2));
  532. gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2));
  533. gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  534. gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
  535. gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2));
  536. gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2));
  537. gSavedSettings.getControl("AuditTexture")->getSignal()->connect(boost::bind(&handleAuditTextureChanged, _2));
  538. gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _2));
  539. gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _2));
  540. gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _2));
  541. gSavedSettings.getControl("UploadBakedTexOld")->getSignal()->connect(boost::bind(&handleUploadBakedTexOldChanged, _2));
  542. gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _2));
  543. gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  544. gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  545. gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  546. gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  547. gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  548. gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  549. gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  550. gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  551. gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  552. gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  553. gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  554. gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  555. gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  556. gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  557. gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
  558. gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  559. gSavedSettings.getControl("RenderUseVAO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  560. gSavedSettings.getControl("RenderVBOMappingDisable")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  561. gSavedSettings.getControl("RenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  562. gSavedSettings.getControl("RenderPreferStreamDraw")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
  563. gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2));
  564. gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2));
  565. gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  566. gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  567. gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  568. gSavedSettings.getControl("JoystickAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  569. gSavedSettings.getControl("JoystickAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  570. gSavedSettings.getControl("JoystickAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  571. gSavedSettings.getControl("JoystickAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  572. gSavedSettings.getControl("FlycamAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  573. gSavedSettings.getControl("FlycamAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  574. gSavedSettings.getControl("FlycamAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  575. gSavedSettings.getControl("FlycamAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  576. gSavedSettings.getControl("FlycamAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  577. gSavedSettings.getControl("FlycamAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  578. gSavedSettings.getControl("FlycamAxisScale6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  579. gSavedSettings.getControl("FlycamAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  580. gSavedSettings.getControl("FlycamAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  581. gSavedSettings.getControl("FlycamAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  582. gSavedSettings.getControl("FlycamAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  583. gSavedSettings.getControl("FlycamAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  584. gSavedSettings.getControl("FlycamAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  585. gSavedSettings.getControl("FlycamAxisDeadZone6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  586. gSavedSettings.getControl("AvatarAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  587. gSavedSettings.getControl("AvatarAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  588. gSavedSettings.getControl("AvatarAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  589. gSavedSettings.getControl("AvatarAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  590. gSavedSettings.getControl("AvatarAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  591. gSavedSettings.getControl("AvatarAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  592. gSavedSettings.getControl("AvatarAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  593. gSavedSettings.getControl("AvatarAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  594. gSavedSettings.getControl("AvatarAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  595. gSavedSettings.getControl("AvatarAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  596. gSavedSettings.getControl("AvatarAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  597. gSavedSettings.getControl("AvatarAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  598. gSavedSettings.getControl("BuildAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  599. gSavedSettings.getControl("BuildAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  600. gSavedSettings.getControl("BuildAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  601. gSavedSettings.getControl("BuildAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  602. gSavedSettings.getControl("BuildAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  603. gSavedSettings.getControl("BuildAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  604. gSavedSettings.getControl("BuildAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  605. gSavedSettings.getControl("BuildAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  606. gSavedSettings.getControl("BuildAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  607. gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  608. gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  609. gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2));
  610. gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _2));
  611. gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _2));
  612. gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _2));
  613. gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(handleHighResSnapshotChanged, _2));
  614. gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  615. gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  616. gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  617. gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  618. gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  619. gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  620. gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  621. gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  622. gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
  623. gSavedSettings.getControl("VelocityInterpolate")->getSignal()->connect(boost::bind(&handleVelocityInterpolate, _2));
  624. gSavedSettings.getControl("QAMode")->getSignal()->connect(boost::bind(&show_debug_menus));
  625. gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus));
  626. gSavedSettings.getControl("AgentPause")->getSignal()->connect(boost::bind(&toggle_agent_pause, _2));
  627. gSavedSettings.getControl("ShowNavbarNavigationPanel")->getSignal()->connect(boost::bind(&toggle_show_navigation_panel, _2));
  628. gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2));
  629. gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2));
  630. gSavedSettings.getControl("UpdaterServiceSetting")->getSignal()->connect(boost::bind(&toggle_updater_service_active, _2));
  631. gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2));
  632. gSavedSettings.getControl("RenderTransparentWater")->getSignal()->connect(boost::bind(&handleRenderTransparentWaterChanged, _2));
  633. }
  634. #if TEST_CACHED_CONTROL
  635. #define DECL_LLCC(T, V) static LLCachedControl<T> mySetting_##T("TestCachedControl"#T, V)
  636. DECL_LLCC(U32, (U32)666);
  637. DECL_LLCC(S32, (S32)-666);
  638. DECL_LLCC(F32, (F32)-666.666);
  639. DECL_LLCC(bool, true);
  640. DECL_LLCC(BOOL, FALSE);
  641. static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value");
  642. DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
  643. DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
  644. DECL_LLCC(LLRect, LLRect(0, 0, 100, 500));
  645. DECL_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
  646. DECL_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
  647. DECL_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
  648. LLSD test_llsd = LLSD()["testing1"] = LLSD()["testing2"];
  649. DECL_LLCC(LLSD, test_llsd);
  650. static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hahahahahha", "Not the real comment");
  651. void test_cached_control()
  652. {
  653. #define do { TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl; } while(0)
  654. TEST_LLCC(U32, 666);
  655. TEST_LLCC(S32, (S32)-666);
  656. TEST_LLCC(F32, (F32)-666.666);
  657. TEST_LLCC(bool, true);
  658. TEST_LLCC(BOOL, FALSE);
  659. if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl;
  660. TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
  661. TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
  662. TEST_LLCC(LLRect, LLRect(0, 0, 100, 500));
  663. TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
  664. TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
  665. TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));
  666. //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd);
  667. if((std::string)test_BrowserHomePage != "http://www.secondlife.com") llerrs << "Fail BrowserHomePage" << llendl;
  668. }
  669. #endif // TEST_CACHED_CONTROL