From de6ba128468d2ec6ac6acc36fd9ec992a83cf2b5 Mon Sep 17 00:00:00 2001
From: Sean Lilley
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
@@ -617,10 +632,13 @@ define([
this.expireDate = undefined;
}
+ var contentFailedFunction = getContentFailedFunction(this);
+
promise.then(function(arrayBuffer) {
if (that.isDestroyed()) {
// Tile is unloaded before the content finishes loading
- return when.reject('tile is destroyed');
+ contentFailedFunction();
+ return;
}
var uint8Array = new Uint8Array(arrayBuffer);
var magic = getMagic(uint8Array);
@@ -640,10 +658,11 @@ define([
that._contentState = Cesium3DTileContentState.PROCESSING;
that._contentReadyToProcessPromise.resolve(content);
- content.readyPromise.then(function(content) {
+ return content.readyPromise.then(function(content) {
if (that.isDestroyed()) {
// Tile is unloaded before the content finishes processing
- return when.reject('tile is destroyed');
+ contentFailedFunction();
+ return;
}
updateExpireDate(that);
@@ -652,22 +671,14 @@ define([
that._contentState = Cesium3DTileContentState.READY;
that._contentReadyPromise.resolve(content);
- }).otherwise(function(error) {
- that._contentState = Cesium3DTileContentState.FAILED;
- that._contentReadyPromise.reject(error);
});
- }).otherwise(function(error) {
- that._contentState = Cesium3DTileContentState.FAILED;
- that._contentReadyPromise.reject(error);
- that._contentReadyToProcessPromise.reject(error);
- });
+ }).otherwise(contentFailedFunction);
return true;
};
/**
- * Unloads the tile's content and returns the tile's state to the state of when
- * it was first created, before its content was loaded.
+ * Unloads the tile's content.
*
* @private
*/
@@ -764,7 +775,7 @@ define([
return boundingVolume.distanceToCamera(frameState);
};
- var scratchCartesian = new Cartesian3();
+ var scratchToTileCenter = new Cartesian3();
/**
* Computes the distance from the center of the tile's bounding volume to the camera.
@@ -775,8 +786,9 @@ define([
* @private
*/
Cesium3DTile.prototype.distanceToTileCenter = function(frameState) {
- var boundingVolume = getBoundingVolume(this, frameState).boundingVolume;
- var toCenter = Cartesian3.subtract(boundingVolume.center, frameState.camera.positionWC, scratchCartesian);
+ var tileBoundingVolume = getBoundingVolume(this, frameState);
+ var boundingVolume = tileBoundingVolume.boundingVolume; // Gets the underlying OrientedBoundingBox or BoundingSphere
+ var toCenter = Cartesian3.subtract(boundingVolume.center, frameState.camera.positionWC, scratchToTileCenter);
var distance = Cartesian3.magnitude(toCenter);
Cartesian3.divideByScalar(toCenter, distance, toCenter);
var dot = Cartesian3.dot(frameState.camera.directionWC, toCenter);
@@ -793,11 +805,7 @@ define([
*/
Cesium3DTile.prototype.insideViewerRequestVolume = function(frameState) {
var viewerRequestVolume = this._viewerRequestVolume;
- if (!defined(viewerRequestVolume)) {
- return true;
- }
-
- return (viewerRequestVolume.distanceToCamera(frameState) === 0.0);
+ return !defined(viewerRequestVolume) || (viewerRequestVolume.distanceToCamera(frameState) === 0.0);
};
var scratchMatrix = new Matrix3();
@@ -806,6 +814,53 @@ define([
var scratchCenter = new Cartesian3();
var scratchRectangle = new Rectangle();
+ function createBox(box, transform, result) {
+ var center = Cartesian3.fromElements(box[0], box[1], box[2], scratchCenter);
+ var halfAxes = Matrix3.fromArray(box, 3, scratchHalfAxes);
+
+ // Find the transformed center and halfAxes
+ center = Matrix4.multiplyByPoint(transform, center, center);
+ var rotationScale = Matrix4.getRotation(transform, scratchMatrix);
+ halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);
+
+ if (defined(result)) {
+ result.update(center, halfAxes);
+ return result;
+ }
+ return new TileOrientedBoundingBox(center, halfAxes);
+ }
+
+ function createRegion(region, result) {
+ var rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
+
+ if (defined(result)) {
+ // Don't update regions when the transform changes
+ return result;
+ }
+ return new TileBoundingRegion({
+ rectangle : rectangleRegion,
+ minimumHeight : region[4],
+ maximumHeight : region[5]
+ });
+ }
+
+ function createSphere(sphere, transform, result) {
+ var center = Cartesian3.fromElements(sphere[0], sphere[1], sphere[2], scratchCenter);
+ var radius = sphere[3];
+
+ // Find the transformed center and radius
+ center = Matrix4.multiplyByPoint(transform, center, center);
+ var scale = Matrix4.getScale(transform, scratchScale);
+ var uniformScale = Cartesian3.maximumComponent(scale);
+ radius *= uniformScale;
+
+ if (defined(result)) {
+ result.update(center, radius);
+ return result;
+ }
+ return new TileBoundingSphere(center, radius);
+ }
+
/**
* Create a bounding volume from the tile's bounding volume header.
*
@@ -818,52 +873,19 @@ define([
* @private
*/
Cesium3DTile.prototype.createBoundingVolume = function(boundingVolumeHeader, transform, result) {
- var center;
+ if (!defined(boundingVolumeHeader)) {
+ throw new RuntimeError('boundingVolume must be defined');
+ }
if (defined(boundingVolumeHeader.box)) {
- var box = boundingVolumeHeader.box;
- center = Cartesian3.fromElements(box[0], box[1], box[2], scratchCenter);
- var halfAxes = Matrix3.fromArray(box, 3, scratchHalfAxes);
-
- // Find the transformed center and halfAxes
- center = Matrix4.multiplyByPoint(transform, center, center);
- var rotationScale = Matrix4.getRotation(transform, scratchMatrix);
- halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);
-
- if (defined(result)) {
- result.update(center, halfAxes);
- return result;
- }
- return new TileOrientedBoundingBox(center, halfAxes);
- } else if (defined(boundingVolumeHeader.region)) {
- var region = boundingVolumeHeader.region;
- var rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
-
- if (defined(result)) {
- // Don't update regions when the transform changes
- return result;
- }
- return new TileBoundingRegion({
- rectangle : rectangleRegion,
- minimumHeight : region[4],
- maximumHeight : region[5]
- });
- } else if (defined(boundingVolumeHeader.sphere)) {
- var sphere = boundingVolumeHeader.sphere;
- center = Cartesian3.fromElements(sphere[0], sphere[1], sphere[2], scratchCenter);
- var radius = sphere[3];
-
- // Find the transformed center and radius
- center = Matrix4.multiplyByPoint(transform, center, center);
- var scale = Matrix4.getScale(transform, scratchScale);
- var uniformScale = Cartesian3.maximumComponent(scale);
- radius *= uniformScale;
-
- if (defined(result)) {
- result.update(center, radius);
- return result;
- }
- return new TileBoundingSphere(center, radius);
+ return createBox(boundingVolumeHeader.box, transform, result);
+ }
+ if (defined(boundingVolumeHeader.region)) {
+ return createRegion(boundingVolumeHeader.region, transform, result);
+ }
+ if (defined(boundingVolumeHeader.sphere)) {
+ return createSphere(boundingVolumeHeader.sphere, transform, result);
}
+ throw new RuntimeError('boundingVolume must contain a sphere, region, or box');
};
var scratchTransform = new Matrix4();
@@ -877,25 +899,28 @@ define([
parentTransform = defaultValue(parentTransform, Matrix4.IDENTITY);
var computedTransform = Matrix4.multiply(parentTransform, this.transform, scratchTransform);
var transformChanged = !Matrix4.equals(computedTransform, this.computedTransform);
- if (transformChanged) {
- Matrix4.clone(computedTransform, this.computedTransform);
-
- // Update the bounding volumes
- var header = this._header;
- var content = this._header.content;
- this._boundingVolume = this.createBoundingVolume(header.boundingVolume, computedTransform, this._boundingVolume);
- if (defined(this._contentBoundingVolume)) {
- this._contentBoundingVolume = this.createBoundingVolume(content.boundingVolume, computedTransform, this._contentBoundingVolume);
- }
- if (defined(this._viewerRequestVolume)) {
- this._viewerRequestVolume = this.createBoundingVolume(header.viewerRequestVolume, computedTransform, this._viewerRequestVolume);
- }
- // Destroy the debug bounding volumes. They will be generated fresh.
- this._debugBoundingVolume = this._debugBoundingVolume && this._debugBoundingVolume.destroy();
- this._debugContentBoundingVolume = this._debugContentBoundingVolume && this._debugContentBoundingVolume.destroy();
- this._debugViewerRequestVolume = this._debugViewerRequestVolume && this._debugViewerRequestVolume.destroy();
+ if (!transformChanged) {
+ return;
}
+
+ Matrix4.clone(computedTransform, this.computedTransform);
+
+ // Update the bounding volumes
+ var header = this._header;
+ var content = this._header.content;
+ this._boundingVolume = this.createBoundingVolume(header.boundingVolume, computedTransform, this._boundingVolume);
+ if (defined(this._contentBoundingVolume)) {
+ this._contentBoundingVolume = this.createBoundingVolume(content.boundingVolume, computedTransform, this._contentBoundingVolume);
+ }
+ if (defined(this._viewerRequestVolume)) {
+ this._viewerRequestVolume = this.createBoundingVolume(header.viewerRequestVolume, computedTransform, this._viewerRequestVolume);
+ }
+
+ // Destroy the debug bounding volumes. They will be generated fresh.
+ this._debugBoundingVolume = this._debugBoundingVolume && this._debugBoundingVolume.destroy();
+ this._debugContentBoundingVolume = this._debugContentBoundingVolume && this._debugContentBoundingVolume.destroy();
+ this._debugViewerRequestVolume = this._debugViewerRequestVolume && this._debugViewerRequestVolume.destroy();
};
function applyDebugSettings(tile, tileset, frameState) {
@@ -955,13 +980,18 @@ define([
var content = tile._content;
var expiredContent = tile._expiredContent;
- if (defined(expiredContent) && !tile.contentReady) {
- // Render the expired content while the content loads
- expiredContent.update(tileset, frameState);
- return;
+ if (defined(expiredContent)) {
+ if (!tile.contentReady) {
+ // Render the expired content while the content loads
+ expiredContent.update(tileset, frameState);
+ return;
+ } else {
+ // New content is ready, destroy expired content
+ tile._expiredContent.destroy();
+ tile._expiredContent = undefined;
+ }
}
- tile._expiredContent = tile._expiredContent && tile._expiredContent.destroy();
content.update(tileset, frameState);
}
diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js
index 3c16c0422ba4..4e0923211703 100644
--- a/Source/Scene/Cesium3DTileBatchTable.js
+++ b/Source/Scene/Cesium3DTileBatchTable.js
@@ -14,6 +14,7 @@ define([
'../Core/DeveloperError',
'../Core/Math',
'../Core/PixelFormat',
+ '../Core/RuntimeError',
'../Renderer/ContextLimits',
'../Renderer/DrawCommand',
'../Renderer/Pass',
@@ -24,6 +25,7 @@ define([
'../Renderer/Texture',
'../Renderer/TextureMagnificationFilter',
'../Renderer/TextureMinificationFilter',
+ './AttributeType',
'./BlendingState',
'./Cesium3DTileColorBlendMode',
'./CullFace',
@@ -45,6 +47,7 @@ define([
DeveloperError,
CesiumMath,
PixelFormat,
+ RuntimeError,
ContextLimits,
DrawCommand,
Pass,
@@ -55,6 +58,7 @@ define([
Texture,
TextureMagnificationFilter,
TextureMinificationFilter,
+ AttributeType,
BlendingState,
Cesium3DTileColorBlendMode,
CullFace,
@@ -164,8 +168,8 @@ define([
var parentIdsLength = instancesLength;
if (defined(classIds.byteOffset)) {
- classIds.componentType = defaultValue(classIds.componentType, 'UNSIGNED_SHORT');
- classIds.type = 'SCALAR';
+ 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);
}
@@ -173,8 +177,8 @@ define([
var parentIndexes;
if (defined(parentCounts)) {
if (defined(parentCounts.byteOffset)) {
- parentCounts.componentType = defaultValue(parentCounts.componentType, 'UNSIGNED_SHORT');
- parentCounts.type = 'SCALAR';
+ 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);
}
@@ -186,13 +190,11 @@ define([
}
}
- if (defined(parentIds)) {
- if (defined(parentIds.byteOffset)) {
- parentIds.componentType = defaultValue(parentIds.componentType, 'UNSIGNED_SHORT');
- parentIds.type = 'SCALAR';
- binaryAccessor = getBinaryAccessor(parentIds);
- parentIds = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + parentIds.byteOffset, parentIdsLength);
- }
+ if (defined(parentIds) && defined(parentIds.byteOffset)) {
+ 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);
}
var classesLength = classes.length;
@@ -276,48 +278,43 @@ define([
Cesium3DTileBatchTable.getBinaryProperties = function(featuresLength, json, binary) {
var binaryProperties;
- if (defined(json)) {
- for (var name in json) {
- if (json.hasOwnProperty(name)) {
- var property = json[name];
- var byteOffset = property.byteOffset;
- if (defined(byteOffset)) {
- // This is a binary property
- var componentType = ComponentDatatype.fromName(property.componentType);
- var type = property.type;
- //>>includeStart('debug', pragmas.debug);
- if (!defined(componentType)) {
- throw new DeveloperError('componentType is required.');
- }
- if (!defined(type)) {
- throw new DeveloperError('type is required.');
- }
- if (!defined(binary)) {
- throw new DeveloperError('Property ' + name + ' requires a batch table binary.');
- }
- //>>includeEnd('debug');
-
- var binaryAccessor = getBinaryAccessor(property);
- var componentCount = binaryAccessor.componentsPerAttribute;
- var classType = binaryAccessor.classType;
- var typedArray = binaryAccessor.createArrayBufferView(binary.buffer, binary.byteOffset + byteOffset, featuresLength);
-
- if (!defined(binaryProperties)) {
- binaryProperties = {};
- }
-
- // Store any information needed to access the binary data, including the typed array,
- // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).
- binaryProperties[name] = {
- typedArray : typedArray,
- componentCount : componentCount,
- type : classType
- };
+ for (var name in json) {
+ if (json.hasOwnProperty(name)) {
+ var property = json[name];
+ var byteOffset = property.byteOffset;
+ if (defined(byteOffset)) {
+ // This is a binary property
+ var componentType = ComponentDatatype.fromName(property.componentType);
+ var type = property.type;
+ if (!defined(componentType)) {
+ throw new RuntimeError('componentType is required.');
+ }
+ if (!defined(type)) {
+ throw new RuntimeError('type is required.');
}
+ if (!defined(binary)) {
+ 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);
+
+ if (!defined(binaryProperties)) {
+ binaryProperties = {};
+ }
+
+ // Store any information needed to access the binary data, including the typed array,
+ // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).
+ binaryProperties[name] = {
+ typedArray : typedArray,
+ componentCount : componentCount,
+ type : classType
+ };
}
}
}
- return binaryProperties;
};
function getByteLength(batchTable) {
@@ -391,7 +388,6 @@ define([
var featuresLength = this.featuresLength;
for (var i = 0; i < featuresLength; ++i) {
- // PERFORMANCE_IDEA: duplicate part of setColor here to factor things out of the loop
this.setShow(i, show);
}
};
@@ -479,7 +475,6 @@ define([
var featuresLength = this.featuresLength;
for (var i = 0; i < featuresLength; ++i) {
- // PERFORMANCE_IDEA: duplicate part of setColor here to factor things out of the loop
this.setColor(i, color);
}
};
@@ -600,32 +595,26 @@ define([
}
function traverseHierarchySingleParent(hierarchy, instanceIndex, endConditionCallback) {
- while (true) { // eslint-disable-line no-constant-condition
+ var hasParent = true;
+ while (hasParent) {
var result = endConditionCallback(hierarchy, instanceIndex);
if (defined(result)) {
// The end condition was met, stop the traversal and return the result
return result;
}
var parentId = hierarchy.parentIds[instanceIndex];
- if (parentId === instanceIndex) {
- // Stop the traversal when the instance has no parent (its parentId equals itself)
- break;
- }
+ hasParent = parentId !== instanceIndex;
instanceIndex = parentId;
}
}
- function traverseHierarchyNoParents(hierarchy, instanceIndex, endConditionCallback) {
- return endConditionCallback(hierarchy, instanceIndex);
- }
-
function traverseHierarchy(hierarchy, instanceIndex, endConditionCallback) {
// Traverse over the hierarchy and process each instance with the endConditionCallback.
// When the endConditionCallback returns a value, the traversal stops and that value is returned.
var parentCounts = hierarchy.parentCounts;
var parentIds = hierarchy.parentIds;
if (!defined(parentIds)) {
- return traverseHierarchyNoParents(hierarchy, instanceIndex, endConditionCallback);
+ return endConditionCallback(hierarchy, instanceIndex);
} else if (defined(parentCounts)) {
return traverseHierarchyMultipleParents(hierarchy, instanceIndex, endConditionCallback);
}
diff --git a/Source/Scene/Cesium3DTileContentFactory.js b/Source/Scene/Cesium3DTileContentFactory.js
index b4e9471511e2..c90d50b4917b 100644
--- a/Source/Scene/Cesium3DTileContentFactory.js
+++ b/Source/Scene/Cesium3DTileContentFactory.js
@@ -14,8 +14,7 @@ define([
'use strict';
/**
- * Maps a tile's extension (and a tile's magic field in its header) to a new
- * content object for the tile's payload.
+ * Maps a tile's magic field in its header to a new content object for the tile's payload.
*
* @private
*/
diff --git a/Source/Scene/Cesium3DTileFeature.js b/Source/Scene/Cesium3DTileFeature.js
index b6659b273f80..c63d92ba3f36 100644
--- a/Source/Scene/Cesium3DTileFeature.js
+++ b/Source/Scene/Cesium3DTileFeature.js
@@ -45,15 +45,6 @@ define([
this._content = content;
this._batchId = batchId;
this._color = undefined; // for calling getColor
-
- /**
- * All objects returned by {@link Scene#pick} have a
* The number of pending tile requests,
* This event is fired at the end of the frame after the scene is rendered.
@@ -452,13 +456,13 @@ define([
* @default new Event()
*
* @example
- * tileset.loadProgress.addEventListener(function(numberOfPendingRequests, numberProcessing) {
- * if ((numberOfPendingRequests === 0) && (numberProcessing === 0)) {
+ * tileset.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
+ * if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
* console.log('Stopped loading');
* return;
* }
*
- * console.log('Loading: requests: ' + numberOfPendingRequests + ', processing: ' + numberProcessing);
+ * console.log('Loading: requests: ' + numberOfPendingRequests + ', processing: ' + numberOfTilesProcessing);
* });
*/
this.loadProgress = new Event();
@@ -1128,12 +1132,10 @@ define([
*/
Cesium3DTileset.prototype.loadTileset = function(tilesetUrl, tilesetJson, parentTile) {
var asset = tilesetJson.asset;
- //>>includeStart('debug', pragmas.debug);
Check.typeOf.object('tilesetJson.asset', asset);
if (asset.version !== '0.0' && asset.version !== '1.0') {
- throw new DeveloperError('The tileset must be 3D Tiles version 0.0 or 1.0. See https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status');
+ throw new RuntimeError('The tileset must be 3D Tiles version 0.0 or 1.0. See https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status');
}
- //>>includeEnd('debug');
var statistics = this._statistics;
@@ -1157,7 +1159,7 @@ define([
rootTile._depth = parentTile._depth + 1;
}
- ++statistics.numberTotal;
+ ++statistics.numberOfTilesTotal;
var stack = [];
stack.push({
@@ -1176,7 +1178,7 @@ define([
var childTile = new Cesium3DTile(this, basePath, childHeader, tile3D);
tile3D.children.push(childTile);
childTile._depth = tile3D._depth + 1;
- ++statistics.numberTotal;
+ ++statistics.numberOfTilesTotal;
stack.push({
header : childHeader,
tile3D : childTile
@@ -1330,7 +1332,7 @@ define([
if (expired) {
if (tile.hasRenderableContent) {
statistics.decrementLoadCounts(tile.content);
- --tileset._statistics.numberContentReady;
+ --tileset._statistics.numberOfTilesWithContentReady;
} else if (tile.hasTilesetContent) {
destroySubtree(tileset, tile);
}
@@ -1360,7 +1362,7 @@ define([
tileset._processingQueue.push(tile);
--tileset._statistics.numberOfPendingRequests;
- ++tileset._statistics.numberProcessing;
+ ++tileset._statistics.numberOfTilesProcessing;
};
}
@@ -1370,13 +1372,13 @@ define([
if (index >= 0) {
// Remove from processing queue
tileset._processingQueue.splice(index, 1);
- --tileset._statistics.numberProcessing;
+ --tileset._statistics.numberOfTilesProcessing;
if (tile.hasRenderableContent) {
// RESEARCH_IDEA: ability to unload tiles (without content) for an
// external tileset when all the tiles are unloaded.
tileset._statistics.incrementLoadCounts(tile.content);
- ++tileset._statistics.numberContentReady;
+ ++tileset._statistics.numberOfTilesWithContentReady;
// Add to the tile cache. Previously expired tiles are already in the cache.
if (!defined(tile.replacementNode)) {
@@ -1570,7 +1572,7 @@ define([
* of an object, they will always be drawn while loading, even if backface culling is enabled.
*/
- var backfaceCommands = tileset._backfaceCommands.internalArray;
+ var backfaceCommands = tileset._backfaceCommands.values;
var addedCommandsLength = (lengthAfterUpdate - lengthBeforeUpdate);
var backfaceCommandsLength = backfaceCommands.length;
@@ -1615,7 +1617,7 @@ define([
if (tile !== root) {
unloadTileFromCache(tileset, tile);
tile.destroy();
- --statistics.numberTotal;
+ --statistics.numberOfTilesTotal;
}
}
root.children = [];
@@ -1634,7 +1636,7 @@ define([
tileUnload.raiseEvent(tile);
replacementList.remove(node);
statistics.decrementLoadCounts(tile.content);
- --statistics.numberContentReady;
+ --statistics.numberOfTilesWithContentReady;
}
function unloadTiles(tileset) {
@@ -1681,19 +1683,19 @@ define([
var statistics = tileset._statistics;
var statisticsLast = tileset._statisticsLastColor;
var numberOfPendingRequests = statistics.numberOfPendingRequests;
- var numberProcessing = statistics.numberProcessing;
+ var numberOfTilesProcessing = statistics.numberOfTilesProcessing;
var lastNumberOfPendingRequest = statisticsLast.numberOfPendingRequests;
- var lastNumberProcessing = statisticsLast.numberProcessing;
+ var lastNumberOfTilesProcessing = statisticsLast.numberOfTilesProcessing;
- var progressChanged = (numberOfPendingRequests !== lastNumberOfPendingRequest) || (numberProcessing !== lastNumberProcessing);
+ var progressChanged = (numberOfPendingRequests !== lastNumberOfPendingRequest) || (numberOfTilesProcessing !== lastNumberOfTilesProcessing);
if (progressChanged) {
frameState.afterRender.push(function() {
- tileset.loadProgress.raiseEvent(numberOfPendingRequests, numberProcessing);
+ tileset.loadProgress.raiseEvent(numberOfPendingRequests, numberOfTilesProcessing);
});
}
- tileset._tilesLoaded = (statistics.numberOfPendingRequests === 0) && (statistics.numberProcessing === 0) && (statistics.numberOfAttemptedRequests === 0);
+ tileset._tilesLoaded = (statistics.numberOfPendingRequests === 0) && (statistics.numberOfTilesProcessing === 0) && (statistics.numberOfAttemptedRequests === 0);
if (progressChanged && tileset._tilesLoaded) {
frameState.afterRender.push(function() {
@@ -1714,6 +1716,10 @@ define([
*
*/
Cesium3DTileset.prototype.update = function(frameState) {
+ if (frameState.mode === SceneMode.MORPHING) {
+ return;
+ }
+
if (!this.show || !this.ready) {
return;
}
diff --git a/Source/Scene/Cesium3DTilesetStatistics.js b/Source/Scene/Cesium3DTilesetStatistics.js
index 07383a35e976..85442f395427 100644
--- a/Source/Scene/Cesium3DTilesetStatistics.js
+++ b/Source/Scene/Cesium3DTilesetStatistics.js
@@ -16,9 +16,9 @@ define([
this.numberOfCommands = 0;
this.numberOfAttemptedRequests = 0;
this.numberOfPendingRequests = 0;
- this.numberProcessing = 0;
- this.numberContentReady = 0; // Number of tiles with content loaded, does not include empty tiles
- this.numberTotal = 0; // Number of tiles in tileset.json (and other tileset.json files as they are loaded)
+ this.numberOfTilesProcessing = 0;
+ this.numberOfTilesWithContentReady = 0; // Number of tiles with content loaded, does not include empty tiles
+ this.numberOfTilesTotal = 0; // Number of tiles in tileset.json (and other tileset.json files as they are loaded)
// Features statistics
this.numberOfFeaturesSelected = 0; // Number of features rendered
this.numberOfFeaturesLoaded = 0; // Number of features in memory
@@ -97,9 +97,9 @@ define([
result.selected = statistics.selected;
result.numberOfAttemptedRequests = statistics.numberOfAttemptedRequests;
result.numberOfPendingRequests = statistics.numberOfPendingRequests;
- result.numberProcessing = statistics.numberProcessing;
- result.numberContentReady = statistics.numberContentReady;
- result.numberTotal = statistics.numberTotal;
+ result.numberOfTilesProcessing = statistics.numberOfTilesProcessing;
+ result.numberOfTilesWithContentReady = statistics.numberOfTilesWithContentReady;
+ result.numberOfTilesTotal = statistics.numberOfTilesTotal;
result.numberOfFeaturesSelected = statistics.numberOfFeaturesSelected;
result.numberOfFeaturesLoaded = statistics.numberOfFeaturesLoaded;
result.numberOfPointsSelected = statistics.numberOfPointsSelected;
diff --git a/Source/Scene/Cesium3DTilesetTraversal.js b/Source/Scene/Cesium3DTilesetTraversal.js
index 55b8eb30a36c..31f536fefd93 100644
--- a/Source/Scene/Cesium3DTilesetTraversal.js
+++ b/Source/Scene/Cesium3DTilesetTraversal.js
@@ -231,7 +231,7 @@ define([
function selectTile(tileset, tile, frameState) {
// There may also be a tight box around just the tile's contents, e.g., for a city, we may be
- // zoomed into a neighborhood and can cull the skyscrapers in the root node.
+ // zoomed into a neighborhood and can cull the skyscrapers in the root tile.
if (tile.contentAvailable && (
(tile._visibilityPlaneMask === CullingVolume.MASK_INSIDE) ||
(tile.contentVisibility(frameState) !== Intersect.OUTSIDE)
@@ -670,7 +670,7 @@ define([
function getScreenSpaceError(tileset, geometricError, tile, frameState) {
if (geometricError === 0.0) {
- // Leaf nodes do not have any error so save the computation
+ // Leaf tiles do not have any error so save the computation
return 0.0;
}
@@ -745,9 +745,9 @@ define([
while (stack.length > 0) {
maxLength = Math.max(maxLength, stack.length);
- var node = stack.pop();
- options.visitStart(node);
- var children = options.getChildren(node);
+ var tile = stack.pop();
+ options.visitStart(tile);
+ var children = options.getChildren(tile);
var isNativeArray = !defined(children.get);
var length = children.length;
for (var i = 0; i < length; ++i) {
@@ -759,9 +759,9 @@ define([
}
if (length === 0 && defined(options.leafHandler)) {
- options.leafHandler(node);
+ options.leafHandler(tile);
}
- options.visitEnd(node);
+ options.visitEnd(tile);
}
stack.trim(maxLength);
@@ -781,9 +781,9 @@ define([
maxLength = Math.max(maxLength, length);
for (var i = 0; i < length; ++i) {
- var node = queue1.get(i);
- options.visitStart(node);
- var children = options.getChildren(node);
+ var tile = queue1.get(i);
+ options.visitStart(tile);
+ var children = options.getChildren(tile);
var isNativeArray = !defined(children.get);
var childrenLength = children.length;
for (var j = 0; j < childrenLength; ++j) {
@@ -795,9 +795,9 @@ define([
}
if (childrenLength === 0 && defined(options.leafHandler)) {
- options.leafHandler(node);
+ options.leafHandler(tile);
}
- options.visitEnd(node);
+ options.visitEnd(tile);
}
queue1.length = 0;
diff --git a/Source/Scene/Composite3DTileContent.js b/Source/Scene/Composite3DTileContent.js
index 470f29a05137..39b0cf0ab799 100644
--- a/Source/Scene/Composite3DTileContent.js
+++ b/Source/Scene/Composite3DTileContent.js
@@ -4,23 +4,34 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/destroyObject',
- '../Core/DeveloperError',
+ '../Core/FeatureDetection',
'../Core/getMagic',
+ '../Core/RuntimeError',
'../ThirdParty/when'
], function(
defaultValue,
defined,
defineProperties,
destroyObject,
- DeveloperError,
+ FeatureDetection,
getMagic,
+ RuntimeError,
when) {
'use strict';
+ // Bail out if the browser doesn't support typed arrays, to prevent the setup function
+ // from failing, since we won't be able to create a WebGL context anyway.
+ if (!FeatureDetection.supportsTypedArrays()) {
+ return {};
+ }
+
/**
* Represents the contents of a
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Composite/README.md|Composite}
* tile in a {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/README.md|3D Tiles} tileset.
+ *
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
+ * Implements the {@link Cesium3DTileContent} interface.
+ *
- * The value is copied before being returned.
- *
+ * See the {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/schema/tile.schema.json|tile schema}
+ * in the 3D Tiles spec.
+ *
+ * The common strategy for replacement-refinement traversal is to store all levels of the tree in memory and require
+ * all children to be loaded before the parent can refine. With this optimization levels of the tree can be skipped
+ * entirely and children can be rendered alongside their parents. The tileset requires significantly less memory when
+ * using this optimization.
+ *
+ * A tile's screen space error is roughly equivalent to the number of pixels that would be drawn if a sphere with a
+ * radius equal to the tile's geometric error were rendered at the tile's position. If this value exceeds
+ *
* Depending on the tileset,
@@ -1050,6 +1048,16 @@ define([
*
* @type {Matrix4}
* @default Matrix4.IDENTITY
+ *
+ * @example
+ * // Adjust a tileset's height from the globe's surface.
+ * var heightOffset = 20.0;
+ * var boundingSphere = tileset.boundingSphere;
+ * var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
+ * var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
+ * var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
+ * var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
+ * tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
*/
modelMatrix : {
get : function() {
@@ -1139,7 +1147,7 @@ define([
var statistics = this._statistics;
- // Append the version to the basePath
+ // Append the tileset version to the basePath
var hasVersionQuery = /[?&]v=/.test(tilesetUrl);
if (!hasVersionQuery) {
var versionQuery = '?v=' + defaultValue(asset.tilesetVersion, '0.0');
@@ -1312,11 +1320,7 @@ define([
///////////////////////////////////////////////////////////////////////////
function requestContent(tileset, tile, outOfCore) {
- if (!outOfCore) {
- return;
- }
-
- if (tile.hasEmptyContent) {
+ if (!outOfCore || tile.hasEmptyContent) {
return;
}
@@ -1369,26 +1373,27 @@ define([
function removeFromProcessingQueue(tileset, tile) {
return function() {
var index = tileset._processingQueue.indexOf(tile);
- if (index >= 0) {
- // Remove from processing queue
- tileset._processingQueue.splice(index, 1);
- --tileset._statistics.numberOfTilesProcessing;
-
- if (tile.hasRenderableContent) {
- // RESEARCH_IDEA: ability to unload tiles (without content) for an
- // external tileset when all the tiles are unloaded.
- tileset._statistics.incrementLoadCounts(tile.content);
- ++tileset._statistics.numberOfTilesWithContentReady;
-
- // Add to the tile cache. Previously expired tiles are already in the cache.
- if (!defined(tile.replacementNode)) {
- tile.replacementNode = tileset._replacementList.add(tile);
- }
- }
- } else {
+ if (index === -1) {
// Not in processing queue
// For example, when a url request fails and the ready promise is rejected
--tileset._statistics.numberOfPendingRequests;
+ return;
+ }
+
+ // Remove from processing queue
+ tileset._processingQueue.splice(index, 1);
+ --tileset._statistics.numberOfTilesProcessing;
+
+ if (tile.hasRenderableContent) {
+ // RESEARCH_IDEA: ability to unload tiles (without content) for an
+ // external tileset when all the tiles are unloaded.
+ tileset._statistics.incrementLoadCounts(tile.content);
+ ++tileset._statistics.numberOfTilesWithContentReady;
+
+ // Add to the tile cache. Previously expired tiles are already in the cache.
+ if (!defined(tile.replacementNode)) {
+ tile.replacementNode = tileset._replacementList.add(tile);
+ }
}
};
}
@@ -1535,8 +1540,8 @@ define([
var tile = selectedTiles[i];
// tiles may get unloaded and destroyed between selection and update
if (tile.selected) {
- // Raise visible event before update in case the visible event
- // makes changes that update needs to apply to WebGL resources
+ // Raise the tileVisible event before update in case the tileVisible event
+ // handler makes changes that update needs to apply to WebGL resources
tileVisible.raiseEvent(tile);
tile.update(tileset, frameState);
statistics.incrementSelectionCounts(tile.content);
@@ -1557,7 +1562,7 @@ define([
* 1. Render just the backfaces of unresolved tiles in order to lay down z
* 2. Render all frontfaces wherever tile._selectionDepth > stencilBuffer.
* Replace stencilBuffer with tile._selectionDepth, when passing the z test.
- * Because children are always drawn before ancestors (@see {@link Cesium3DTilesetTraversal#traverseAndSelect}),
+ * Because children are always drawn before ancestors {@link Cesium3DTilesetTraversal#traverseAndSelect},
* this effectively draws children first and does not draw ancestors if a descendant has already
* been drawn at that pixel.
* Step 1 prevents child tiles from appearing on top when they are truly behind ancestor content.
diff --git a/Source/Scene/Cesium3DTilesetTraversal.js b/Source/Scene/Cesium3DTilesetTraversal.js
index 31f536fefd93..711be0227226 100644
--- a/Source/Scene/Cesium3DTilesetTraversal.js
+++ b/Source/Scene/Cesium3DTilesetTraversal.js
@@ -23,6 +23,9 @@ define([
SceneMode) {
'use strict';
+ /**
+ * @private
+ */
var Cesium3DTilesetTraversal = {};
function selectTiles(tileset, frameState, outOfCore) {
@@ -394,20 +397,21 @@ define([
};
InternalBaseTraversal.prototype.getChildren = function(tile) {
- if (baseUpdateAndCheckChildren(this.tileset, tile, this.baseScreenSpaceError, this.frameState)) {
- var children = tile.children;
- var childrenLength = children.length;
- for (var i = 0; i < childrenLength; ++i) {
- var child = children[i];
- loadTile(child, this.frameState);
- touch(this.tileset, child, this.outOfCore);
- if (!tile.contentAvailable) {
- this.allLoaded = false;
- }
+ if (!baseUpdateAndCheckChildren(this.tileset, tile, this.baseScreenSpaceError, this.frameState)) {
+ return emptyArray;
+ }
+
+ var children = tile.children;
+ var childrenLength = children.length;
+ for (var i = 0; i < childrenLength; ++i) {
+ var child = children[i];
+ loadTile(child, this.frameState);
+ touch(this.tileset, child, this.outOfCore);
+ if (!tile.contentAvailable) {
+ this.allLoaded = false;
}
- return children;
}
- return emptyArray;
+ return children;
};
InternalBaseTraversal.prototype.updateAndCheckChildren = BaseTraversal.prototype.updateAndCheckChildren;
diff --git a/Source/Scene/ConditionsExpression.js b/Source/Scene/ConditionsExpression.js
index c5fa40afa089..b8b816a7d1f6 100644
--- a/Source/Scene/ConditionsExpression.js
+++ b/Source/Scene/ConditionsExpression.js
@@ -68,19 +68,19 @@ define([
function setRuntime(expression, expressions) {
var runtimeConditions = [];
var conditions = expression._conditions;
- if (defined(conditions)) {
- var length = conditions.length;
- for (var i = 0; i < length; ++i) {
- var statement = conditions[i];
- var cond = String(statement[0]);
- var condExpression = String(statement[1]);
- runtimeConditions.push(new Statement(
- new Expression(cond, expressions),
- new Expression(condExpression, expressions)
- ));
- }
+ if (!defined(conditions)) {
+ return;
+ }
+ var length = conditions.length;
+ for (var i = 0; i < length; ++i) {
+ var statement = conditions[i];
+ var cond = String(statement[0]);
+ var condExpression = String(statement[1]);
+ runtimeConditions.push(new Statement(
+ new Expression(cond, expressions),
+ new Expression(condExpression, expressions)
+ ));
}
-
expression._runtimeConditions = runtimeConditions;
}
@@ -91,21 +91,24 @@ define([
* is of type
- * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ * This is equivalent to {@link ConditionsExpression#evaluate} but always returns a {@link Color} object.
*
- * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ * This is equivalent to {@link Expression#evaluate} but always returns a {@link Color} object.
*
- * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ * This is equivalent to {@link StyleExpression#evaluate} but always returns a {@link Color} object.
*
* Do not construct this directly, instead access tiles through {@link Cesium3DTileset#tileVisible}.
diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js
index 6eeaede60441..69f20ac1be21 100644
--- a/Source/Scene/Cesium3DTileBatchTable.js
+++ b/Source/Scene/Cesium3DTileBatchTable.js
@@ -617,14 +617,16 @@ define([
return defined(result);
}
- function getPropertyNamesInHierarchy(batchTable, batchId, names) {
+ function getPropertyNamesInHierarchy(batchTable, batchId, results) {
var hierarchy = batchTable._batchTableHierarchy;
traverseHierarchy(hierarchy, batchId, function(hierarchy, instanceIndex) {
var classId = hierarchy.classIds[instanceIndex];
var instances = hierarchy.classes[classId].instances;
for (var name in instances) {
if (instances.hasOwnProperty(name)) {
- names[name] = true;
+ if (results.indexOf(name) === -1) {
+ results.push(name);
+ }
}
}
});
@@ -725,32 +727,26 @@ define([
return (defined(json) && defined(json[name])) || (defined(this._batchTableHierarchy) && hasPropertyInHierarchy(this, batchId, name));
};
- Cesium3DTileBatchTable.prototype.getPropertyNames = function(batchId) {
+ Cesium3DTileBatchTable.prototype.getPropertyNames = function(batchId, results) {
//>>includeStart('debug', pragmas.debug);
checkBatchId(batchId, this.featuresLength);
//>>includeEnd('debug');
- var json = this.batchTableJson;
-
- if (!defined(json)) {
- return [];
- }
-
- if (!defined(this._batchTableHierarchy)) {
- return Object.keys(json);
- }
+ results = defined(results) ? results : [];
+ results.length = 0;
- // Has a batch table hierarchy. Build a hash map of property names to avoid duplicates.
- // Different classes in the hierarchy may have identical property names.
- var names = {};
+ var json = this.batchTableJson;
for (var name in json) {
if (json.hasOwnProperty(name)) {
- names[name] = true;
+ results.push(name);
}
}
- getPropertyNamesInHierarchy(this, batchId, names);
- return Object.keys(names);
+ if (defined(this._batchTableHierarchy)) {
+ getPropertyNamesInHierarchy(this, batchId, results);
+ }
+
+ return results;
};
Cesium3DTileBatchTable.prototype.getProperty = function(batchId, name) {
diff --git a/Source/Scene/Cesium3DTileContent.js b/Source/Scene/Cesium3DTileContent.js
index 03356c72087a..f39056a7c2be 100644
--- a/Source/Scene/Cesium3DTileContent.js
+++ b/Source/Scene/Cesium3DTileContent.js
@@ -8,8 +8,11 @@ define([
'use strict';
/**
+ * The content of a tile in a {@link Cesium3DTileset}.
+ *
* Derived classes of this interface provide access to individual features in the tile.
* Access derived objects through {@link Cesium3DTile#content}.
+ *
* This type describes an interface and is not intended to be instantiated directly.
*
* Provides access to a feature's properties stored in the tile's batch table, as well
* as the ability to show/hide a feature and change its highlight color via
* {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color}, respectively.
+ *
* Modifications to a
* Evaluates an expression defined using the
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}.
+ *
- * A tile's screen space error is roughly equivalent to the number of pixels that would be drawn if a sphere with a
+ * A tile's screen space error is roughly equivalent to the number of pixels wide that would be drawn if a sphere with a
* radius equal to the tile's geometric error were rendered at the tile's position. If this value exceeds
* primitive
property.
- *
- * @type {Cesium3DTileset}
- *
- * @private
- */
- this.primitive = tileset;
}
defineProperties(Cesium3DTileFeature.prototype, {
@@ -113,6 +104,17 @@ define([
get : function() {
return this._content;
}
+ },
+
+ /**
+ * All objects returned by {@link Scene#pick} have a primitive
property.
+ *
+ * @type {Cesium3DTileset}
+ */
+ primitive : {
+ get : function() {
+ return this._content.tileset;
+ }
}
});
diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js
index 9dd78cb8cb36..38e5b7e2601e 100644
--- a/Source/Scene/Cesium3DTileStyle.js
+++ b/Source/Scene/Cesium3DTileStyle.js
@@ -50,6 +50,13 @@ define([
* description : '"Building id ${id} has height ${Height}."'
* }
* });
+ *
+ * @example
+ * tileset.style = new Cesium.Cesium3DTileStyle({
+ * color : 'vec4(${Temperature})',
+ * pointSize : '${Temperature} * 2.0'
+ * });
+
*/
function Cesium3DTileStyle(data) {
this._style = undefined;
diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js
index 26d03238ea08..d1e322eb4182 100644
--- a/Source/Scene/Cesium3DTileset.js
+++ b/Source/Scene/Cesium3DTileset.js
@@ -23,6 +23,7 @@ define([
'../Core/Matrix4',
'../Core/RequestScheduler',
'../Core/RequestType',
+ '../Core/RuntimeError',
'../Renderer/ClearCommand',
'../Renderer/Pass',
'../ThirdParty/when',
@@ -35,6 +36,7 @@ define([
'./Cesium3DTilesetTraversal',
'./Cesium3DTileStyleEngine',
'./LabelCollection',
+ './SceneMode',
'./ShadowMode',
'./TileBoundingRegion',
'./TileBoundingSphere',
@@ -63,6 +65,7 @@ define([
Matrix4,
RequestScheduler,
RequestType,
+ RuntimeError,
ClearCommand,
Pass,
when,
@@ -75,6 +78,7 @@ define([
Cesium3DTilesetTraversal,
Cesium3DTileStyleEngine,
LabelCollection,
+ SceneMode,
ShadowMode,
TileBoundingRegion,
TileBoundingSphere,
@@ -442,7 +446,7 @@ define([
* processed and is ready to render.
* numberOfPendingRequests
, and number of tiles
- * processing, numberProcessing
are passed to the event listener.
+ * processing, numberOfTilesProcessing
are passed to the event listener.
* ';
s +=
diff --git a/Specs/Cesium3DTilesTester.js b/Specs/Cesium3DTilesTester.js
index 7df050000976..1861fdb46a80 100644
--- a/Specs/Cesium3DTilesTester.js
+++ b/Specs/Cesium3DTilesTester.js
@@ -124,8 +124,8 @@ define([
var tileset = {};
var url = '';
expect(function() {
- var content = Cesium3DTileContentFactory[type](tileset, mockTile, url, arrayBuffer, type);
- content.update(tileset, scene.frameState);
+ Cesium3DTileContentFactory[type](tileset, mockTile, url, arrayBuffer, type);
+ //content.update(tileset, scene.frameState);
}).toThrowDeveloperError();
};
diff --git a/Specs/Core/ManagedArraySpec.js b/Specs/Core/ManagedArraySpec.js
index 53b364bda68f..67d138fa540a 100644
--- a/Specs/Core/ManagedArraySpec.js
+++ b/Specs/Core/ManagedArraySpec.js
@@ -13,7 +13,7 @@ defineSuite([
it('constructor initializes length', function() {
var array = new ManagedArray(10);
expect(array.length).toEqual(10);
- expect(array.internalArray.length).toEqual(10);
+ expect(array.values.length).toEqual(10);
});
it('can get and set values', function() {
@@ -25,14 +25,14 @@ defineSuite([
}
for (i = 0; i < length; ++i) {
expect(array.get(i)).toEqual(i*i);
- expect(array.internalArray[i]).toEqual(i*i);
+ expect(array.values[i]).toEqual(i*i);
}
});
it('get throws if index does not exist', function() {
var array = new ManagedArray();
array.reserve(5);
- expect(array.internalArray.length).toEqual(5);
+ expect(array.values.length).toEqual(5);
expect(function() {
array.get(5);
}).toThrowDeveloperError();
@@ -63,9 +63,9 @@ defineSuite([
var val = Math.random();
array.push(val);
expect(array.length).toEqual(i+1);
- expect(array.internalArray.length).toEqual(i+1);
+ expect(array.values.length).toEqual(i+1);
expect(array.get(i)).toEqual(val);
- expect(array.internalArray[i]).toEqual(val);
+ expect(array.values[i]).toEqual(val);
}
});
@@ -80,7 +80,7 @@ defineSuite([
var val = array.get(i);
expect(array.pop()).toEqual(val);
expect(array.length).toEqual(i);
- expect(array.internalArray.length).toEqual(length);
+ expect(array.values.length).toEqual(length);
}
});
@@ -94,13 +94,13 @@ defineSuite([
it('reserve', function() {
var array = new ManagedArray(2);
array.reserve(10);
- expect(array.internalArray.length).toEqual(10);
+ expect(array.values.length).toEqual(10);
expect(array.length).toEqual(2);
array.reserve(20);
- expect(array.internalArray.length).toEqual(20);
+ expect(array.values.length).toEqual(20);
expect(array.length).toEqual(2);
array.reserve(5);
- expect(array.internalArray.length).toEqual(20);
+ expect(array.values.length).toEqual(20);
expect(array.length).toEqual(2);
});
@@ -114,13 +114,13 @@ defineSuite([
it('resize', function() {
var array = new ManagedArray(2);
array.resize(10);
- expect(array.internalArray.length).toEqual(10);
+ expect(array.values.length).toEqual(10);
expect(array.length).toEqual(10);
array.resize(20);
- expect(array.internalArray.length).toEqual(20);
+ expect(array.values.length).toEqual(20);
expect(array.length).toEqual(20);
array.resize(5);
- expect(array.internalArray.length).toEqual(20);
+ expect(array.values.length).toEqual(20);
expect(array.length).toEqual(5);
});
@@ -128,14 +128,14 @@ defineSuite([
var array = new ManagedArray(2);
array.reserve(10);
expect(array.length).toEqual(2);
- expect(array.internalArray.length).toEqual(10);
+ expect(array.values.length).toEqual(10);
array.trim();
- expect(array.internalArray.length).toEqual(2);
+ expect(array.values.length).toEqual(2);
array.trim(5);
expect(array.length).toEqual(2);
- expect(array.internalArray.length).toEqual(5);
+ expect(array.values.length).toEqual(5);
array.trim(3);
expect(array.length).toEqual(2);
- expect(array.internalArray.length).toEqual(3);
+ expect(array.values.length).toEqual(3);
});
});
diff --git a/Specs/Scene/Cesium3DTileBatchTableSpec.js b/Specs/Scene/Cesium3DTileBatchTableSpec.js
index 56505a200213..de6b257c03df 100644
--- a/Specs/Scene/Cesium3DTileBatchTableSpec.js
+++ b/Specs/Scene/Cesium3DTileBatchTableSpec.js
@@ -388,7 +388,7 @@ defineSuite([
var batchTableBinary = new Float64Array([0, 1]);
expect(function() {
return new Cesium3DTileBatchTable(mockTileset, 2, batchTableJson, batchTableBinary);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if the binary property does not specify a type', function() {
@@ -401,7 +401,7 @@ defineSuite([
var batchTableBinary = new Float64Array([0, 1]);
expect(function() {
return new Cesium3DTileBatchTable(mockTileset, 2, batchTableJson, batchTableBinary);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if a binary property exists but there is no batchTableBinary', function() {
diff --git a/Specs/Scene/Cesium3DTileSpec.js b/Specs/Scene/Cesium3DTileSpec.js
index a594c06604a6..5e039a095ed7 100644
--- a/Specs/Scene/Cesium3DTileSpec.js
+++ b/Specs/Scene/Cesium3DTileSpec.js
@@ -140,6 +140,30 @@ defineSuite([
expect(tile.isDestroyed()).toEqual(true);
});
+ it('throws if geometricError is undefined', function() {
+ var tileWithoutGeometricError = clone(tileWithBoundingSphere);
+ delete tileWithoutGeometricError.geometricError;
+ expect(function() {
+ return new Cesium3DTile(mockTileset, '/some_url', tileWithoutGeometricError, undefined);
+ }).toThrowRuntimeError();
+ });
+
+ it('throws if boundingVolume is undefined', function() {
+ var tileWithoutBoundingVolume = clone(tileWithBoundingSphere);
+ delete tileWithoutBoundingVolume.boundingVolume;
+ expect(function() {
+ return new Cesium3DTile(mockTileset, '/some_url', tileWithoutBoundingVolume, undefined);
+ }).toThrowRuntimeError();
+ });
+
+ it('throws if boundingVolume does not contain a sphere, region, or box', function() {
+ var tileWithoutBoundingVolume = clone(tileWithBoundingSphere);
+ delete tileWithoutBoundingVolume.boundingVolume.sphere;
+ expect(function() {
+ return new Cesium3DTile(mockTileset, '/some_url', tileWithoutBoundingVolume, undefined);
+ }).toThrowRuntimeError();
+ });
+
describe('bounding volumes', function() {
it('can have a bounding sphere', function() {
var tile = new Cesium3DTile(mockTileset, '/some_url', tileWithBoundingSphere, undefined);
diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js
index b7b928f4f012..ab2b63cec6ba 100644
--- a/Specs/Scene/Cesium3DTilesetSpec.js
+++ b/Specs/Scene/Cesium3DTilesetSpec.js
@@ -415,6 +415,18 @@ defineSuite([
});
});
+ it('does not render during morph', function() {
+ return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
+ var commandList = scene.frameState.commandList;
+ scene.renderForSpecs();
+ expect(commandList.length).toBeGreaterThan(0);
+ scene.morphToColumbusView(1.0);
+ scene.renderForSpecs();
+ expect(commandList.length).toBe(0);
+ });
+
+ });
+
it('renders tileset with empty root tile', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetEmptyRootUrl).then(function(tileset) {
var statistics = tileset._statistics;
@@ -433,21 +445,21 @@ defineSuite([
expect(statistics.visited).toEqual(0);
expect(statistics.numberOfCommands).toEqual(0);
expect(statistics.numberOfPendingRequests).toEqual(0);
- expect(statistics.numberProcessing).toEqual(0);
+ expect(statistics.numberOfTilesProcessing).toEqual(0);
return Cesium3DTilesTester.waitForReady(scene, tileset).then(function() {
// Check that root and children are requested
expect(statistics.visited).toEqual(5);
expect(statistics.numberOfCommands).toEqual(0);
expect(statistics.numberOfPendingRequests).toEqual(5);
- expect(statistics.numberProcessing).toEqual(0);
+ expect(statistics.numberOfTilesProcessing).toEqual(0);
// Wait for all tiles to load and check that they are all visited and rendered
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.visited).toEqual(5);
expect(statistics.numberOfCommands).toEqual(5);
expect(statistics.numberOfPendingRequests).toEqual(0);
- expect(statistics.numberProcessing).toEqual(0);
+ expect(statistics.numberOfTilesProcessing).toEqual(0);
});
});
});
@@ -1548,7 +1560,7 @@ defineSuite([
});
it('load progress events are raised', function() {
- // [numberOfPendingRequests, numberProcessing]
+ // [numberOfPendingRequests, numberOfTilesProcessing]
var results = [
[1, 0],
[0, 1],
@@ -2068,7 +2080,7 @@ defineSuite([
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
expect(tileset.totalMemoryUsageInBytes).toEqual(44400); // Specific to this tileset
// Zoom out so only root tile is needed to meet SSE. This unloads
@@ -2077,7 +2089,7 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(1);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(1);
expect(tileset.totalMemoryUsageInBytes).toEqual(8880); // Specific to this tileset
// Zoom back in so all four children are re-requested.
@@ -2085,7 +2097,7 @@ defineSuite([
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
expect(tileset.totalMemoryUsageInBytes).toEqual(44400); // Specific to this tileset
});
});
@@ -2101,7 +2113,7 @@ defineSuite([
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. This unloads
// two of the four children so three tiles are still loaded (the
@@ -2110,14 +2122,14 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(3);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(3);
// Zoom back in so the two children are re-requested.
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
});
});
});
@@ -2129,21 +2141,21 @@ defineSuite([
scene.renderForSpecs();
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
viewSky();
// All tiles are unloaded
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(0);
- expect(statistics.numberContentReady).toEqual(0);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(0);
// Reset camera so all tiles are reloaded
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
});
});
});
@@ -2157,7 +2169,7 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
expect(replacementList.length - 1).toEqual(5); // Only tiles with content are on the replacement list. -1 for sentinel.
// Zoom out so only root tile is needed to meet SSE. This unloads
@@ -2166,7 +2178,7 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(2);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(2);
expect(replacementList.length - 1).toEqual(2);
// Reset camera so all tiles are reloaded
@@ -2174,7 +2186,7 @@ defineSuite([
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
expect(replacementList.length - 1).toEqual(5);
});
@@ -2189,21 +2201,21 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(4);
- expect(statistics.numberContentReady).toEqual(4); // 4 children with b3dm content (does not include empty root)
+ expect(statistics.numberOfTilesWithContentReady).toEqual(4); // 4 children with b3dm content (does not include empty root)
viewSky();
// Unload tiles to meet cache size
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(0);
- expect(statistics.numberContentReady).toEqual(2); // 2 children with b3dm content (does not include empty root)
+ expect(statistics.numberOfTilesWithContentReady).toEqual(2); // 2 children with b3dm content (does not include empty root)
// Reset camera so all tiles are reloaded
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(4);
- expect(statistics.numberContentReady).toEqual(4);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(4);
});
});
});
@@ -2224,7 +2236,7 @@ defineSuite([
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(4); // 4 grandchildren. Root is replaced.
- expect(statistics.numberContentReady).toEqual(5); // Root + four grandchildren (does not include empty children)
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Root + four grandchildren (does not include empty children)
// Zoom out so only root tile is needed to meet SSE. This unloads
// all grandchildren since the max number of loaded tiles is one.
@@ -2232,14 +2244,14 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(1);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(1);
// Zoom back in so the four children are re-requested.
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(statistics.numberOfCommands).toEqual(4);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
});
});
});
@@ -2254,7 +2266,7 @@ defineSuite([
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. The children
// are not unloaded since max number of loaded tiles is five.
@@ -2262,13 +2274,13 @@ defineSuite([
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
tileset.trimLoadedTiles();
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(1);
- expect(statistics.numberContentReady).toEqual(1);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(1);
});
});
@@ -2282,7 +2294,7 @@ defineSuite([
var statistics = tileset._statistics;
expect(statistics.numberOfCommands).toEqual(5);
- expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. All the
// children are unloaded since max number of loaded tiles is one.
@@ -2368,12 +2380,12 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
var statistics = tileset._statistics;
- expect(statistics.numberContentReady).toEqual(1);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(1);
expect(tileset._selectedTiles[0]._selectionDepth).toEqual(0);
expect(tileset._hasMixedContent).toBe(false);
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- expect(statistics.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
expect(tileset._hasMixedContent).toBe(false);
});
});
@@ -2386,17 +2398,17 @@ defineSuite([
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.numberContentReady -= 3;
+ statistics.numberOfTilesWithContentReady -= 3;
scene.renderForSpecs();
expect(tileset._hasMixedContent).toBe(true);
- expect(statistics.numberContentReady).toEqual(2);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(2);
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.numberContentReady).toEqual(5);
+ expect(statistics.numberOfTilesWithContentReady).toEqual(5);
expect(tileset._hasMixedContent).toBe(false);
});
});
@@ -2500,11 +2512,11 @@ defineSuite([
baseScreenSpaceError: 1000000000
}).then(function(tileset) {
var statistics = tileset._statistics;
- expect(statistics.numberContentReady).toBe(2);
+ expect(statistics.numberOfTilesWithContentReady).toBe(2);
tileset.loadSiblings = true;
scene.renderForSpecs();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- expect(statistics.numberContentReady).toBe(5);
+ expect(statistics.numberOfTilesWithContentReady).toBe(5);
});
});
});
@@ -2522,7 +2534,7 @@ defineSuite([
tileset._root.children[0].refine = Cesium3DTileRefine.REPLACE;
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
var statistics = tileset._statistics;
- expect(statistics.numberContentReady).toBe(1);
+ expect(statistics.numberOfTilesWithContentReady).toBe(1);
});
});
});
@@ -2568,7 +2580,7 @@ defineSuite([
// Check statistics
expect(statistics.numberOfCommands).toBe(1);
- expect(statistics.numberTotal).toBe(1);
+ expect(statistics.numberOfTilesTotal).toBe(1);
// Trigger expiration to happen next frame
tile.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate());
@@ -2585,7 +2597,7 @@ defineSuite([
// Expired content renders while new content loads in
expect(statistics.numberOfCommands).toBe(1);
- expect(statistics.numberTotal).toBe(1);
+ expect(statistics.numberOfTilesTotal).toBe(1);
// Request goes through, now in the LOADING state
scene.renderForSpecs();
@@ -2601,7 +2613,7 @@ defineSuite([
// statistics are still the same
expect(statistics.numberOfCommands).toBe(1);
- expect(statistics.numberTotal).toBe(1);
+ expect(statistics.numberOfTilesTotal).toBe(1);
return pollToPromise(function() {
scene.renderForSpecs();
@@ -2616,7 +2628,7 @@ defineSuite([
// statistics for new content
expect(statistics.numberOfCommands).toBe(10);
- expect(statistics.numberTotal).toBe(1);
+ expect(statistics.numberOfTilesTotal).toBe(1);
});
});
});
@@ -2655,8 +2667,8 @@ defineSuite([
// Check statistics
expect(statistics.numberOfCommands).toBe(5);
- expect(statistics.numberTotal).toBe(7);
- expect(statistics.numberContentReady).toBe(5);
+ expect(statistics.numberOfTilesTotal).toBe(7);
+ expect(statistics.numberOfTilesWithContentReady).toBe(5);
// Trigger expiration to happen next frame
subtreeRoot.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate());
@@ -2684,8 +2696,8 @@ defineSuite([
}).then(function() {
scene.renderForSpecs();
expect(statistics.numberOfCommands).toBe(4);
- expect(statistics.numberTotal).toBe(6);
- expect(statistics.numberContentReady).toBe(4);
+ expect(statistics.numberOfTilesTotal).toBe(6);
+ expect(statistics.numberOfTilesWithContentReady).toBe(4);
});
});
});
@@ -2711,7 +2723,7 @@ defineSuite([
scene.renderForSpecs();
expect(tile._contentState).toBe(Cesium3DTileContentState.FAILED);
expect(statistics.numberOfCommands).toBe(0);
- expect(statistics.numberTotal).toBe(1);
+ expect(statistics.numberOfTilesTotal).toBe(1);
});
});
diff --git a/Specs/Scene/ExpressionSpec.js b/Specs/Scene/ExpressionSpec.js
index 53898631800e..e20b815d5f12 100644
--- a/Specs/Scene/ExpressionSpec.js
+++ b/Specs/Scene/ExpressionSpec.js
@@ -123,7 +123,7 @@ defineSuite([
expect(function() {
return new Expression('${height');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates with additional expressions', function() {
@@ -150,75 +150,75 @@ defineSuite([
expect(function() {
return new Expression('');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('this');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2; 3;');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws on unknown characters', function() {
expect(function() {
return new Expression('#');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws on unmatched parenthesis', function() {
expect(function() {
return new Expression('((true)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('(true))');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws on unknown identifiers', function() {
expect(function() {
return new Expression('flse');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws on unknown function calls', function() {
expect(function() {
return new Expression('unknown()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws on unknown member function calls', function() {
expect(function() {
return new Expression('regExp().unknown()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws with unsupported operators', function() {
expect(function() {
return new Expression('~1');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2 | 3');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2 & 3');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2 << 3');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2 >> 3');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('2 >>> 3');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates literal null', function() {
@@ -489,19 +489,19 @@ defineSuite([
it('color constructors throw with wrong number of arguments', function() {
expect(function() {
return new Expression('rgb(255, 255)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('hsl(1, 1)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('rgba(255, 255, 255)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('hsla(1, 1, 1)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates color properties (r, g, b, a)', function() {
@@ -595,24 +595,24 @@ defineSuite([
var expression = new Expression('vec2()');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec2(3.0, 4.0, 5.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec2(vec2(3.0, 4.0), 5.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if vec2 has invalid argument', function() {
var expression = new Expression('vec2("1")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates vec3', function() {
@@ -639,34 +639,34 @@ defineSuite([
var expression = new Expression('vec3()');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec3(3.0, 4.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec3(3.0, 4.0, 5.0, 6.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec3(vec2(3.0, 4.0), vec2(5.0, 6.0))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec3(vec4(3.0, 4.0, 5.0, 6.0), 1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if vec3 has invalid argument', function() {
var expression = new Expression('vec3(1.0, "1.0", 2.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates vec4', function() {
@@ -699,34 +699,34 @@ defineSuite([
var expression = new Expression('vec4()');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec4(3.0, 4.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec4(3.0, 4.0, 5.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec4(3.0, 4.0, 5.0, 6.0, 7.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec4(vec3(3.0, 4.0, 5.0))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if vec4 has invalid argument', function() {
var expression = new Expression('vec4(1.0, "2.0", 3.0, 4.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates vector with expressions as arguments', function() {
@@ -827,7 +827,7 @@ defineSuite([
var expression = new Expression('!"true"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates unary negative', function() {
@@ -842,7 +842,7 @@ defineSuite([
var expression = new Expression('-"56"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates unary positive', function() {
@@ -854,7 +854,7 @@ defineSuite([
var expression = new Expression('+"56"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary addition', function() {
@@ -901,12 +901,12 @@ defineSuite([
var expression = new Expression('vec2(1.0) + vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 + vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary subtraction', function() {
@@ -921,17 +921,17 @@ defineSuite([
var expression = new Expression('vec2(1.0) - vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 - vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('"name1" - "name2"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary multiplication', function() {
@@ -946,12 +946,12 @@ defineSuite([
var expression = new Expression('vec2(1.0) * vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec2(1.0) * "name"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary division', function() {
@@ -969,17 +969,17 @@ defineSuite([
var expression = new Expression('vec2(1.0) / vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec2(1.0) / "2.0"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 / vec4(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary modulus', function() {
@@ -994,17 +994,17 @@ defineSuite([
var expression = new Expression('vec2(1.0) % vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('vec2(1.0) % "2.0"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 % vec4(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary equals strict', function() {
@@ -1050,22 +1050,22 @@ defineSuite([
var expression = new Expression('vec2(1.0) < vec2(2.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 < vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('true < false');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('color(\'blue\') < 10');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary less than or equals', function() {
@@ -1083,27 +1083,27 @@ defineSuite([
var expression = new Expression('vec2(1.0) <= vec2(2.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 <= vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 <= "5"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('true <= false');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('color(\'blue\') <= 10');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary greater than', function() {
@@ -1121,27 +1121,27 @@ defineSuite([
var expression = new Expression('vec2(1.0) > vec2(2.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 > vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 > "5"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('true > false');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('color(\'blue\') > 10');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates binary greater than or equals', function() {
@@ -1159,27 +1159,27 @@ defineSuite([
var expression = new Expression('vec2(1.0) >= vec2(2.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 >= vec3(1.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1.0 >= "5"');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('true >= false');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('color(\'blue\') >= 10');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates logical and', function() {
@@ -1195,19 +1195,19 @@ defineSuite([
expression = new Expression('2 && color(\'red\')');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws with invalid and operands', function() {
var expression = new Expression('2 && true');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('true && color(\'red\')');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates logical or', function() {
@@ -1225,12 +1225,12 @@ defineSuite([
var expression = new Expression('2 || false');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('false || color(\'red\')');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates color operations', function() {
@@ -1469,11 +1469,11 @@ defineSuite([
it('throws if isExactClass takes an invalid number of arguments', function() {
expect(function() {
return new Expression('isExactClass()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('isExactClass("door", "roof")');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates isClass function', function() {
@@ -1489,11 +1489,11 @@ defineSuite([
it('throws if isClass takes an invalid number of arguments', function() {
expect(function() {
return new Expression('isClass()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('isClass("door", "building")');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates getExactClassName function', function() {
@@ -1506,7 +1506,7 @@ defineSuite([
it('throws if getExactClassName takes an invalid number of arguments', function() {
expect(function() {
return new Expression('getExactClassName("door")');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if built-in unary function is given an invalid argument', function() {
@@ -1514,7 +1514,7 @@ defineSuite([
var expression = new Expression('abs("-1")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates abs function', function() {
@@ -1537,11 +1537,11 @@ defineSuite([
it('throws if abs function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('abs()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('abs(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates cos function', function() {
@@ -1561,11 +1561,11 @@ defineSuite([
it('throws if cos function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('cos()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('cos(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates sin function', function() {
@@ -1585,11 +1585,11 @@ defineSuite([
it('throws if sin function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('sin()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('sin(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates tan function', function() {
@@ -1609,11 +1609,11 @@ defineSuite([
it('throws if tan function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('tan()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('tan(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates acos function', function() {
@@ -1633,11 +1633,11 @@ defineSuite([
it('throws if acos function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('acos()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('acos(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates asin function', function() {
@@ -1657,11 +1657,11 @@ defineSuite([
it('throws if asin function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('asin()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('asin(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates atan function', function() {
@@ -1681,11 +1681,11 @@ defineSuite([
it('throws if atan function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('atan()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('atan(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates radians function', function() {
@@ -1705,11 +1705,11 @@ defineSuite([
it('throws if radians function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('radians()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('radians(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates degrees function', function() {
@@ -1729,7 +1729,7 @@ defineSuite([
it('throws if degrees function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('degrees()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('degrees(1, 2)');
@@ -1759,11 +1759,11 @@ defineSuite([
it('throws if sqrt function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('sqrt()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('sqrt(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates sign function', function() {
@@ -1789,11 +1789,11 @@ defineSuite([
it('throws if sign function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('sign()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('sign(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates floor function', function() {
@@ -1819,11 +1819,11 @@ defineSuite([
it('throws if floor function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('floor()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('floor(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates ceil function', function() {
@@ -1849,11 +1849,11 @@ defineSuite([
it('throws if ceil function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('ceil()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('ceil(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates round function', function() {
@@ -1879,11 +1879,11 @@ defineSuite([
it('throws if round function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('round()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('round(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates exp function', function() {
@@ -1906,11 +1906,11 @@ defineSuite([
it('throws if exp function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('exp()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('exp(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates exp2 function', function() {
@@ -1936,11 +1936,11 @@ defineSuite([
it('throws if exp2 function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('exp2()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('exp2(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates log function', function() {
@@ -1963,11 +1963,11 @@ defineSuite([
it('throws if log function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('log()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('log(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates log2 function', function() {
@@ -1993,11 +1993,11 @@ defineSuite([
it('throws if log2 function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('log2()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('log2(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates fract function', function() {
@@ -2023,11 +2023,11 @@ defineSuite([
it('throws if fract function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('fract()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('fract(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates length function', function() {
@@ -2047,11 +2047,11 @@ defineSuite([
it('throws if length function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('length()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('length(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates normalize function', function() {
@@ -2073,11 +2073,11 @@ defineSuite([
it('throws if normalize function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('fract()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('fract(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates clamp function', function() {
@@ -2106,36 +2106,36 @@ defineSuite([
it('throws if clamp function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('clamp()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('clamp(1)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('clamp(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('clamp(1, 2, 3, 4)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if clamp function takes mismatching types', function() {
var expression = new Expression('clamp(0.0,vec2(0,1),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('clamp(vec2(0,1),vec3(0,1,2),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('clamp(vec2(0,1),vec2(0,1), vec3(1,2,3))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates mix function', function() {
@@ -2159,35 +2159,35 @@ defineSuite([
var expression = new Expression('mix(0.0,vec2(0,1),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('mix(vec2(0,1),vec3(0,1,2),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('mix(vec2(0,1),vec2(0,1), vec3(1,2,3))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if mix function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('mix()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('mix(1)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('mix(1, 2)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('mix(1, 2, 3, 4)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates atan2 function', function() {
@@ -2213,28 +2213,28 @@ defineSuite([
it('throws if atan2 function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('atan2(0.0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('atan2(1, 2, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if atan2 function takes mismatching types', function() {
var expression = new Expression('atan2(0.0,vec2(0,1))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('atan2(vec2(0,1),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('atan2(vec2(0,1),vec3(0,1,2))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates pow function', function() {
@@ -2257,28 +2257,28 @@ defineSuite([
it('throws if pow function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('pow(0.0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('pow(1, 2, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if pow function takes mismatching types', function() {
var expression = new Expression('pow(0.0, vec2(0,1))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('pow(vec2(0,1),0.0)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('pow(vec2(0,1),vec3(0,1,2))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates min function', function() {
@@ -2304,23 +2304,23 @@ defineSuite([
it('throws if min function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('min(0.0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('min(1, 2, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if min function takes mismatching types', function() {
var expression = new Expression('min(0.0, vec2(0,1))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('min(vec2(0,1),vec3(0,1,2))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates max function', function() {
@@ -2346,23 +2346,23 @@ defineSuite([
it('throws if max function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('max(0.0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('max(1, 2, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if max function takes mismatching types', function() {
var expression = new Expression('max(0.0, vec2(0,1))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('max(vec2(0,1),vec3(0,1,2))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates the distance function', function() {
@@ -2382,21 +2382,21 @@ defineSuite([
it('throws if distance function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('distance(0.0)');
- }) .toThrowDeveloperError();
+ }) .toThrowRuntimeError();
expect(function() {
return new Expression('distance(1, 3, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if distance function takes mismatching types of arguments', function() {
expect(function() {
return new Expression('distance(1, vec2(3.0, 2.0)').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('distance(vec4(5.0, 2.0, 3.0, 1.0), vec3(4.0, 4.0, 4.0))').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates the dot function', function() {
@@ -2416,21 +2416,21 @@ defineSuite([
it('throws if dot function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('dot(0.0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('dot(1, 3, 0)');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if dot function takes mismatching types of arguments', function() {
expect(function() {
return new Expression('dot(1, vec2(3.0, 2.0)').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('dot(vec4(5.0, 2.0, 3.0, 1.0), vec3(4.0, 4.0, 4.0))').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates the cross function', function() {
@@ -2447,21 +2447,21 @@ defineSuite([
it('throws if cross function takes an invalid number of arguments', function() {
expect(function() {
return new Expression('cross(vec3(0.0, 0.0, 0.0))');
- }) .toThrowDeveloperError();
+ }) .toThrowRuntimeError();
expect(function() {
return new Expression('cross(vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0), vec3(2.0, 2.0, 2.0))');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if cross function does not take vec3 arguments', function() {
expect(function() {
return new Expression('cross(vec2(1.0, 2.0), vec2(3.0, 2.0)').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('cross(vec4(5.0, 2.0, 3.0, 1.0), vec3(4.0, 4.0, 4.0))').evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates ternary conditional', function() {
@@ -2599,11 +2599,11 @@ defineSuite([
it('member expressions throw without variable notation', function() {
expect(function() {
return new Expression('color.r');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('color["r"]');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('member expression throws with variable property', function() {
@@ -2613,7 +2613,7 @@ defineSuite([
expect(function() {
return new Expression('${vector[${vectorName}]}');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates feature property', function() {
@@ -2674,22 +2674,22 @@ defineSuite([
var expression = new Expression('regExp("(?<=\\s)" + ".")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('regExp("(?<=\\s)")');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if regex constructor has invalid flags', function() {
var expression = new Expression('regExp("a" + "b", "q")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('regExp("a", "q")');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates regex test function', function() {
@@ -2716,12 +2716,12 @@ defineSuite([
var expression = new Expression('regExp("1").test(1)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('regExp("a").test(regExp("b"))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates regex exec function', function() {
@@ -2752,12 +2752,12 @@ defineSuite([
var expression = new Expression('regExp("1").exec(1)');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('regExp("a").exec(regExp("b"))');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates regex match operator', function() {
@@ -2790,17 +2790,17 @@ defineSuite([
var expression = new Expression('regExp("a") =~ 1');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 =~ regExp("a")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 =~ 1');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates regex not match operator', function() {
@@ -2830,27 +2830,27 @@ defineSuite([
var expression = new Expression('regExp("a") !~ 1');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 !~ regExp("a")');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('1 !~ 1');
expect(function() {
expression.evaluate(frameState, undefined);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws if test is not called with a RegExp', function() {
expect(function() {
return new Expression('color("blue").test()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expect(function() {
return new Expression('"blue".test()');
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates regExp toString function', function() {
@@ -2874,7 +2874,7 @@ defineSuite([
var expression = new Expression('${property}.toString()');
expect(function() {
return expression.evaluate(frameState, feature);
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('evaluates array expression', function() {
@@ -3109,17 +3109,17 @@ defineSuite([
var expression = new Expression('[]');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('[1.0]');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('[1.0, 2.0, 3.0, 4.0, 5.0]');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('gets shader expression for boolean', function() {
@@ -3499,112 +3499,112 @@ defineSuite([
var expression = new Expression('regExp("a").test("abc")');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('regExp("a(.)", "i").exec("Abc")');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('regExp("a") =~ "abc"');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
expression = new Expression('regExp("a") !~ "abc"');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for member expression with dot', function() {
var expression = new Expression('${property.name}');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for string member expression with brackets', function() {
var expression = new Expression('${property["name"]}');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for String', function() {
var expression = new Expression('String(1.0)');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for toString', function() {
var expression = new Expression('color("red").toString()');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for literal string', function() {
var expression = new Expression('"name"');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for variable in string', function() {
var expression = new Expression('"${property}"');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for literal undefined', function() {
var expression = new Expression('undefined');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for literal null', function() {
var expression = new Expression('null');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for isNaN', function() {
var expression = new Expression('isNaN(1.0)');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for isFinite', function() {
var expression = new Expression('isFinite(1.0)');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for isExactClass', function() {
var expression = new Expression('isExactClass("door")');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for isClass', function() {
var expression = new Expression('isClass("door")');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
it('throws when getting shader expression for getExactClassName', function() {
var expression = new Expression('getExactClassName()');
expect(function() {
return expression.getShaderExpression('', {});
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
});
diff --git a/Specs/Scene/ModelInstanceCollectionSpec.js b/Specs/Scene/ModelInstanceCollectionSpec.js
index 5d0fa3640069..72b7b5e23caf 100644
--- a/Specs/Scene/ModelInstanceCollectionSpec.js
+++ b/Specs/Scene/ModelInstanceCollectionSpec.js
@@ -669,6 +669,21 @@ defineSuite([
});
});
+ it('does not render during morph', function() {
+ return loadCollection({
+ gltf : boxGltf,
+ instances : createInstances(4),
+ cull : false
+ }).then(function() {
+ var commandList = scene.frameState.commandList;
+ scene.renderForSpecs();
+ expect(commandList.length).toBeGreaterThan(0);
+ scene.morphToColumbusView(1.0);
+ scene.renderForSpecs();
+ expect(commandList.length).toBe(0);
+ });
+ });
+
it('destroys', function() {
return loadCollection({
gltf : boxGltf,
diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js
index d5f9dd16bcb9..09c8c2a3ef6d 100644
--- a/Specs/Scene/ModelSpec.js
+++ b/Specs/Scene/ModelSpec.js
@@ -350,6 +350,23 @@ defineSuite([
});
});
+ it('does not render during morph', function() {
+ var commandList = scene.frameState.commandList;
+ var model = texturedBoxModel;
+ model.show = true;
+ model.cull = false;
+ expect(model.ready).toBe(true);
+
+ scene.renderForSpecs();
+ expect(commandList.length).toBeGreaterThan(0);
+
+ scene.morphTo2D(1.0);
+ scene.renderForSpecs();
+ expect(commandList.length).toBe(0);
+ scene.completeMorph();
+ model.show = false;
+ });
+
it('Renders x-up model', function() {
return loadJson(boxEcefUrl).then(function(gltf) {
// Model data is z-up. Edit the transform to be z-up to x-up.
diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js
index 027b178e36bc..e4bf3023811a 100644
--- a/Specs/Scene/PointCloud3DTileContentSpec.js
+++ b/Specs/Scene/PointCloud3DTileContentSpec.js
@@ -588,7 +588,7 @@ defineSuite([
content.applyStyle(scene.frameState, new Cesium3DTileStyle({
color : '${NORMAL}[0] > 0.5'
}));
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
});
@@ -599,7 +599,7 @@ defineSuite([
content.applyStyle(scene.frameState, new Cesium3DTileStyle({
color : 'color() * ${non_existent_property}'
}));
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
});
@@ -624,7 +624,7 @@ defineSuite([
content.applyStyle(scene.frameState, new Cesium3DTileStyle({
show : '1 < "2"'
}));
- }).toThrowDeveloperError();
+ }).toThrowRuntimeError();
});
});
From a011d36d09bd7826e53d50dc7e90dd0fc647a781 Mon Sep 17 00:00:00 2001
From: Sean Lilley
primitive
property.
+ * Gets the tileset containing the feature.
+ *
+ * @memberof Cesium3DTileFeature.prototype
*
* @type {Cesium3DTileset}
+ *
+ * @readonly
+ */
+ tileset : {
+ get : function() {
+ return this._content.tileset;
+ }
+ },
+
+ /**
+ * All objects returned by {@link Scene#pick} have a primitive
property. This returns
+ * the tileset containing the feature.
+ *
+ * @memberof Cesium3DTileFeature.prototype
+ *
+ * @type {Cesium3DTileset}
+ *
+ * @readonly
*/
primitive : {
get : function() {
@@ -144,11 +164,8 @@ define([
};
/**
- * Returns the value of the feature's property with the given name. This includes properties from this feature's
+ * Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's
* class and inherited classes when using a batch table hierarchy.
- * maximumScreenSpaceError
the tile refines to its descendants.
+ * maximumScreenSpaceError
may need to be tweaked to achieve the right balance.
* Higher values provide better performance but lower visual quality.
* Boolean
, Number
, or String
, the corresponding JavaScript
* primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
* object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
- * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned. If the result
argument is
+ * a {@link Color}, the {@link Cartesian4} value is converted to a {@link Color} and then returned.
*
* @param {FrameState} frameState The frame state.
* @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
+ * @param {Object} [result] The object onto which to store the result.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color} The result of evaluating the expression.
*/
- ConditionsExpression.prototype.evaluate = function(frameState, feature) {
+ ConditionsExpression.prototype.evaluate = function(frameState, feature, result) {
var conditions = this._runtimeConditions;
- if (defined(conditions)) {
- var length = conditions.length;
- for (var i = 0; i < length; ++i) {
- var statement = conditions[i];
- if (statement.condition.evaluate(frameState, feature)) {
- return statement.expression.evaluate(frameState, feature);
- }
+ if (!defined(conditions)) {
+ return undefined;
+ }
+ var length = conditions.length;
+ for (var i = 0; i < length; ++i) {
+ var statement = conditions[i];
+ if (statement.condition.evaluate(frameState, feature)) {
+ return statement.expression.evaluate(frameState, feature, result);
}
}
};
@@ -113,7 +116,7 @@ define([
/**
* Evaluates the result of a Color expression, using the values defined by a feature.
* Boolean
, Number
, or String
, the corresponding JavaScript
* primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
* object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
- * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned. If the result
argument is
+ * a {@link Color}, the {@link Cartesian4} value is converted to a {@link Color} and then returned.
*
* @param {FrameState} frameState The frame state.
* @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
+ * @param {Object} [result] The object onto which to store the result.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color} The result of evaluating the expression.
*/
- Expression.prototype.evaluate = function(frameState, feature) {
+ Expression.prototype.evaluate = function(frameState, feature, result) {
scratchStorage.reset();
- var result = this._runtimeAst.evaluate(frameState, feature);
- if ((result instanceof Cartesian2) || (result instanceof Cartesian3) || (result instanceof Cartesian4)) {
- return result.clone();
+ var value = this._runtimeAst.evaluate(frameState, feature);
+ if ((result instanceof Color) && (value instanceof Cartesian4)) {
+ return Color.fromCartesian4(value, result);
}
- return result;
+ if ((value instanceof Cartesian2) || (value instanceof Cartesian3) || (value instanceof Cartesian4)) {
+ return value.clone(result);
+ }
+ return value;
};
/**
- * Evaluates the result of a Color expression, using the values defined by a feature.
+ * Evaluates the result of a Color expression, optionally using the provided feature's properties.
* Boolean
, Number
, or String
, the corresponding JavaScript
* primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
* object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
- * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned. If the result
argument is
+ * a {@link Color}, the {@link Cartesian4} value is converted to a {@link Color} and then returned.
*
* @param {FrameState} frameState The frame state.
* @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
+ * @param {Object} [result] The object onto which to store the result.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color} The result of evaluating the expression.
*/
- StyleExpression.prototype.evaluate = function(frameState, feature) {
+ StyleExpression.prototype.evaluate = function(frameState, feature, result) {
DeveloperError.throwInstantiationError();
};
/**
* Evaluates the result of a Color expression, optionally using the provided feature's properties.
* Cesium3DTileFeature
object have the lifetime of the tile's
* content. If the tile's content is unloaded, e.g., due to it going out of view and needing
@@ -157,10 +160,11 @@ define([
*
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/BatchTable#batch-table-hierarchy}
*
+ * @param {String[]} results An array into which to store the results.
* @returns {String[]} The names of the feature's properties.
*/
- Cesium3DTileFeature.prototype.getPropertyNames = function() {
- return this._content.batchTable.getPropertyNames(this._batchId);
+ Cesium3DTileFeature.prototype.getPropertyNames = function(results) {
+ return this._content.batchTable.getPropertyNames(this._batchId, results);
};
/**
diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js
index b745c1451b9e..e9e0ee3ca12d 100644
--- a/Source/Scene/Cesium3DTileStyle.js
+++ b/Source/Scene/Cesium3DTileStyle.js
@@ -28,8 +28,11 @@ define([
var DEFAULT_JSON_NUMBER_EXPRESSION = 1.0;
/**
+ * A style that is applied to a {@link Cesium3DTileset}.
+ * maximumScreenSpaceError
the tile refines to its descendants.
*
* Evaluates a conditions expression defined using the * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}. + *
** Implements the {@link StyleExpression} interface. *
diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js index 281845e24ba5..f4a07b4a5414 100644 --- a/Source/Scene/Expression.js +++ b/Source/Scene/Expression.js @@ -28,8 +28,11 @@ define([ 'use strict'; /** + * An expression for a style applied to a {@link Cesium3DTileset}. + ** Evaluates an expression defined using the * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}. + *
** Implements the {@link StyleExpression} interface. *
diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 0a8553816138..4e9675c9e966 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -1,5 +1,6 @@ /*global define*/ define([ + '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Cartesian4', '../Core/Color', @@ -33,6 +34,7 @@ define([ './SceneMode', './ShadowMode' ], function( + Cartesian2, Cartesian3, Cartesian4, Color, @@ -438,6 +440,8 @@ define([ content._hasBatchIds = defined(batchIds); } + var scratchPointSizeAndTilesetTime = new Cartesian2(); + var positionLocation = 0; var colorLocation = 1; var normalLocation = 2; @@ -508,17 +512,16 @@ define([ } var uniformMap = { - u_pointSize : function() { - return content._pointSize; + u_pointSizeAndTilesetTime : function() { + scratchPointSizeAndTilesetTime.x = content._pointSize; + scratchPointSizeAndTilesetTime.y = content._tileset.timeSinceLoad; + return scratchPointSizeAndTilesetTime; }, u_highlightColor : function() { return content._highlightColor; }, u_constantColor : function() { return content._constantColor; - }, - u_tilesetTime : function() { - return content._tileset.timeSinceLoad; } }; @@ -896,10 +899,11 @@ define([ var vs = 'attribute vec3 a_position; \n' + 'varying vec4 v_color; \n' + - 'uniform float u_pointSize; \n' + + 'uniform vec2 u_pointSizeAndTilesetTime; \n' + 'uniform vec4 u_constantColor; \n' + 'uniform vec4 u_highlightColor; \n' + - 'uniform float u_tilesetTime; \n'; + 'float u_pointSize; \n' + + 'float u_tilesetTime; \n'; vs += attributeDeclarations; @@ -947,7 +951,9 @@ define([ } vs += 'void main() \n' + - '{ \n'; + '{ \n' + + ' u_pointSize = u_pointSizeAndTilesetTime.x; \n' + + ' u_tilesetTime = u_pointSizeAndTilesetTime.y; \n'; if (usesColors) { if (isTranslucent) { @@ -1075,7 +1081,7 @@ define([ // Check if the shader compiles correctly. If not there is likely a syntax error with the style. drawCommand.shaderProgram._bind(); } catch (error) { - // Turn the RuntimeError into a DeveloperError and rephrase it. + // Rephrase the error. throw new RuntimeError('Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.'); } } diff --git a/Source/Scene/StyleExpression.js b/Source/Scene/StyleExpression.js index d4e065fa18f2..81fd8315fe7b 100644 --- a/Source/Scene/StyleExpression.js +++ b/Source/Scene/StyleExpression.js @@ -6,6 +6,7 @@ define([ 'use strict'; /** + * An expression for a style applied to a {@link Cesium3DTileset}. *
* Derived classes of this interface evaluate expressions in the
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}.
diff --git a/Source/Scene/TileOrientedBoundingBox.js b/Source/Scene/TileOrientedBoundingBox.js
index 06943b54898a..a074396ab48a 100644
--- a/Source/Scene/TileOrientedBoundingBox.js
+++ b/Source/Scene/TileOrientedBoundingBox.js
@@ -86,17 +86,6 @@ define([
return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(frameState.camera.positionWC));
};
- /**
- * Calculates the distance between the tile's center and the camera.
- *
- * @param {FrameState} frameState The frame state.
- * @return {Number} The distance between the tile's center and the camera, in meters.
- */
- TileOrientedBoundingBox.prototype.distanceFromCenterToCamera = function(frameState) {
- DeveloperError.throwInstantiationError();
- };
-
-
/**
* Determines which side of a plane this box is located.
*
diff --git a/Specs/Scene/Cesium3DTileBatchTableSpec.js b/Specs/Scene/Cesium3DTileBatchTableSpec.js
index 6e4a64ece8c3..2db529bb5692 100644
--- a/Specs/Scene/Cesium3DTileBatchTableSpec.js
+++ b/Specs/Scene/Cesium3DTileBatchTableSpec.js
@@ -296,6 +296,18 @@ defineSuite([
expect(batchTable.getPropertyNames(0)).toEqual(['height', 'id']);
});
+ it('getPropertyNames works with results argument', function() {
+ var batchTableJson = {
+ height: [0.0],
+ id : [0]
+ };
+ var batchTable = new Cesium3DTileBatchTable(mockTileset, 1, batchTableJson);
+ var results = [];
+ var names = batchTable.getPropertyNames(0, results);
+ expect(names).toBe(results);
+ expect(names).toEqual(['height', 'id']);
+ });
+
it('getProperty throws with invalid batchId', function() {
var batchTable = new Cesium3DTileBatchTable(mockTileset, 1);
expect(function() {
diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js
index 6f6d5fde30ca..c77fb338b472 100644
--- a/Specs/Scene/Cesium3DTilesetSpec.js
+++ b/Specs/Scene/Cesium3DTilesetSpec.js
@@ -128,6 +128,7 @@ defineSuite([
beforeAll(function() {
scene = createScene();
+ scene.
});
afterAll(function() {
diff --git a/Specs/Scene/ConditionsExpressionSpec.js b/Specs/Scene/ConditionsExpressionSpec.js
index 233b37267b3e..e1d7650e5464 100644
--- a/Specs/Scene/ConditionsExpressionSpec.js
+++ b/Specs/Scene/ConditionsExpressionSpec.js
@@ -1,9 +1,11 @@
/*global defineSuite*/
defineSuite([
'Scene/ConditionsExpression',
+ 'Core/Cartesian4',
'Core/Color'
], function(
ConditionsExpression,
+ Cartesian4,
Color) {
'use strict';
@@ -57,6 +59,22 @@ defineSuite([
expect(expression.evaluateColor(frameState, new MockFeature(3))).toEqual(Color.LIME);
});
+ it('evaluate takes result argument', function() {
+ var result = new Cartesian4();
+ var expression = new ConditionsExpression(jsonExpWithAdditionalExpressions, additionalExpressions, result);
+ var value = expression.evaluate(frameState, new MockFeature(101), result);
+ expect(value).toEqual(new Cartesian4(0.0, 0.0, 1.0, 1.0));
+ expect(value).toBe(result);
+ });
+
+ it('evaluate takes a color result argument', function() {
+ var result = new Color();
+ var expression = new ConditionsExpression(jsonExpWithAdditionalExpressions, additionalExpressions, result);
+ var value = expression.evaluate(frameState, new MockFeature(101), result);
+ expect(value).toEqual(Color.BLUE);
+ expect(value).toBe(result);
+ });
+
it('constructs and evaluates empty conditional', function() {
var expression = new ConditionsExpression({
"conditions" : []
diff --git a/Specs/Scene/Empty3DTileContentSpec.js b/Specs/Scene/Empty3DTileContentSpec.js
index 8ae355ca4305..86dbf32b9438 100644
--- a/Specs/Scene/Empty3DTileContentSpec.js
+++ b/Specs/Scene/Empty3DTileContentSpec.js
@@ -22,11 +22,11 @@ defineSuite([
expect(content.geometryByteLength).toBe(0);
expect(content.texturesByteLength).toBe(0);
expect(content.batchTableByteLength).toBe(0);
- expect(content.innerContents).toBe(undefined);
- expect(content.readyPromise).toBe(undefined);
+ expect(content.innerContents).toBeUndefined();
+ expect(content.readyPromise).toBeUndefined();
expect(content.tileset).toBe(mockTileset);
expect(content.tile).toBe(mockTile);
expect(content.url).toBeUndefined();
- expect(content.batchTable).toBe(undefined);
+ expect(content.batchTable).toBeUndefined();
});
});
diff --git a/Specs/Scene/ExpressionSpec.js b/Specs/Scene/ExpressionSpec.js
index 392e96235b16..540befded12f 100644
--- a/Specs/Scene/ExpressionSpec.js
+++ b/Specs/Scene/ExpressionSpec.js
@@ -137,6 +137,22 @@ defineSuite([
expect(expression.evaluate(frameState, feature)).toEqual(5);
});
+ it('evaluate takes result argument', function() {
+ var expression = new Expression('vec3(1.0)');
+ var result = new Cartesian3();
+ var value = expression.evaluate(frameState, undefined, result);
+ expect(value).toEqual(new Cartesian3(1.0, 1.0, 1.0));
+ expect(value).toBe(result);
+ });
+
+ it('evaluate takes a color result argument', function() {
+ var expression = new Expression('color("red")');
+ var result = new Color();
+ var value = expression.evaluate(frameState, undefined, result);
+ expect(value).toEqual(Color.RED);
+ expect(value).toBe(result);
+ });
+
it('gets expressions', function() {
var expressionString = "(regExp('^Chest').test(${County})) && (${YearBuilt} >= 1970)";
var expression = new Expression(expressionString);
diff --git a/Specs/Scene/Tileset3DTileContentSpec.js b/Specs/Scene/Tileset3DTileContentSpec.js
index 42cb0f05df45..36b536d93db9 100644
--- a/Specs/Scene/Tileset3DTileContentSpec.js
+++ b/Specs/Scene/Tileset3DTileContentSpec.js
@@ -55,14 +55,14 @@ defineSuite([
expect(content.geometryByteLength).toBe(0);
expect(content.texturesByteLength).toBe(0);
expect(content.batchTableByteLength).toBe(0);
- expect(content.innerContents).toBe(undefined);
- expect(content.readyPromise).toBe(undefined);
+ expect(content.innerContents).toBeUndefined();
+ expect(content.readyPromise).toBeDefined();
expect(content.tileset).toBe(tileset);
expect(content.tile).toBe(tile);
expect(content.url).toBeDefined();
- expect(content.batchTable).toBe(undefined);
+ expect(content.batchTable).toBeUndefined();
expect(content.hasProperty(0, 'name')).toBe(false);
- expect(content.getFeature(0).toBeUndefined());
+ expect(content.getFeature(0)).toBeUndefined();
});
});
From 3855a2ceb5cabf6291e5a327eb87c2768b588301 Mon Sep 17 00:00:00 2001
From: Sean Lilley