cloneUniforms function

Map<String, dynamic> cloneUniforms(
  1. Map<String, dynamic> src
)

Implementation

Map<String, dynamic> cloneUniforms(Map<String, dynamic> src) {
  final dst = <String, dynamic>{};

  for (final u in src.keys) {
    dst[u] = {};

    for (final p in src[u].keys) {
      final property = src[u][p];

      if (property != null &&
          (property is Color ||
              property is Matrix3 ||
              property is Matrix4 ||
              property is Vector2 ||
              property is Vector3 ||
              property is Vector4 ||
              property is Texture ||
              property is Quaternion)) {
        dst[u][p] = property.clone();
      } else if (property is List) {
        dst[u][p] = property.sublist(0);
      } else {
        dst[u][p] = property;
      }
    }
  }

  return dst;
}