Skip to content

Commit

Permalink
Merge pull request #2805 from AnalyticalGraphicsInc/issue2803
Browse files Browse the repository at this point in the history
Fix #2803 by restoring some logic lost in #2786.
  • Loading branch information
bagnell committed Jun 12, 2015
2 parents 781907a + 0b63ccf commit c1d67e7
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions Source/DataSources/EntityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ define([
var northUpAxisFactor = 1.25; // times ellipsoid's maximum radius

function updateTransform(that, camera, updateLookAt, saveCamera, positionProperty, time, ellipsoid) {
var mode = that.scene.mode;
var cartesian = positionProperty.getValue(time, that._lastCartesian);
if (defined(cartesian)) {
var hasBasis = false;
var xBasis;
var yBasis;
var zBasis;

var mode = that.scene.mode;
if (mode === SceneMode.SCENE3D) {
// The time delta was determined based on how fast satellites move compared to vehicles near the surface.
// Slower moving vehicles will most likely default to east-north-up, while faster ones will be VVLH.
Expand Down Expand Up @@ -184,7 +184,8 @@ define([
}

if (updateLookAt) {
camera.lookAtTransform(camera.transform, that.scene.mode === SceneMode.SCENE2D ? that._offset2D : that._offset3D);
var offset = (mode === SceneMode.SCENE2D || Cartesian3.equals(that._offset3D, Cartesian3.ZERO)) ? undefined : that._offset3D;
camera.lookAtTransform(camera.transform, offset);
}
}

Expand Down Expand Up @@ -232,10 +233,8 @@ define([

this._lastCartesian = new Cartesian3();
this._defaultOffset3D = undefined;
this._defaultOffset2D = undefined;

this._offset3D = new Cartesian3();
this._offset2D = new HeadingPitchRange();
};

// STATIC properties defined here, not per-instance.
Expand All @@ -252,7 +251,6 @@ define([
},
set : function(vector) {
this._defaultOffset3D = Cartesian3.clone(vector, new Cartesian3());
this._defaultOffset2D = new HeadingPitchRange(0.0, 0.0, Cartesian3.magnitude(this._defaultOffset3D));
}
}
});
Expand Down Expand Up @@ -302,7 +300,6 @@ define([
var sceneModeChanged = sceneMode !== this._mode;

var offset3D = this._offset3D;
var offset2D = this._offset2D;
var camera = scene.camera;

var updateLookAt = objectChanged || sceneModeChanged;
Expand Down Expand Up @@ -334,19 +331,10 @@ define([
updateLookAt = false;
saveCamera = false;
} else if (!hasViewFrom || !defined(viewFromProperty.getValue(time, offset3D))) {
HeadingPitchRange.clone(EntityView._defaultOffset2D, offset2D);
Cartesian3.clone(EntityView._defaultOffset3D, offset3D);
} else {
offset2D.heading = 0.0;
offset2D.range = Cartesian3.magnitude(offset3D);
}
} else if (!sceneModeChanged && scene.mode !== SceneMode.MORPHING) {
if (this._mode === SceneMode.SCENE2D) {
offset2D.heading = camera.heading;
offset2D.range = camera.frustum.right - camera.frustum.left;
} else if (this._mode === SceneMode.SCENE3D || this._mode === SceneMode.COLUMBUS_VIEW) {
Cartesian3.clone(camera.position, offset3D);
}
} else if (!sceneModeChanged && scene.mode !== SceneMode.MORPHING && this._mode !== SceneMode.SCENE2D) {
Cartesian3.clone(camera.position, offset3D);
}

this._lastEntity = entity;
Expand Down

0 comments on commit c1d67e7

Please sign in to comment.