onGeometryDispose method

void onGeometryDispose(
  1. Event event
)

Implementation

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

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

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

  geometry.removeEventListener('dispose', onGeometryDispose);

  geometries.remove(geometry.id);

  final 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;
}