cloneUniforms function
Uniform Utilities
Implementation
Map<String, dynamic> cloneUniforms(Map<String, dynamic> src) {
var dst = <String, dynamic>{};
for (var u in src.keys) {
dst[u] = {};
for (var p in src[u].keys) {
var property = src[u][p];
if (property != null &&
(property.runtimeType == Color ||
property.runtimeType == Matrix3 ||
property.runtimeType == Matrix4 ||
property.runtimeType == Vector2 ||
property.runtimeType == Vector3 ||
property.runtimeType == Vector4 ||
property.runtimeType == Texture ||
property.runtimeType == Quaternion)) {
dst[u][p] = property.clone();
} else if (property is List) {
dst[u][p] = property.sublist(0);
} else {
dst[u][p] = property;
}
}
}
return dst;
}