endFrame method
void
endFrame()
A frame has been drawn: now and then, lets go of what has not been used for keepFrames frames and is not inUse.
Implementation
void endFrame() {
_frame++;
if (_frame % 120 != 0) return;
final old = _frame - keepFrames;
final live = Set<Object>.identity()..addAll(inUse?.call() ?? const []);
_meshes.removeWhere((_, e) => e.used < old && !live.contains(e.value));
_materials.removeWhere((_, e) => e.used < old && !live.contains(e.value));
// What a kept material shows stays, so it can be reloaded.
final textured = {for (final m in _materials.values) m.texture};
_textures.removeWhere(
(path, t) => t.texture != null && !textured.contains(path),
);
}