BillboardVisualizer.prototype.update = function(time) {
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
var items = this._items.values;
var cluster = this._cluster;
for (var i = 0, len = items.length; i < len; i++) {
var item = items[i];
var entity = item.entity;
var billboardGraphics = entity._billboard;
var textureValue;
var billboard = item.billboard;
var show = entity.isShowing && entity.isAvailable(time) && Property.getValueOrDefault(billboardGraphics._show, time, true);
if (show) {
position = Property.getValueOrUndefined(entity._position, time, position);
textureValue = Property.getValueOrUndefined(billboardGraphics._image, time);
show = defined(position) && defined(textureValue);
}
if (!show) {
//don't bother creating or updating anything else
returnPrimitive(item, entity, cluster);
continue;
}
if (!Property.isConstant(entity._position)) {
cluster._clusterDirty = true;
}
if (!defined(billboard)) {
billboard = cluster.getBillboard(entity);
billboard.id = entity;
billboard.image = undefined;
item.billboard = billboard;
}
billboard.show = show;
if (!defined(billboard.image) || item.textureValue !== textureValue) {
billboard.image = textureValue;
item.textureValue = textureValue;
}
billboard.position = position;
billboard.color = Property.getValueOrDefault(billboardGraphics._color, time, defaultColor, color);
billboard.eyeOffset = Property.getValueOrDefault(billboardGraphics._eyeOffset, time, defaultEyeOffset, eyeOffset);
billboard.heightReference = Property.getValueOrDefault(billboardGraphics._heightReference, time, defaultHeightReference);
billboard.pixelOffset = Property.getValueOrDefault(billboardGraphics._pixelOffset, time, defaultPixelOffset, pixelOffset);
billboard.scale = Property.getValueOrDefault(billboardGraphics._scale, time, defaultScale);
billboard.rotation = Property.getValueOrDefault(billboardGraphics._rotation, time, defaultRotation);
billboard.alignedAxis = Property.getValueOrDefault(billboardGraphics._alignedAxis, time, defaultAlignedAxis);
billboard.horizontalOrigin = Property.getValueOrDefault(billboardGraphics._horizontalOrigin, time, defaultHorizontalOrigin);
billboard.verticalOrigin = Property.getValueOrDefault(billboardGraphics._verticalOrigin, time, defaultVerticalOrigin);
billboard.width = Property.getValueOrUndefined(billboardGraphics._width, time);
billboard.height = Property.getValueOrUndefined(billboardGraphics._height, time);
billboard.scaleByDistance = Property.getValueOrUndefined(billboardGraphics._scaleByDistance, time, scaleByDistance);
billboard.translucencyByDistance = Property.getValueOrUndefined(billboardGraphics._translucencyByDistance, time, translucencyByDistance);
billboard.pixelOffsetScaleByDistance = Property.getValueOrUndefined(billboardGraphics._pixelOffsetScaleByDistance, time, pixelOffsetScaleByDistance);
billboard.sizeInMeters = Property.getValueOrDefault(billboardGraphics._sizeInMeters, defaultSizeInMeters);
billboard.distanceDisplayCondition = Property.getValueOrUndefined(billboardGraphics._distanceDisplayCondition, time, distanceDisplayCondition);
billboard.isDynamic = Property.getValueOrDefault(billboardGraphics._isDynamic, time, defaultIsDynamic);
var subRegion = Property.getValueOrUndefined(billboardGraphics._imageSubRegion, time, boundingRectangle);
if (defined(subRegion)) {
billboard.setImageSubRegion(billboard._imageId, subRegion);
}
}
return true;
};