Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fps
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES
  • Loading branch information
shunter committed May 16, 2012
2 parents 56670f0 + 1089174 commit 90a3957
Show file tree
Hide file tree
Showing 84 changed files with 467 additions and 529 deletions.
15 changes: 14 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This is beta software. It is incomplete and subject to change.
What's New
----------

b5 - xxx
b5 - 5/16/2012
---------------
* Breaking changes:
* Renamed Geoscope to Cesium. To update your code, change all Geoscope.*
Expand Down Expand Up @@ -76,6 +76,19 @@ What's New
* Added Shapes.computeEllipseBoundary and updated Shapes.computeCircleBoundary to compute boundaries using arc-distance.
* Added fileExtension and credit properties to OpenStreetMapTileProvider construction.
* Added PerformanceDisplay which can be added to a scene to display frames per second (FPS).
* Ellipsoid.getScaledWgs84() has been removed since it is not needed.
* getXXX() methods which returned a new instance of what should really be a constant are now exposed as frozen properties
instead. This should improve performance and memory pressure.

1. Cartsian2/3/4.getUnitX() -> Cartsian2/3/4.UNIT_X
2. Cartsian2/3/4.getUnitY() -> Cartsian2/3/4.UNIT_Y
3. Cartsian2/3/4.getUnitZ() -> Cartsian3/4.UNIT_Z
4. Cartsian2/3/4.getUnitW() -> Cartsian4.UNIT_W
5. Matrix/2/3/4.getIdentity() -> Matrix/2/3/4.IDENTITY
6. Quaternion.getIdentity() -> Quaternion.IDENTITY
7. Ellipsoid.getWgs84() -> Ellipsoid.WGS84
8. Ellipsoid.getUnitSphere() -> Ellipsoid.UNIT_SPHERE
9. Cartesian2/3/4/Cartographic.getZero() => Cartesian2/3/4/Cartographic.ZERO

b4 - 03/01/2012
---------------
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sandbox/CodeSnippets/Advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Sandbox.CustomRendering = function (scene, ellipsoid, primitives) {
this.code = function () {
Sandbox.ExamplePrimitive = function(position) {
var ellipsoid = Cesium.Ellipsoid.getWgs84();
var ellipsoid = Cesium.Ellipsoid.WGS84;

this._ellipsoid = ellipsoid;
this._va = undefined;
Expand Down
24 changes: 12 additions & 12 deletions Examples/Sandbox/CodeSnippets/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// set a new camera position, in case this example is clicked consecutively.
scene.getCamera().lookAt({
eye : new Cesium.Cartesian3(2203128.2853925996, -7504680.128731707, 5615591.201449535),
target: Cesium.Cartesian3.getZero(),
target: Cesium.Cartesian3.ZERO,
up : new Cesium.Cartesian3(-0.1642824655609347, 0.5596076102188919, 0.8123118822806428)
});
};
Expand All @@ -33,15 +33,15 @@

var spindle = scene.getCamera().getControllers().get(0);
spindle.mouseConstrainedZAxis = true;
spindle.setReferenceFrame(transform, Cesium.Ellipsoid.getUnitSphere());
spindle.setReferenceFrame(transform, Cesium.Ellipsoid.UNIT_SPHERE);

// draw x axis in red
var xAxis = new Cesium.Polyline(undefined);
xAxis.modelMatrix = transform;
xAxis.color = {red : 1.0, green : 0.0, blue : 0.0, alpha : 1.0 };
xAxis.setPositions([
Cesium.Cartesian3.getZero(),
Cesium.Cartesian3.getUnitX().multiplyWithScalar(100000.0)
Cesium.Cartesian3.ZERO,
Cesium.Cartesian3.UNIT_X.multiplyWithScalar(100000.0)
]);
primitives.add(xAxis);

Expand All @@ -50,8 +50,8 @@
yAxis.modelMatrix = transform;
yAxis.color = {red : 0.0, green : 1.0, blue : 0.0, alpha : 1.0 };
yAxis.setPositions([
Cesium.Cartesian3.getZero(),
Cesium.Cartesian3.getUnitY().multiplyWithScalar(100000.0)
Cesium.Cartesian3.ZERO,
Cesium.Cartesian3.UNIT_Y.multiplyWithScalar(100000.0)
]);
primitives.add(yAxis);

Expand All @@ -60,21 +60,21 @@
zAxis.modelMatrix = transform;
zAxis.color = {red : 0.0, green : 0.0, blue : 1.0, alpha : 1.0 };
zAxis.setPositions([
Cesium.Cartesian3.getZero(),
Cesium.Cartesian3.getUnitZ().multiplyWithScalar(100000.0)
Cesium.Cartesian3.ZERO,
Cesium.Cartesian3.UNIT_Z.multiplyWithScalar(100000.0)
]);
primitives.add(zAxis);
};

this.camera = {
eye: new Cesium.Cartesian3(1.0, 1.0, 1.0).normalize().multiplyWithScalar(200000.0),
target: Cesium.Cartesian3.getZero(),
up: Cesium.Cartesian3.getUnitZ()
target: Cesium.Cartesian3.ZERO,
up: Cesium.Cartesian3.UNIT_Z
};

this.clear = function() {
var spindle = scene.getCamera().getControllers().get(0);
spindle.setReferenceFrame(Cesium.Matrix4.getIdentity());
spindle.setReferenceFrame(Cesium.Matrix4.IDENTITY);
spindle.mouseConstrainedZAxis = false;
};
};
Expand Down Expand Up @@ -102,7 +102,7 @@
this.clear = function() {
scene.getCamera().lookAt({
eye : new Cesium.Cartesian3(2203128.2853925996, -7504680.128731707, 5615591.201449535),
target: Cesium.Cartesian3.getZero(),
target: Cesium.Cartesian3.ZERO,
up : new Cesium.Cartesian3(-0.1642824655609347, 0.5596076102188919, 0.8123118822806428)
});
};
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sandbox/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

