Skip to content

Commit

Permalink
Merge branch '3d-tiles' into 3d-tiles-transform
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Aug 23, 2016
2 parents 4569101 + 57f6086 commit 4a18731
Show file tree
Hide file tree
Showing 40 changed files with 696 additions and 134 deletions.
2 changes: 2 additions & 0 deletions Apps/Sandcastle/gallery/3D Tiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
name : 'Batched', url : '../../../Specs/Data/Cesium3DTiles/Batched/BatchedWithBatchTable/'
}, {
name : 'Instanced', url : '../../../Specs/Data/Cesium3DTiles/Instanced/InstancedWithBatchTable/'
}, {
name : 'Instanced/Orientation', url : '../../../Specs/Data/Cesium3DTiles/Instanced/InstancedOrientationWithBatchTable/'
}, {
name : 'Composite', url : '../../../Specs/Data/Cesium3DTiles/Composite/Composite/'
}, {
Expand Down
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ Change Log
* `Cesium3DTileFeature`

### 1.25 - 2016-09-01

* Breaking changes
* Number and order of arguments passed to `KmlDataSource` `unsupportedNodeEvent` listeners have changed to allow better handling of unsupported KML Features.
* Deprecated
* Deprecated `castShadows` and `receiveShadows` properties from `Model`, `Primitive`, and `Globe`. They will be removed in 1.26. Use `shadows` instead with the `ShadowMode` enum, e.g. `model.shadows = ShadowMode.ENABLED`.
* `Viewer.terrainShadows` now uses the `ShadowMode` enum instead of a Boolean, e.g. `viewer.terrainShadows = ShadowMode.RECEIVE_ONLY`. Boolean support will be dropped in 1.26.
* Updated the online [model converter](http://cesiumjs.org/convertmodel.html) to convert OBJ models to glTF with [obj2gltf](https://github.com/AnalyticalGraphicsInc/OBJ2GLTF), as well as optimize existing glTF models with the [gltf-pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline). Also added an option to compress geometry using the glTF [WEB3D_quantized_attributes](https://github.com/KhronosGroup/glTF/blob/master/extensions/Vendor/WEB3D_quantized_attributes/README.md) extension.
* Added `shadows` property to the entity API for `Box`, `Corridor`, `Cylinder`, `Ellipse`, `Ellipsoid`, `Polygon`, `Polyline`, `PoylineVolume`, `Rectangle`, and `Wall`. [#4005](https://github.com/AnalyticalGraphicsInc/cesium/pull/4005)
* Fixed an issue causing error if KML has a clamped to ground LineString with color. [#4131](https://github.com/AnalyticalGraphicsInc/cesium/issues/4131)
* Added logic to `KmlDataSource` defaulting KML Feature node to hidden unless all ancestors are visible. This better matches the KML specification.
* Camera flights now disable collision with the terrain until all of the terrain in the area has finished loading. This prevents the camera from being moved to be above lower resolution terrain when flying to a position close to higher resolution terrain. [#4075](https://github.com/AnalyticalGraphicsInc/cesium/issues/4075)
* Added support for Int32 and Uint32 in ComponentDatatypeSpec.
* Added `GeocoderViewModel.keepExpanded` which when set to true will always keep the GeoCoder in its expanded state.


### 1.24 - 2016-08-01

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ We appreciate attribution by including the Cesium logo and link in your app.
### Demos ###

<p align="center">
<a href="http://cesiumjs.org/demos/ShakeFinder.html"><img src="http://cesiumjs.org/demos/images/ShakeFinder.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/GeoPort3D.html"><img src="http://cesiumjs.org/demos/images/GeoPort3D.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/HurricaneHunters.html"><img src="http://cesiumjs.org/demos/images/HurricaneHunters.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/HWRF.html"><img src="http://cesiumjs.org/demos/images/HWRF.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/GPMNRTView.html"><img src="http://cesiumjs.org/demos/images/GPMNRTView.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/STORMVG.html"><img src="http://cesiumjs.org/demos/images/STORMVG.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/CubeCities.html"><img src="http://cesiumjs.org/demos/images/CubeCities.png" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/VirES.html"><img src="http://cesiumjs.org/demos/images/VirES.png" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/NASAweather.html"><img src="http://cesiumjs.org/demos/images/NASAweather.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/Citisens.html"><img src="http://cesiumjs.org/demos/images/citisens.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/ParalogPerformance.html"><img src="http://cesiumjs.org/demos/images/ParalogPerformance.jpg" height="150" /></a>&nbsp;
<a href="http://cesiumjs.org/demos/FlightClub.html"><img src="http://cesiumjs.org/demos/images/FlightClub.jpg" height="150" /></a>&nbsp;
Expand Down
23 changes: 15 additions & 8 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1527,8 +1527,16 @@ define([
}
entity.availability = availability;

// Per KML spec "A Feature is visible only if it and all its ancestors are visible."
function ancestryIsVisible(parentEntity) {
if (!parentEntity) {
return true;
}
return parentEntity.show && ancestryIsVisible(parentEntity.parent);
}

var visibility = queryBooleanValue(featureNode, 'visibility', namespaces.kml);
entity.show = defaultValue(visibility, true);
entity.show = ancestryIsVisible(parent) && defaultValue(visibility, true);
//var open = queryBooleanValue(featureNode, 'open', namespaces.kml);

var authorNode = queryFirstNode(featureNode, 'author', namespaces.atom);
Expand Down Expand Up @@ -1719,8 +1727,8 @@ define([
}
}

function processUnsupported(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver) {
dataSource._unsupportedNode.raiseEvent(dataSource, node, uriResolver);
function processUnsupportedFeature(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver) {
dataSource._unsupportedNode.raiseEvent(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver);
console.log('KML - Unsupported feature: ' + node.localName);
}

Expand Down Expand Up @@ -2010,18 +2018,17 @@ define([
Placemark : processPlacemark,
NetworkLink : processNetworkLink,
GroundOverlay : processGroundOverlay,
PhotoOverlay : processUnsupported,
ScreenOverlay : processUnsupported,
Tour : processUnsupported
PhotoOverlay : processUnsupportedFeature,
ScreenOverlay : processUnsupportedFeature,
Tour : processUnsupportedFeature
};

function processFeatureNode(dataSource, node, parent, entityCollection, styleCollection, sourceUri, uriResolver) {
var featureProcessor = featureTypes[node.localName];
if (defined(featureProcessor)) {
featureProcessor(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver);
} else {
dataSource._unsupportedNode.raiseEvent(dataSource, node, uriResolver);
console.log('KML - Unsupported feature node: ' + node.localName);
processUnsupportedFeature(dataSource, parent, node, entityCollection, styleCollection, sourceUri, uriResolver);
}
}

Expand Down
85 changes: 85 additions & 0 deletions Source/Scene/Cesium3DTileFeatureTableResources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*global define*/
define([
'../Core/ComponentDatatype',
'../Core/defaultValue',
'../Core/defined',
'../Core/DeveloperError'
], function(
ComponentDatatype,
defaultValue,
defined,
DeveloperError) {
'use strict';

/**
* @private
*/
function Cesium3DTileFeatureTableResources(featureTableJSON, featureTableBinary) {
this.json = featureTableJSON;
this.buffer = featureTableBinary;
this._cachedArrayBufferViews = {};
this.featuresLength = 0;
}

Cesium3DTileFeatureTableResources.prototype.getTypedArrayForSemantic = function(semantic, byteOffset, componentType, count, featureSize) {
//>>includeStart('debug', pragmas.debug);
if (!defined(byteOffset)) {
throw new DeveloperError('byteOffset must be defined to read from binary data for semantic: ' + semantic);
}
if (!defined(componentType)) {
throw new DeveloperError('componentType must be defined to read from binary data for semantic: ' + semantic);
}
if (!defined(count)) {
throw new DeveloperError('count must be defined to read from binary data for semantic: ' + semantic);
}
//>>includeEnd('debug');
var cachedArrayBufferViews = this._cachedArrayBufferViews;
var arrayBuffer = cachedArrayBufferViews[semantic];
if (!defined(arrayBuffer)) {
arrayBuffer = ComponentDatatype.createArrayBufferView(componentType, this.buffer.buffer, this.buffer.byteOffset + byteOffset, count * featureSize);
cachedArrayBufferViews[semantic] = arrayBuffer;
}
return arrayBuffer;
};

Cesium3DTileFeatureTableResources.prototype.getGlobalProperty = function(semantic, componentType, count) {
var jsonValue = this.json[semantic];
if (defined(jsonValue)) {
var byteOffset = jsonValue.byteOffset;
if (defined(byteOffset)) {
// This is a reference to the binary
count = defaultValue(count, 1);
var typedArray = this.getTypedArrayForSemantic(semantic, byteOffset, componentType, count, 1);
var subArray = typedArray.subarray(0, count);
if (subArray.length === 1) {
return subArray[0];
}
return subArray;
}
}
return jsonValue;
};

Cesium3DTileFeatureTableResources.prototype.getProperty = function(semantic, featureId, componentType, featureSize) {
var jsonValue = this.json[semantic];
if (defined(jsonValue)) {
var byteOffset = jsonValue.byteOffset;
if (defined(byteOffset)) {
// This is a reference to the binary
featureSize = defaultValue(featureSize, 1);
var typedArray = this.getTypedArrayForSemantic(semantic, byteOffset, componentType, this.featuresLength, featureSize);
var subArray = typedArray.subarray(featureId * featureSize, featureId * featureSize + featureSize);
if (subArray.length === 1) {
return subArray[0];
}
return subArray;
}
}
if (Array.isArray(jsonValue)) {
return jsonValue.slice(featureId * featureSize, featureId * featureSize + featureSize);
}
return jsonValue;
};

return Cesium3DTileFeatureTableResources;
});
2 changes: 1 addition & 1 deletion Source/Scene/Composite3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ define([

var that = this;

when.all(contentPromises, function() {
when.all(contentPromises).then(function() {
that.state = Cesium3DTileContentState.READY;
that._readyPromise.resolve(that);
}).otherwise(function(error) {
Expand Down
Loading

0 comments on commit 4a18731

Please sign in to comment.