Skip to content

Commit

Permalink
Update multi-frustum tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Apr 5, 2018
1 parent d546e45 commit e17dbcc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Specs/Renderer/AutomaticUniformSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
23 changes: 23 additions & 0 deletions Specs/Scene/MultifrustumSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand Down Expand Up @@ -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');

0 comments on commit e17dbcc

Please sign in to comment.