scene.getCamera().lookAt(currentCodeSnippet.camera || {
eye : new Cesium.Cartesian3(2203128.2853925996, -7504680.128731707, 5615591.201449535),
target : Cesium.Cartesian3.getZero(),
target : Cesium.Cartesian3.ZERO,
up : new Cesium.Cartesian3(-0.1642824655609347, 0.5596076102188919, 0.8123118822806428)
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sandbox/Sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Sandbox = Sandbox || {};
var canvas = document.getElementById("glCanvas");
var scene = new Cesium.Scene(canvas);
var primitives = scene.getPrimitives();
var ellipsoid = Cesium.Ellipsoid.getWgs84();
var ellipsoid = Cesium.Ellipsoid.WGS84;

// TODO: make multiple tile providers available
var bing = new Cesium.BingMapsTileProvider({
Expand Down
2 changes: 1 addition & 1 deletion Examples/Skeleton/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require({ baseUrl : '../../Source' }, [
"use strict";

var canvas = document.getElementById("glCanvas");
var ellipsoid = Ellipsoid.getWgs84(); // Used in many Sandbox examples
var ellipsoid = Ellipsoid.WGS84; // Used in many Sandbox examples
var scene = new Scene(canvas);
var primitives = scene.getPrimitives();

Expand Down
2 changes: 1 addition & 1 deletion Examples/Skeleton2D/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require({ baseUrl : '../../Source' }, [
SceneTransitioner) {
"use strict";

var ellipsoid = Ellipsoid.getWgs84();
var ellipsoid = Ellipsoid.WGS84;

var scene3D = new Scene(document.getElementById("canvas3D"));
var scene2D = new Scene(document.getElementById("canvas2D"));
Expand Down
21 changes: 6 additions & 15 deletions Source/Core/Cartesian2.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,25 @@ define(function() {
};

/**
* Creates a Cartesian2 instance initialized to (0, 0).
* An immutable Cartesian2 instance initialized to (0.0, 0.0).
*
* @memberof Cartesian2
* @return {Cartesian2} A new Cartesian2 instance.
*/
Cartesian2.getZero = function() {
return new Cartesian2(0, 0);
};
Cartesian2.ZERO = Object.freeze(new Cartesian2(0.0, 0.0));

/**
* Creates a Cartesian2 instance initialized to (1, 0).
* An immutable Cartesian2 instance initialized to (1, 0).
*
* @memberof Cartesian2
* @return {Cartesian2} A new Cartesian2 instance.
*/
Cartesian2.getUnitX = function() {
return new Cartesian2(1, 0);
};
Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1.0, 0.0));

/**
* Creates a Cartesian2 instance initialized to (0, 1).
* An immutable Cartesian2 instance initialized to (0.0, 1.0).
*
* @memberof Cartesian2
* @return {Cartesian2} A new Cartesian2 instance.
*/
Cartesian2.getUnitY = function() {
return new Cartesian2(0, 1);
};
Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0.0, 1.0));

/**
* Returns the Cartesian's squared magnitude (length).
Expand Down
34 changes: 11 additions & 23 deletions Source/Core/Cartesian3.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,44 +61,32 @@ define(['./Cartesian2'], function(Cartesian2) {
};

/**
* Creates a Cartesian3 instance initialized to (0, 0, 0).
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
*
* @memberof Cartesian3
* @return {Cartesian3} A new Cartesian3 instance.
*/
Cartesian3.getZero = function() {
return new Cartesian3(0, 0, 0);
};
Cartesian3.ZERO = Object.freeze(new Cartesian3(0.0, 0.0, 0.0));

/**
* Creates a Cartesian3 instance initialized to (1, 0, 0).
* An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
*
* @memberof Cartesian3v
* @return {Cartesian3} A new Cartesian3 instance.
*/
Cartesian3.getUnitX = function() {
return new Cartesian3(1, 0, 0);
};
Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1.0, 0.0, 0.0));

/**
* Creates a Cartesian3 instance initialized to (0, 1, 0).
* An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
*
* @memberof Cartesian3
* @return {Cartesian3} A new Cartesian3 instance.
*/
Cartesian3.getUnitY = function() {
return new Cartesian3(0, 1, 0);
};
Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0.0, 1.0, 0.0));

/**
* Creates a Cartesian3 instance initialized to (0, 0, 1).
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
*
* @memberof Cartesian3
* @return {Cartesian3} A new Cartesian3 instance.
*/
Cartesian3.getUnitZ = function() {
return new Cartesian3(0, 0, 1);
};
Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0.0, 0.0, 1.0));

