From e17dbcc2702cd67ad4e792b347c4ca1b2d73f30d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 5 Apr 2018 15:39:31 -0400 Subject: [PATCH] Update multi-frustum tests. --- Specs/Renderer/AutomaticUniformSpec.js | 11 +++++++++++ Specs/Scene/MultifrustumSpec.js | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Specs/Renderer/AutomaticUniformSpec.js b/Specs/Renderer/AutomaticUniformSpec.js index 72baabf820d2..f439c7e1af6a 100644 --- a/Specs/Renderer/AutomaticUniformSpec.js +++ b/Specs/Renderer/AutomaticUniformSpec.js @@ -1307,4 +1307,15 @@ defineSuite([ }).contextToRender(); }); + it('has czm_logFarDistance', function() { + var fs = + 'void main() {' + + ' gl_FragColor = vec4(czm_logFarDistance == (2.0 / log2(czm_currentFrustum.y + 1.0)));' + + '}'; + expect({ + context : context, + fragmentShader : fs + }).contextToRender(); + }); + }, 'WebGL'); diff --git a/Specs/Scene/MultifrustumSpec.js b/Specs/Scene/MultifrustumSpec.js index e28a5dd2099b..2bb926965d0d 100644 --- a/Specs/Scene/MultifrustumSpec.js +++ b/Specs/Scene/MultifrustumSpec.js @@ -63,7 +63,13 @@ defineSuite([ var blueImage; var whiteImage; + var logDepth; + beforeAll(function() { + scene = createScene(); + logDepth = scene.logarithmicDepthBuffer; + scene.destroyForSpecs(); + return when.join( Resource.fetchImage('./Data/Images/Green.png').then(function(image) { greenImage = image; @@ -81,6 +87,8 @@ defineSuite([ context = scene.context; primitives = scene.primitives; + scene.logarithmicDepthBuffer = false; + var camera = scene.camera; camera.position = new Cartesian3(); camera.direction = Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()); @@ -350,4 +358,19 @@ defineSuite([ createBillboards(); scene.renderForSpecs(); }); + + it('log depth uses less frustums', function() { + if (!logDepth) { + return; + } + + createBillboards(); + + scene.render(); + expect(scene._frustumCommandsList.length).toEqual(3); + + scene.logarithmicDepthBuffer = true; + scene.render(); + expect(scene._frustumCommandsList.length).toEqual(1); + }); }, 'WebGL');