onGeometryDispose method

void onGeometryDispose(
  1. Event event
)

Implementation

void onGeometryDispose(Event event) {
  var geometry = event.target;

  if (geometry.index != null) {
    attributes.remove(geometry.index);
  }

  for (var name in geometry.attributes.keys) {
    attributes.remove(geometry.attributes[name]);
  }

  geometry.removeEventListener('dispose', onGeometryDispose);

  geometries.remove(geometry.id);

  var attribute = wireframeAttributes.get(geometry);

  if (attribute != null) {
    attributes.remove(attribute);
    wireframeAttributes.delete(geometry);
  }

  bindingStates.releaseStatesOfGeometry(geometry);

  if (geometry is InstancedBufferGeometry) {
    // geometry.remove("maxInstanceCount");
    geometry.maxInstanceCount = null;
  }

  //

  info.memory["geometries"] = info.memory["geometries"]! - 1;
}