Skip to content

Commit

Permalink
Merge branch 'master' into entity-model-matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
rahwang committed Jul 18, 2017
2 parents 987ab4e + 510bc06 commit 4735c4d
Show file tree
Hide file tree
Showing 72 changed files with 3,269 additions and 1,881 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '4.3'
- "6"
sudo: false
before_script:
- export DISPLAY=:99.0
Expand Down
1 change: 0 additions & 1 deletion Apps/Sandcastle/gallery/3D Tiles Inspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: 'https://beta.cesium.com/api/assets/1461?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYWJmM2MzNS02OWM5LTQ3OWItYjEyYS0xZmNlODM5ZDNkMTYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjFdLCJpYXQiOjE0OTkyNjQ3NDN9.vuR75SqPDKcggvUrG_vpx0Av02jdiAxnnB1fNf-9f7s'
}));
inspectorViewModel.tileset = tileset;

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
Expand Down
26 changes: 25 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,33 @@ Change Log

### 1.36 - 2017-08-01

* Breaking changes
* The function `Quaternion.fromHeadingPitchRoll(heading, pitch, roll, result)` was removed. Use `Quaternion.fromHeadingPitchRoll(hpr, result)` instead where `hpr` is a `HeadingPitchRoll`.
* The function `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`).
* The function `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`).
* Deprecated
* `Scene/CullingVolume` is deprecated and will be removed in 1.38. Use `Core/CullingVolume`.
* `Scene/OrthographicFrustum` is deprecated and will be removed in 1.38. Use `Core/OrthographicFrustum`.
* `Scene/OrthographicOffCenterFrustum` is deprecated and will be removed in 1.38. Use `Core/OrthographicOffCenterFrustum`.
* `Scene/PerspectiveFrustum` is deprecated and will be removed in 1.38. Use `Core/PerspectiveFrustum`.
* `Scene/PerspectiveOffCenterFrustum` is deprecated and will be removed in 1.38. Use `Core/PerspectiveOffCenterFrustum`.
* Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592)
* Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139)
* Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602)
* Fixed issue where scene would blink when labels were added. [#5537](https://github.com/AnalyticalGraphicsInc/cesium/issues/5537)
* Fixed crash when using the `Cesium3DTilesInspectorViewModel` and removing a tileset [#5607](https://github.com/AnalyticalGraphicsInc/cesium/issues/5607)

### 1.35.2 - 2017-07-11

* This is an npm-only release to fix an issue with using Cesium in Node.js.
* Fixed a bug where Cesium would fail to load under Node.js and some webpack configurations. [#5593](https://github.com/AnalyticalGraphicsInc/cesium/issues/5593)
* Fixed a bug where a Model's compressed textures were not being displayed. [#5596](https://github.com/AnalyticalGraphicsInc/cesium/pull/5596)
* Fixed a bug where jsep was undefined when using webpack [#5593](https://github.com/AnalyticalGraphicsInc/cesium/issues/5593)
* Added Entity.computeModelMatrix which returns the model matrix representing the entity's transformation. [#5584](https://github.com/AnalyticalGraphicsInc/cesium/pull/5584)
* Fixed documentation for `OrthographicFrustum`. [#5586](https://github.com/AnalyticalGraphicsInc/cesium/issues/5586)

### 1.35.1 - 2017-07-05

* This is an npm-only release to fix a deployment issue with 1.35. No code changes.

### 1.35 - 2017-07-05
* Breaking changes
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Joel Depooter](https://github.com/JDepooter)
* [Bentley Systems, Inc.](https://www.bentley.com)
* [Paul Connelly](https://github.com/pmconne)
* [Jason Crow](https://github.com/jason-crow)
* [Flightradar24 AB](https://www.flightradar24.com)
* [Aleksei Kalmykov](https://github.com/kalmykov)

Expand Down
216 changes: 216 additions & 0 deletions Source/Core/CullingVolume.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
define([
'./Cartesian3',
'./Cartesian4',
'./defaultValue',
'./defined',
'./DeveloperError',
'./Intersect',
'./Plane'
], function(
Cartesian3,
Cartesian4,
defaultValue,
defined,
DeveloperError,
Intersect,
Plane) {
'use strict';

/**
* The culling volume defined by planes.
*
* @alias CullingVolume
* @constructor
*
* @param {Cartesian4[]} [planes] An array of clipping planes.
*/
function CullingVolume(planes) {
/**
* Each plane is represented by a Cartesian4 object, where the x, y, and z components
* define the unit vector normal to the plane, and the w component is the distance of the
* plane from the origin.
* @type {Cartesian4[]}
* @default []
*/
this.planes = defaultValue(planes, []);
}

var faces = [new Cartesian3(), new Cartesian3(), new Cartesian3()];
Cartesian3.clone(Cartesian3.UNIT_X, faces[0]);
Cartesian3.clone(Cartesian3.UNIT_Y, faces[1]);
Cartesian3.clone(Cartesian3.UNIT_Z, faces[2]);

var scratchPlaneCenter = new Cartesian3();
var scratchPlaneNormal = new Cartesian3();
var scratchPlane = new Plane(new Cartesian3(1.0, 0.0, 0.0), 0.0);

/**
* Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.
* The planes are aligned to the x, y, and z axes in world coordinates.
*
* @param {BoundingSphere} boundingSphere The bounding sphere used to create the culling volume.
* @param {CullingVolume} [result] The object onto which to store the result.
* @returns {CullingVolume} The culling volume created from the bounding sphere.
*/
CullingVolume.fromBoundingSphere = function(boundingSphere, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(boundingSphere)) {
throw new DeveloperError('boundingSphere is required.');
}
//>>includeEnd('debug');

if (!defined(result)) {
result = new CullingVolume();
}

var length = faces.length;
var planes = result.planes;
planes.length = 2 * length;

var center = boundingSphere.center;
var radius = boundingSphere.radius;

var planeIndex = 0;

for (var i = 0; i < length; ++i) {
var faceNormal = faces[i];

var plane0 = planes[planeIndex];
var plane1 = planes[planeIndex + 1];

if (!defined(plane0)) {
plane0 = planes[planeIndex] = new Cartesian4();
}
if (!defined(plane1)) {
plane1 = planes[planeIndex + 1] = new Cartesian4();
}

Cartesian3.multiplyByScalar(faceNormal, -radius, scratchPlaneCenter);
Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);

plane0.x = faceNormal.x;
plane0.y = faceNormal.y;
plane0.z = faceNormal.z;
plane0.w = -Cartesian3.dot(faceNormal, scratchPlaneCenter);

Cartesian3.multiplyByScalar(faceNormal, radius, scratchPlaneCenter);
Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);

plane1.x = -faceNormal.x;
plane1.y = -faceNormal.y;
plane1.z = -faceNormal.z;
plane1.w = -Cartesian3.dot(Cartesian3.negate(faceNormal, scratchPlaneNormal), scratchPlaneCenter);

planeIndex += 2;
}

return result;
};

/**
* Determines whether a bounding volume intersects the culling volume.
*
* @param {Object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.
* @returns {Intersect} Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE.
*/
CullingVolume.prototype.computeVisibility = function(boundingVolume) {
//>>includeStart('debug', pragmas.debug);
if (!defined(boundingVolume)) {
throw new DeveloperError('boundingVolume is required.');
}
//>>includeEnd('debug');

var planes = this.planes;
var intersecting = false;
for (var k = 0, len = planes.length; k < len; ++k) {
var result = boundingVolume.intersectPlane(Plane.fromCartesian4(planes[k], scratchPlane));
if (result === Intersect.OUTSIDE) {
return Intersect.OUTSIDE;
} else if (result === Intersect.INTERSECTING) {
intersecting = true;
}
}

return intersecting ? Intersect.INTERSECTING : Intersect.INSIDE;
};

/**
* Determines whether a bounding volume intersects the culling volume.
*
* @param {Object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.
* @param {Number} parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling
* volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then
* the parent (and therefore this) volume is completely inside plane[planeIndex]
* and that plane check can be skipped.
* @returns {Number} A plane mask as described above (which can be applied to this boundingVolume's children).
*
* @private
*/
CullingVolume.prototype.computeVisibilityWithPlaneMask = function(boundingVolume, parentPlaneMask) {
//>>includeStart('debug', pragmas.debug);
if (!defined(boundingVolume)) {
throw new DeveloperError('boundingVolume is required.');
}
if (!defined(parentPlaneMask)) {
throw new DeveloperError('parentPlaneMask is required.');
}
//>>includeEnd('debug');

if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
// parent is completely outside or completely inside, so this child is as well.
return parentPlaneMask;
}

// Start with MASK_INSIDE (all zeros) so that after the loop, the return value can be compared with MASK_INSIDE.
// (Because if there are fewer than 31 planes, the upper bits wont be changed.)
var mask = CullingVolume.MASK_INSIDE;

var planes = this.planes;
for (var k = 0, len = planes.length; k < len; ++k) {
// For k greater than 31 (since 31 is the maximum number of INSIDE/INTERSECTING bits we can store), skip the optimization.
var flag = (k < 31) ? (1 << k) : 0;
if (k < 31 && (parentPlaneMask & flag) === 0) {
// boundingVolume is known to be INSIDE this plane.
continue;
}

var result = boundingVolume.intersectPlane(Plane.fromCartesian4(planes[k], scratchPlane));
if (result === Intersect.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === Intersect.INTERSECTING) {
mask |= flag;
}
}

return mask;
};

/**
* For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value
* represents the case where the object bounding volume is entirely outside the culling volume.
*
* @type {Number}
* @private
*/
CullingVolume.MASK_OUTSIDE = 0xffffffff;

/**
* For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value
* represents the case where the object bounding volume is entirely inside the culling volume.
*
* @type {Number}
* @private
*/
CullingVolume.MASK_INSIDE = 0x00000000;

/**
* For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value
* represents the case where the object bounding volume (may) intersect all planes of the culling volume.
*
* @type {Number}
* @private
*/
CullingVolume.MASK_INDETERMINATE = 0x7fffffff;

return CullingVolume;
});
4 changes: 2 additions & 2 deletions Source/Core/GoogleEarthEnterpriseMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ define([

/**
* Gets the proxy used for metadata requests.
* @memberof GoogleEarthEnterpriseImageryProvider.prototype
* @memberof GoogleEarthEnterpriseMetadata.prototype
* @type {Proxy}
* @readonly
*/
Expand All @@ -169,7 +169,7 @@ define([

/**
* Gets a promise that resolves to true when the metadata is ready for use.
* @memberof GoogleEarthEnterpriseProvider.prototype
* @memberof GoogleEarthEnterpriseMetadata.prototype
* @type {Promise.<Boolean>}
* @readonly
*/
Expand Down
Loading

0 comments on commit 4735c4d

Please sign in to comment.