100
100
extern LLPointer<LLViewerTexture> gStartTexture ;
101
101
extern bool gShiftFrame ;
102
102
103
- LLPointer<LLViewerTexture> gDisconnectedImagep = NULL ;
103
+ LLPointer<LLViewerTexture> gDisconnectedImagep = nullptr ;
104
104
105
105
// used to toggle renderer back on after teleport
106
106
bool gTeleportDisplay = false ;
107
107
LLFrameTimer gTeleportDisplayTimer ;
108
108
LLFrameTimer gTeleportArrivalTimer ;
109
- const F32 RESTORE_GL_TIME = 5 .f; // Wait this long while reloading textures before we raise the curtain
109
+ constexpr F32 RESTORE_GL_TIME = 5 .f; // Wait this long while reloading textures before we raise the curtain
110
110
111
111
bool gForceRenderLandFence = false ;
112
112
bool gDisplaySwapBuffers = false ;
@@ -120,18 +120,16 @@ bool gSnapshotNoPost = false;
120
120
bool gShaderProfileFrame = false ;
121
121
122
122
// This is how long the sim will try to teleport you before giving up.
123
- const F32 TELEPORT_EXPIRY = 15 .0f ;
123
+ constexpr F32 TELEPORT_EXPIRY = 15 .0f ;
124
124
// Additional time (in seconds) to wait per attachment
125
- const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3 .f;
125
+ constexpr F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3 .f;
126
126
127
127
U32 gRecentFrameCount = 0 ; // number of 'recent' frames
128
128
LLFrameTimer gRecentFPSTime ;
129
129
LLFrameTimer gRecentMemoryTime ;
130
130
LLFrameTimer gAssetStorageLogTime ;
131
131
132
132
// Rendering stuff
133
- void pre_show_depth_buffer ();
134
- void post_show_depth_buffer ();
135
133
void render_ui (F32 zoom_factor = 1 .f, int subfield = 0 );
136
134
void swap ();
137
135
void render_hud_attachments ();
@@ -212,7 +210,8 @@ void display_update_camera()
212
210
F32 final_far = gAgentCamera .mDrawDistance ;
213
211
if (gCubeSnapshot )
214
212
{
215
- final_far = gSavedSettings .getF32 (" RenderReflectionProbeDrawDistance" );
213
+ static LLCachedControl<F32> reflection_probe_draw_distance (gSavedSettings , " RenderReflectionProbeDrawDistance" , 64 .f );
214
+ final_far = reflection_probe_draw_distance ();
216
215
}
217
216
else if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera .getCameraMode ())
218
217
@@ -233,7 +232,7 @@ void display_update_camera()
233
232
void display_stats ()
234
233
{
235
234
LL_PROFILE_ZONE_SCOPED;
236
- const F32 FPS_LOG_FREQUENCY = 10 .f ;
235
+ constexpr F32 FPS_LOG_FREQUENCY = 10 .f ;
237
236
if (gRecentFPSTime .getElapsedTimeF32 () >= FPS_LOG_FREQUENCY)
238
237
{
239
238
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY (" DS - FPS" );
@@ -242,7 +241,7 @@ void display_stats()
242
241
gRecentFrameCount = 0 ;
243
242
gRecentFPSTime .reset ();
244
243
}
245
- F32 mem_log_freq = gSavedSettings . getF32 ( " MemoryLogFrequency" );
244
+ static LLCachedControl< F32> mem_log_freq ( gSavedSettings , " MemoryLogFrequency" , 600 . f );
246
245
if (mem_log_freq > 0 .f && gRecentMemoryTime .getElapsedTimeF32 () >= mem_log_freq)
247
246
{
248
247
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY (" DS - Memory" );
@@ -252,7 +251,7 @@ void display_stats()
252
251
LLMemory::logMemoryInfo (true ) ;
253
252
gRecentMemoryTime .reset ();
254
253
}
255
- const F32 ASSET_STORAGE_LOG_FREQUENCY = 60 .f ;
254
+ constexpr F32 ASSET_STORAGE_LOG_FREQUENCY = 60 .f ;
256
255
if (gAssetStorageLogTime .getElapsedTimeF32 () >= ASSET_STORAGE_LOG_FREQUENCY)
257
256
{
258
257
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY (" DS - Asset Storage" );
@@ -568,8 +567,10 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
568
567
569
568
LLImageGL::updateStats (gFrameTimeSeconds );
570
569
571
- LLVOAvatar::sRenderName = gSavedSettings .getS32 (" AvatarNameTagMode" );
572
- LLVOAvatar::sRenderGroupTitles = (gSavedSettings .getBOOL (" NameTagShowGroupTitles" ) && gSavedSettings .getS32 (" AvatarNameTagMode" ));
570
+ static LLCachedControl<S32> avatar_name_tag_mode (gSavedSettings , " AvatarNameTagMode" , 1 );
571
+ static LLCachedControl<bool > name_tag_show_group_titles (gSavedSettings , " NameTagShowGroupTitles" , true );
572
+ LLVOAvatar::sRenderName = avatar_name_tag_mode;
573
+ LLVOAvatar::sRenderGroupTitles = name_tag_show_group_titles && avatar_name_tag_mode > 0 ;
573
574
574
575
gPipeline .mBackfaceCull = true ;
575
576
gFrameCount ++;
@@ -792,7 +793,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
792
793
}
793
794
794
795
gGL .setColorMask (true , true );
795
- glClearColor (0 , 0 , 0 , 0 );
796
+ glClearColor (0 . f , 0 . f , 0 . f , 0 . f );
796
797
797
798
LLGLState::checkStates ();
798
799
@@ -960,7 +961,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
960
961
gPipeline .mRT ->deferredScreen .bindTarget ();
961
962
if (gUseWireframe )
962
963
{
963
- F32 g = 0 .5f ;
964
+ constexpr F32 g = 0 .5f ;
964
965
glClearColor (g, g, g, 1 .f );
965
966
}
966
967
else
@@ -979,11 +980,12 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
979
980
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY (" display - 5" )
980
981
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
981
982
982
- if (gSavedSettings .getBOOL (" RenderDepthPrePass" ))
983
+ static LLCachedControl<bool > render_depth_pre_pass (gSavedSettings , " RenderDepthPrePass" , false );
984
+ if (render_depth_pre_pass)
983
985
{
984
986
gGL .setColorMask (false , false );
985
987
986
- static const U32 types[] = {
988
+ constexpr U32 types[] = {
987
989
LLRenderPass::PASS_SIMPLE,
988
990
LLRenderPass::PASS_FULLBRIGHT,
989
991
LLRenderPass::PASS_SHINY
@@ -1197,7 +1199,7 @@ void display_cube_face()
1197
1199
1198
1200
gGL .setColorMask (true , true );
1199
1201
1200
- glClearColor (0 , 0 , 0 , 0 );
1202
+ glClearColor (0 . f , 0 . f , 0 . f , 0 . f );
1201
1203
gPipeline .generateSunShadow (*LLViewerCamera::getInstance ());
1202
1204
1203
1205
glClear (GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
@@ -1233,7 +1235,7 @@ void display_cube_face()
1233
1235
}
1234
1236
else
1235
1237
{
1236
- glClearColor (1 , 0 , 1 , 1 );
1238
+ glClearColor (1 . f , 0 . f , 1 . f , 1 . f );
1237
1239
}
1238
1240
gPipeline .mRT ->deferredScreen .clear ();
1239
1241
@@ -1274,11 +1276,12 @@ void render_hud_attachments()
1274
1276
{
1275
1277
LLPipeline::sRenderingHUDs = true ;
1276
1278
LLCamera hud_cam = *LLViewerCamera::getInstance ();
1277
- hud_cam.setOrigin (-1 .f ,0 , 0 );
1278
- hud_cam.setAxes (LLVector3 (1 , 0 , 0 ), LLVector3 (0 , 1 , 0 ), LLVector3 (0 , 0 , 1 ));
1279
+ hud_cam.setOrigin (-1 .f , 0 . f , 0 . f );
1280
+ hud_cam.setAxes (LLVector3 (1 . f , 0 . f , 0 . f ), LLVector3 (0 . f , 1 . f , 0 . f ), LLVector3 (0 . f , 0 . f , 1 . f ));
1279
1281
LLViewerCamera::updateFrustumPlanes (hud_cam, true );
1280
1282
1281
- bool render_particles = gPipeline .hasRenderType (LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings .getBOOL (" RenderHUDParticles" );
1283
+ static LLCachedControl<bool > render_hud_particles (gSavedSettings , " RenderHUDParticles" , false );
1284
+ bool render_particles = gPipeline .hasRenderType (LLPipeline::RENDER_TYPE_PARTICLES) && render_hud_particles;
1282
1285
1283
1286
// only render hud objects
1284
1287
gPipeline .pushRenderTypeMask ();
@@ -1638,10 +1641,11 @@ void render_ui_3d()
1638
1641
stop_glerror ();
1639
1642
1640
1643
gUIProgram .bind ();
1641
- gGL .color4f (1 , 1 , 1 , 1 );
1644
+ gGL .color4f (1 . f , 1 . f , 1 . f , 1 . f );
1642
1645
1643
1646
// Coordinate axes
1644
- if (gSavedSettings .getBOOL (" ShowAxes" ))
1647
+ static LLCachedControl<bool > show_axes (gSavedSettings , " ShowAxes" );
1648
+ if (show_axes ())
1645
1649
{
1646
1650
draw_axes ();
1647
1651
}
@@ -1701,7 +1705,7 @@ void render_ui_2d()
1701
1705
gGL .pushMatrix ();
1702
1706
S32 half_width = (gViewerWindow ->getWorldViewWidthScaled () / 2 );
1703
1707
S32 half_height = (gViewerWindow ->getWorldViewHeightScaled () / 2 );
1704
- gGL .scalef (LLUI::getScaleFactor ().mV [0 ], LLUI::getScaleFactor ().mV [1 ], 1 .f );
1708
+ gGL .scalef (LLUI::getScaleFactor ().mV [VX ], LLUI::getScaleFactor ().mV [VY ], 1 .f );
1705
1709
gGL .translatef ((F32)half_width, (F32)half_height, 0 .f );
1706
1710
F32 zoom = gAgentCamera .mHUDCurZoom ;
1707
1711
gGL .scalef (zoom,zoom,1 .f );
@@ -1723,7 +1727,7 @@ void render_ui_2d()
1723
1727
gPipeline .mUIScreen .bindTarget ();
1724
1728
gGL .setColorMask (true , true );
1725
1729
{
1726
- static const S32 pad = 8 ;
1730
+ constexpr S32 pad = 8 ;
1727
1731
1728
1732
LLView::sDirtyRect .mLeft -= pad;
1729
1733
LLView::sDirtyRect .mRight += pad;
@@ -1776,8 +1780,6 @@ void render_ui_2d()
1776
1780
gViewerWindow ->draw ();
1777
1781
}
1778
1782
1779
-
1780
-
1781
1783
// reset current origin for font rendering, in case of tiling render
1782
1784
LLFontGL::sCurOrigin .set (0 , 0 );
1783
1785
}
@@ -1786,7 +1788,7 @@ void render_disconnected_background()
1786
1788
{
1787
1789
gUIProgram .bind ();
1788
1790
1789
- gGL .color4f (1 , 1 , 1 , 1 );
1791
+ gGL .color4f (1 . f , 1 . f , 1 . f , 1 . f );
1790
1792
if (!gDisconnectedImagep && gDisconnected )
1791
1793
{
1792
1794
LL_INFOS () << " Loading last bitmap..." << LL_ENDL;
@@ -1826,7 +1828,7 @@ void render_disconnected_background()
1826
1828
1827
1829
1828
1830
raw->expandToPowerOfTwo ();
1829
- gDisconnectedImagep = LLViewerTextureManager::getLocalTexture (raw.get (), false );
1831
+ gDisconnectedImagep = LLViewerTextureManager::getLocalTexture (raw.get (), false );
1830
1832
gStartTexture = gDisconnectedImagep ;
1831
1833
gGL .getTexUnit (0 )->unbind (LLTexUnit::TT_TEXTURE);
1832
1834
}
@@ -1861,6 +1863,5 @@ void render_disconnected_background()
1861
1863
1862
1864
void display_cleanup ()
1863
1865
{
1864
- gDisconnectedImagep = NULL ;
1866
+ gDisconnectedImagep = nullptr ;
1865
1867
}
1866
-
0 commit comments