/**
 * Uniform Utilities
 */

var UniformsUtils = {

	merge: function ( uniforms ) {

		var merged = {};

		for ( var u = 0; u < uniforms.length; u ++ ) {

			var tmp = this.clone( uniforms[ u ] );

			for ( var p in tmp ) {

				merged[ p ] = tmp[ p ];

			}

		}

		return merged;

	},

	clone: function ( uniforms_src ) {

		var uniforms_dst = {};

		for ( var u in uniforms_src ) {

			uniforms_dst[ u ] = {};

			for ( var p in uniforms_src[ u ] ) {

				var parameter_src = uniforms_src[ u ][ p ];

				if ( parameter_src && ( parameter_src.isColor ||
					parameter_src.isMatrix3 || parameter_src.isMatrix4 ||
					parameter_src.isVector2 || parameter_src.isVector3 || parameter_src.isVector4 ||
					parameter_src.isTexture ) ) {

					uniforms_dst[ u ][ p ] = parameter_src.clone();

				} else if ( Array.isArray( parameter_src ) ) {

					uniforms_dst[ u ][ p ] = parameter_src.slice();

				} else {

					uniforms_dst[ u ][ p ] = parameter_src;

				}

			}

		}

		return uniforms_dst;

	}

};


export { UniformsUtils };

@@ -407,61 +407,188 @@
 %5D = 
-%7B%7D;%0A%0A%09%09%09for ( var p in uniforms_src%5B u %5D ) %7B%0A%0A%09%09%09%09var
+UniformsUtils.cloneParameters( uniforms_src%5B u %5D );%0A%0A%09%09%7D%0A%0A%09%09return uniforms_dst;%0A%0A%09%7D,%0A%0A%0A%09cloneParameters: function ( parameters_src ) %7B%0A%0A%09%09var parameters_dst = %7B%7D%0A%0A%09%09for ( var p in
  par
@@ -597,42 +597,181 @@
 eter
+s
 _src
+ ) %7B%0A%0A%09%09%09parameters_dst%5B p %5D
  = 
-u
+U
 niforms
+Utils.cloneParameter( parameters
 _src%5B 
-u %5D%5B p %5D;%0A%0A%09%09
+p %5D );%0A%0A%09%09%7D%0A%0A%09%09return parameters_dst;%0A%0A%09%7D,%0A%0A%09cloneParameter: function ( parameter_src ) %7B%0A%0A
 %09%09if
@@ -813,26 +813,24 @@
 .isColor %7C%7C%0A
-%09%09
 %09%09%09parameter
@@ -870,26 +870,24 @@
 sMatrix4 %7C%7C%0A
-%09%09
 %09%09%09parameter
@@ -961,18 +961,16 @@
 4 %7C%7C%0A%09%09%09
-%09%09
 paramete
@@ -999,34 +999,14 @@
 %0A%09%09%09
-%09%09uniforms_dst%5B u %5D%5B p %5D =
+return
  par
@@ -1022,26 +1022,24 @@
 c.clone();%0A%0A
-%09%09
 %09%09%7D else if 
@@ -1083,34 +1083,14 @@
 %0A%09%09%09
-%09%09uniforms_dst%5B u %5D%5B p %5D =
+return
  par
@@ -1110,18 +1110,16 @@
 ice();%0A%0A
-%09%09
 %09%09%7D else
@@ -1129,91 +1129,34 @@
 %0A%09%09%09
-%09%09uniforms_dst%5B u %5D%5B p %5D = parameter_src;%0A%0A%09%09%09%09%7D%0A%0A%09%09%09%7D%0A%0A%09%09%7D%0A%0A%09%09return uniforms_dst;
+return parameter_src;%0A%0A%09%09%7D
 %0A%0A%09%7D

fix uniform utils.