diff --git a/CHANGES.md b/CHANGES.md
index a91c2f588467..2c897210abdc 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,6 +8,7 @@ Change Log
##### Deprecated :hourglass_flowing_sand:
* Support for 3D Tiles `content.url` is deprecated to reflect updates to the [3D Tiles spec](https://github.com/AnalyticalGraphicsInc/3d-tiles/pull/301). Use `content.uri instead`. Support for `content.url` will remain for backwards compatibility. [#6744](https://github.com/AnalyticalGraphicsInc/cesium/pull/6744)
+* Support for the 3D Tiles pre-version 1.0 Batch Table Hierarchy is deprecated to reflect updates to the [3D Tiles spec](https://github.com/AnalyticalGraphicsInc/3d-tiles/pull/301). Use the [`3DTILES_batch_table_hierarchy`](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/1.0/extensions/3DTILES_batch_table_hierarchy) extension instead. Support for the deprecated batch table hierarchy will remain for backwards compatibility. [#6780](https://github.com/AnalyticalGraphicsInc/cesium/pull/6780)
##### Fixes :wrench:
* Fixed bug causing billboards and labels to appear the wrong size when switching scene modes [#6745](https://github.com/AnalyticalGraphicsInc/cesium/issues/6745)
diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js
index 1aeea246c2da..33f7e93b0b60 100644
--- a/Source/Scene/Cesium3DTileBatchTable.js
+++ b/Source/Scene/Cesium3DTileBatchTable.js
@@ -10,6 +10,7 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
+ '../Core/deprecationWarning',
'../Core/destroyObject',
'../Core/DeveloperError',
'../Core/Math',
@@ -44,6 +45,7 @@ define([
defaultValue,
defined,
defineProperties,
+ deprecationWarning,
destroyObject,
DeveloperError,
CesiumMath,
@@ -82,31 +84,17 @@ define([
this._translucentFeaturesLength = 0; // Number of features in the tile that are translucent
- /**
- * @private
- */
- this.batchTableJson = batchTableJson;
-
- /**
- * @private
- */
- this.batchTableBinary = batchTableBinary;
-
- var batchTableHierarchy;
- var batchTableBinaryProperties;
+ var extensions;
if (defined(batchTableJson)) {
- // Extract the hierarchy and remove it from the batch table json
- batchTableHierarchy = batchTableJson.HIERARCHY;
- if (defined(batchTableHierarchy)) {
- delete batchTableJson.HIERARCHY;
- batchTableHierarchy = initializeHierarchy(batchTableHierarchy, batchTableBinary);
- }
- // Get the binary properties
- batchTableBinaryProperties = Cesium3DTileBatchTable.getBinaryProperties(featuresLength, batchTableJson, batchTableBinary);
+ extensions = batchTableJson.extensions;
}
+ this._extensions = defaultValue(extensions, {});
+
+ var properties = initializeProperties(batchTableJson);
+ this._properties = properties;
- this._batchTableHierarchy = batchTableHierarchy;
- this._batchTableBinaryProperties = batchTableBinaryProperties;
+ this._batchTableHierarchy = initializeHierarchy(this, batchTableJson, batchTableBinary);
+ this._batchTableBinaryProperties = getBinaryProperties(featuresLength, properties, batchTableBinary);
// PERFORMANCE_IDEA: These parallel arrays probably generate cache misses in get/set color/show
// and use A LOT of memory. How can we use less memory?
@@ -146,6 +134,9 @@ define([
this._textureStep = textureStep;
}
+ // This can be overridden for testing purposes
+ Cesium3DTileBatchTable._deprecationWarning = deprecationWarning;
+
defineProperties(Cesium3DTileBatchTable.prototype, {
memorySizeInBytes : {
get : function() {
@@ -161,23 +152,63 @@ define([
}
});
- function initializeHierarchy(json, binary) {
+ function initializeProperties(jsonHeader) {
+ var properties = {};
+
+ if (!defined(jsonHeader)) {
+ return properties;
+ }
+
+ for (var propertyName in jsonHeader) {
+ if (jsonHeader.hasOwnProperty(propertyName)
+ && propertyName !== 'HIERARCHY' // Deprecated HIERARCHY property
+ && propertyName !== 'extensions'
+ && propertyName !== 'extras') {
+ properties[propertyName] = clone(jsonHeader[propertyName], true);
+ }
+ }
+
+ return properties;
+ }
+
+ function initializeHierarchy(batchTable, jsonHeader, binaryBody) {
+ if (!defined(jsonHeader)) {
+ return;
+ }
+
+ var hierarchy = batchTable._extensions['3DTILES_batch_table_hierarchy'];
+
+ var legacyHierarchy = jsonHeader.HIERARCHY;
+ if (defined(legacyHierarchy)) {
+ Cesium3DTileBatchTable._deprecationWarning('batchTableHierarchyExtension', 'The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead.');
+ batchTable._extensions['3DTILES_batch_table_hierarchy'] = legacyHierarchy;
+ hierarchy = legacyHierarchy;
+ }
+
+ if (!defined(hierarchy)) {
+ return;
+ }
+
+ return initializeHierarchyValues(hierarchy, binaryBody);
+ }
+
+ function initializeHierarchyValues(hierarchyJson, binaryBody) {
var i;
var classId;
var binaryAccessor;
- var instancesLength = json.instancesLength;
- var classes = json.classes;
- var classIds = json.classIds;
- var parentCounts = json.parentCounts;
- var parentIds = json.parentIds;
+ var instancesLength = hierarchyJson.instancesLength;
+ var classes = hierarchyJson.classes;
+ var classIds = hierarchyJson.classIds;
+ var parentCounts = hierarchyJson.parentCounts;
+ var parentIds = hierarchyJson.parentIds;
var parentIdsLength = instancesLength;
if (defined(classIds.byteOffset)) {
classIds.componentType = defaultValue(classIds.componentType, ComponentDatatype.UNSIGNED_SHORT);
classIds.type = AttributeType.SCALAR;
binaryAccessor = getBinaryAccessor(classIds);
- classIds = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + classIds.byteOffset, instancesLength);
+ classIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + classIds.byteOffset, instancesLength);
}
var parentIndexes;
@@ -186,7 +217,7 @@ define([
parentCounts.componentType = defaultValue(parentCounts.componentType, ComponentDatatype.UNSIGNED_SHORT);
parentCounts.type = AttributeType.SCALAR;
binaryAccessor = getBinaryAccessor(parentCounts);
- parentCounts = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + parentCounts.byteOffset, instancesLength);
+ parentCounts = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentCounts.byteOffset, instancesLength);
}
parentIndexes = new Uint16Array(instancesLength);
parentIdsLength = 0;
@@ -200,14 +231,14 @@ define([
parentIds.componentType = defaultValue(parentIds.componentType, ComponentDatatype.UNSIGNED_SHORT);
parentIds.type = AttributeType.SCALAR;
binaryAccessor = getBinaryAccessor(parentIds);
- parentIds = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + parentIds.byteOffset, parentIdsLength);
+ parentIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentIds.byteOffset, parentIdsLength);
}
var classesLength = classes.length;
for (i = 0; i < classesLength; ++i) {
var classInstancesLength = classes[i].length;
var properties = classes[i].instances;
- var binaryProperties = Cesium3DTileBatchTable.getBinaryProperties(classInstancesLength, properties, binary);
+ var binaryProperties = getBinaryProperties(classInstancesLength, properties, binaryBody);
classes[i].instances = combine(binaryProperties, properties);
}
@@ -282,11 +313,11 @@ define([
}
//>>includeEnd('debug');
- Cesium3DTileBatchTable.getBinaryProperties = function(featuresLength, json, binary) {
+ function getBinaryProperties(featuresLength, properties, binaryBody) {
var binaryProperties;
- for (var name in json) {
- if (json.hasOwnProperty(name)) {
- var property = json[name];
+ for (var name in properties) {
+ if (properties.hasOwnProperty(name)) {
+ var property = properties[name];
var byteOffset = property.byteOffset;
if (defined(byteOffset)) {
// This is a binary property
@@ -298,14 +329,14 @@ define([
if (!defined(type)) {
throw new RuntimeError('type is required.');
}
- if (!defined(binary)) {
+ if (!defined(binaryBody)) {
throw new RuntimeError('Property ' + name + ' requires a batch table binary.');
}
var binaryAccessor = getBinaryAccessor(property);
var componentCount = binaryAccessor.componentsPerAttribute;
var classType = binaryAccessor.classType;
- var typedArray = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + byteOffset, featuresLength);
+ var typedArray = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + byteOffset, featuresLength);
if (!defined(binaryProperties)) {
binaryProperties = {};
@@ -322,6 +353,10 @@ define([
}
}
return binaryProperties;
+ }
+
+ Cesium3DTileBatchTable.getBinaryProperties = function(featuresLength, batchTableJson, batchTableBinary) {
+ return getBinaryProperties(featuresLength, batchTableJson, batchTableBinary);
};
function getByteLength(batchTable) {
@@ -738,8 +773,7 @@ define([
Check.typeOf.string('name', name);
//>>includeEnd('debug');
- var json = this.batchTableJson;
- return (defined(json) && defined(json[name])) || (defined(this._batchTableHierarchy) && hasPropertyInHierarchy(this, batchId, name));
+ return (defined(this._properties[name])) || (defined(this._batchTableHierarchy) && hasPropertyInHierarchy(this, batchId, name));
};
Cesium3DTileBatchTable.prototype.getPropertyNames = function(batchId, results) {
@@ -750,12 +784,8 @@ define([
results = defined(results) ? results : [];
results.length = 0;
- var json = this.batchTableJson;
- for (var name in json) {
- if (json.hasOwnProperty(name)) {
- results.push(name);
- }
- }
+ var propertyNames = Object.keys(this._properties);
+ results.push.apply(results, propertyNames);
if (defined(this._batchTableHierarchy)) {
getPropertyNamesInHierarchy(this, batchId, results);
@@ -770,10 +800,6 @@ define([
Check.typeOf.string('name', name);
//>>includeEnd('debug');
- if (!defined(this.batchTableJson)) {
- return undefined;
- }
-
if (defined(this._batchTableBinaryProperties)) {
var binaryProperty = this._batchTableBinaryProperties[name];
if (defined(binaryProperty)) {
@@ -781,7 +807,7 @@ define([
}
}
- var propertyValues = this.batchTableJson[name];
+ var propertyValues = this._properties[name];
if (defined(propertyValues)) {
return clone(propertyValues[batchId], true);
}
@@ -817,17 +843,11 @@ define([
}
}
- if (!defined(this.batchTableJson)) {
- // Tile payload did not have a batch table. Create one for new user-defined properties.
- this.batchTableJson = {};
- }
-
- var propertyValues = this.batchTableJson[name];
-
+ var propertyValues = this._properties[name];
if (!defined(propertyValues)) {
// Property does not exist. Create it.
- this.batchTableJson[name] = new Array(featuresLength);
- propertyValues = this.batchTableJson[name];
+ this._properties[name] = new Array(featuresLength);
+ propertyValues = this._properties[name];
}
propertyValues[batchId] = clone(value, true);
diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js
index 086f27e75a79..19bd749a7313 100644
--- a/Source/Scene/Cesium3DTileset.js
+++ b/Source/Scene/Cesium3DTileset.js
@@ -167,6 +167,7 @@ define([
this._asset = undefined; // Metadata for the entire tileset
this._properties = undefined; // Metadata for per-model/point/etc properties
this._geometricError = undefined; // Geometric error when the tree is not rendered at all
+ this._extensionsUsed = undefined;
this._gltfUpAxis = undefined;
this._processingQueue = [];
this._selectedTiles = [];
@@ -709,6 +710,7 @@ define([
that._asset = tilesetJson.asset;
that._properties = tilesetJson.properties;
that._geometricError = tilesetJson.geometricError;
+ that._extensionsUsed = tilesetJson.extensionsUsed;
that._gltfUpAxis = gltfUpAxis;
that._readyPromise.resolve(that);
}).otherwise(function(error) {
@@ -1915,6 +1917,20 @@ define([
}
};
+ /**
+ * true
if the tileset JSON file lists the extension in extensionsUsed; otherwise, false
.
+ * @param {String} extensionName The name of the extension to check.
+ *
+ * @returns {Boolean} true
if the tileset JSON file lists the extension in extensionsUsed; otherwise, false
.
+ */
+ Cesium3DTileset.prototype.hasExtension = function(extensionName) {
+ if (!defined(this._extensionsUsed)) {
+ return false;
+ }
+
+ return (this._extensionsUsed.indexOf(extensionName) > -1);
+ };
+
/**
* Returns true if this object was destroyed; otherwise, false.
*
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tile.b3dm b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tile.b3dm
index 1f7b54d4f418..c9eda60d78cf 100644
Binary files a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tile.b3dm and b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tile.b3dm differ
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json
index 01d4746f1ded..b58514642f34 100644
--- a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json
+++ b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json
@@ -41,7 +41,13 @@
},
"geometricError": 0,
"content": {
- "url": "tile.b3dm"
+ "uri": "tile.b3dm"
}
- }
+ },
+ "extensionsUsed": [
+ "3DTILES_batch_table_hierarchy"
+ ],
+ "extensionsRequired": [
+ "3DTILES_batch_table_hierarchy"
+ ]
}
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tile.b3dm b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tile.b3dm
index a58039a483bf..992d1a7190e9 100644
Binary files a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tile.b3dm and b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tile.b3dm differ
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tileset.json b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tileset.json
index 01d4746f1ded..b58514642f34 100644
--- a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tileset.json
+++ b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tileset.json
@@ -41,7 +41,13 @@
},
"geometricError": 0,
"content": {
- "url": "tile.b3dm"
+ "uri": "tile.b3dm"
}
- }
+ },
+ "extensionsUsed": [
+ "3DTILES_batch_table_hierarchy"
+ ],
+ "extensionsRequired": [
+ "3DTILES_batch_table_hierarchy"
+ ]
}
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tile.b3dm b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tile.b3dm
new file mode 100644
index 000000000000..17e76151f1cc
Binary files /dev/null and b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tile.b3dm differ
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tileset.json b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tileset.json
new file mode 100644
index 000000000000..909f50ecccd8
--- /dev/null
+++ b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tileset.json
@@ -0,0 +1,47 @@
+{
+ "asset": {
+ "version": "0.0"
+ },
+ "geometricError": 70,
+ "root": {
+ "transform": [
+ 0.9686356343768792,
+ 0.24848542777253735,
+ 0,
+ 0,
+ -0.15986460744966327,
+ 0.623177611820219,
+ 0.765567091384559,
+ 0,
+ 0.19023226619126932,
+ -0.7415555652213445,
+ 0.6433560667227647,
+ 0,
+ 1215011.9317263428,
+ -4736309.3434217675,
+ 4081602.0044800863,
+ 1
+ ],
+ "refine": "ADD",
+ "boundingVolume": {
+ "box": [
+ 0,
+ 0,
+ 10,
+ 50,
+ 0,
+ 0,
+ 0,
+ 50,
+ 0,
+ 0,
+ 0,
+ 10
+ ]
+ },
+ "geometricError": 0,
+ "content": {
+ "uri": "tile.b3dm"
+ }
+ }
+}
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tile.b3dm b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tile.b3dm
index 983d0e56dee0..f9ffe19315dd 100644
Binary files a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tile.b3dm and b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tile.b3dm differ
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tileset.json b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tileset.json
index 01d4746f1ded..b58514642f34 100644
--- a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tileset.json
+++ b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tileset.json
@@ -41,7 +41,13 @@
},
"geometricError": 0,
"content": {
- "url": "tile.b3dm"
+ "uri": "tile.b3dm"
}
- }
+ },
+ "extensionsUsed": [
+ "3DTILES_batch_table_hierarchy"
+ ],
+ "extensionsRequired": [
+ "3DTILES_batch_table_hierarchy"
+ ]
}
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tile.b3dm b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tile.b3dm
index 362a919adabd..c63977a14720 100644
Binary files a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tile.b3dm and b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tile.b3dm differ
diff --git a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tileset.json b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tileset.json
index 01d4746f1ded..b58514642f34 100644
--- a/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tileset.json
+++ b/Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tileset.json
@@ -41,7 +41,13 @@
},
"geometricError": 0,
"content": {
- "url": "tile.b3dm"
+ "uri": "tile.b3dm"
}
- }
+ },
+ "extensionsUsed": [
+ "3DTILES_batch_table_hierarchy"
+ ],
+ "extensionsRequired": [
+ "3DTILES_batch_table_hierarchy"
+ ]
}
diff --git a/Specs/Scene/Batched3DModel3DTileContentSpec.js b/Specs/Scene/Batched3DModel3DTileContentSpec.js
index 52a2ef22f301..14fe3dc13f8d 100644
--- a/Specs/Scene/Batched3DModel3DTileContentSpec.js
+++ b/Specs/Scene/Batched3DModel3DTileContentSpec.js
@@ -54,6 +54,9 @@ defineSuite([
beforeAll(function() {
scene = createScene();
+
+ // Keep the error from logging to the console when running tests
+ spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
});
afterAll(function() {
@@ -76,31 +79,26 @@ defineSuite([
});
it('recognizes the legacy 20-byte header', function() {
- spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
return Cesium3DTilesTester.loadTileset(scene, deprecated1Url)
.then(function(tileset) {
expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled();
Cesium3DTilesTester.expectRenderTileset(scene, tileset);
var batchTable = tileset._root._content.batchTable;
- expect(batchTable.batchTableJson).toBeDefined();
- expect(batchTable.batchTableBinary).toBeUndefined();
+ expect(batchTable._properties).toBeDefined();
});
});
it('recognizes the legacy 24-byte header', function() {
- spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
return Cesium3DTilesTester.loadTileset(scene, deprecated2Url)
.then(function(tileset) {
expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled();
Cesium3DTilesTester.expectRenderTileset(scene, tileset);
var batchTable = tileset._root._content.batchTable;
- expect(batchTable.batchTableJson).toBeDefined();
- expect(batchTable.batchTableBinary).toBeUndefined();
+ expect(batchTable._properties).toBeDefined();
});
});
it('logs deprecation warning for use of BATCHID without prefixed underscore', function() {
- spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
return Cesium3DTilesTester.loadTileset(scene, deprecated1Url)
.then(function(tileset) {
expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled();
diff --git a/Specs/Scene/Cesium3DTileBatchTableSpec.js b/Specs/Scene/Cesium3DTileBatchTableSpec.js
index e9f36c782644..65028807093b 100644
--- a/Specs/Scene/Cesium3DTileBatchTableSpec.js
+++ b/Specs/Scene/Cesium3DTileBatchTableSpec.js
@@ -9,6 +9,7 @@ defineSuite([
'Core/Matrix3',
'Core/Matrix4',
'Renderer/ContextLimits',
+ 'Scene/Batched3DModel3DTileContent',
'Scene/Cesium3DTileStyle',
'Specs/Cesium3DTilesTester',
'Specs/createScene'
@@ -23,6 +24,7 @@ defineSuite([
Matrix3,
Matrix4,
ContextLimits,
+ Batched3DModel3DTileContent,
Cesium3DTileStyle,
Cesium3DTilesTester,
createScene) {
@@ -39,6 +41,7 @@ defineSuite([
var batchTableHierarchyBinaryUrl = './Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyBinary/tileset.json';
var batchTableHierarchyMultipleParentsUrl = './Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyMultipleParents/tileset.json';
var batchTableHierarchyNoParentsUrl = './Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyNoParents/tileset.json';
+ var batchTableHierarchyLegacyUrl = './Data/Cesium3DTiles/Hierarchy/BatchTableHierarchyLegacy/tileset.json';
var result = new Color();
@@ -58,6 +61,10 @@ defineSuite([
// One feature is located at the center, point the camera there
var center = Cartesian3.fromRadians(centerLongitude, centerLatitude);
scene.camera.lookAt(center, new HeadingPitchRange(0.0, -1.57, 20.0));
+
+ // Keep the error from logging to the console when running tests
+ spyOn(Cesium3DTileBatchTable, '_deprecationWarning');
+ spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
});
afterAll(function() {
@@ -366,7 +373,7 @@ defineSuite([
var batchTable = new Cesium3DTileBatchTable(mockTileset, 3);
batchTable.setProperty(0, 'height', 1.0);
- expect(batchTable.batchTableJson.height.length).toEqual(3);
+ expect(batchTable._properties.height.length).toEqual(3);
expect(batchTable.getProperty(0, 'height')).toEqual(1.0);
expect(batchTable.getProperty(1, 'height')).toBeUndefined();
expect(batchTable.getProperty(2, 'height')).toBeUndefined();
@@ -896,7 +903,7 @@ defineSuite([
});
}
- it('renders tileset with batch table hierarchy', function() {
+ it('renders tileset with batch table hierarchy extension', function() {
return checkBatchTableHierarchy(batchTableHierarchyUrl, false);
});
@@ -912,6 +919,17 @@ defineSuite([
return checkBatchTableHierarchyNoParents(batchTableHierarchyNoParentsUrl);
});
+ it('renders tileset with legacy batch table hierarchy (pre-version 1.0)', function() {
+ return checkBatchTableHierarchy(batchTableHierarchyLegacyUrl, false);
+ });
+
+ it('warns about deprecated batch hierarchy (pre-version 1.0)', function() {
+ return checkBatchTableHierarchy(batchTableHierarchyLegacyUrl, false)
+ .then(function(tileset) {
+ expect(Cesium3DTileBatchTable._deprecationWarning).toHaveBeenCalled();
+ });
+ });
+
it('validates hierarchy with multiple parents', function() {
// building0
// / \
diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js
index b072e9e9d1f1..be683c7c3f27 100644
--- a/Specs/Scene/Cesium3DTilesetSpec.js
+++ b/Specs/Scene/Cesium3DTilesetSpec.js
@@ -86,6 +86,8 @@ defineSuite([
var withBatchTableUrl = 'Data/Cesium3DTiles/Batched/BatchedWithBatchTable/tileset.json';
var noBatchIdsUrl = 'Data/Cesium3DTiles/Batched/BatchedNoBatchIds/tileset.json';
+ var withBatchTableHierarchyUrl = 'Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json';
+
var withTransformBoxUrl = 'Data/Cesium3DTiles/Batched/BatchedWithTransformBox/tileset.json';
var withTransformSphereUrl = 'Data/Cesium3DTiles/Batched/BatchedWithTransformSphere/tileset.json';
var withTransformRegionUrl = 'Data/Cesium3DTiles/Batched/BatchedWithTransformRegion/tileset.json';
@@ -358,6 +360,13 @@ defineSuite([
});
});
+ 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);
+ expect(tileset.hasExtension('3DTILES_nonexistant_extension')).toBe(false);
+ });
+ });
+
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')));