Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/engine/Source/DataSources/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function createPropertyTypeDescriptor(name, Type) {
* @property {PolylineVolumeGraphics | PolylineVolumeGraphics.ConstructorOptions} [polylineVolume] A polylineVolume to associate with this entity.
* @property {RectangleGraphics | RectangleGraphics.ConstructorOptions} [rectangle] A rectangle to associate with this entity.
* @property {WallGraphics | WallGraphics.ConstructorOptions} [wall] A wall to associate with this entity.
* @property {boolean} [asynchronous=true] Determines if the underlying primitives will be created asynchronously or block until ready.
*/

/**
Expand All @@ -121,6 +122,7 @@ function Entity(options) {

this._availability = undefined;
this._id = id;
this._asynchronous = options.asynchronous ?? true;
this._definitionChanged = new Event();
this._name = options.name;
this._show = options.show ?? true;
Expand Down Expand Up @@ -249,6 +251,16 @@ Object.defineProperties(Entity.prototype, {
return this._id;
},
},
/**
* Gets whether the underlying primitives should be created asynchronously or block until ready.
* @memberof Entity.prototype
* @type {boolean}
*/
asynchronous: {
get: function () {
return this._asynchronous;
},
},
/**
* Gets the event that is raised whenever a property or sub-property is changed or modified.
* @memberof Entity.prototype
Expand Down
14 changes: 14 additions & 0 deletions packages/engine/Source/DataSources/GeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function GeometryUpdater(options) {
const geometryPropertyName = options.geometryPropertyName;

this._entity = entity;
this._asynchronous = entity.asynchronous;
this._scene = options.scene;
this._fillEnabled = false;
this._isClosed = false;
Expand Down Expand Up @@ -242,6 +243,19 @@ Object.defineProperties(GeometryUpdater.prototype, {
return this._dynamic;
},
},
/**
* Gets a value indicating if the geometry should be created asynchronously
*
* @memberof GeometryUpdater.prototype
*
* @type {boolean}
* @readonly
*/
asynchronous: {
get: function () {
return this._asynchronous;
},
},
/**
* Gets a value indicating if the geometry is closed.
* This property is only valid for static geometry.
Expand Down
10 changes: 8 additions & 2 deletions packages/engine/Source/DataSources/StaticGeometryColorBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function Batch(
depthFailMaterialProperty,
closed,
shadows,
asynchronous,
) {
this.translucent = translucent;
this.appearanceType = appearanceType;
Expand All @@ -48,6 +49,7 @@ function Batch(
this.showsUpdated = new AssociativeArray();
this.itemsToRemove = [];
this.invalidated = false;
this.asynchronous = asynchronous ?? true;

let removeMaterialSubscription;
if (defined(depthFailMaterialProperty)) {
Expand Down Expand Up @@ -156,7 +158,7 @@ Batch.prototype.update = function (time) {

primitive = new Primitive({
show: false,
asynchronous: true,
asynchronous: this.asynchronous,
geometryInstances: geometries.slice(),
appearance: new this.appearanceType({
translucent: this.translucent,
Expand Down Expand Up @@ -430,7 +432,10 @@ StaticGeometryColorBatch.prototype.add = function (time, updater) {
const length = items.length;
for (let i = 0; i < length; i++) {
const item = items[i];
if (item.isMaterial(updater)) {
if (
item.isMaterial(updater) &&
item.asynchronous === updater.asynchronous
) {
item.add(updater, instance);
return;
}
Expand All @@ -443,6 +448,7 @@ StaticGeometryColorBatch.prototype.add = function (time, updater) {
updater.depthFailMaterialProperty,
this._closed,
this._shadows,
updater.asynchronous,
);
batch.add(updater, instance);
items.push(batch);
Expand Down