clone method

Mesh clone()

Returns a shallow copy: a new Mesh with new MeshPrimitives that reuse this mesh's Geometry and Material instances.

The heavy GPU resources (geometry buffers, textures) stay shared, but the new primitives are independent slots, so reassigning a clone's primitive.material does not affect the original or sibling clones. Used by Node.clone so model instances can be reskinned per instance.

Implementation

Mesh clone() => Mesh.primitives(
  primitives: [
    for (final p in primitives) MeshPrimitive(p.geometry, p.material),
  ],
);