BillboardCollection update issue

I have a BillboardCollection where one of the billboards was removed prior to the texture atlas ever being created, so BillboardCollection.update is failing when it tries to load the image for the removed billboard.

I was able to fix the issue by moving the “removeBillboards” call to above the texture atlas creation step. I’m not sure if I’m doing something unsupported so I didn’t submit a pull request, but I figured I’d report the issue. Here’s the update to the function:

BillboardCollection.prototype.update = function(context, frameState, commandList) {
    removeBillboards(this);

    var billboards = this._billboards;
    var billboardsLength = billboards.length;

    var textureAtlas = this._textureAtlas;
    if (!defined(textureAtlas)) {
        textureAtlas = this._textureAtlas = new TextureAtlas({
            context : context
        });

        for (var ii = 0; ii < billboardsLength; ++ii) {
            billboards[ii]._loadImage();
        }
    }

    var textureAtlasCoordinates = textureAtlas.textureCoordinates;
    if (textureAtlasCoordinates.length === 0) {
        // Can't write billboard vertices until we have texture coordinates
        // provided by a texture atlas
        return;
    }

    updateMode(this, frameState);

``

Thanks for the report. It certainly sounds like a bug, I’ll look more into it and let you know what I find.

Yep, this was definitely a bug. I opened a PR to fix it. Thanks again: https://github.com/AnalyticalGraphicsInc/cesium/pull/2630