AnalyticalGraphicsInc/cesium — pull request #1959 by shunter (2014-07-24 20:44:36+00:00)
Title: Texture atlas changes

NOTE: This is a pull request into the existing texture-atlas pull request branch.

These changes attempt to unify the API for billboard images even further. `TextureAtlas` (now an implementation detail) returns a promise for an image index, allowing a single code path for loaded `Image`, remote image URL, function, etc.

`Billboard.image` mirrors that single code path. `image` can be set to a loaded `Image` (or a `Canvas` or other texture-able object which WebGL calls a `TexImageSource`), or a string, which will be loaded as an image asynchronously.

In more advanced situations, users can use `setImage` which requires both an `id` and an image source. The image source is only evaluated if a texture with the given `id` is not already loaded. We use this in `PointVisualizer` to dynamically draw points, but only if not already drawn.

The constructor options now no longer distinguish `imageUrl` and `getImageCallback` from `image`. `imageId` is still useful for the function and canvas case, but the common case omits it. `imageSubRegion` is still available to create billboards using a pre-made atlas image, which is used in one of the Sandcastle examples.