Skip to content

Commit

Permalink
Merge branch 'master' into 5819_fix_for_empty_icon_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Bernstein authored Oct 23, 2017
2 parents cb773a6 + d2a7982 commit fa1e73e
Show file tree
Hide file tree
Showing 38 changed files with 1,284 additions and 629 deletions.
31 changes: 17 additions & 14 deletions Apps/Sandcastle/gallery/CZML Reference Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
if(typeof require === "function") {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
Expand All @@ -38,7 +40,7 @@
"cartographicDegrees" : [-110.0, 50.0, 0]
}
}, {
"id" : "outlineColor-reference",
"id" : "fillColor-reference",
"name" : "Referencing Position",
"description" : "<p>For more examples of reference properties, see CZML Polygon - Interpolating References.</p>",
"billboard" : {
Expand All @@ -62,11 +64,11 @@
"text" : "referencing position"
},
"position" : {
"reference" : "position-reference#position"
"reference" : "position-reference#position"
}
}, {
"id" : "polygon",
"name" : "Referencing Outline Color",
"name" : "Referencing Fill Color",
"description" : "<p>For more examples of reference properties, see CZML Polygon - Interpolating References.</p>",
"label" : {
"fillColor" : {
Expand All @@ -78,7 +80,7 @@
"cartesian2" : [20, 0]
},
"style" : "FILL_AND_OUTLINE",
"text" : "referencing outlineColor"
"text" : "referencing fillColor"
},
"position" : {
"cartographicDegrees" : [-105, 35, 0]
Expand All @@ -94,17 +96,18 @@
]
},
"height" : 0,
"outline" : true,
"outlineColor" : {
"reference" : "outlineColor-reference#label.outlineColor"
},
"outlineWidth" : 5
"material" : {
"solidColor" : {
"color" : {
"reference" : "fillColor-reference#label.outlineColor"
}
}
}
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ Change Log
==========
### 1.39 - 2017-11-01

