Skip to content

Commit

Permalink
Merge branch 'master' into clipping-crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Shehata committed Oct 26, 2018
2 parents 790765d + e3649be commit b302bb1
Show file tree
Hide file tree
Showing 63 changed files with 1,843 additions and 484 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Adjust hue, saturation, and brightness of the sky/atmosphere.">
<meta name="description" content="Adjust lighting on the globe as seen from space.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
Expand Down Expand Up @@ -93,7 +93,6 @@
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);

// Make the skyAtmosphere's HSB parameters subscribers of the viewModel.
function subscribeParameter(name) {
Cesium.knockout.getObservable(viewModel, name).subscribe(
function(newValue) {
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
});
var scene = viewer.scene;
var skyAtmosphere = scene.skyAtmosphere;
var globe = scene.globe;

// The viewModel tracks the state of our mini application.
var viewModel = {
Expand All @@ -81,20 +82,21 @@
Cesium.knockout.applyBindings(viewModel, toolbar);

// Make the skyAtmosphere's HSB parameters subscribers of the viewModel.
function subscribeParameter(name) {
function subscribeParameter(name, globeName) {
Cesium.knockout.getObservable(viewModel, name).subscribe(
function(newValue) {
skyAtmosphere[name] = newValue;
globe[globeName] = newValue;
}
);
}

subscribeParameter('hueShift');
subscribeParameter('saturationShift');
subscribeParameter('brightnessShift');
subscribeParameter('hueShift', 'atmosphereHueShift');
subscribeParameter('saturationShift', 'atmosphereSaturationShift');
subscribeParameter('brightnessShift', 'atmosphereBrightnessShift');

Sandcastle.addToggleButton('Lighting', scene.globe.enableLighting, function(checked) {
scene.globe.enableLighting = checked;
Sandcastle.addToggleButton('Lighting', globe.enableLighting, function(checked) {
globe.enableLighting = checked;
});

Sandcastle.addToggleButton('Fog', scene.fog.enabled, function(checked) {
Expand Down
File renamed without changes
12 changes: 11 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ Change Log
### 1.51 - 2018-11-01

##### Additions :tada:
* Added `Ray.clone`. [#7174](https://github.com/AnalyticalGraphicsInc/cesium/pull/7174)
* Shrink minified and gzipped Cesium.js by 27 KB (~3.7%) by delay loading seldom-used third-party dependencies. [#7140](https://github.com/AnalyticalGraphicsInc/cesium/pull/7140)
* Added WMS-T (time) support in WebMapServiceImageryProvider [#2581](https://github.com/AnalyticalGraphicsInc/cesium/issues/2581)
* Added `Transforms.fixedFrameToHeadingPitchRoll`, a helper function for extracting a `HeadingPitchRoll` from a fixed frame transform [#7164](https://github.com/AnalyticalGraphicsInc/cesium/pull/7164)
* Added `cutoutRectangle` to `ImageryLayer`, which allows cutting out rectangular areas in imagery layers to reveal underlying imagery. [#7056](https://github.com/AnalyticalGraphicsInc/cesium/pull/7056)
* Added `imageBasedLightingFactor` property to `Cesium3DTileset`, `Model`, and `ModelGraphics` to scale the diffuse and specular image-based lighting contributions to the final color. [#7025](https://github.com/AnalyticalGraphicsInc/cesium/pull/7025)
* Added `lightColor` property to `Cesium3DTileset`, `Model`, and `ModelGraphics` to change the intensity of the light used when shading model. [#7025](https://github.com/AnalyticalGraphicsInc/cesium/pull/7025)
* Added `atmosphereHueShift`, `atmosphereSaturationShift`, and `atmosphereBrightnessShift` properties to `Globe` which shift the color of the ground atmosphere to match the hue, saturation, and brightness shifts of the sky atmosphere. [#4195](https://github.com/AnalyticalGraphicsInc/cesium/issues/4195)

##### Fixes :wrench:
* Fixed issue removing geometry entities with different materials [#7163](https://github.com/AnalyticalGraphicsInc/cesium/pull/7163)
* Fixed an issue where `pickPosition` would return incorrect results when called after `sampleHeight` or `clampToHeight`. [#7113](https://github.com/AnalyticalGraphicsInc/cesium/pull/7113)
* Fixed an issue where `sampleHeight` and `clampToHeight` would crash if picking a primitive that doesn't write depth. [#7120](https://github.com/AnalyticalGraphicsInc/cesium/issues/7120)
* Fixed crash when updating polyline attributes twice in one frame [#7155](https://github.com/AnalyticalGraphicsInc/cesium/pull/7155)
* Fixed a crash when using `BingMapsGeocoderService` [#7143](https://github.com/AnalyticalGraphicsInc/cesium/issues/7143)
* Fixed entity visibility issue related to setting an entity show property and altering or adding entity geometry [#7156](https://github.com/AnalyticalGraphicsInc/cesium/pull/7156)
* Fixed accuracy of rotation matrix generated by `VelocityOrientationProperty` [#6641](https://github.com/AnalyticalGraphicsInc/cesium/pull/6641)

### 1.50 - 2018-10-01

##### Breaking Changes :mega:
* Renamed Ground Clamping Sandcastle example to [Clamp to Terrain](https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Clamp%20to%20Terrain.html).
* Clipping planes on tilesets now use the root tile's transform, or the root tile's bounding sphere if a transform is not defined. [#7034](https://github.com/AnalyticalGraphicsInc/cesium/pull/7034)
* This is to make clipping planes' coordinates always relative to the object they're attached to. So if you were positioning the clipping planes as in the example below, this is no longer necessary:
```javascript
Expand All @@ -37,6 +46,7 @@ Change Log
* Added `OpenCageGeocoderService`, which provides geocoding via [OpenCage](https://opencagedata.com/). [#7015](https://github.com/AnalyticalGraphicsInc/cesium/pull/7015)
* Added ground atmosphere lighting in 3D. This can be toggled with `Globe.showGroundAtmosphere`. [6877](https://github.com/AnalyticalGraphicsInc/cesium/pull/6877)
* Added `Globe.nightFadeOutDistance` and `Globe.nightFadeInDistance` to configure when ground atmosphere night lighting fades in and out. [6877](https://github.com/AnalyticalGraphicsInc/cesium/pull/6877)
* Added `onStop` event to `Clock` that fires each time stopTime is reached. [#7066](https://github.com/AnalyticalGraphicsInc/cesium/pull/7066)

##### Fixes :wrench:
* Fixed picking for overlapping translucent primitives. [#7039](https://github.com/AnalyticalGraphicsInc/cesium/pull/7039)
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Chris Cooper](https://github.com/chris-cooper)
* [Andrew McDowell](https://github.com/madole)
* [Tony Luk](https://github.com/impactblue573)
* [GeoFS](https://www.geo-fs.com)
* [Xavier Tassin](https://github.com/xtassin/)

## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
* [Victor Berchet](https://github.com/vicb)
* [Caleb Morse](https://github.com/cmorse)
Expand Down Expand Up @@ -193,3 +196,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Hannah Bollar](https://github.com/hanbollar)
* [Felix Palmer](https://github.com/felixpalmer)
* [Cedric Le Roux](https://github.com/cleroux)
* [Dag Wästberg](https://github.com/dwastberg)
7 changes: 7 additions & 0 deletions Source/Core/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ define([
* @type {Event}
*/
this.onTick = new Event();
/**
* An {@link Event} that is fired whenever {@link Clock#stopTime} is reached.
* @type {Event}
*/
this.onStop = new Event();

this._currentTime = undefined;
this._multiplier = undefined;
Expand Down Expand Up @@ -290,13 +295,15 @@ define([
currentTime = JulianDate.clone(startTime, currentTime);
} else if (JulianDate.greaterThan(currentTime, stopTime)) {
currentTime = JulianDate.clone(stopTime, currentTime);
this.onStop.raiseEvent(this);
}
} else if (clockRange === ClockRange.LOOP_STOP) {
if (JulianDate.lessThan(currentTime, startTime)) {
currentTime = JulianDate.clone(startTime, currentTime);
}
while (JulianDate.greaterThan(currentTime, stopTime)) {
currentTime = JulianDate.addSeconds(startTime, JulianDate.secondsDifference(currentTime, stopTime), currentTime);
this.onStop.raiseEvent(this);
}
}
}
Expand Down
35 changes: 25 additions & 10 deletions Source/Core/Ray.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
define([
'./Cartesian3',
'./Check',
'./defaultValue',
'./defined',
'./DeveloperError'
'./defined'
], function(
Cartesian3,
Check,
defaultValue,
defined,
DeveloperError) {
defined) {
'use strict';

/**
Expand Down Expand Up @@ -38,6 +38,25 @@ define([
this.direction = direction;
}

/**
* Duplicates a Ray instance.
*
* @param {Ray} ray The ray to duplicate.
* @param {Ray} [result] The object onto which to store the result.
* @returns {Ray} The modified result parameter or a new Ray instance if one was not provided. (Returns undefined if ray is undefined)
*/
Ray.clone = function(ray, result) {
if (!defined(ray)) {
return undefined;
}
if (!defined(result)) {
return new Ray(ray.origin, ray.direction);
}
result.origin = Cartesian3.clone(ray.origin);
result.direction = Cartesian3.clone(ray.direction);
return result;
};

/**
* Computes the point along the ray given by r(t) = o + t*d,
* where o is the origin of the ray and d is the direction.
Expand All @@ -54,12 +73,8 @@ define([
*/
Ray.getPoint = function(ray, t, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(ray)){
throw new DeveloperError('ray is requred');
}
if (typeof t !== 'number') {
throw new DeveloperError('t is a required number');
}
Check.typeOf.object('ray', ray);
Check.typeOf.number('t', t);
//>>includeEnd('debug');

if (!defined(result)) {
Expand Down
52 changes: 52 additions & 0 deletions Source/Core/Transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define([
'./EarthOrientationParameters',
'./EarthOrientationParametersSample',
'./Ellipsoid',
'./HeadingPitchRoll',
'./Iau2006XysData',
'./Iau2006XysSample',
'./JulianDate',
Expand All @@ -32,6 +33,7 @@ define([
EarthOrientationParameters,
EarthOrientationParametersSample,
Ellipsoid,
HeadingPitchRoll,
Iau2006XysData,
Iau2006XysSample,
JulianDate,
Expand Down Expand Up @@ -377,6 +379,53 @@ define([
return Quaternion.fromRotationMatrix(rotation, result);
};

var noScale = new Cartesian3(1.0, 1.0, 1.0);
var hprCenterScratch = new Cartesian3();
var ffScratch = new Matrix4();
var hprTransformScratch = new Matrix4();
var hprRotationScratch = new Matrix3();
var hprQuaternionScratch = new Quaternion();
/**
* Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local north
* direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
* are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
*
* @param {Matrix4} transform The transform
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation.
* @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation
* matrix from a reference frame to the provided ellipsoid's fixed reference frame
* @param {HeadingPitchRoll} [result] The object onto which to store the result.
* @returns {HeadingPitchRoll} The modified result parameter or a new HeadingPitchRoll instance if none was provided.
*/
Transforms.fixedFrameToHeadingPitchRoll = function(transform, ellipsoid, fixedFrameTransform, result) {
//>>includeStart('debug', pragmas.debug);
Check.defined('transform', transform);
//>>includeEnd('debug');

ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
fixedFrameTransform = defaultValue(fixedFrameTransform, Transforms.eastNorthUpToFixedFrame);
if (!defined(result)) {
result = new HeadingPitchRoll();
}

var center = Matrix4.getTranslation(transform, hprCenterScratch);
if (Cartesian3.equals(center, Cartesian3.ZERO)) {
result.heading = 0;
result.pitch = 0;
result.roll = 0;
return result;
}
var toFixedFrame = Matrix4.inverseTransformation(fixedFrameTransform(center, ellipsoid, ffScratch), ffScratch);
var transformCopy = Matrix4.setScale(transform, noScale, hprTransformScratch);
transformCopy = Matrix4.setTranslation(transformCopy, Cartesian3.ZERO, transformCopy);

toFixedFrame = Matrix4.multiply(toFixedFrame, transformCopy, toFixedFrame);
var quaternionRotation = Quaternion.fromRotationMatrix(Matrix4.getRotation(toFixedFrame, hprRotationScratch), hprQuaternionScratch);
quaternionRotation = Quaternion.normalize(quaternionRotation, quaternionRotation);

return HeadingPitchRoll.fromQuaternion(quaternionRotation, result);
};

var gmstConstant0 = 6 * 3600 + 41 * 60 + 50.54841;
var gmstConstant1 = 8640184.812866;
var gmstConstant2 = 0.093104;
Expand Down Expand Up @@ -759,13 +808,16 @@ define([

var normal = defaultValue(ellipsoid, Ellipsoid.WGS84).geodeticSurfaceNormal(position, normalScratch);
var right = Cartesian3.cross(velocity, normal, rightScratch);

if (Cartesian3.equalsEpsilon(right, Cartesian3.ZERO, CesiumMath.EPSILON6)) {
right = Cartesian3.clone(Cartesian3.UNIT_X, right);
}

var up = Cartesian3.cross(right, velocity, upScratch);
Cartesian3.normalize(up, up);
Cartesian3.cross(velocity, up, right);
Cartesian3.negate(right, right);
Cartesian3.normalize(right, right);

if (!defined(result)) {
result = new Matrix3();
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/oneTimeWarning.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ define([

oneTimeWarning.geometryZIndex = 'Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored';

oneTimeWarning.geometryHeightReference = 'Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored';
oneTimeWarning.geometryExtrudedHeightReference = 'Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored';

return oneTimeWarning;
});
Loading

0 comments on commit b302bb1

Please sign in to comment.