mirror of https://github.com/CesiumGS/cesium.git
Compare commits
3 Commits
d82c456eb8
...
4fdb0c39f2
| Author | SHA1 | Date |
|---|---|---|
|
|
4fdb0c39f2 | |
|
|
e04df47fc6 | |
|
|
26756aa44a |
|
|
@ -47,23 +47,8 @@ function Batch(
|
||||||
this.subscriptions = new AssociativeArray();
|
this.subscriptions = new AssociativeArray();
|
||||||
this.showsUpdated = new AssociativeArray();
|
this.showsUpdated = new AssociativeArray();
|
||||||
this.itemsToRemove = [];
|
this.itemsToRemove = [];
|
||||||
this.invalidated = false;
|
|
||||||
|
|
||||||
let removeMaterialSubscription;
|
|
||||||
if (defined(depthFailMaterialProperty)) {
|
|
||||||
removeMaterialSubscription =
|
|
||||||
depthFailMaterialProperty.definitionChanged.addEventListener(
|
|
||||||
Batch.prototype.onMaterialChanged,
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.removeMaterialSubscription = removeMaterialSubscription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Batch.prototype.onMaterialChanged = function () {
|
|
||||||
this.invalidated = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
Batch.prototype.isMaterial = function (updater) {
|
Batch.prototype.isMaterial = function (updater) {
|
||||||
const material = this.depthFailMaterialProperty;
|
const material = this.depthFailMaterialProperty;
|
||||||
const updaterMaterial = updater.depthFailMaterialProperty;
|
const updaterMaterial = updater.depthFailMaterialProperty;
|
||||||
|
|
@ -391,9 +376,6 @@ Batch.prototype.destroy = function () {
|
||||||
if (defined(oldPrimitive)) {
|
if (defined(oldPrimitive)) {
|
||||||
primitives.remove(oldPrimitive);
|
primitives.remove(oldPrimitive);
|
||||||
}
|
}
|
||||||
if (defined(this.removeMaterialSubscription)) {
|
|
||||||
this.removeMaterialSubscription();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -451,12 +433,9 @@ StaticGeometryColorBatch.prototype.add = function (time, updater) {
|
||||||
function removeItem(items, updater) {
|
function removeItem(items, updater) {
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
for (let i = length - 1; i >= 0; i--) {
|
for (let i = length - 1; i >= 0; i--) {
|
||||||
const item = items[i];
|
if (items[i].remove(updater)) {
|
||||||
if (item.remove(updater)) {
|
// If the item is now empty, delete it (deferred until the next update,
|
||||||
if (item.updaters.length === 0) {
|
// in case a new updater is added to the same item first).
|
||||||
items.splice(i, 1);
|
|
||||||
item.destroy();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -489,26 +468,18 @@ function moveItems(batch, items, time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateItems(batch, items, time, isUpdated) {
|
function updateItems(batch, items, time, isUpdated) {
|
||||||
let length = items.length;
|
for (let i = items.length - 1; i >= 0; i--) {
|
||||||
let i;
|
|
||||||
for (i = length - 1; i >= 0; i--) {
|
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
if (item.invalidated) {
|
if (item.updaters.length === 0) {
|
||||||
items.splice(i, 1);
|
items.splice(i, 1);
|
||||||
const updaters = item.updaters.values;
|
|
||||||
const updatersLength = updaters.length;
|
|
||||||
for (let h = 0; h < updatersLength; h++) {
|
|
||||||
batch.add(time, updaters[h]);
|
|
||||||
}
|
|
||||||
item.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
length = items.length;
|
return items.reduce(
|
||||||
for (i = 0; i < length; ++i) {
|
(isUpdated, item) => isUpdated && item.update(time),
|
||||||
isUpdated = items[i].update(time) && isUpdated;
|
isUpdated,
|
||||||
}
|
);
|
||||||
return isUpdated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticGeometryColorBatch.prototype.update = function (time) {
|
StaticGeometryColorBatch.prototype.update = function (time) {
|
||||||
|
|
|
||||||
|
|
@ -43,20 +43,10 @@ function Batch(
|
||||||
this.depthFailMaterial = undefined;
|
this.depthFailMaterial = undefined;
|
||||||
this.updatersWithAttributes = new AssociativeArray();
|
this.updatersWithAttributes = new AssociativeArray();
|
||||||
this.attributes = new AssociativeArray();
|
this.attributes = new AssociativeArray();
|
||||||
this.invalidated = false;
|
|
||||||
this.removeMaterialSubscription =
|
|
||||||
materialProperty.definitionChanged.addEventListener(
|
|
||||||
Batch.prototype.onMaterialChanged,
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
this.subscriptions = new AssociativeArray();
|
this.subscriptions = new AssociativeArray();
|
||||||
this.showsUpdated = new AssociativeArray();
|
this.showsUpdated = new AssociativeArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
Batch.prototype.onMaterialChanged = function () {
|
|
||||||
this.invalidated = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
Batch.prototype.isMaterial = function (updater) {
|
Batch.prototype.isMaterial = function (updater) {
|
||||||
const material = this.materialProperty;
|
const material = this.materialProperty;
|
||||||
const updaterMaterial = updater.fillMaterialProperty;
|
const updaterMaterial = updater.fillMaterialProperty;
|
||||||
|
|
@ -378,7 +368,6 @@ Batch.prototype.destroy = function () {
|
||||||
if (defined(oldPrimitive)) {
|
if (defined(oldPrimitive)) {
|
||||||
primitives.remove(oldPrimitive);
|
primitives.remove(oldPrimitive);
|
||||||
}
|
}
|
||||||
this.removeMaterialSubscription();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -426,40 +415,30 @@ StaticGeometryPerMaterialBatch.prototype.remove = function (updater) {
|
||||||
const items = this._items;
|
const items = this._items;
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
for (let i = length - 1; i >= 0; i--) {
|
for (let i = length - 1; i >= 0; i--) {
|
||||||
const item = items[i];
|
if (items[i].remove(updater)) {
|
||||||
if (item.remove(updater)) {
|
// If the item is now empty, delete it (deferred until the next update,
|
||||||
if (item.updaters.length === 0) {
|
// in case a new updater is added to the same item first).
|
||||||
items.splice(i, 1);
|
|
||||||
item.destroy();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StaticGeometryPerMaterialBatch.prototype.update = function (time) {
|
StaticGeometryPerMaterialBatch.prototype.update = function (time) {
|
||||||
let i;
|
|
||||||
const items = this._items;
|
const items = this._items;
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
|
|
||||||
for (i = length - 1; i >= 0; i--) {
|
for (let i = length - 1; i >= 0; i--) {
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
if (item.invalidated) {
|
if (item.updaters.length === 0) {
|
||||||
items.splice(i, 1);
|
items.splice(i, 1);
|
||||||
const updaters = item.updaters.values;
|
|
||||||
const updatersLength = updaters.length;
|
|
||||||
for (let h = 0; h < updatersLength; h++) {
|
|
||||||
this.add(time, updaters[h]);
|
|
||||||
}
|
|
||||||
item.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let isUpdated = true;
|
return items.reduce(
|
||||||
for (i = 0; i < items.length; i++) {
|
(isUpdated, item) => isUpdated && item.update(time),
|
||||||
isUpdated = items[i].update(time) && isUpdated;
|
false,
|
||||||
}
|
);
|
||||||
return isUpdated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StaticGeometryPerMaterialBatch.prototype.getBoundingSphere = function (
|
StaticGeometryPerMaterialBatch.prototype.getBoundingSphere = function (
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,6 @@ function Batch(
|
||||||
this.material = undefined;
|
this.material = undefined;
|
||||||
this.updatersWithAttributes = new AssociativeArray();
|
this.updatersWithAttributes = new AssociativeArray();
|
||||||
this.attributes = new AssociativeArray();
|
this.attributes = new AssociativeArray();
|
||||||
this.invalidated = false;
|
|
||||||
this.removeMaterialSubscription =
|
|
||||||
materialProperty.definitionChanged.addEventListener(
|
|
||||||
Batch.prototype.onMaterialChanged,
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
this.subscriptions = new AssociativeArray();
|
this.subscriptions = new AssociativeArray();
|
||||||
this.showsUpdated = new AssociativeArray();
|
this.showsUpdated = new AssociativeArray();
|
||||||
this.zIndex = zIndex;
|
this.zIndex = zIndex;
|
||||||
|
|
@ -57,10 +51,6 @@ function Batch(
|
||||||
this._asynchronous = asynchronous;
|
this._asynchronous = asynchronous;
|
||||||
}
|
}
|
||||||
|
|
||||||
Batch.prototype.onMaterialChanged = function () {
|
|
||||||
this.invalidated = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check if the given updater's material is compatible with this batch
|
// Check if the given updater's material is compatible with this batch
|
||||||
Batch.prototype.isMaterial = function (updater) {
|
Batch.prototype.isMaterial = function (updater) {
|
||||||
const material = this.materialProperty;
|
const material = this.materialProperty;
|
||||||
|
|
@ -325,7 +315,6 @@ Batch.prototype.destroy = function () {
|
||||||
if (defined(oldPrimitive)) {
|
if (defined(oldPrimitive)) {
|
||||||
orderedGroundPrimitives.remove(oldPrimitive);
|
orderedGroundPrimitives.remove(oldPrimitive);
|
||||||
}
|
}
|
||||||
this.removeMaterialSubscription();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -371,12 +360,9 @@ StaticGroundPolylinePerMaterialBatch.prototype.remove = function (updater) {
|
||||||
const items = this._items;
|
const items = this._items;
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
for (let i = length - 1; i >= 0; i--) {
|
for (let i = length - 1; i >= 0; i--) {
|
||||||
const item = items[i];
|
if (items[i].remove(updater)) {
|
||||||
if (item.remove(updater)) {
|
// If the item is now empty, delete it (deferred until the next update,
|
||||||
if (item.updaters.length === 0) {
|
// in case a new updater is added to the same item first).
|
||||||
items.splice(i, 1);
|
|
||||||
item.destroy();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -389,22 +375,16 @@ StaticGroundPolylinePerMaterialBatch.prototype.update = function (time) {
|
||||||
|
|
||||||
for (i = length - 1; i >= 0; i--) {
|
for (i = length - 1; i >= 0; i--) {
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
if (item.invalidated) {
|
if (item.updaters.length === 0) {
|
||||||
items.splice(i, 1);
|
items.splice(i, 1);
|
||||||
const updaters = item.updaters.values;
|
|
||||||
const updatersLength = updaters.length;
|
|
||||||
for (let h = 0; h < updatersLength; h++) {
|
|
||||||
this.add(time, updaters[h]);
|
|
||||||
}
|
|
||||||
item.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let isUpdated = true;
|
return items.reduce(
|
||||||
for (i = 0; i < items.length; i++) {
|
(isUpdated, item) => isUpdated && item.update(time),
|
||||||
isUpdated = items[i].update(time) && isUpdated;
|
false,
|
||||||
}
|
);
|
||||||
return isUpdated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere = function (
|
StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere = function (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue