@@ -266,6 +266,7 @@ define([
266
266
}
267
267
268
268
this . _logDepthBuffer = context . fragmentDepth ;
269
+ this . _logDepthBufferChanged = true ;
269
270
270
271
this . _id = createGuid ( ) ;
271
272
this . _jobScheduler = new JobScheduler ( ) ;
@@ -1379,6 +1380,22 @@ define([
1379
1380
//>>includeEnd('debug');
1380
1381
this . _minimumDisableDepthTestDistance = value ;
1381
1382
}
1383
+ } ,
1384
+
1385
+ /**
1386
+ * Whether or not to use a logarithmic depth buffer. Enabling this option will allow for less frustums in the multi-frustum,
1387
+ * increasing performance. This property relies on {@link Context#fragmentDepth} being supported.
1388
+ */
1389
+ logDepthBuffer : {
1390
+ get : function ( ) {
1391
+ return this . _logDepthBuffer ;
1392
+ } ,
1393
+ set : function ( value ) {
1394
+ if ( this . _context . fragmentDepth && this . _logDepthBuffer !== value ) {
1395
+ this . _logDepthBuffer = value ;
1396
+ this . _logDepthBufferChanged = true ;
1397
+ }
1398
+ }
1382
1399
}
1383
1400
} ) ;
1384
1401
@@ -1432,7 +1449,7 @@ define([
1432
1449
}
1433
1450
1434
1451
var derivedCommands = command . derivedCommands ;
1435
- if ( ( scene . _frustumChanged || command . dirty ) && defined ( derivedCommands ) ) {
1452
+ if ( ( scene . _logDepthBufferChanged || scene . _frustumChanged || command . dirty ) && defined ( derivedCommands ) ) {
1436
1453
command . dirty = false ;
1437
1454
1438
1455
var frustum = scene . camera . frustum ;
@@ -3099,14 +3116,14 @@ define([
3099
3116
tryAndCatchError ( this , time , update ) ;
3100
3117
this . _postUpdate . raiseEvent ( this , time ) ;
3101
3118
3102
- this . _frustumChanged = this . _camera . frustum !== this . _cameraClone . frustum ;
3119
+ this . _frustumChanged = ! this . _camera . frustum . equals ( this . _cameraClone . frustum ) ;
3103
3120
if ( this . _frustumChanged && this . _logDepthBuffer && ! ( this . _camera . frustum instanceof OrthographicFrustum || this . _camera . frustum instanceof OrthographicOffCenterFrustum ) ) {
3104
3121
this . _camera . frustum . near = 1.0 ;
3105
3122
this . _camera . frustum . far = 10000000000.0 ;
3106
3123
}
3107
3124
3108
3125
var cameraChanged = checkForCameraUpdates ( this ) ;
3109
- var shouldRender = ! this . requestRenderMode || this . _renderRequested || cameraChanged || this . _frustumChanged || ( this . mode === SceneMode . MORPHING ) ;
3126
+ var shouldRender = ! this . requestRenderMode || this . _renderRequested || cameraChanged || this . _frustumChanged || this . _logDepthBufferChanged || ( this . mode === SceneMode . MORPHING ) ;
3110
3127
if ( ! shouldRender && defined ( this . maximumRenderTimeChange ) && defined ( this . _lastRenderTime ) ) {
3111
3128
var difference = Math . abs ( JulianDate . secondsDifference ( this . _lastRenderTime , time ) ) ;
3112
3129
shouldRender = shouldRender || difference > this . maximumRenderTimeChange ;
@@ -3115,6 +3132,7 @@ define([
3115
3132
if ( shouldRender ) {
3116
3133
this . _lastRenderTime = JulianDate . clone ( time , this . _lastRenderTime ) ;
3117
3134
this . _renderRequested = false ;
3135
+ this . _logDepthBufferChanged = false ;
3118
3136
3119
3137
// Render
3120
3138
this . _preRender . raiseEvent ( this , time ) ;
0 commit comments