diff --git a/CHANGES.md b/CHANGES.md index 06650970365e..8c8b054f4567 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Change Log * Added `Matrix4.setScale` for setting the scale on an affine transformation matrix [#6888](https://github.com/AnalyticalGraphicsInc/cesium/pull/6888) * Added `GeocoderViewModel.destinationFound` for specifying a function that is called upon a successful geocode. The default behavior is to fly to the destination found by the geocoder. [#6915](https://github.com/AnalyticalGraphicsInc/cesium/pull/6915) * Added optional `width` and `height` to `Scene.drillPick` for specifying a search area. +* Added `Cesium3DTileset.root` for getting the root tile of a tileset. [#6944](https://github.com/AnalyticalGraphicsInc/cesium/pull/6944) * Added `heightReference` to `BoxGraphics`, `CylinderGraphics` and `EllipsoidGraphics`, which can be used to clamp these entity types to terrain [#6932](https://github.com/AnalyticalGraphicsInc/cesium/pull/6932) ##### Fixes :wrench: diff --git a/Source/Scene/Cesium3DTile.js b/Source/Scene/Cesium3DTile.js index 95aafb56ae90..4369a18e734e 100644 --- a/Source/Scene/Cesium3DTile.js +++ b/Source/Scene/Cesium3DTile.js @@ -383,6 +383,21 @@ define([ } }, + /** + * Get the tile's bounding volume. + * + * @memberof Cesium3DTile.prototype + * + * @type {TileBoundingVolume} + * @readonly + * @private + */ + boundingVolume : { + get : function() { + return this._boundingVolume; + } + }, + /** * Get the bounding volume of the tile's contents. This defaults to the * tile's bounding volume when the content's bounding volume is @@ -793,7 +808,7 @@ define([ var tileset = this._tileset; var clippingPlanes = tileset.clippingPlanes; if (defined(clippingPlanes) && clippingPlanes.enabled) { - var tileTransform = tileset._root.computedTransform; + var tileTransform = tileset.root.computedTransform; var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileTransform); this._isClipped = intersection !== Intersect.INSIDE; if (intersection === Intersect.OUTSIDE) { @@ -828,7 +843,7 @@ define([ var tileset = this._tileset; var clippingPlanes = tileset.clippingPlanes; if (defined(clippingPlanes) && clippingPlanes.enabled) { - var tileTransform = tileset._root.computedTransform; + var tileTransform = tileset.root.computedTransform; var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileTransform); this._isClipped = intersection !== Intersect.INSIDE; if (intersection === Intersect.OUTSIDE) { diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js index dff3cb9a4d96..e4885fac3e9a 100644 --- a/Source/Scene/Cesium3DTileBatchTable.js +++ b/Source/Scene/Cesium3DTileBatchTable.js @@ -1181,7 +1181,7 @@ define([ }; function getColorBlend(batchTable) { - var tileset = batchTable._content._tileset; + var tileset = batchTable._content.tileset; var colorBlendMode = tileset.colorBlendMode; var colorBlendAmount = tileset.colorBlendAmount; if (colorBlendMode === Cesium3DTileColorBlendMode.HIGHLIGHT) { @@ -1246,7 +1246,7 @@ define([ var commandEnd = commandList.length; var tile = this._content._tile; var finalResolution = tile._finalResolution; - var tileset = tile._tileset; + var tileset = tile.tileset; var bivariateVisibilityTest = tileset._skipLevelOfDetail && tileset._hasMixedContent && frameState.context.stencilBuffer; var styleCommandsNeeded = getStyleCommandsNeeded(this); @@ -1483,7 +1483,7 @@ define([ } batchTable._pickTexture = createTexture(batchTable, context, bytes); - content._tileset._statistics.batchTableByteLength += batchTable._pickTexture.sizeInBytes; + content.tileset._statistics.batchTableByteLength += batchTable._pickTexture.sizeInBytes; } } diff --git a/Source/Scene/Cesium3DTileOptimizations.js b/Source/Scene/Cesium3DTileOptimizations.js index d3e08593f9a3..1b644d6c00be 100644 --- a/Source/Scene/Cesium3DTileOptimizations.js +++ b/Source/Scene/Cesium3DTileOptimizations.js @@ -44,7 +44,7 @@ define([ var length = children.length; // Check if the parent has an oriented bounding box. - var boundingVolume = tile._boundingVolume; + var boundingVolume = tile.boundingVolume; if (boundingVolume instanceof TileOrientedBoundingBox || boundingVolume instanceof TileBoundingRegion) { var orientedBoundingBox = boundingVolume._orientedBoundingBox; tile._optimChildrenWithinParent = Cesium3DTileOptimizationHint.USE_OPTIMIZATION; @@ -52,7 +52,7 @@ define([ var child = children[i]; // Check if the child has an oriented bounding box. - var childBoundingVolume = child._boundingVolume; + var childBoundingVolume = child.boundingVolume; if (!(childBoundingVolume instanceof TileOrientedBoundingBox || childBoundingVolume instanceof TileBoundingRegion)) { // Do not support if the parent and child both do not have oriented bounding boxes. tile._optimChildrenWithinParent = Cesium3DTileOptimizationHint.SKIP_OPTIMIZATION; diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 1ecd404e04a3..6749e8926540 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1059,6 +1059,28 @@ define([ } }, + /** + * The root tile. + * + * @memberOf Cesium3DTileset.prototype + * + * @type {Cesium3DTile} + * @readonly + * + * @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true. + */ + root : { + get : function() { + //>>includeStart('debug', pragmas.debug); + if (!this.ready) { + throw new DeveloperError('The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.'); + } + //>>includeEnd('debug'); + + return this._root; + } + }, + /** * The tileset's bounding sphere. * @@ -1522,7 +1544,7 @@ define([ } function computeTileLabelPosition(tile) { - var boundingVolume = tile._boundingVolume.boundingVolume; + var boundingVolume = tile.boundingVolume.boundingVolume; var halfAxes = boundingVolume.halfAxes; var radius = boundingVolume.radius; diff --git a/Source/Scene/Cesium3DTilesetTraversal.js b/Source/Scene/Cesium3DTilesetTraversal.js index 72447fbf8cda..b3b6e72394ba 100644 --- a/Source/Scene/Cesium3DTilesetTraversal.js +++ b/Source/Scene/Cesium3DTilesetTraversal.js @@ -68,7 +68,7 @@ define([ tileset._emptyTiles.length = 0; tileset._hasMixedContent = false; - var root = tileset._root; + var root = tileset.root; updateTile(tileset, root, frameState); // The root tile is not visible @@ -216,7 +216,7 @@ define([ var parent = tile.parent; var useParentScreenSpaceError = defined(parent) && (!skipLevelOfDetail(tileset) || (tile._screenSpaceError === 0.0)); var screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : tile._screenSpaceError; - var rootScreenSpaceError = tileset._root._screenSpaceError; + var rootScreenSpaceError = tileset.root._screenSpaceError; return rootScreenSpaceError - screenSpaceError; // Map higher SSE to lower values (e.g. root tile is highest priority) } diff --git a/Source/Scene/Geometry3DTileContent.js b/Source/Scene/Geometry3DTileContent.js index 7d4655cea89b..ff4f949e83c6 100644 --- a/Source/Scene/Geometry3DTileContent.js +++ b/Source/Scene/Geometry3DTileContent.js @@ -317,7 +317,7 @@ define([ return; } - var modelMatrix = content._tile.computedTransform; + var modelMatrix = content.tile.computedTransform; var center; if (defined(featureTableJson.RTC_CENTER)) { @@ -365,7 +365,7 @@ define([ center : center, modelMatrix : modelMatrix, batchTable : batchTable, - boundingVolume : content._tile._boundingVolume.boundingVolume + boundingVolume : content.tile.boundingVolume.boundingVolume }); } } diff --git a/Source/Scene/Vector3DTileContent.js b/Source/Scene/Vector3DTileContent.js index 73f2bb67f709..4db34f4c8e2f 100644 --- a/Source/Scene/Vector3DTileContent.js +++ b/Source/Scene/Vector3DTileContent.js @@ -396,7 +396,7 @@ define([ polygonMaximumHeights : polygonMaximumHeights, center : center, rectangle : rectangle, - boundingVolume : content._tile._boundingVolume.boundingVolume, + boundingVolume : content.tile.boundingVolume.boundingVolume, batchTable : batchTable, batchIds : batchIds.polygons, modelMatrix : modelMatrix @@ -430,7 +430,7 @@ define([ maximumHeight : maxHeight, center : center, rectangle : rectangle, - boundingVolume : content._tile._boundingVolume.boundingVolume, + boundingVolume : content.tile.boundingVolume.boundingVolume, batchTable : batchTable }); } diff --git a/Specs/Cesium3DTilesTester.js b/Specs/Cesium3DTilesTester.js index 500b9aa877d4..ab7b62618e7c 100644 --- a/Specs/Cesium3DTilesTester.js +++ b/Specs/Cesium3DTilesTester.js @@ -163,7 +163,7 @@ define([ Cesium3DTilesTester.resolvesReadyPromise = function(scene, url) { return Cesium3DTilesTester.loadTileset(scene, url).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; return content.readyPromise.then(function(content) { expect(content).toBeDefined(); }); @@ -172,7 +172,7 @@ define([ Cesium3DTilesTester.tileDestroys = function(scene, url) { return Cesium3DTilesTester.loadTileset(scene, url).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.isDestroyed()).toEqual(false); scene.primitives.remove(tileset); expect(content.isDestroyed()).toEqual(true); diff --git a/Specs/Scene/Batched3DModel3DTileContentSpec.js b/Specs/Scene/Batched3DModel3DTileContentSpec.js index 272a81666bfb..73c1647a69a7 100644 --- a/Specs/Scene/Batched3DModel3DTileContentSpec.js +++ b/Specs/Scene/Batched3DModel3DTileContentSpec.js @@ -80,7 +80,7 @@ defineSuite([ .then(function(tileset) { expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled(); Cesium3DTilesTester.expectRenderTileset(scene, tileset); - var batchTable = tileset._root._content.batchTable; + var batchTable = tileset.root.content.batchTable; expect(batchTable._properties).toBeDefined(); }); }); @@ -90,7 +90,7 @@ defineSuite([ .then(function(tileset) { expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled(); Cesium3DTilesTester.expectRenderTileset(scene, tileset); - var batchTable = tileset._root._content.batchTable; + var batchTable = tileset.root.content.batchTable; expect(batchTable._properties).toBeDefined(); }); }); @@ -160,7 +160,7 @@ defineSuite([ var newTransform = Transforms.headingPitchRollToFixedFrame(newCenter, newHPR); // Update tile transform - tileset._root.transform = newTransform; + tileset.root.transform = newTransform; scene.renderForSpecs(); // Move the camera to the new location @@ -183,7 +183,7 @@ defineSuite([ it('picks with batch table', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; tileset.show = false; expect(scene).toPickPrimitive(undefined); tileset.show = true; @@ -197,7 +197,7 @@ defineSuite([ it('picks without batch table', function() { return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; tileset.show = false; expect(scene).toPickPrimitive(undefined); tileset.show = true; @@ -211,7 +211,7 @@ defineSuite([ it('can get features and properties', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(10); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'id')).toBe(true); @@ -221,7 +221,7 @@ defineSuite([ it('throws when calling getFeature with invalid index', function() { return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(function(){ content.getFeature(-1); }).toThrowDeveloperError(); @@ -236,7 +236,7 @@ defineSuite([ it('gets memory usage', function() { return Cesium3DTilesTester.loadTileset(scene, texturedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // 10 buildings, 36 ushort indices and 24 vertices per building, 8 float components (position, normal, uv) and 1 uint component (batchId) per vertex. // 10 * ((24 * (8 * 4 + 1 * 4)) + (36 * 2)) = 9360 @@ -271,7 +271,7 @@ defineSuite([ it('Links model to tileset clipping planes based on bounding volume clipping', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var content = tile.content; var model = content._model; @@ -298,7 +298,7 @@ defineSuite([ it('Links model to tileset clipping planes if tileset clipping planes are reassigned', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var model = tile.content._model; expect(model.clippingPlanes).toBeUndefined(); @@ -333,7 +333,7 @@ defineSuite([ spyOn(Model, '_getClippingFunction').and.callThrough(); return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var clippingPlaneCollection = new ClippingPlaneCollection({ planes : [ @@ -352,12 +352,12 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, withRtcCenterUrl).then(function(tileset) { Cesium3DTilesTester.expectRenderTileset(scene, tileset); - var rtcTransform = tileset._root._content._rtcCenterTransform; + var rtcTransform = tileset.root.content._rtcCenterTransform; expect(rtcTransform).toEqual(Matrix4.fromTranslation(new Cartesian3(0.1, 0.2, 0.3))); - var expectedModelTransform = Matrix4.multiply(tileset._root.transform, rtcTransform, new Matrix4()); - expect(tileset._root._content._contentModelMatrix).toEqual(expectedModelTransform); - expect(tileset._root._content._model._modelMatrix).toEqual(expectedModelTransform); + var expectedModelTransform = Matrix4.multiply(tileset.root.transform, rtcTransform, new Matrix4()); + expect(tileset.root.content._contentModelMatrix).toEqual(expectedModelTransform); + expect(tileset.root.content._model._modelMatrix).toEqual(expectedModelTransform); // Update tile transform var newLongitude = -1.31962; @@ -365,12 +365,12 @@ defineSuite([ var newCenter = Cartesian3.fromRadians(newLongitude, newLatitude, 0.0); var newHPR = new HeadingPitchRoll(); var newTransform = Transforms.headingPitchRollToFixedFrame(newCenter, newHPR); - tileset._root.transform = newTransform; + tileset.root.transform = newTransform; scene.camera.lookAt(newCenter, new HeadingPitchRange(0.0, 0.0, 15.0)); scene.renderForSpecs(); - expectedModelTransform = Matrix4.multiply(tileset._root.computedTransform, rtcTransform, expectedModelTransform); - expect(tileset._root._content._model._modelMatrix).toEqual(expectedModelTransform); + expectedModelTransform = Matrix4.multiply(tileset.root.computedTransform, rtcTransform, expectedModelTransform); + expect(tileset.root.content._model._modelMatrix).toEqual(expectedModelTransform); }); }); diff --git a/Specs/Scene/Cesium3DTileBatchTableSpec.js b/Specs/Scene/Cesium3DTileBatchTableSpec.js index 65028807093b..43b9dd330d93 100644 --- a/Specs/Scene/Cesium3DTileBatchTableSpec.js +++ b/Specs/Scene/Cesium3DTileBatchTableSpec.js @@ -550,7 +550,7 @@ defineSuite([ it('renders tileset with batch table', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // Each feature in the b3dm file has an id property from 0 to 9, // check that the 2nd resource has an id of 2 @@ -568,7 +568,7 @@ defineSuite([ it('renders tileset without batch table', function() { return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.getFeature(2).getProperty('id')).toBeUndefined(); @@ -595,7 +595,7 @@ defineSuite([ ContextLimits._maximumTextureSize = 4; return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBeGreaterThan(ContextLimits._maximumTextureSize); Cesium3DTilesTester.expectRenderTileset(scene, tileset); @@ -616,7 +616,7 @@ defineSuite([ }); function expectRenderTranslucent(tileset) { - var batchTable = tileset._root.content.batchTable; + var batchTable = tileset.root.content.batchTable; // Get initial color var opaqueColor; @@ -799,7 +799,7 @@ defineSuite([ function checkHierarchyProperties(tileset, multipleParents) { // Check isExactClass, isClass, and getExactClassName in Cesium3DTileFeature - var content = tileset._root.content; + var content = tileset.root.content; var batchTable = content.batchTable; var hierarchy = batchTable._batchTableHierarchy; @@ -861,7 +861,7 @@ defineSuite([ function checkHierarchyPropertiesNoParents(tileset) { // Check isExactClass, isClass, and getExactClassName in Cesium3DTileFeature - var content = tileset._root.content; + var content = tileset.root.content; var doorFeature = content.getFeature(4); expect(doorFeature.isExactClass('door')).toBe(true); expect(doorFeature.isExactClass('doorknob')).toBe(false); @@ -1111,7 +1111,7 @@ defineSuite([ it('destroys', function() { return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; var batchTable = content.batchTable; expect(batchTable.isDestroyed()).toEqual(false); scene.primitives.remove(tileset); diff --git a/Specs/Scene/Cesium3DTileSpec.js b/Specs/Scene/Cesium3DTileSpec.js index 590031c45c21..cd5661d1fd2d 100644 --- a/Specs/Scene/Cesium3DTileSpec.js +++ b/Specs/Scene/Cesium3DTileSpec.js @@ -180,12 +180,18 @@ defineSuite([ }); describe('bounding volumes', function() { + it('returns the tile bounding volume if the content bounding volume is undefined', function() { + var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithBoundingSphere, undefined); + expect(tile.boundingVolume).toBeDefined(); + expect(tile.contentBoundingVolume).toBe(tile.boundingVolume); + }); + it('can have a bounding sphere', function() { var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithBoundingSphere, undefined); var radius = tileWithBoundingSphere.boundingVolume.sphere[3]; - expect(tile.contentBoundingVolume).toBeDefined(); - expect(tile.contentBoundingVolume.boundingVolume.radius).toEqual(radius); - expect(tile.contentBoundingVolume.boundingVolume.center).toEqual(Cartesian3.ZERO); + expect(tile.boundingVolume).toBeDefined(); + expect(tile.boundingVolume.boundingVolume.radius).toEqual(radius); + expect(tile.boundingVolume.boundingVolume.center).toEqual(Cartesian3.ZERO); }); it('can have a content bounding sphere', function() { @@ -203,30 +209,30 @@ defineSuite([ var maximumHeight = tileWithBoundingRegion.boundingVolume.region[5]; var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithBoundingRegion, undefined); var tbr = new TileBoundingRegion({rectangle: rectangle, minimumHeight: minimumHeight, maximumHeight: maximumHeight}); - expect(tile.contentBoundingVolume).toBeDefined(); - expect(tile.contentBoundingVolume).toEqual(tbr); + expect(tile.boundingVolume).toBeDefined(); + expect(tile.boundingVolume).toEqual(tbr); }); it('can have a content bounding region', function() { var region = tileWithContentBoundingRegion.content.boundingVolume.region; var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithContentBoundingRegion, undefined); - expect(tile._contentBoundingVolume).toBeDefined(); + expect(tile.contentBoundingVolume).toBeDefined(); var tbb = new TileBoundingRegion({ rectangle: new Rectangle(region[0], region[1], region[2], region[3]), minimumHeight: region[4], maximumHeight: region[5] }); - expect(tile._contentBoundingVolume).toEqual(tbb); + expect(tile.contentBoundingVolume).toEqual(tbb); }); it('can have an oriented bounding box', function() { var box = tileWithBoundingBox.boundingVolume.box; var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithBoundingBox, undefined); - expect(tile.contentBoundingVolume).toBeDefined(); + expect(tile.boundingVolume).toBeDefined(); var center = new Cartesian3(box[0], box[1], box[2]); var halfAxes = Matrix3.fromArray(box, 3); var obb = new TileOrientedBoundingBox(center, halfAxes); - expect(tile.contentBoundingVolume).toEqual(obb); + expect(tile.boundingVolume).toEqual(obb); }); it('can have a content oriented bounding box', function() { @@ -243,8 +249,8 @@ defineSuite([ var header = clone(tileWithContentBoundingSphere, true); header.transform = getTileTransform(centerLongitude, centerLatitude); var tile = new Cesium3DTile(mockTileset, '/some_url', header, undefined); - var boundingSphere = tile._boundingVolume.boundingVolume; - var contentBoundingSphere = tile._contentBoundingVolume.boundingVolume; + var boundingSphere = tile.boundingVolume.boundingVolume; + var contentBoundingSphere = tile.contentBoundingVolume.boundingVolume; var boundingVolumeCenter = Cartesian3.fromRadians(centerLongitude, centerLatitude, 1.0); expect(boundingSphere.center).toEqualEpsilon(boundingVolumeCenter, CesiumMath.EPSILON4); @@ -258,8 +264,8 @@ defineSuite([ var header = clone(tileWithContentBoundingBox, true); header.transform = getTileTransform(centerLongitude, centerLatitude); var tile = new Cesium3DTile(mockTileset, '/some_url', header, undefined); - var boundingBox = tile._boundingVolume.boundingVolume; - var contentBoundingBox = tile._contentBoundingVolume.boundingVolume; + var boundingBox = tile.boundingVolume.boundingVolume; + var contentBoundingBox = tile.contentBoundingVolume.boundingVolume; var boundingVolumeCenter = Cartesian3.fromRadians(centerLongitude, centerLatitude, 1.0); expect(boundingBox.center).toEqualEpsilon(boundingVolumeCenter, CesiumMath.EPSILON7); @@ -270,8 +276,8 @@ defineSuite([ var header = clone(tileWithContentBoundingRegion, true); header.transform = getTileTransform(centerLongitude, centerLatitude); var tile = new Cesium3DTile(mockTileset, '/some_url', header, undefined); - var boundingRegion = tile._boundingVolume; - var contentBoundingRegion = tile._contentBoundingVolume; + var boundingRegion = tile.boundingVolume; + var contentBoundingRegion = tile.contentBoundingVolume; var region = header.boundingVolume.region; var rectangle = Rectangle.unpack(region); @@ -295,7 +301,7 @@ defineSuite([ var header = clone(tileWithBoundingSphere, true); header.transform = getTileTransform(centerLongitude, centerLatitude); var tile = new Cesium3DTile(mockTileset, '/some_url', header, undefined); - var boundingSphere = tile._boundingVolume.boundingVolume; + var boundingSphere = tile.boundingVolume.boundingVolume; // Check the original transform var boundingVolumeCenter = Cartesian3.fromRadians(centerLongitude, centerLatitude); diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index c4d6e06bb7b7..0942ba09652f 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -351,11 +351,23 @@ defineSuite([ expect(properties.id.maximum).toEqual(9); expect(tileset._geometricError).toEqual(240.0); - expect(tileset._root).toBeDefined(); + expect(tileset.root).toBeDefined(); expect(tileset.url).toEqual(tilesetUrl); }); }); + it('gets root tile', function() { + var tileset = scene.primitives.add(new Cesium3DTileset({ + url : tilesetUrl + })); + expect(function() { + return tileset.root; + }).toThrowDeveloperError(); + return tileset.readyPromise.then(function() { + expect(tileset.root).toBeDefined(); + }); + }); + it('hasExtension returns true if the tileset JSON file uses the specified extension', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableHierarchyUrl).then(function(tileset) { expect(tileset.hasExtension('3DTILES_batch_table_hierarchy')).toBe(true); @@ -365,7 +377,7 @@ defineSuite([ it('passes version in query string to tiles', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - expect(tileset._root.content._resource.url).toEqual(getAbsoluteUri(tilesetUrl.replace('tileset.json','parent.b3dm?v=1.2.3'))); + expect(tileset.root.content._resource.url).toEqual(getAbsoluteUri(tilesetUrl.replace('tileset.json','parent.b3dm?v=1.2.3'))); }); }); @@ -424,7 +436,7 @@ defineSuite([ deferred.resolve(invalidMagicBuffer); }); scene.renderForSpecs(); // Request root - var root = tileset._root; + var root = tileset.root; return root.contentReadyPromise.then(function() { fail('should not resolve'); }).otherwise(function(error) { @@ -445,7 +457,7 @@ defineSuite([ deferred.reject(); }); scene.renderForSpecs(); // Request root - var root = tileset._root; + var root = tileset.root; return root.contentReadyPromise.then(function() { fail('should not resolve'); }).otherwise(function(error) { @@ -472,7 +484,7 @@ defineSuite([ })); }); scene.renderForSpecs(); // Request root - var root = tileset._root; + var root = tileset.root; return root.contentReadyPromise.then(function() { fail('should not resolve'); }).otherwise(function(error) { @@ -699,7 +711,7 @@ defineSuite([ expect(statistics.batchTableByteLength).toEqual(0); // One feature colored, the batch table memory is now higher - tileset._root.content.getFeature(0).color = Color.RED; + tileset.root.content.getFeature(0).color = Color.RED; scene.renderForSpecs(); expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory * tilesLength); expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory * tilesLength); @@ -779,7 +791,7 @@ defineSuite([ scene.renderForSpecs(); expect(statistics.visited).toEqual(0); expect(statistics.numberOfCommands).toEqual(0); - expect(tileset._root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).toEqual(CullingVolume.MASK_OUTSIDE); + expect(tileset.root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).toEqual(CullingVolume.MASK_OUTSIDE); }); }); @@ -803,10 +815,10 @@ defineSuite([ scene.renderForSpecs(); expect(statistics.visited).toEqual(2); // Visits root, but does not render it expect(statistics.numberOfCommands).toEqual(1); - expect(tileset._selectedTiles[0]).not.toBe(tileset._root); + expect(tileset._selectedTiles[0]).not.toBe(tileset.root); // Set contents box to undefined, and now root won't be culled - tileset._root._contentBoundingVolume = undefined; + tileset.root._contentBoundingVolume = undefined; scene.renderForSpecs(); expect(statistics.visited).toEqual(2); expect(statistics.numberOfCommands).toEqual(2); @@ -835,7 +847,7 @@ defineSuite([ scene.camera.moveDown(0.5); scene.renderForSpecs(); - var root = tileset._root; + var root = tileset.root; var llTile = findTileByUrl(root.children, 'll.b3dm'); var lrTile = findTileByUrl(root.children, 'lr.b3dm'); var urTile = findTileByUrl(root.children, 'ur.b3dm'); @@ -959,7 +971,7 @@ defineSuite([ it('replacement refinement - selects root when sse is met', function() { viewRootOnly(); return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset._root.refine = Cesium3DTileRefine.REPLACE; + tileset.root.refine = Cesium3DTileRefine.REPLACE; // Meets screen space error, only root tile is rendered scene.renderForSpecs(); @@ -972,7 +984,7 @@ defineSuite([ it('replacement refinement - selects children when sse is not met', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset._root.refine = Cesium3DTileRefine.REPLACE; + tileset.root.refine = Cesium3DTileRefine.REPLACE; // Does not meet screen space error, child tiles replace root tile scene.renderForSpecs(); @@ -986,7 +998,7 @@ defineSuite([ it('replacement refinement - selects root when sse is not met and children are not ready', function() { viewRootOnly(); return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; root.refine = Cesium3DTileRefine.REPLACE; // Set zoom to start loading child tiles @@ -1010,7 +1022,7 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl, options).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; root.refine = Cesium3DTileRefine.REPLACE; root.hasEmptyContent = false; // mock content tileset.maximumScreenSpaceError = 0.0; // Force root tile to always not meet SSE since this is just checking the request volume @@ -1043,7 +1055,7 @@ defineSuite([ scene.renderForSpecs(); var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; // Even though root's children are loaded, the grandchildren need to be loaded before it becomes refinable expect(numberOfChildrenWithoutContent(root)).toEqual(0); // Children are loaded @@ -1096,7 +1108,7 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) { tileset.skipLevelOfDetail = false; var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; expect(statistics.numberOfCommands).toEqual(1); viewAllTiles(); @@ -1133,7 +1145,7 @@ defineSuite([ var center = Cartesian3.fromRadians(centerLongitude, centerLatitude, 22.0); scene.camera.lookAt(center, new HeadingPitchRange(0.0, 1.57, 1.0)); - var root = tileset._root; + var root = tileset.root; var childRoot = root.children[0]; scene.renderForSpecs(); @@ -1152,7 +1164,7 @@ defineSuite([ it('does not select visible tiles not meeting SSE with visible children', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacementWithViewerRequestVolumeUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; var childRoot = root.children[0]; childRoot.geometricError = 240; @@ -1171,7 +1183,7 @@ defineSuite([ it('does select visible tiles meeting SSE with visible children', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacementWithViewerRequestVolumeUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; var childRoot = root.children[0]; childRoot.geometricError = 0; // child root should meet SSE and children should not be drawn @@ -1196,7 +1208,7 @@ defineSuite([ }; viewRootOnly(); return Cesium3DTilesTester.loadTileset(scene, tilesetReplacementWithViewerRequestVolumeUrl, options).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; var childRoot = root.children[0]; expect(childRoot.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).not.toEqual(CullingVolume.MASK_OUTSIDE); @@ -1213,7 +1225,7 @@ defineSuite([ it('does select visible tiles with visible children passing request volumes', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacementWithViewerRequestVolumeUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; var childRoot = root.children[0]; childRoot.geometricError = 0; @@ -1244,7 +1256,7 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) { // Root points to an external tileset JSON file and has no children until it is requested - var root = tileset._root; + var root = tileset.root; expect(root.children.length).toEqual(0); // Set view so that root's content is requested @@ -1287,7 +1299,7 @@ defineSuite([ viewRootOnly(); scene.renderForSpecs(); - return tileset._root.contentReadyPromise; + return tileset.root.contentReadyPromise; }).then(function() { //Make sure tileset2.json was requested with query parameters and does not use parent tilesetVersion expectedUrl = getAbsoluteUri('Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset2.json?v=1.2.3&' + queryParams); @@ -1312,7 +1324,7 @@ defineSuite([ }); // Check for color - tileset._root.color = Color.RED; + tileset.root.color = Color.RED; Cesium3DTilesTester.expectRender(scene, tileset, function(rgba) { expect(rgba).not.toEqual(color); }); @@ -1457,7 +1469,7 @@ defineSuite([ expect(tileset._tileDebugLabels).toBeDefined(); expect(tileset._tileDebugLabels.length).toEqual(5); - var root = tileset._root; + var root = tileset.root; expect(tileset._tileDebugLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError); expect(tileset._tileDebugLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError); expect(tileset._tileDebugLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError); @@ -1478,7 +1490,7 @@ defineSuite([ expect(tileset._tileDebugLabels).toBeDefined(); expect(tileset._tileDebugLabels.length).toEqual(2); - var root = tileset._root; + var root = tileset.root; expect(tileset._tileDebugLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError); expect(tileset._tileDebugLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError); @@ -1517,8 +1529,8 @@ defineSuite([ expect(tileset._tileDebugLabels).toBeDefined(); expect(tileset._tileDebugLabels.length).toEqual(1); - var content = tileset._root.content; - var expected = 'Commands: ' + tileset._root.commandsLength + '\n' + + var content = tileset.root.content; + var expected = 'Commands: ' + tileset.root.commandsLength + '\n' + 'Triangles: ' + content.trianglesLength + '\n' + 'Features: ' + content.featuresLength; @@ -1589,7 +1601,7 @@ defineSuite([ tileset.debugPickedTileLabelOnly = true; var scratchPosition = new Cartesian3(1.0, 1.0, 1.0); - tileset.debugPickedTile = tileset._root; + tileset.debugPickedTile = tileset.root; tileset.debugPickPosition = scratchPosition; scene.renderForSpecs(); @@ -1630,7 +1642,7 @@ defineSuite([ viewRootOnly(); scene.renderForSpecs(); // Request root expect(tileset._statistics.numberOfPendingRequests).toEqual(1); - return tileset._root.contentReadyToProcessPromise.then(function() { + return tileset.root.contentReadyToProcessPromise.then(function() { scene.pickForSpecs(); expect(spy).not.toHaveBeenCalled(); scene.renderForSpecs(); @@ -1715,9 +1727,9 @@ defineSuite([ var spyUpdate = jasmine.createSpy('listener'); tileset.tileVisible.addEventListener(spyUpdate); scene.renderForSpecs(); - expect(tileset._root.visibility(scene.frameState, 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); + expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset.root); }); }); @@ -1731,7 +1743,7 @@ defineSuite([ return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() { // Root is loaded expect(spyUpdate.calls.count()).toEqual(1); - expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root); + expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset.root); spyUpdate.calls.reset(); // Unload from cache @@ -1743,7 +1755,7 @@ defineSuite([ viewRootOnly(); return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() { expect(spyUpdate.calls.count()).toEqual(1); - expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset._root); + expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset.root); }); }); }); @@ -1772,7 +1784,7 @@ defineSuite([ it('destroys', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; expect(tileset.isDestroyed()).toEqual(false); scene.primitives.remove(tileset); expect(tileset.isDestroyed()).toEqual(true); @@ -1789,7 +1801,7 @@ defineSuite([ it('destroys before external tileset JSON file finishes loading', function() { viewNothing(); return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; viewRootOnly(); scene.renderForSpecs(); // Request external tileset JSON file @@ -1813,7 +1825,7 @@ defineSuite([ url : tilesetUrl })); return tileset.readyPromise.then(function(tileset) { - var root = tileset._root; + var root = tileset.root; scene.renderForSpecs(); // Request root scene.primitives.remove(tileset); @@ -1919,7 +1931,7 @@ defineSuite([ expect(scene).notToRender([0, 0, 0, 255]); // Change feature ids so the show expression will evaluate to false - var content = tileset._root.content; + var content = tileset.root.content; var length = content.featuresLength; var i; var feature; @@ -2444,12 +2456,12 @@ defineSuite([ tileset.tileUnload.addEventListener(spyUpdate); scene.renderForSpecs(); - expect(tileset._root.visibility(scene.frameState, 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]); - expect(spyUpdate.calls.argsFor(2)[0]).toBe(tileset._root.children[2]); - expect(spyUpdate.calls.argsFor(3)[0]).toBe(tileset._root.children[3]); + expect(spyUpdate.calls.argsFor(0)[0]).toBe(tileset.root.children[0]); + expect(spyUpdate.calls.argsFor(1)[0]).toBe(tileset.root.children[1]); + expect(spyUpdate.calls.argsFor(2)[0]).toBe(tileset.root.children[2]); + expect(spyUpdate.calls.argsFor(3)[0]).toBe(tileset.root.children[3]); }); }); @@ -2477,7 +2489,7 @@ defineSuite([ var totalCommands = b3dmCommands + i3dmCommands; return Cesium3DTilesTester.loadTileset(scene, tilesetWithTransformsUrl).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; var rootTransform = Matrix4.unpack(root._header.transform); var child = root.children[0]; @@ -2536,17 +2548,17 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) { var statistics = tileset._statistics; - tileset._root.children[0].children[0].children[0].unloadContent(); - tileset._root.children[0].children[0].children[1].unloadContent(); - tileset._root.children[0].children[0].children[2].unloadContent(); + tileset.root.children[0].children[0].children[0].unloadContent(); + tileset.root.children[0].children[0].children[1].unloadContent(); + tileset.root.children[0].children[0].children[2].unloadContent(); statistics.numberOfTilesWithContentReady -= 3; scene.renderForSpecs(); expect(tileset._hasMixedContent).toBe(true); expect(statistics.numberOfTilesWithContentReady).toEqual(2); - expect(tileset._root.children[0].children[0].children[3]._selectionDepth).toEqual(1); - expect(tileset._root._selectionDepth).toEqual(0); + expect(tileset.root.children[0].children[0].children[3]._selectionDepth).toEqual(1); + expect(tileset.root._selectionDepth).toEqual(0); return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) { expect(statistics.numberOfTilesWithContentReady).toEqual(5); @@ -2557,9 +2569,9 @@ defineSuite([ it('adds stencil clear command first when unresolved', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) { - tileset._root.children[0].children[0].children[0].unloadContent(); - tileset._root.children[0].children[0].children[1].unloadContent(); - tileset._root.children[0].children[0].children[2].unloadContent(); + tileset.root.children[0].children[0].children[0].unloadContent(); + tileset.root.children[0].children[0].children[1].unloadContent(); + tileset.root.children[0].children[0].children[2].unloadContent(); scene.renderForSpecs(); var commandList = scene.frameState.commandList; @@ -2571,11 +2583,11 @@ defineSuite([ it('creates duplicate backface commands', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; - tileset._root.children[0].children[0].children[0].unloadContent(); - tileset._root.children[0].children[0].children[1].unloadContent(); - tileset._root.children[0].children[0].children[2].unloadContent(); + tileset.root.children[0].children[0].children[0].unloadContent(); + tileset.root.children[0].children[0].children[1].unloadContent(); + tileset.root.children[0].children[0].children[2].unloadContent(); scene.renderForSpecs(); @@ -2599,12 +2611,12 @@ defineSuite([ it('does not create duplicate backface commands if no selected descendants', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; - tileset._root.children[0].children[0].children[0].unloadContent(); - tileset._root.children[0].children[0].children[1].unloadContent(); - tileset._root.children[0].children[0].children[2].unloadContent(); - tileset._root.children[0].children[0].children[3].unloadContent(); + tileset.root.children[0].children[0].children[0].unloadContent(); + tileset.root.children[0].children[0].children[1].unloadContent(); + tileset.root.children[0].children[0].children[2].unloadContent(); + tileset.root.children[0].children[0].children[3].unloadContent(); scene.renderForSpecs(); @@ -2669,9 +2681,9 @@ defineSuite([ })); return Cesium3DTilesTester.waitForReady(scene, tileset).then(function(tileset) { scene.renderForSpecs(); - return tileset._root.contentReadyPromise.then(function() { - tileset._root.refine = Cesium3DTileRefine.REPLACE; - tileset._root.children[0].refine = Cesium3DTileRefine.REPLACE; + return tileset.root.contentReadyPromise.then(function() { + tileset.root.refine = Cesium3DTileRefine.REPLACE; + tileset.root.children[0].refine = Cesium3DTileRefine.REPLACE; tileset._allTilesAdditive = false; return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) { var statistics = tileset._statistics; @@ -2679,11 +2691,11 @@ defineSuite([ // Renders child while parent loads viewRootOnly(); scene.renderForSpecs(); - expect(isSelected(tileset, tileset._root.children[0])); - expect(!isSelected(tileset, tileset._root)); + expect(isSelected(tileset, tileset.root.children[0])); + expect(!isSelected(tileset, tileset.root)); return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) { - expect(!isSelected(tileset, tileset._root.children[0])); - expect(isSelected(tileset, tileset._root)); + expect(!isSelected(tileset, tileset.root.children[0])); + expect(isSelected(tileset, tileset.root)); }); }); }); @@ -2693,7 +2705,7 @@ defineSuite([ it('selects children if no ancestors available', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) { var statistics = tileset._statistics; - var parent = tileset._root.children[0]; + var parent = tileset.root.children[0]; var child = parent.children[3].children[0]; parent.refine = Cesium3DTileRefine.REPLACE; parent.unloadContent(); @@ -2715,7 +2727,7 @@ defineSuite([ spyOn(Resource._Implementations, 'loadWithXhr').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) { Resource._DefaultImplementations.loadWithXhr(batchedColorsB3dmUrl, responseType, method, data, headers, deferred, overrideMimeType); }); - var tile = tileset._root; + var tile = tileset.root; var statistics = tileset._statistics; var expiredContent; tileset.style = new Cesium3DTileStyle({ @@ -2816,7 +2828,7 @@ defineSuite([ }); }); - var subtreeRoot = tileset._root.children[0]; + var subtreeRoot = tileset.root.children[0]; var subtreeChildren = subtreeRoot.children[0].children; var childrenLength = subtreeChildren.length; var statistics = tileset._statistics; @@ -2863,7 +2875,7 @@ defineSuite([ spyOn(Resource._Implementations, 'loadWithXhr').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) { deferred.reject(); }); - var tile = tileset._root; + var tile = tileset.root; var statistics = tileset._statistics; // Trigger expiration to happen next frame @@ -2885,7 +2897,7 @@ defineSuite([ it('tile expiration date', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; // Trigger expiration to happen next frame tile.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate()); @@ -2962,7 +2974,7 @@ defineSuite([ it('clipping planes cull hidden tiles', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - var visibility = tileset._root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); + var visibility = tileset.root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); expect(visibility).not.toBe(CullingVolume.MASK_OUTSIDE); @@ -2973,12 +2985,12 @@ defineSuite([ ] }); - visibility = tileset._root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); + visibility = tileset.root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); expect(visibility).toBe(CullingVolume.MASK_OUTSIDE); plane.distance = 0.0; - visibility = tileset._root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); + visibility = tileset.root.visibility(scene.frameState, CullingVolume.MASK_INSIDE); expect(visibility).not.toBe(CullingVolume.MASK_OUTSIDE); }); @@ -2986,7 +2998,7 @@ defineSuite([ it('clipping planes cull hidden content', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - var visibility = tileset._root.contentVisibility(scene.frameState); + var visibility = tileset.root.contentVisibility(scene.frameState); expect(visibility).not.toBe(Intersect.OUTSIDE); @@ -2997,12 +3009,12 @@ defineSuite([ ] }); - visibility = tileset._root.contentVisibility(scene.frameState); + visibility = tileset.root.contentVisibility(scene.frameState); expect(visibility).toBe(Intersect.OUTSIDE); plane.distance = 0.0; - visibility = tileset._root.contentVisibility(scene.frameState); + visibility = tileset.root.contentVisibility(scene.frameState); expect(visibility).not.toBe(Intersect.OUTSIDE); }); @@ -3011,7 +3023,7 @@ defineSuite([ it('clipping planes cull tiles completely inside clipping region', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; scene.renderForSpecs(); @@ -3053,7 +3065,7 @@ defineSuite([ it('clipping planes cull tiles completely inside clipping region for i3dm', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetWithExternalResourcesUrl).then(function(tileset) { var statistics = tileset._statistics; - var root = tileset._root; + var root = tileset.root; scene.renderForSpecs(); diff --git a/Specs/Scene/Geometry3DTileContentSpec.js b/Specs/Scene/Geometry3DTileContentSpec.js index 55eaba37fde7..dae01c33c3cc 100644 --- a/Specs/Scene/Geometry3DTileContentSpec.js +++ b/Specs/Scene/Geometry3DTileContentSpec.js @@ -552,7 +552,7 @@ defineSuite([ url : geometryBoxesWithBatchTable })); return loadTileset(tileset).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(1); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'name')).toBe(true); @@ -565,7 +565,7 @@ defineSuite([ url : geometryBoxesWithBatchTable })); return loadTileset(tileset).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(function(){ content.getFeature(-1); }).toThrowDeveloperError(); diff --git a/Specs/Scene/Instanced3DModel3DTileContentSpec.js b/Specs/Scene/Instanced3DModel3DTileContentSpec.js index 75fca2f18e88..bf7254ed943d 100644 --- a/Specs/Scene/Instanced3DModel3DTileContentSpec.js +++ b/Specs/Scene/Instanced3DModel3DTileContentSpec.js @@ -183,7 +183,7 @@ defineSuite([ var newTransform = Transforms.headingPitchRollToFixedFrame(newCenter, new HeadingPitchRoll()); // Update tile transform - tileset._root.transform = newTransform; + tileset.root.transform = newTransform; // Move the camera to the new location setCamera(newLongitude, newLatitude); @@ -245,7 +245,7 @@ defineSuite([ it('throws when calling getFeature with invalid index', function() { return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(function(){ content.getFeature(-1); }).toThrowDeveloperError(); @@ -260,7 +260,7 @@ defineSuite([ it('gets memory usage', function() { return Cesium3DTilesTester.loadTileset(scene, texturedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // Box model - 36 ushort indices and 24 vertices per building, 8 float components (position, normal, uv) per vertex. // (24 * 8 * 4) + (36 * 2) = 840 @@ -295,7 +295,7 @@ defineSuite([ it('Links model to tileset clipping planes based on bounding volume clipping', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var content = tile.content; var model = content._modelInstanceCollection._model; @@ -322,7 +322,7 @@ defineSuite([ it('Links model to tileset clipping planes if tileset clipping planes are reassigned', function() { return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var model = tile.content._modelInstanceCollection._model; expect(model.clippingPlanes).toBeUndefined(); @@ -357,7 +357,7 @@ defineSuite([ spyOn(Model, '_getClippingFunction').and.callThrough(); return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var content = tile.content; var clippingPlaneCollection = new ClippingPlaneCollection({ planes : [ diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js index 7fd70f1518e5..1e5907acf35f 100644 --- a/Specs/Scene/PointCloud3DTileContentSpec.js +++ b/Specs/Scene/PointCloud3DTileContentSpec.js @@ -184,8 +184,8 @@ defineSuite([ it('gets tileset properties', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) { - var root = tileset._root; - var content = root._content; + var root = tileset.root; + var content = root.content; expect(content.tileset).toBe(tileset); expect(content.tile).toBe(root); expect(content.url.indexOf(root._header.content.uri) > -1).toBe(true); @@ -284,7 +284,7 @@ defineSuite([ var decoder = DracoLoader._getDecoderTaskProcessor(); spyOn(decoder, 'scheduleTask').and.returnValue(when.reject({message : 'my error'})); return Cesium3DTilesTester.loadTileset(scene, pointCloudDracoUrl).then(function(tileset) { - var root = tileset._root; + var root = tileset.root; return root.contentReadyPromise.then(function() { fail('should not resolve'); }).otherwise(function(error) { @@ -323,7 +323,7 @@ defineSuite([ var newTransform = Transforms.headingPitchRollToFixedFrame(newCenter, newHPR); // Update tile transform - tileset._root.transform = newTransform; + tileset.root.transform = newTransform; // Move the camera to the new location setCamera(newLongitude, newLatitude); @@ -363,7 +363,7 @@ defineSuite([ it('picks', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; tileset.show = false; expect(scene).toPickPrimitive(undefined); tileset.show = true; @@ -404,7 +404,7 @@ defineSuite([ it('point cloud without batch table works', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(0); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'name')).toBe(false); @@ -414,7 +414,7 @@ defineSuite([ it('batched point cloud works', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudBatchedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(8); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'name')).toBe(true); @@ -427,7 +427,7 @@ defineSuite([ // created. There is no per-point show/color/pickId because the overhead is too high. Instead points are styled // based on their properties, and these are not accessible from the API. return Cesium3DTilesTester.loadTileset(scene, pointCloudWithPerPointPropertiesUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(0); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'name')).toBe(false); @@ -437,7 +437,7 @@ defineSuite([ it('throws when calling getFeature with invalid index', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudBatchedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(function(){ content.getFeature(-1); }).toThrowDeveloperError(); @@ -452,7 +452,7 @@ defineSuite([ it('Supports back face culling when there are per-point normals', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudBatchedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // Get the number of picked sections with back face culling on var pickedCountCulling = 0; @@ -605,7 +605,7 @@ defineSuite([ it('applies shader style', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudWithPerPointPropertiesUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // Solid red color tileset.style = new Cesium3DTileStyle({ @@ -797,7 +797,7 @@ defineSuite([ it('does not apply shader style if the point cloud has a batch table', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudBatchedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; var shaderProgram = content._pointCloud._drawCommand.shaderProgram; tileset.style = new Cesium3DTileStyle({ color:'color("red")' @@ -840,7 +840,7 @@ defineSuite([ return when.all(promises).then(function(tilesets) { var length = tilesets.length; for (var i = 0; i < length; ++i) { - var content = tilesets[i]._root.content; + var content = tilesets[i].root.content; expect(content.geometryByteLength).toEqual(expectedGeometryMemory[i]); expect(content.texturesByteLength).toEqual(0); } @@ -849,7 +849,7 @@ defineSuite([ it('gets memory usage for batch point cloud', function() { return Cesium3DTilesTester.loadTileset(scene, pointCloudBatchedUrl).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; // Point cloud consists of positions, colors, normals, and batchIds // 3 floats (xyz), 3 floats (normal), 1 byte (batchId) @@ -881,7 +881,7 @@ defineSuite([ it('rebuilds shaders when clipping planes are enabled, change between union and intersection, or change count', function () { return Cesium3DTilesTester.loadTileset(scene, pointCloudRGBUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; tile._isClipped = true; var content = tile.content; diff --git a/Specs/Scene/Tileset3DTileContentSpec.js b/Specs/Scene/Tileset3DTileContentSpec.js index 72d493898efd..7ed264900d93 100644 --- a/Specs/Scene/Tileset3DTileContentSpec.js +++ b/Specs/Scene/Tileset3DTileContentSpec.js @@ -42,7 +42,7 @@ defineSuite([ it('gets properties', function() { return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) { - var tile = tileset._root; + var tile = tileset.root; var content = tile.content; expect(content.featuresLength).toBe(0); expect(content.pointsLength).toBe(0); diff --git a/Specs/Scene/Vector3DTileContentSpec.js b/Specs/Scene/Vector3DTileContentSpec.js index e53d39c78258..e4f2cbc69257 100644 --- a/Specs/Scene/Vector3DTileContentSpec.js +++ b/Specs/Scene/Vector3DTileContentSpec.js @@ -646,7 +646,7 @@ defineSuite([ url : vectorPolygonsWithBatchTable })); return loadTileset(tileset).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(content.featuresLength).toBe(1); expect(content.innerContents).toBeUndefined(); expect(content.hasProperty(0, 'name')).toBe(true); @@ -659,7 +659,7 @@ defineSuite([ url : vectorPolygonsWithBatchTable })); return loadTileset(tileset).then(function(tileset) { - var content = tileset._root.content; + var content = tileset.root.content; expect(function(){ content.getFeature(-1); }).toThrowDeveloperError(); diff --git a/Specs/Scene/Vector3DTileGeometrySpec.js b/Specs/Scene/Vector3DTileGeometrySpec.js index e9043896c4c4..233317192880 100644 --- a/Specs/Scene/Vector3DTileGeometrySpec.js +++ b/Specs/Scene/Vector3DTileGeometrySpec.js @@ -74,7 +74,7 @@ defineSuite([ _statistics : { texturesByteLength : 0 }, - _tileset : { + tileset : { _statistics : { batchTableByteLength : 0 }, diff --git a/Specs/Scene/Vector3DTilePointsSpec.js b/Specs/Scene/Vector3DTilePointsSpec.js index a7dea4a9c3e1..057edb4fabea 100644 --- a/Specs/Scene/Vector3DTilePointsSpec.js +++ b/Specs/Scene/Vector3DTilePointsSpec.js @@ -60,13 +60,11 @@ defineSuite([ _statistics : { texturesByteLength : 0 }, - _tileset : { + tileset : { _statistics : { batchTableByteLength : 0 }, - colorBlendMode : ColorBlendMode.HIGHLIGHT - }, - tileset : { + colorBlendMode : ColorBlendMode.HIGHLIGHT, ellipsoid : Ellipsoid.WGS84 }, getFeature : function(id) { return { batchId : id }; } diff --git a/Specs/Scene/Vector3DTilePolygonsSpec.js b/Specs/Scene/Vector3DTilePolygonsSpec.js index e728b2dc6f32..d7f9d0b28598 100644 --- a/Specs/Scene/Vector3DTilePolygonsSpec.js +++ b/Specs/Scene/Vector3DTilePolygonsSpec.js @@ -76,7 +76,7 @@ defineSuite([ _statistics : { texturesByteLength : 0 }, - _tileset : { + tileset : { _statistics : { batchTableByteLength : 0 }, diff --git a/Specs/Scene/Vector3DTilePolylinesSpec.js b/Specs/Scene/Vector3DTilePolylinesSpec.js index 3ccedcd9447a..eea85b35e1d2 100644 --- a/Specs/Scene/Vector3DTilePolylinesSpec.js +++ b/Specs/Scene/Vector3DTilePolylinesSpec.js @@ -46,7 +46,7 @@ defineSuite([ _statistics : { texturesByteLength : 0 }, - _tileset : { + tileset : { _statistics : { batchTableByteLength : 0 },