addNodeRef method

void addNodeRef(
  1. Map<String, dynamic> cache,
  2. int? index
)

Counts references to shared node / Object3D resources. These resources can be reused, or "instantiated", at multiple nodes in the scene hierarchy. Mesh, Camera, and Light instances are instantiated and must be marked. Non-scenegraph resources (like Materials, Geometries, and Textures) can be reused directly and are not marked here.

Example: CesiumMilkTruck sample model reuses "Wheel" meshes.

Implementation

void addNodeRef(Map<String,dynamic> cache, int? index) {
  if (index == null) return;

  if (cache["refs"][index] == null) {
    cache["refs"][index] = cache["uses"][index] = 0;
  }

  cache["refs"][index]++;
}