* Added the ability to load Cesium's assets from the local file system if security permissions allow it. [#5830](https://github.com/AnalyticalGraphicsInc/cesium/issues/5830)
* Added function that inserts missing namespace declarations into KML files. [#5860](https://github.com/AnalyticalGraphicsInc/cesium/pull/5860)
* Added support for the layer.json `parentUrl` property in `CesiumTerrainProvider` to allow for compositing of tilesets.
* Fixed a bug that caused KML ground overlays to appear distorted when rotation was applied. [#5914](https://github.com/AnalyticalGraphicsInc/cesium/issues/5914)
* KML files load when a Network Link fails [#5871](https://github.com/AnalyticalGraphicsInc/cesium/pull/5871)
* Adds `invertClassification` and `invertClassificationColor` to `Scene`. When `invertClassification` is `true`, any 3D Tiles geometry that is not classified by a `ClassificationPrimitive` or `GroundPrimitive` will have its color multiplied by `invertClassificationColor`. [#5836](https://github.com/AnalyticalGraphicsInc/cesium/pull/5836)
* Added `eyeSeparation` and `focalLength` properties to `Scene` to configure VR settings. [#5917](https://github.com/AnalyticalGraphicsInc/cesium/pull/5917)
* Added `customTags` property to the UrlTemplateImageryProvider to allow custom keywords in the template URL. [#5696](https://github.com/AnalyticalGraphicsInc/cesium/pull/5696)
* Improved CZML Reference Properties example [#5754](https://github.com/AnalyticalGraphicsInc/cesium/pull/5754)
* Fixed bug with placemarks in imported KML: placemarks with no specified icon would be displayed with default icon. [#5819](https://github.com/AnalyticalGraphicsInc/cesium/issues/5819)

### 1.38 - 2017-10-02
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/HeightmapTessellator.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ define([
var granularityX = rectangleWidth / (width - 1);
var granularityY = rectangleHeight / (height - 1);

if (!isGeographic) {
rectangleWidth *= oneOverGlobeSemimajorAxis;
rectangleHeight *= oneOverGlobeSemimajorAxis;
}

var radiiSquared = ellipsoid.radiiSquared;
var radiiSquaredX = radiiSquared.x;
var radiiSquaredY = radiiSquared.y;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/OrientedBoundingBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ define([
if (!defined(rectangle)) {
throw new DeveloperError('rectangle is required');
}
if (rectangle.width < 0.0 || rectangle.width > CesiumMath.PI) {
throw new DeveloperError('Rectangle width must be between 0 and pi');
if (rectangle.width < 0.0 || rectangle.width > CesiumMath.TWO_PI) {
throw new DeveloperError('Rectangle width must be between 0 and 2*pi');
}
if (rectangle.height < 0.0 || rectangle.height > CesiumMath.PI) {
throw new DeveloperError('Rectangle height must be between 0 and pi');
Expand Down
8 changes: 7 additions & 1 deletion Source/Core/loadWithXhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ define([
xhr.responseType = responseType;
}

// While non-standard, file protocol always returns a status of 0 on success
var localFile = false;
if (typeof url === 'string') {
localFile = url.indexOf('file://') === 0;
}

xhr.onload = function() {
if (xhr.status < 200 || xhr.status >= 300) {
if ((xhr.status < 200 || xhr.status >= 300) && !(localFile && xhr.status === 0)) {
deferred.reject(new RequestErrorEvent(xhr.status, xhr.response, xhr.getAllResponseHeaders()));
return;
}
Expand Down
1 change: 1 addition & 0 deletions Source/DataSources/BillboardGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ define([
* @param {Property} [options.sizeInMeters] A boolean Property specifying whether this billboard's size should be measured in meters.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this billboard will be displayed.
* @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to.
*
* @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo}
*/
Expand Down
2 changes: 2 additions & 0 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,8 @@ define([
} else if (viewRefreshMode === 'onRegion') {
oneTimeWarning('kml-refrehMode-onRegion', 'KML - Unsupported viewRefreshMode: onRegion');
}
}).otherwise(function(error) {
oneTimeWarning('An error occured during loading ' + linkUrl);
});

promises.push(promise);
Expand Down
1 change: 1 addition & 0 deletions Source/DataSources/LabelGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ define([
* @param {Property} [options.scaleByDistance] A {@link NearFarScalar} Property used to set scale based on distance from the camera.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this label will be displayed.
* @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to.
*
* @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Labels.html|Cesium Sandcastle Labels Demo}
*/
Expand Down
1 change: 1 addition & 0 deletions Source/DataSources/PointGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ define([
* @param {Property} [options.translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this point will be displayed.
* @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to.
*/
function PointGraphics(options) {
this._color = undefined;
Expand Down
124 changes: 104 additions & 20 deletions Source/Renderer/Buffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define([
'../Core/Check',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
Expand All @@ -8,6 +9,7 @@ define([
'../Core/WebGLConstants',
'./BufferUsage'
], function(
Check,
defaultValue,
defined,
defineProperties,
Expand All @@ -25,9 +27,7 @@ define([
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.context)) {
throw new DeveloperError('options.context is required.');
}
Check.defined('options.context', options.context);

if (!defined(options.typedArray) && !defined(options.sizeInBytes)) {
throw new DeveloperError('Either options.sizeInBytes or options.typedArray is required.');
Expand All @@ -37,8 +37,9 @@ define([
throw new DeveloperError('Cannot pass in both options.sizeInBytes and options.typedArray.');
}

if (defined(options.typedArray) && !(typeof options.typedArray === 'object' && typeof options.typedArray.byteLength === 'number')) {
throw new DeveloperError('options.typedArray must be a typed array');
if (defined(options.typedArray)) {
Check.typeOf.object('options.typedArray', options.typedArray);
Check.typeOf.number('options.typedArray.byteLength', options.typedArray.byteLength);
}

if (!BufferUsage.validate(options.usage)) {
Expand All @@ -58,9 +59,7 @@ define([
}

//>>includeStart('debug', pragmas.debug);
if (sizeInBytes <= 0) {
throw new DeveloperError('Buffer size must be greater than zero.');
}
Check.typeOf.number.greaterThan('sizeInBytes', sizeInBytes, 0);
//>>includeEnd('debug');

var buffer = gl.createBuffer();
Expand All @@ -69,6 +68,7 @@ define([
gl.bindBuffer(bufferTarget, null);

this._gl = gl;
this._webgl2 = options.context._webgl2;
this._bufferTarget = bufferTarget;
this._sizeInBytes = sizeInBytes;
this._usage = usage;
Expand Down Expand Up @@ -118,9 +118,7 @@ define([
*/
Buffer.createVertexBuffer = function(options) {
//>>includeStart('debug', pragmas.debug);
if (!defined(options.context)) {
throw new DeveloperError('options.context is required.');
}
Check.defined('options.context', options.context);
//>>includeEnd('debug');

return new Buffer({
Expand Down Expand Up @@ -179,15 +177,13 @@ define([
*/
Buffer.createIndexBuffer = function(options) {
//>>includeStart('debug', pragmas.debug);
if (!defined(options.context)) {
throw new DeveloperError('options.context is required.');
}
Check.defined('options.context', options.context);

if (!IndexDatatype.validate(options.indexDatatype)) {
throw new DeveloperError('Invalid indexDatatype.');
}

if ((options.indexDatatype === IndexDatatype.UNSIGNED_INT) && !options.context.elementIndexUint) {
if (options.indexDatatype === IndexDatatype.UNSIGNED_INT && !options.context.elementIndexUint) {
throw new DeveloperError('IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.');
}
//>>includeEnd('debug');
Expand Down Expand Up @@ -249,18 +245,106 @@ define([
offsetInBytes = defaultValue(offsetInBytes, 0);

//>>includeStart('debug', pragmas.debug);
if (!arrayView) {
Check.defined('arrayView', arrayView);
Check.typeOf.number.lessThanOrEquals('offsetInBytes + arrayView.byteLength', offsetInBytes + arrayView.byteLength, this._sizeInBytes);
//>>includeEnd('debug');

var gl = this._gl;
var target = this._bufferTarget;
gl.bindBuffer(target, this._buffer);
gl.bufferSubData(target, offsetInBytes, arrayView);
gl.bindBuffer(target, null);
};

Buffer.prototype.copyFromBuffer = function(readBuffer, readOffset, writeOffset, sizeInBytes) {
//>>includeStart('debug', pragmas.debug);
if (!this._webgl2) {
throw new DeveloperError('A WebGL 2 context is required.');
}
if (!defined(readBuffer)) {
throw new DeveloperError('readBuffer must be defined.');
}
if (!defined(sizeInBytes) || sizeInBytes <= 0) {
throw new DeveloperError('sizeInBytes must be defined and be greater than zero.');
}
if (!defined(readOffset) || readOffset < 0 || readOffset + sizeInBytes > readBuffer._sizeInBytes) {
throw new DeveloperError('readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.');
}
if (!defined(writeOffset) || writeOffset < 0 || writeOffset + sizeInBytes > this._sizeInBytes) {
throw new DeveloperError('writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.');
}
if (this._buffer === readBuffer._buffer && ((writeOffset >= readOffset && writeOffset < readOffset + sizeInBytes) || (readOffset > writeOffset && readOffset < writeOffset + sizeInBytes))) {
throw new DeveloperError('When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.');
}
if ((this._bufferTarget === WebGLConstants.ELEMENT_ARRAY_BUFFER && readBuffer._bufferTarget !== WebGLConstants.ELEMENT_ARRAY_BUFFER) ||
(this._bufferTarget !== WebGLConstants.ELEMENT_ARRAY_BUFFER && readBuffer._bufferTarget === WebGLConstants.ELEMENT_ARRAY_BUFFER)) {
throw new DeveloperError('Can not copy an index buffer into another buffer type.');
}
//>>includeEnd('debug');

var readTarget = WebGLConstants.COPY_READ_BUFFER;
var writeTarget = WebGLConstants.COPY_WRITE_BUFFER;

var gl = this._gl;
gl.bindBuffer(writeTarget, this._buffer);
gl.bindBuffer(readTarget, readBuffer._buffer);
gl.copyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, sizeInBytes);
gl.bindBuffer(writeTarget, null);
gl.bindBuffer(readTarget, null);
};

Buffer.prototype.getBufferData = function(arrayView, sourceOffset, destinationOffset, length) {
sourceOffset = defaultValue(sourceOffset, 0);
destinationOffset = defaultValue(destinationOffset, 0);

//>>includeStart('debug', pragmas.debug);
if (!this._webgl2) {
throw new DeveloperError('A WebGL 2 context is required.');
}
if (!defined(arrayView)) {
throw new DeveloperError('arrayView is required.');
}
if (offsetInBytes + arrayView.byteLength > this._sizeInBytes) {
throw new DeveloperError('This buffer is not large enough.');

var copyLength;
var elementSize;
var arrayLength = arrayView.byteLength;
if (!defined(length)) {
if (defined(arrayLength)) {
copyLength = arrayLength - destinationOffset;
elementSize = 1;
} else {
arrayLength = arrayView.length;
copyLength = arrayLength - destinationOffset;
elementSize = arrayView.BYTES_PER_ELEMENT;
}
} else {
copyLength = length;
if (defined(arrayLength)) {
elementSize = 1;
} else {
arrayLength = arrayView.length;
elementSize = arrayView.BYTES_PER_ELEMENT;
}
}

if (destinationOffset < 0 || destinationOffset > arrayLength) {
throw new DeveloperError('destinationOffset must be greater than zero and less than the arrayView length.');
}
if (destinationOffset + copyLength > arrayLength) {
throw new DeveloperError('destinationOffset + length must be less than or equal to the arrayViewLength.');
}
if (sourceOffset < 0 || sourceOffset > this._sizeInBytes) {
throw new DeveloperError('sourceOffset must be greater than zero and less than the buffers size.');
}
if (sourceOffset + copyLength * elementSize > this._sizeInBytes) {
throw new DeveloperError('sourceOffset + length must be less than the buffers size.');
}
//>>includeEnd('debug');

var gl = this._gl;
var target = this._bufferTarget;
var target = WebGLConstants.COPY_READ_BUFFER;
gl.bindBuffer(target, this._buffer);
gl.bufferSubData(target, offsetInBytes, arrayView);
gl.getBufferSubData(target, sourceOffset, arrayView, destinationOffset, length);
gl.bindBuffer(target, null);
};

Expand Down
10 changes: 4 additions & 6 deletions Source/Renderer/ComputeEngine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define([
'../Core/BoundingRectangle',
'../Core/Check',
'../Core/Color',
'../Core/defined',
'../Core/destroyObject',
Expand All @@ -13,6 +14,7 @@ define([
'./ShaderProgram'
], function(
BoundingRectangle,
Check,
Color,
defined,
destroyObject,
Expand Down Expand Up @@ -75,9 +77,7 @@ define([

ComputeEngine.prototype.execute = function(computeCommand) {
//>>includeStart('debug', pragmas.debug);
if (!defined(computeCommand)) {
throw new DeveloperError('computeCommand is required.');
}
Check.defined('computeCommand', computeCommand);
//>>includeEnd('debug');

// This may modify the command's resources, so do error checking afterwards
Expand All @@ -90,9 +90,7 @@ define([
throw new DeveloperError('computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.');
}

if (!defined(computeCommand.outputTexture)) {
throw new DeveloperError('computeCommand.outputTexture is required.');
}
Check.defined('computeCommand.outputTexture', computeCommand.outputTexture);
//>>includeEnd('debug');

var outputTexture = computeCommand.outputTexture;
Expand Down
Loading

0 comments on commit fa1e73e

Please sign in to comment.