/**
* Returns a new array, where each {@link Cartesian3}
Expand Down Expand Up @@ -280,11 +268,11 @@ define(['./Cartesian2'], function(Cartesian2) {
var z = Math.abs(this.z);

if ((x < y) && (x < z)) {
return Cartesian3.getUnitX();
return Cartesian3.UNIT_X;
} else if ((y < x) && (y < z)) {
return Cartesian3.getUnitY();
return Cartesian3.UNIT_Y;
} else {
return Cartesian3.getUnitZ();
return Cartesian3.UNIT_Z;
}
};

Expand Down
43 changes: 14 additions & 29 deletions Source/Core/Cartesian4.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,54 +86,39 @@ define([
};

/**
* Creates a Cartesian4 instance initialized to (0, 0, 0, 0).
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
*
* @memberof Cartesian4
* @return {Cartesian4} A new Cartesian4 instance.
*/
Cartesian4.getZero = function() {
return new Cartesian4(0, 0, 0, 0);
};
Cartesian4.ZERO = Object.freeze(new Cartesian4(0.0, 0.0, 0.0, 0.0));

/**
* Creates a Cartesian4 instance initialized to (1, 0, 0, 0).
* An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
*
* @memberof Cartesian4
* @return {Cartesian4} A new Cartesian4 instance.
*/
Cartesian4.getUnitX = function() {
return new Cartesian4(1, 0, 0, 0);
};
Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1.0, 0.0, 0.0, 0.0));

/**
* Creates a Cartesian4 instance initialized to (0, 1, 0, 0).
* An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
*
* @memberof Cartesian4
* @return {Cartesian4} A new Cartesian4 instance.
*/
Cartesian4.getUnitY = function() {
return new Cartesian4(0, 1, 0, 0);
};
Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0.0, 1.0, 0.0, 0.0));

/**
* Creates a Cartesian4 instance initialized to (0, 0, 1, 0).
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
*
* @memberof Cartesian4
* @return {Cartesian4} A new Cartesian4 instance.
*/
Cartesian4.getUnitZ = function() {
return new Cartesian4(0, 0, 1, 0);
};
Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0.0, 0.0, 1.0, 0.0));

/**
* Creates a Cartesian4 instance initialized to (0, 0, 0, 1).
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
*
* @memberof Cartesian4
* @return {Cartesian4} A new Cartesian4 instance.
*/
Cartesian4.getUnitW = function() {
return new Cartesian4(0, 0, 0, 1);
};
Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0.0, 0.0, 0.0, 1.0));

/**
* Returns the Cartesian's x and y components as a Cartesian2.
Expand Down Expand Up @@ -287,13 +272,13 @@ define([
var w = Math.abs(this.w);

if ((x < y) && (x < z) && (x < w)) {
return Cartesian4.getUnitX();
return Cartesian4.UNIT_X;
} else if ((y < x) && (y < z) && (y < w)) {
return Cartesian4.getUnitY();
return Cartesian4.UNIT_Y;
} else if ((z < x) && (z < y) && (z < w)) {
return Cartesian4.getUnitZ();
return Cartesian4.UNIT_Z;
} else {
return Cartesian4.getUnitW();
return Cartesian4.UNIT_W;
}
};

Expand Down
11 changes: 4 additions & 7 deletions Source/Core/Cartographic2.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ define(function() {
}

/**
* Creates a Cartographic2 instance initialized to (0.0, 0.0).
* An immutable Cartographic2 instance initialized to (0.0, 0.0).
*
* @memberof Cartographic2
* @return {Cartographic2} A new Cartographic2 instance.
*/
Cartographic2.getZero = function() {
return new Cartographic2(0.0, 0.0);
};
Cartographic2.ZERO = Object.freeze(new Cartographic2(0.0, 0.0));

/**
* Returns a duplicate of a Cartographic2 instance.
Expand All @@ -69,7 +66,7 @@ define(function() {
* Returns <code>true</code> if this instance equals other.
*
* @memberof Cartographic2
*
*
* @param {Cartographic2} other The cartographic position to compare for equality.
*
* @return {Boolean} <code>true</code> if the positions are equal; otherwise, false.
Expand All @@ -82,7 +79,7 @@ define(function() {
* Returns <code>true</code> if this instance equals other within the specified epsilon.
*
* @memberof Cartographic2
*
*
* @param {Cartographic2} other The cartographic position to compare for equality.
* @param {Number} [epsilon=0.0] The epsilon to use for equality testing.
*
Expand Down
Loading

0 comments on commit 90a3957

Please sign in to comment.