Skip to content

Commit

Permalink
Remove the create*Geometry workers. Require geometries to implement p…
Browse files Browse the repository at this point in the history
…ackable and have a createGeometry function.
  • Loading branch information
bagnell committed Jan 5, 2015
1 parent e5d3f39 commit 4073f38
Show file tree
Hide file tree
Showing 50 changed files with 63 additions and 558 deletions.
5 changes: 2 additions & 3 deletions Source/Core/BoxGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define([
* });
* var geometry = Cesium.BoxGeometry.createGeometry(box);
*/
var BoxGeometry = function(options) {
function BoxGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var min = options.minimumCorner;
var max = options.maximumCorner;
Expand All @@ -71,8 +71,7 @@ define([
this._minimumCorner = Cartesian3.clone(min);
this._maximumCorner = Cartesian3.clone(max);
this._vertexFormat = vertexFormat;
this._workerName = 'createBoxGeometry';
};
}

/**
* Creates a cube centered at the origin given its dimensions.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/BoxOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define([
* });
* var geometry = Cesium.BoxOutlineGeometry.createGeometry(box);
*/
var BoxOutlineGeometry = function(options) {
function BoxOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var min = options.minimumCorner;
Expand All @@ -64,8 +64,7 @@ define([

this._min = Cartesian3.clone(min);
this._max = Cartesian3.clone(max);
this._workerName = 'createBoxOutlineGeometry';
};
}

/**
* Creates an outline of a cube centered at the origin given its dimensions.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CircleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define([
* });
* var geometry = Cesium.CircleGeometry.createGeometry(circle);
*/
var CircleGeometry = function(options) {
function CircleGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var radius = options.radius;

Expand All @@ -74,8 +74,7 @@ define([
stRotation : options.stRotation
};
this._ellipseGeometry = new EllipseGeometry(ellipseGeometryOptions);
this._workerName = 'createCircleGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CircleOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define([
* });
* var geometry = Cesium.CircleOutlineGeometry.createGeometry(circle);
*/
var CircleOutlineGeometry = function(options) {
function CircleOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var radius = options.radius;

Expand All @@ -70,8 +70,7 @@ define([
numberOfVerticalLines : options.numberOfVerticalLines
};
this._ellipseGeometry = new EllipseOutlineGeometry(ellipseGeometryOptions);
this._workerName = 'createCircleOutlineGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ define([
* width : 100000
* });
*/
var CorridorGeometry = function(options) {
function CorridorGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var positions = options.positions;
var width = options.width;
Expand All @@ -670,14 +670,13 @@ define([
this._extrudedHeight = defaultValue(options.extrudedHeight, this._height);
this._cornerType = defaultValue(options.cornerType, CornerType.ROUNDED);
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
this._workerName = 'createCorridorGeometry';

/**
* The number of elements used to pack the object into an array.
* @type {Number}
*/
this.packedLength = 1 + positions.length * Cartesian3.packedLength + Ellipsoid.packedLength + VertexFormat.packedLength + 5;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CorridorOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ define([
* width : 100000
* });
*/
var CorridorOutlineGeometry = function(options) {
function CorridorOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var positions = options.positions;
var width = options.width;
Expand All @@ -346,14 +346,13 @@ define([
this._extrudedHeight = defaultValue(options.extrudedHeight, this._height);
this._cornerType = defaultValue(options.cornerType, CornerType.ROUNDED);
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
this._workerName = 'createCorridorOutlineGeometry';

/**
* The number of elements used to pack the object into an array.
* @type {Number}
*/
this.packedLength = 1 + positions.length * Cartesian3.packedLength + Ellipsoid.packedLength + 5;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CylinderGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define([
* });
* var geometry = Cesium.CylinderGeometry.createGeometry(cylinder);
*/
var CylinderGeometry = function(options) {
function CylinderGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var length = options.length;
Expand Down Expand Up @@ -104,8 +104,7 @@ define([
this._bottomRadius = bottomRadius;
this._vertexFormat = VertexFormat.clone(vertexFormat);
this._slices = slices;
this._workerName = 'createCylinderGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/CylinderOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ define([
* });
* var geometry = Cesium.CylinderOutlineGeometry.createGeometry(cylinder);
*/
var CylinderOutlineGeometry = function(options) {
function CylinderOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var length = options.length;
Expand Down Expand Up @@ -95,8 +95,7 @@ define([
this._bottomRadius = bottomRadius;
this._slices = slices;
this._numberOfVerticalLines = numberOfVerticalLines;
this._workerName = 'createCylinderOutlineGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/EllipseGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ define([
* });
* var geometry = Cesium.EllipseGeometry.createGeometry(ellipse);
*/
var EllipseGeometry = function(options) {
function EllipseGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var center = options.center;
Expand Down Expand Up @@ -631,8 +631,7 @@ define([
this._vertexFormat = VertexFormat.clone(vertexFormat);
this._extrudedHeight = defaultValue(extrudedHeight, height);
this._extrude = extrude;
this._workerName = 'createEllipseGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/EllipseOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ define([
* });
* var geometry = Cesium.EllipseOutlineGeometry.createGeometry(ellipse);
*/
var EllipseOutlineGeometry = function(options) {
function EllipseOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var center = options.center;
Expand Down Expand Up @@ -204,8 +204,7 @@ define([
this._extrudedHeight = defaultValue(extrudedHeight, 0.0);
this._extrude = extrude;
this._numberOfVerticalLines = Math.max(defaultValue(options.numberOfVerticalLines, 16), 0);
this._workerName = 'createEllipseOutlineGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/EllipsoidGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ define([
* });
* var geometry = Cesium.EllipsoidGeometry.createGeometry(ellipsoid);
*/
var EllipsoidGeometry = function(options) {
function EllipsoidGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var radii = defaultValue(options.radii, defaultRadii);
Expand All @@ -90,8 +90,7 @@ define([
this._stackPartitions = stackPartitions;
this._slicePartitions = slicePartitions;
this._vertexFormat = VertexFormat.clone(vertexFormat);
this._workerName = 'createEllipsoidGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/EllipsoidOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define([
* });
* var geometry = Cesium.EllipsoidOutlineGeometry.createGeometry(ellipsoid);
*/
var EllipsoidOutlineGeometry = function(options) {
function EllipsoidOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var radii = defaultValue(options.radii, defaultRadii);
Expand All @@ -83,8 +83,7 @@ define([
this._stackPartitions = stackPartitions;
this._slicePartitions = slicePartitions;
this._subdivisions = subdivisions;
this._workerName = 'createEllipsoidOutlineGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/PolygonGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ define([
* });
* var geometry = Cesium.PolygonGeometry.createGeometry(extrudedPolygon);
*/
var PolygonGeometry = function(options) {
function PolygonGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var vertexFormat = defaultValue(options.vertexFormat, VertexFormat.DEFAULT);
Expand Down Expand Up @@ -637,14 +637,13 @@ define([
this._extrude = extrude;
this._polygonHierarchy = polygonHierarchy;
this._perPositionHeight = perPositionHeight;
this._workerName = 'createPolygonGeometry';

/**
* The number of elements used to pack the object into an array.
* @type {Number}
*/
this.packedLength = PolygonGeometryLibrary.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid.packedLength + VertexFormat.packedLength + 6;
};
}

/**
* A description of a polygon from an array of positions.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/PolygonOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ define([
* });
* var geometry = Cesium.PolygonOutlineGeometry.createGeometry(extrudedPolygon);
*/
var PolygonOutlineGeometry = function(options) {
function PolygonOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
Expand Down Expand Up @@ -328,14 +328,13 @@ define([
this._extrude = extrude;
this._polygonHierarchy = polygonHierarchy;
this._perPositionHeight = perPositionHeight;
this._workerName = 'createPolygonOutlineGeometry';

/**
* The number of elements used to pack the object into an array.
* @type {Number}
*/
this.packedLength = PolygonGeometryLibrary.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid.packedLength + 5;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/PolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ define([
* });
* var geometry = Cesium.PolylineGeometry.createGeometry(polyline);
*/
var PolylineGeometry = function(options) {
function PolylineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var positions = options.positions;
var colors = options.colors;
Expand All @@ -137,7 +137,6 @@ define([
this._followSurface = defaultValue(options.followSurface, true);
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
this._ellipsoid = Ellipsoid.clone(defaultValue(options.ellipsoid, Ellipsoid.WGS84));
this._workerName = 'createPolylineGeometry';

var numComponents = 1 + positions.length * Cartesian3.packedLength;
numComponents += defined(colors) ? 1 + colors.length * Color.packedLength : 1;
Expand All @@ -147,7 +146,7 @@ define([
* @type {Number}
*/
this.packedLength = numComponents + Ellipsoid.packedLength + VertexFormat.packedLength + 4;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/PolylineVolumeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ define([
* shapePositions : computeCircle(100000.0)
* });
*/
var PolylineVolumeGeometry = function(options) {
function PolylineVolumeGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var positions = options.polylinePositions;
var shape = options.shapePositions;
Expand All @@ -233,7 +233,6 @@ define([
this._cornerType = defaultValue(options.cornerType, CornerType.ROUNDED);
this._vertexFormat = VertexFormat.clone(defaultValue(options.vertexFormat, VertexFormat.DEFAULT));
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
this._workerName = 'createPolylineVolumeGeometry';

var numComponents = 1 + positions.length * Cartesian3.packedLength;
numComponents += 1 + shape.length * Cartesian2.packedLength;
Expand All @@ -243,7 +242,7 @@ define([
* @type {Number}
*/
this.packedLength = numComponents + Ellipsoid.packedLength + VertexFormat.packedLength + 2;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/PolylineVolumeOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ define([
* shapePositions : computeCircle(100000.0)
* });
*/
var PolylineVolumeOutlineGeometry = function(options) {
function PolylineVolumeOutlineGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var positions = options.polylinePositions;
var shape = options.shapePositions;
Expand All @@ -147,7 +147,6 @@ define([
this._ellipsoid = Ellipsoid.clone(defaultValue(options.ellipsoid, Ellipsoid.WGS84));
this._cornerType = defaultValue(options.cornerType, CornerType.ROUNDED);
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
this._workerName = 'createPolylineVolumeOutlineGeometry';

var numComponents = 1 + positions.length * Cartesian3.packedLength;
numComponents += 1 + shape.length * Cartesian2.packedLength;
Expand All @@ -157,7 +156,7 @@ define([
* @type {Number}
*/
this.packedLength = numComponents + Ellipsoid.packedLength + 2;
};
}

/**
* Stores the provided instance into the provided array.
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/RectangleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ define([
* });
* var geometry = Cesium.RectangleGeometry.createGeometry(rectangle);
*/
var RectangleGeometry = function(options) {
function RectangleGeometry(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var rectangle = options.rectangle;
Expand Down Expand Up @@ -579,8 +579,7 @@ define([
this._extrude = extrude;
this._closeTop = closeTop;
this._closeBottom = closeBottom;
this._workerName = 'createRectangleGeometry';
};
}

/**
* The number of elements used to pack the object into an array.
Expand Down
Loading

0 comments on commit 4073f38

Please sign in to comment.