Skip to content

Commit

Permalink
Merge branch 'master' into grid-offset
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.md
  • Loading branch information
bagnell committed Apr 29, 2014
2 parents 0fe2c64 + cdeb6bc commit 80e8765
Show file tree
Hide file tree
Showing 33 changed files with 632 additions and 1,374 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
Sandcastle.highlight(flyToRectangle);
});

Sandcastle.addToolbarButton('View an Rectangle', function() {
Sandcastle.addToolbarButton('View a Rectangle', function() {
reset(scene);
viewAnRectangle(scene);
Sandcastle.highlight(viewAnRectangle);
Expand Down
46 changes: 28 additions & 18 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ Beta Releases
* Renamed and moved `Scene.primitives.centralBody` moved to `Scene.globe`.
* Removed `CesiumWidget.centralBody` and `Viewer.centralBody`. Use `Scene.globe`.
* Renamed `CentralBody` to `Globe`.
* Replaced `Model.computeWorldBoundingSphere` with `Model.boundingSphere`.
* Refactored visualizers, removing `setDynamicObjectCollection`, `getDynamicObjectCollection`, `getScene`, and `removeAllPrimitives` which are all superfluous after the introduction of `DataSourceDisplay`. The affected classes are:
* `DynamicBillboardVisualizer`
* `DynamicConeVisualizerUsingCustomSensor`
* `DynamicLabelVisualizer`
* `DynamicModelVisualizer`
* `DynamicPathVisualizer`
* `DynamicPointVisualizer`
* `DynamicPyramidVisualizer`
* `DynamicVectorVisualizer`
* `GeometryVisualizer`
* Renamed Extent to Rectangle
* `Extent` -> `Rectangle`
* `ExtentGeometry` -> `RectangleGeomtry`
Expand All @@ -26,37 +37,36 @@ Beta Releases
* `TilingScheme.extentToNativeRectangle` -> `TilingScheme.rectangleToNativeRectangle`
* `TilingScheme.tileXYToNativeExtent` -> `TilingScheme.tileXYToNativeRectangle`
* `TilingScheme.tileXYToExtent` -> `TilingScheme.tileXYToRectangle`
* Converted 'DataSource' get methods into properties.
* 'getName` -> `name`
* 'getClock` -> `clock`
* 'getChangedEvent` -> `changedEvent`
* 'getDynamicObjectCollection` -> `dynamicObjects`
* 'getErrorEvent` -> `errorEvent`
* `BaseLayerPicker` has been extended to support terrain selection.
* Converted `DataSource` get methods into properties.
* `getName` -> `name`
* `getClock` -> `clock`
* `getChangedEvent` -> `changedEvent`
* `getDynamicObjectCollection` -> `dynamicObjects`
* `getErrorEvent` -> `errorEvent`
* `BaseLayerPicker` has been extended to support terrain selection ([#1607](https://github.com/AnalyticalGraphicsInc/cesium/pull/1607)).
* The `BaseLayerPicker` constructor function now takes the container element and an options object instead of a CentralBody and ImageryLayerCollection.
* The `BaseLayerPickerViewModel` constructor function now takes an options object instead of a CentralBody and ImageryLayerCollection.
* The `BaseLayerPickerViewModel` constructor function now takes an options object instead of a `CentralBody` and `ImageryLayerCollection`.
* `ImageryProviderViewModel` -> `ProviderViewModel`
* `BaseLayerPickerViewModel.selectedName` -> `BaseLayerPickerViewModel.buttonTooltip`
* `BaseLayerPickerViewModel.selectedIconUrl` -> `BaseLayerPickerViewModel.buttonImageUrl`
* `BaseLayerPickerViewModel.selectedItem` -> `BaseLayerPickerViewModel.selectedImagery`
* `BaseLayerPickerViewModel.imageryLayers`has been removed and replaced with `BaseLayerPickerViewModel.centralBody`
* See [#1607](https://github.com/AnalyticalGraphicsInc/cesium/pull/1607) for full details.
* `TimeIntervalCollection.clear` renamed to `TimeIntervalColection.removeAll`
* Renamed `TimeIntervalCollection.clear` to `TimeIntervalColection.removeAll`
* `Context` is now private
* Removed `Scene.context`: replaced by adding `drawingBufferWidth`, `drawingBufferHeight`, `maximumAliasedLineWidth` properties and `createTextureAtlas` function to `Scene`.
* `Camera` constructor takes `Scene` as parameter instead of `Context`
* Removed `Scene.context`. Instead, use `Scene.drawingBufferWidth`, `Scene.drawingBufferHeight`, `Scene.maximumAliasedLineWidth`, and `Scene.createTextureAtlas`.
* `Billboard.computeScreenSpacePosition`, `Label.computeScreenSpacePosition`, `SceneTransforms.clipToWindowCoordinates` and `SceneTransforms.clipToDrawingBufferCoordinates` take a `Scene` parameter instead of a `Context`.
* Types implementing the `ImageryProvider` interface are now required to have a `hasAlphaChannel` property.
* Removed `checkForChromeFrame` since it is no longer supported by Google. See [Google's official announcement](http://blog.chromium.org/2013/06/retiring-chrome-frame.html).
* Types implementing `DataSource` no longer need to implement `getIsTimeVarying`, since it is no longer needed.
* Replaced `Model.computeWorldBoundingSphere` with `Model.boundingSphere`.
* `Camera` constructor takes `Scene` as parameter instead of `Context`
* Types implementing the `ImageryProvider` interface arenow require a `hasAlphaChannel` property.
* Removed `checkForChromeFrame` since Chrome Frame is no longer supported by Google. See [Google's official announcement](http://blog.chromium.org/2013/06/retiring-chrome-frame.html).
* Types implementing `DataSource` no longer need to implement `getIsTimeVarying`.
* Added a `NavigationHelpButton` widget that, when clicked, displays information about how to navigate around the globe with the mouse. The new button is enabled by default in the `Viewer` widget.
* Added `Model.minimumPixelSize` property so models remain visible when the viewer zooms out.
* Added `DynamicRectangle` to support DataSource provided `RectangleGeometry`.
* Added `DynamicWall` to support DataSource provided `WallGeometry`.
* Improved texture upload performance and reduced memory usage when using `BingMapsImageryProvider` and other imagery providers that return false from `hasAlphaChannel`.
* Added a `NavigationHelpButton` widget that, when clicked, displays information about how to navigate around the globe with the mouse. The new button is enabled by default in the `Viewer` widget.
* Added the ability to offset the grid in the `GridMaterial`.
* `GeometryVisualizer` now creates geometry asynchronously to prevent locking up the browser.
* `Clock.canAnimate` was added to prevent time from advancing, even while the clock is animating.
* Add `Clock.canAnimate` to prevent time from advancing, even while the clock is animating.
* `Viewer` now prevents time from advancing if asynchronous geometry is being processed in order to avoid showing an incomplete picture. This can be disabled via the `Viewer.allowDataSourcesToSuspendAnimation` settings.
* Added `Model.minimumPixelSize` property so models remain visible when the viewer zooms out.
* Added ability to modify glTF material parameters using `Model.getMaterial`, `ModelMaterial`, and `ModelMesh.material`.
Expand Down
1 change: 1 addition & 0 deletions Source/DynamicScene/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ define(['../Core/Cartesian2',

processPacketData(Boolean, model, 'show', modelData.show, interval, sourceUri);
processPacketData(Number, model, 'scale', modelData.scale, interval, sourceUri);
processPacketData(Number, model, 'minimumPixelSize', modelData.minimumPixelSize, interval, sourceUri);
processPacketData(Uri, model, 'uri', modelData.gltf, interval, sourceUri);
}

Expand Down
132 changes: 29 additions & 103 deletions Source/DynamicScene/DynamicBillboardVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ define([
TextureAtlasBuilder) {
"use strict";

//Callback to create a callback so that we close over all of the proper values.
function textureReady(dynamicObject, billboardCollection, textureValue) {
return function(imageIndex) {
//By the time the texture was loaded, the billboard might already be
Expand All @@ -41,83 +40,41 @@ define([
}

/**
* A DynamicObject visualizer which maps the DynamicBillboard instance
* in DynamicObject.billboard to a Billboard primitive.
* A {@link Visualizer} which maps {@link DynamicObject#billboard} to a {@link Billboard}.
* @alias DynamicBillboardVisualizer
* @constructor
*
* @param {Scene} scene The scene the primitives will be rendered in.
* @param {DynamicObjectCollection} [dynamicObjectCollection] The dynamicObjectCollection to visualize.
*
* @see DynamicBillboard
* @see DynamicObject
* @see DynamicObjectCollection
* @see CompositeDynamicObjectCollection
* @see DynamicConeVisualizer
* @see DynamicConeVisualizerUsingCustomSensor
* @see DynamicLabelVisualizer
* @see DynamicPointVisualizer
* @see DynamicPyramidVisualizer
* @param {DynamicObjectCollection} dynamicObjectCollection The dynamicObjectCollection to visualize.
*/
var DynamicBillboardVisualizer = function(scene, dynamicObjectCollection) {
//>>includeStart('debug', pragmas.debug);
if (!defined(scene)) {
throw new DeveloperError('scene is required.');
}
if (!defined(dynamicObjectCollection)) {
throw new DeveloperError('dynamicObjectCollection is required.');
}
//>>includeEnd('debug');

this._scene = scene;
this._unusedIndexes = [];
this._dynamicObjectCollection = undefined;

var billboardCollection = this._billboardCollection = new BillboardCollection();
var atlas = this._textureAtlas = scene.createTextureAtlas();
this._textureAtlasBuilder = new TextureAtlasBuilder(atlas);
var billboardCollection = new BillboardCollection();
var atlas = scene.createTextureAtlas();
billboardCollection.textureAtlas = atlas;
scene.primitives.add(billboardCollection);
this.setDynamicObjectCollection(dynamicObjectCollection);
};

/**
* Returns the scene being used by this visualizer.
*
* @returns {Scene} The scene being used by this visualizer.
*/
DynamicBillboardVisualizer.prototype.getScene = function() {
return this._scene;
};

/**
* Gets the DynamicObjectCollection being visualized.
*
* @returns {DynamicObjectCollection} The DynamicObjectCollection being visualized.
*/
DynamicBillboardVisualizer.prototype.getDynamicObjectCollection = function() {
return this._dynamicObjectCollection;
};
dynamicObjectCollection.collectionChanged.addEventListener(DynamicBillboardVisualizer.prototype._onObjectsRemoved, this);

/**
* Sets the DynamicObjectCollection to visualize.
*
* @param dynamicObjectCollection The DynamicObjectCollection to visualizer.
*/
DynamicBillboardVisualizer.prototype.setDynamicObjectCollection = function(dynamicObjectCollection) {
var oldCollection = this._dynamicObjectCollection;
if (oldCollection !== dynamicObjectCollection) {
if (defined(oldCollection)) {
oldCollection.collectionChanged.removeEventListener(DynamicBillboardVisualizer.prototype._onObjectsRemoved, this);
this.removeAllPrimitives();
}
this._dynamicObjectCollection = dynamicObjectCollection;
if (defined(dynamicObjectCollection)) {
dynamicObjectCollection.collectionChanged.addEventListener(DynamicBillboardVisualizer.prototype._onObjectsRemoved, this);
}
}
this._scene = scene;
this._unusedIndexes = [];
this._textureAtlas = atlas;
this._billboardCollection = billboardCollection;
this._textureAtlasBuilder = new TextureAtlasBuilder(atlas);
this._dynamicObjectCollection = dynamicObjectCollection;
};

/**
* Updates all of the primitives created by this visualizer to match their
* Updates the primitives created by this visualizer to match their
* DynamicObject counterpart at the given time.
* @memberof DynamicBillboardVisualizer
*
* @param {JulianDate} time The time to update to.
* @returns {Boolean} This function always returns true.
Expand All @@ -129,66 +86,36 @@ define([
}
//>>includeEnd('debug');

if (defined(this._dynamicObjectCollection)) {
var dynamicObjects = this._dynamicObjectCollection.getObjects();
for ( var i = 0, len = dynamicObjects.length; i < len; i++) {
updateObject(this, time, dynamicObjects[i]);
}
var dynamicObjects = this._dynamicObjectCollection.getObjects();
for (var i = 0, len = dynamicObjects.length; i < len; i++) {
updateObject(this, time, dynamicObjects[i]);
}
return true;
};

/**
* Removes all primitives from the scene.
*/
DynamicBillboardVisualizer.prototype.removeAllPrimitives = function() {
if (defined(this._dynamicObjectCollection)) {
this._unusedIndexes = [];
this._billboardCollection.removeAll();
var dynamicObjects = this._dynamicObjectCollection.getObjects();
for ( var i = dynamicObjects.length - 1; i > -1; i--) {
dynamicObjects[i]._billboardVisualizerIndex = undefined;
}
}
};

/**
* Returns true if this object was destroyed; otherwise, false.
* <br /><br />
* If this object was destroyed, it should not be used; calling any function other than
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
*
* @memberof DynamicBillboardVisualizer
*
* @returns {Boolean} True if this object was destroyed; otherwise, false.
*
* @see DynamicBillboardVisualizer#destroy
*/
DynamicBillboardVisualizer.prototype.isDestroyed = function() {
return false;
};

/**
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
* <br /><br />
* Once an object is destroyed, it should not be used; calling any function other than
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
* assign the return value (<code>undefined</code>) to the object as done in the example.
*
* Removes and destroys all primitives created by this instance.
* @memberof DynamicBillboardVisualizer
*
* @returns {undefined}
*
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
*
* @see DynamicBillboardVisualizer#isDestroyed
*
* @example
* visualizer = visualizer && visualizer.destroy();
*/
DynamicBillboardVisualizer.prototype.destroy = function() {
this.setDynamicObjectCollection(undefined);
var dynamicObjectCollection = this._dynamicObjectCollection;
dynamicObjectCollection.collectionChanged.removeEventListener(DynamicBillboardVisualizer.prototype._onObjectsRemoved, this);

var dynamicObjects = dynamicObjectCollection.getObjects();
var length = dynamicObjects.length;
for (var i = 0; i < length; i++) {
dynamicObjects[i]._billboardVisualizerIndex = undefined;
}
this._scene.primitives.remove(this._billboardCollection);
return destroyObject(this);
};
Expand Down Expand Up @@ -247,7 +174,6 @@ define([
billboard._visualizerUrl = undefined;
billboard._visualizerTextureAvailable = false;

// CZML_TODO Determine official defaults
billboard.color = Color.WHITE;
billboard.eyeOffset = Cartesian3.ZERO;
billboard.pixelOffset = Cartesian2.ZERO;
Expand Down Expand Up @@ -369,7 +295,7 @@ define([
DynamicBillboardVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, added, dynamicObjects) {
var thisBillboardCollection = this._billboardCollection;
var thisUnusedIndexes = this._unusedIndexes;
for ( var i = dynamicObjects.length - 1; i > -1; i--) {
for (var i = dynamicObjects.length - 1; i > -1; i--) {
var dynamicObject = dynamicObjects[i];
var billboardVisualizerIndex = dynamicObject._billboardVisualizerIndex;
if (defined(billboardVisualizerIndex)) {
Expand Down
Loading

0 comments on commit 80e8765

Please sign in to comment.