remove method
Removes an arbitrary number of objects from this AnimationObjectGroup
.
Implementation
void remove(List<Mesh> items) {
final objects = _objects,
indicesByUUID = _indicesByUUID,
bindings = _bindings,
nBindings = bindings.length;
int nCachedObjects = nCachedObjects_;
for (int i = 0, n = items.length; i != n; ++i) {
final object = items[i], uuid = object.uuid, index = indicesByUUID[uuid];
if (index != null && index >= nCachedObjects) {
// move existing object into the CACHED region
final lastCachedIndex = nCachedObjects++,
firstActiveObject = objects[lastCachedIndex];
indicesByUUID[firstActiveObject.uuid] = index;
objects[index] = firstActiveObject;
indicesByUUID[uuid] = lastCachedIndex;
objects[lastCachedIndex] = object;
// accounting is done, now do the same for all bindings
for (int j = 0, m = nBindings; j != m; ++j) {
final bindingsForPath = bindings[j],
firstActive = bindingsForPath[lastCachedIndex],
binding = bindingsForPath[index];
bindingsForPath[index] = firstActive;
bindingsForPath[lastCachedIndex] = binding;
}
}
} // for arguments
nCachedObjects_ = nCachedObjects;
}