Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into model-animation-names
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGES.md
  • Loading branch information
emackey committed Sep 8, 2017
2 parents 3a06502 + 10f78b5 commit d50a63e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Log

* Added ability to add an animation to `ModelAnimationCollection` by its index. [#5815](https://github.com/AnalyticalGraphicsInc/cesium/pull/5815)
* Fixed a bug in `ModelAnimationCollection` that caused adding an animation by its name to throw an error. [#5815](https://github.com/AnalyticalGraphicsInc/cesium/pull/5815)
* Zoom about mouse now maintains camera heading, pitch, and roll [#4639](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603)

### 1.37 - 2017-09-01

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Jason Crow](https://github.com/jason-crow)
* [Flightradar24 AB](https://www.flightradar24.com)
* [Aleksei Kalmykov](https://github.com/kalmykov)
* [BIT Systems](http://www.caci.com/bit-systems)
* [William Wall](https://github.com/wallw-bits)
* [virtualcitySYSTEMS GmbH](https://www.virtualcitysystems.de)
* [Jannes Bolling](https://github.com/jbo023)

Expand Down
16 changes: 1 addition & 15 deletions Source/Core/sampleTerrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,7 @@ define([
Check.defined('positions', positions);
//>>includeEnd('debug');

var deferred = when.defer();

function doSamplingWhenReady() {
if (terrainProvider.ready) {
when(doSampling(terrainProvider, level, positions), function(updatedPositions) {
deferred.resolve(updatedPositions);
});
} else {
setTimeout(doSamplingWhenReady, 10);
}
}

doSamplingWhenReady();

return deferred.promise;
return terrainProvider.readyPromise.then(function() { return doSampling(terrainProvider, level, positions); });
}

function doSampling(terrainProvider, level, positions) {
Expand Down
13 changes: 13 additions & 0 deletions Source/Scene/ScreenSpaceCameraController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define([
'../Core/destroyObject',
'../Core/DeveloperError',
'../Core/Ellipsoid',
'../Core/HeadingPitchRoll',
'../Core/IntersectionTests',
'../Core/isArray',
'../Core/KeyboardEventModifier',
Expand Down Expand Up @@ -35,6 +36,7 @@ define([
destroyObject,
DeveloperError,
Ellipsoid,
HeadingPitchRoll,
IntersectionTests,
isArray,
KeyboardEventModifier,
Expand Down Expand Up @@ -446,6 +448,9 @@ define([
var scratchCartesian = new Cartesian3();
var scratchCartesianTwo = new Cartesian3();
var scratchCartesianThree = new Cartesian3();
var scratchZoomViewOptions = {
orientation: new HeadingPitchRoll()
};

function handleZoom(object, startPosition, movement, zoomFactor, distanceMeasure, unitPositionDotDirection) {
var percentage = 1.0;
Expand Down Expand Up @@ -485,6 +490,11 @@ define([
var camera = scene.camera;
var mode = scene.mode;

var orientation = scratchZoomViewOptions.orientation;
orientation.heading = camera.heading;
orientation.pitch = camera.pitch;
orientation.roll = camera.roll;

if (camera.frustum instanceof OrthographicFrustum) {
if (Math.abs(distance) > 0.0) {
camera.zoomIn(distance);
Expand Down Expand Up @@ -646,6 +656,7 @@ define([
Cartesian3.cross(camera.direction, camera.up, camera.right);
Cartesian3.cross(camera.right, camera.direction, camera.up);

camera.setView(scratchZoomViewOptions);
return;
}

Expand Down Expand Up @@ -691,6 +702,8 @@ define([
} else {
camera.zoomIn(distance);
}

camera.setView(scratchZoomViewOptions);
}

var translate2DStart = new Ray();
Expand Down
12 changes: 12 additions & 0 deletions Specs/Scene/ScreenSpaceCameraControllerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,19 +849,31 @@ defineSuite([
it('zoom in 3D with wheel', function() {
setUp3D();
var position = Cartesian3.clone(camera.position);
var heading = camera.heading;
var pitch = camera.pitch;
var roll = camera.roll;

simulateMouseWheel(120);
updateController();
expect(Cartesian3.magnitude(position)).toBeGreaterThan(Cartesian3.magnitude(camera.position));
expect(camera.heading).toBeCloseTo(heading, 10);
expect(camera.pitch).toBeCloseTo(pitch, 10);
expect(camera.roll).toBeCloseTo(roll, 10);
});

it('zoom out in 3D with wheel', function() {
setUp3D();
var position = Cartesian3.clone(camera.position);
var heading = camera.heading;
var pitch = camera.pitch;
var roll = camera.roll;

simulateMouseWheel(-120);
updateController();
expect(Cartesian3.magnitude(position)).toBeLessThan(Cartesian3.magnitude(camera.position));
expect(camera.heading).toBeCloseTo(heading, 10);
expect(camera.pitch).toBeCloseTo(pitch, 10);
expect(camera.roll).toBeCloseTo(roll, 10);
});

it('zoom in 3D with orthographic projection', function() {
Expand Down

0 comments on commit d50a63e

Please sign in to comment.