Skip to content

Commit

Permalink
Add 3D tiles tests for rendering in 2D and CV.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Jan 25, 2017
1 parent a85a1c6 commit 1f70717
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions Specs/Cesium3DTilesTester.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ define([

var mockTile = {
contentBoundingVolume : new TileBoundingSphere(),
_contentBoundingVolume : new TileBoundingSphere(),
_header : {
content : {
boundingVolume : {
Expand Down
28 changes: 25 additions & 3 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ defineSuite([
});

beforeEach(function() {
scene.morphTo3D(0.0);
originalMaximumRequests = RequestScheduler.maximumRequests;
viewAllTiles();
});
Expand Down Expand Up @@ -305,6 +306,27 @@ defineSuite([
});
});

it('renders tileset in CV', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
scene.morphToColumbusView(0.0);
scene.renderForSpecs();
var stats = tileset._statistics;
expect(stats.visited).toEqual(5);
expect(stats.numberOfCommands).toEqual(5);
});
});

it('renders tileset in 2D', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
scene.morphTo2D(0.0);
tileset.maximumScreenSpaceError = 3;
scene.renderForSpecs();
var stats = tileset._statistics;
expect(stats.visited).toEqual(5);
expect(stats.numberOfCommands).toEqual(10);
});
});

it('renders tileset with empty root tile', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetEmptyRootUrl).then(function(tileset) {
scene.renderForSpecs();
Expand Down Expand Up @@ -380,7 +402,7 @@ defineSuite([
scene.renderForSpecs();
expect(stats.visited).toEqual(0);
expect(stats.numberOfCommands).toEqual(0);
expect(tileset._root.visibility(scene.frameState.cullingVolume, CullingVolume.MASK_INDETERMINATE)).toEqual(CullingVolume.MASK_OUTSIDE);
expect(tileset._root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).toEqual(CullingVolume.MASK_OUTSIDE);
});
});

Expand Down Expand Up @@ -1110,7 +1132,7 @@ defineSuite([
var spyUpdate = jasmine.createSpy('listener');
tileset.tileVisible.addEventListener(spyUpdate);
scene.renderForSpecs();
expect(tileset._root.visibility(scene.frameState.cullingVolume, CullingVolume.MASK_INDETERMINATE)).not.toEqual(CullingVolume.MASK_OUTSIDE);
expect(tileset._root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).not.toEqual(CullingVolume.MASK_OUTSIDE);
expect(spyUpdate.calls.count()).toEqual(1);
expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root);
});
Expand Down Expand Up @@ -1814,7 +1836,7 @@ defineSuite([
tileset.tileUnload.addEventListener(spyUpdate);
scene.renderForSpecs();

expect(tileset._root.visibility(scene.frameState.cullingVolume, CullingVolume.MASK_INDETERMINATE)).not.toEqual(CullingVolume.MASK_OUTSIDE);
expect(tileset._root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).not.toEqual(CullingVolume.MASK_OUTSIDE);
expect(spyUpdate.calls.count()).toEqual(4);
expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root.children[0]);
expect(spyUpdate.calls.argsFor(1)[0]).toBe(tileset._root.children[1]);
Expand Down
24 changes: 19 additions & 5 deletions Specs/Scene/PointCloud3DTileContentSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ defineSuite([
}

beforeAll(function() {
// Point tiles use RTC, which for now requires scene3DOnly to be true
scene = createScene({
scene3DOnly : true
});

scene = createScene();
scene.frameState.passes.render = true;
});

Expand All @@ -65,6 +61,7 @@ defineSuite([
});

beforeEach(function() {
scene.morphTo3D(0.0);
setCamera(centerLongitude, centerLatitude);
});

Expand Down Expand Up @@ -259,6 +256,23 @@ defineSuite([
});
});

it('renders in CV', function() {
return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) {
scene.morphToColumbusView(0.0);
setCamera(centerLongitude, centerLatitude);
expectRenderPointCloud(tileset);
});
});

it('renders in 2D', function() {
return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) {
scene.morphTo2D(0.0);
setCamera(centerLongitude, centerLatitude);
tileset.maximumScreenSpaceError = 3;
expectRenderPointCloud(tileset);
});
});

it('picks', function() {
return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) {
var content = tileset._root.content;
Expand Down

0 comments on commit 1f70717

Please sign in to comment.