Explorar o código

Changed the rest of the lib and examples to use auto-texture units.

All examples should work now.

The only weird thing seems to be that for some reason bone texture doesn't like to be assigned to arbitrary texture unit (or more precisely to alternating texture units).

See #2340
alteredq %!s(int64=13) %!d(string=hai) anos
pai
achega
013f3b375e
Modificáronse 55 ficheiros con 291 adicións e 288 borrados
  1. 58 55
      build/three.js
  2. 32 32
      build/three.min.js
  3. 27 27
      examples/js/ShaderExtras.js
  4. 3 6
      examples/js/ShaderGodRays.js
  5. 11 11
      examples/js/ShaderSkin.js
  6. 6 6
      examples/js/ShaderTerrain.js
  7. 4 4
      examples/js/effects/AnaglyphEffect.js
  8. 4 4
      examples/js/effects/ParallaxBarrierEffect.js
  9. 3 3
      examples/js/postprocessing/BloomPass.js
  10. 1 1
      examples/js/postprocessing/DotScreenPass.js
  11. 1 1
      examples/js/postprocessing/FilmPass.js
  12. 1 1
      examples/js/postprocessing/SavePass.js
  13. 1 1
      examples/js/postprocessing/ShaderPass.js
  14. 1 1
      examples/js/postprocessing/TexturePass.js
  15. 3 3
      examples/misc_camera_fly.html
  16. 2 2
      examples/webgl_custom_attributes.html
  17. 1 1
      examples/webgl_custom_attributes_particles.html
  18. 2 2
      examples/webgl_custom_attributes_particles2.html
  19. 2 2
      examples/webgl_custom_attributes_particles3.html
  20. 1 1
      examples/webgl_hdr.html
  21. 1 1
      examples/webgl_kinect.html
  22. 3 3
      examples/webgl_loader_ctm.html
  23. 1 1
      examples/webgl_loader_ctm_materials.html
  24. 4 4
      examples/webgl_materials_bumpmap_skin.html
  25. 1 1
      examples/webgl_materials_cars.html
  26. 1 1
      examples/webgl_materials_cars_anaglyph.html
  27. 1 1
      examples/webgl_materials_cars_parallaxbarrier.html
  28. 1 1
      examples/webgl_materials_cubemap.html
  29. 1 1
      examples/webgl_materials_cubemap_balls_reflection.html
  30. 1 1
      examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
  31. 1 1
      examples/webgl_materials_cubemap_balls_refraction.html
  32. 1 1
      examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
  33. 1 1
      examples/webgl_materials_cubemap_dynamic.html
  34. 1 1
      examples/webgl_materials_cubemap_escher.html
  35. 1 1
      examples/webgl_materials_cubemap_refraction.html
  36. 4 4
      examples/webgl_materials_normalmap.html
  37. 3 3
      examples/webgl_materials_normalmap2.html
  38. 2 2
      examples/webgl_materials_shaders_fresnel.html
  39. 9 9
      examples/webgl_materials_skin.html
  40. 1 1
      examples/webgl_particles_shapes.html
  41. 4 4
      examples/webgl_postprocessing.html
  42. 2 2
      examples/webgl_postprocessing_dof.html
  43. 5 5
      examples/webgl_postprocessing_godrays.html
  44. 1 1
      examples/webgl_rtt.html
  45. 3 3
      examples/webgl_shader2.html
  46. 4 4
      examples/webgl_shader_lava.html
  47. 8 8
      examples/webgl_terrain_dynamic.html
  48. 3 3
      examples/webgl_trackballcamera_earth.html
  49. 8 8
      src/extras/ShaderUtils.js
  50. 2 4
      src/extras/renderers/plugins/ShadowMapPlugin.js
  51. 4 4
      src/loaders/GeometryLoader.js
  52. 4 4
      src/loaders/Loader.js
  53. 7 6
      src/loaders/SceneLoader.js
  54. 32 28
      src/renderers/WebGLRenderer.js
  55. 1 1
      src/renderers/WebGLShaders.js

+ 58 - 55
build/three.js

@@ -6694,7 +6694,7 @@ THREE.Loader.prototype = {
 			var shader = THREE.ShaderUtils.lib[ "normal" ];
 			var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-			uniforms[ "tNormal" ].texture = mpars.normalMap;
+			uniforms[ "tNormal" ].value = mpars.normalMap;
 
 			if ( m.mapNormalFactor ) {
 
@@ -6704,21 +6704,21 @@ THREE.Loader.prototype = {
 
 			if ( mpars.map ) {
 
-				uniforms[ "tDiffuse" ].texture = mpars.map;
+				uniforms[ "tDiffuse" ].value = mpars.map;
 				uniforms[ "enableDiffuse" ].value = true;
 
 			}
 
 			if ( mpars.specularMap ) {
 
-				uniforms[ "tSpecular" ].texture = mpars.specularMap;
+				uniforms[ "tSpecular" ].value = mpars.specularMap;
 				uniforms[ "enableSpecular" ].value = true;
 
 			}
 
 			if ( mpars.lightMap ) {
 
-				uniforms[ "tAO" ].texture = mpars.lightMap;
+				uniforms[ "tAO" ].value = mpars.lightMap;
 				uniforms[ "enableAO" ].value = true;
 
 			}
@@ -8320,7 +8320,7 @@ THREE.GeometryLoader.prototype = {
 					var shader = THREE.ShaderUtils.lib[ "normal" ];
 					var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-					uniforms[ "tNormal" ].texture = mpars.normalMap;
+					uniforms[ "tNormal" ].value = mpars.normalMap;
 
 					if ( m.mapNormalFactor ) {
 
@@ -8330,21 +8330,21 @@ THREE.GeometryLoader.prototype = {
 
 					if ( mpars.map ) {
 
-						uniforms[ "tDiffuse" ].texture = mpars.map;
+						uniforms[ "tDiffuse" ].value = mpars.map;
 						uniforms[ "enableDiffuse" ].value = true;
 
 					}
 
 					if ( mpars.specularMap ) {
 
-						uniforms[ "tSpecular" ].texture = mpars.specularMap;
+						uniforms[ "tSpecular" ].value = mpars.specularMap;
 						uniforms[ "enableSpecular" ].value = true;
 
 					}
 
 					if ( mpars.lightMap ) {
 
-						uniforms[ "tAO" ].texture = mpars.lightMap;
+						uniforms[ "tAO" ].value = mpars.lightMap;
 						uniforms[ "enableAO" ].value = true;
 
 					}
@@ -8811,14 +8811,15 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 
 	}
 
-        // handle all the children from the loaded json and attach them to given parent        
+	// handle all the children from the loaded json and attach them to given parent
+
 	function handle_children( parent, children ) {
 
 		var object;
 
 		for ( dd in children ) {
 
-			// check by id if child has already been handled, 
+			// check by id if child has already been handled,
 			// if not, create new object
 
 			if ( result.objects[ dd ] === undefined ) {
@@ -9404,7 +9405,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 			var ambient = m.parameters.ambient;
 			var shininess = m.parameters.shininess;
 
-			uniforms[ "tNormal" ].texture = result.textures[ m.parameters.normalMap ];
+			uniforms[ "tNormal" ].value = result.textures[ m.parameters.normalMap ];
 
 			if ( m.parameters.normalMapFactor ) {
 
@@ -9414,21 +9415,21 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 
 			if ( m.parameters.map ) {
 
-				uniforms[ "tDiffuse" ].texture = m.parameters.map;
+				uniforms[ "tDiffuse" ].value = m.parameters.map;
 				uniforms[ "enableDiffuse" ].value = true;
 
 			}
 
 			if ( m.parameters.lightMap ) {
 
-				uniforms[ "tAO" ].texture = m.parameters.lightMap;
+				uniforms[ "tAO" ].value = m.parameters.lightMap;
 				uniforms[ "enableAO" ].value = true;
 
 			}
 
 			if ( m.parameters.specularMap ) {
 
-				uniforms[ "tSpecular" ].texture = result.textures[ m.parameters.specularMap ];
+				uniforms[ "tSpecular" ].value = result.textures[ m.parameters.specularMap ];
 				uniforms[ "enableSpecular" ].value = true;
 
 			}
@@ -14079,7 +14080,7 @@ THREE.UniformsUtils = {
 
 		var u, p, tmp, merged = {};
 
-		for ( u = 0; u < uniforms.length; u++ ) {
+		for ( u = 0; u < uniforms.length; u ++ ) {
 
 			tmp = this.clone( uniforms[ u ] );
 
@@ -19444,6 +19445,35 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		// skinning uniforms must be set even if material didn't change
+		// auto-setting of texture unit for bone texture must go before other textures
+		// not sure why, but otherwise weird things happen
+
+		if ( material.skinning ) {
+
+			if ( _supportsBoneTextures && object.useVertexTexture ) {
+
+				if ( p_uniforms.boneTexture !== null ) {
+
+					var textureUnit = getTextureUnit();
+
+					_gl.uniform1i( p_uniforms.boneTexture, textureUnit );
+					_this.setTexture( object.boneTexture, textureUnit );
+
+				}
+
+			} else {
+
+				if ( p_uniforms.boneGlobalMatrices !== null ) {
+
+					_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices );
+
+				}
+
+			}
+
+		}
+
 		if ( refreshMaterial ) {
 
 			// refresh uniforms common to several materials
@@ -19548,31 +19578,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( material.skinning ) {
-
-			if ( _supportsBoneTextures && object.useVertexTexture ) {
-
-				if ( p_uniforms.boneTexture !== null ) {
-
-					var textureUnit = getTextureUnit();
-
-					_gl.uniform1i( p_uniforms.boneTexture, textureUnit );
-					_this.setTexture( object.boneTexture, textureUnit );
-
-				}
-
-			} else {
-
-				if ( p_uniforms.boneGlobalMatrices !== null ) {
-
-					_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices );
-
-				}
-
-			}
-
-		}
-
 		loadUniformsMatrices( p_uniforms, object );
 
 		if ( p_uniforms.modelMatrix !== null ) {
@@ -19997,11 +20002,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					uniform._array = [];
 
-					for( i = 0, il = uniform.value.length; i < il; i ++ ) {
+				}
 
-						uniform._array[ i ] = getTextureUnit();
+				for( i = 0, il = uniform.value.length; i < il; i ++ ) {
 
-					}
+					uniform._array[ i ] = getTextureUnit();
 
 				}
 
@@ -23231,7 +23236,7 @@ THREE.ShaderUtils = {
 				"mFresnelBias": { type: "f", value: 0.1 },
 				"mFresnelPower": { type: "f", value: 2.0 },
 				"mFresnelScale": { type: "f", value: 1.0 },
-				"tCube": { type: "t", value: 1, texture: null }
+				"tCube": { type: "t", value: null }
 
 			},
 
@@ -23316,12 +23321,12 @@ THREE.ShaderUtils = {
 				"enableReflection": { type: "i", value: 0 },
 				"enableDisplacement": { type: "i", value: 0 },
 
-				"tDiffuse"	   : { type: "t", value: 0, texture: null },
-				"tCube"		   : { type: "t", value: 1, texture: null },
-				"tNormal"	   : { type: "t", value: 2, texture: null },
-				"tSpecular"	   : { type: "t", value: 3, texture: null },
-				"tAO"		   : { type: "t", value: 4, texture: null },
-				"tDisplacement": { type: "t", value: 5, texture: null },
+				"tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
+				"tDiffuse"	   : { type: "t", value: null },
+				"tCube"		   : { type: "t", value: null },
+				"tNormal"	   : { type: "t", value: null },
+				"tSpecular"	   : { type: "t", value: null },
+				"tAO"		   : { type: "t", value: null },
 
 				"uNormalScale": { type: "f", value: 1.0 },
 
@@ -23862,7 +23867,7 @@ THREE.ShaderUtils = {
 
 		'cube': {
 
-			uniforms: { "tCube": { type: "t", value: 1, texture: null },
+			uniforms: { "tCube": { type: "t", value: null },
 						"tFlip": { type: "f", value: -1 } },
 
 			vertexShader: [
@@ -34072,10 +34077,8 @@ THREE.ShadowMapPlugin = function ( ) {
 						material = object.customDepthMaterial;
 
 					} else if ( object instanceof THREE.SkinnedMesh ) {
-						
-						material = object.geometry.morphTargets.length ?
-						
-							_depthMaterialMorphSkin : _depthMaterialSkin;
+
+						material = object.geometry.morphTargets.length ? _depthMaterialMorphSkin : _depthMaterialSkin;
 
 					} else if ( object.geometry.morphTargets.length ) {
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 32 - 32
build/three.min.js


+ 27 - 27
examples/js/ShaderExtras.js

@@ -39,7 +39,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			opacity:  { type: "f", value: 1.0 }
 
 		},
@@ -86,7 +86,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse" : 		{ type: "t", value: 0, texture: null },
+			"tDiffuse" : 		{ type: "t", value: null },
 			"uImageIncrement" : { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
 			"cKernel" : 		{ type: "fv1", value: [] }
 
@@ -165,7 +165,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse:   { type: "t", value: 0, texture: null },
+			tDiffuse:   { type: "t", value: null },
 			time: 	    { type: "f", value: 0.0 },
 			nIntensity: { type: "f", value: 0.5 },
 			sIntensity: { type: "f", value: 0.05 },
@@ -253,8 +253,8 @@ THREE.ShaderExtras = {
 
 	'bokeh'	: {
 
-	uniforms: { tColor:   { type: "t", value: 0, texture: null },
-				tDepth:   { type: "t", value: 1, texture: null },
+	uniforms: { tColor:   { type: "t", value: null },
+				tDepth:   { type: "t", value: null },
 				focus:    { type: "f", value: 1.0 },
 				aspect:   { type: "f", value: 1.0 },
 				aperture: { type: "f", value: 0.025 },
@@ -367,8 +367,8 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tColor:   { type: "t", value: 0, texture: null },
-			tDepth:   { type: "t", value: 1, texture: null },
+			tColor:   { type: "t", value: null },
+			tDepth:   { type: "t", value: null },
 			focus:    { type: "f", value: 1.0 },
 			maxblur:  { type: "f", value: 1.0 }
 
@@ -424,7 +424,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			amount:   { type: "f", value: 1.0 }
 
 		},
@@ -477,7 +477,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			tSize:    { type: "v2", value: new THREE.Vector2( 256, 256 ) },
 			center:   { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
 			angle:	  { type: "f", value: 1.57 },
@@ -544,7 +544,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			offset:   { type: "f", value: 1.0 },
 			darkness: { type: "f", value: 1.0 }
 
@@ -606,7 +606,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			opacity:  { type: "f", value: 1.0 }
 
 		},
@@ -669,7 +669,7 @@ THREE.ShaderExtras = {
 
 		uniforms : {
 
-			"tDiffuse": 		{ type: "t", value: 0, texture: null },
+			"tDiffuse": 		{ type: "t", value: null },
 			"screenWidth": 		{ type: "f", value: 1024 },
 			"screenHeight": 	{ type: "f", value: 1024 },
 			"sampleDistance": 	{ type: "f", value: 0.94 },
@@ -764,7 +764,7 @@ THREE.ShaderExtras = {
 
 		uniforms : {
 
-			"texture": 	{ type: "t", value: 0, texture: null },
+			"texture": 	{ type: "t", value: null },
 			"delta": 	{ type: "v2", value:new THREE.Vector2( 1, 1 )  }
 
 		},
@@ -871,7 +871,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": { type: "t", value: 0, texture: null },
+			"tDiffuse": { type: "t", value: null },
 			"h": 		{ type: "f", value: 1.0 / 512.0 }
 
 		},
@@ -923,7 +923,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": { type: "t", value: 0, texture: null },
+			"tDiffuse": { type: "t", value: null },
 			"v": 		{ type: "f", value: 1.0 / 512.0 }
 
 		},
@@ -984,7 +984,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": { type: "t", value: 0, texture: null },
+			"tDiffuse": { type: "t", value: null },
 			"h": 		{ type: "f", value: 1.0 / 512.0 },
 			"r": 		{ type: "f", value: 0.35 }
 
@@ -1040,7 +1040,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": { type: "t", value: 0, texture: null },
+			"tDiffuse": { type: "t", value: null },
 			"v": 		{ type: "f", value: 1.0 / 512.0 },
 			"r": 		{ type: "f", value: 0.35 }
 
@@ -1100,8 +1100,8 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse1: { type: "t", value: 0, texture: null },
-			tDiffuse2: { type: "t", value: 1, texture: null },
+			tDiffuse1: { type: "t", value: null },
+			tDiffuse2: { type: "t", value: null },
 			mixRatio:  { type: "f", value: 0.5 },
 			opacity:   { type: "f", value: 1.0 }
 
@@ -1153,7 +1153,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": 	{ type: "t", value: 0, texture: null },
+			"tDiffuse": 	{ type: "t", value: null },
 			"resolution": 	{ type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 )  }
 
 		},
@@ -1249,7 +1249,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": 	{ type: "t", value: 0, texture: null }
+			"tDiffuse": 	{ type: "t", value: null }
 
 		},
 
@@ -1297,7 +1297,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse" : 	{ type: "t", value: 0, texture: null },
+			"tDiffuse" : 	{ type: "t", value: null },
 			"powRGB" :		{ type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
 			"mulRGB" :		{ type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
 
@@ -1345,7 +1345,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"heightMap"	: { type: "t", value: 0, texture: null },
+			"heightMap"	: { type: "t", value: null },
 			"resolution": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
 			"scale"		: { type: "v2", value: new THREE.Vector2( 1, 1 ) },
 			"height"	: { type: "f", value: 0.05 }
@@ -1405,8 +1405,8 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			"tDiffuse": 	{ type: "t", value: 0, texture: null },
-			"tDepth":   	{ type: "t", value: 1, texture: null },
+			"tDiffuse": 	{ type: "t", value: null },
+			"tDepth":   	{ type: "t", value: null },
 			"size": 		{ type: "v2", value: new THREE.Vector2( 512, 512 ) },
 			"cameraNear":	{ type: "f", value: 1 },
 			"cameraFar":	{ type: "f", value: 100 },
@@ -1655,7 +1655,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			color:    { type: "c", value: new THREE.Color( 0xffffff ) }
 
 		},
@@ -1704,7 +1704,7 @@ THREE.ShaderExtras = {
 
 		uniforms: {
 
-			tDiffuse: { type: "t", value: 0, texture: null },
+			tDiffuse: { type: "t", value: null },
 			opacity:  { type: "f", value: 1.0 }
 
 		},

+ 3 - 6
examples/js/ShaderGodRays.js

@@ -45,8 +45,7 @@ THREE.ShaderGodRays = {
 
 			tInput: {
 				type: "t",
-				value: 0,
-				texture: null
+				value: null
 			},
 
 			fStepSize: {
@@ -148,14 +147,12 @@ THREE.ShaderGodRays = {
 
 			tColors: {
 				type: "t",
-				value: 0,
-				texture: null
+				value: null
 			},
 
 			tGodRays: {
 				type: "t",
-				value: 1,
-				texture: null
+				value: null
 			},
 
 			fGodRayIntensity: {

+ 11 - 11
examples/js/ShaderSkin.js

@@ -33,8 +33,8 @@ THREE.ShaderSkin = {
 			"enableBump"	: { type: "i", value: 0 },
 			"enableSpecular": { type: "i", value: 0 },
 
-			"tDiffuse"	: { type: "t", value: 0, texture: null },
-			"tBeckmann"	: { type: "t", value: 1, texture: null },
+			"tDiffuse"	: { type: "t", value: null },
+			"tBeckmann"	: { type: "t", value: null },
 
 			"uDiffuseColor":  { type: "c", value: new THREE.Color( 0xeeeeee ) },
 			"uSpecularColor": { type: "c", value: new THREE.Color( 0x111111 ) },
@@ -44,10 +44,10 @@ THREE.ShaderSkin = {
 			"uRoughness": 	  		{ type: "f", value: 0.15 },
 			"uSpecularBrightness": 	{ type: "f", value: 0.75 },
 
-			"bumpMap"	: { type: "t", value: 2, texture: null },
+			"bumpMap"	: { type: "t", value: null },
 			"bumpScale" : { type: "f", value: 1 },
 
-			"specularMap" : { type: "t", value: 3, texture: null },
+			"specularMap" : { type: "t", value: null },
 
 			"offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
 
@@ -319,15 +319,15 @@ THREE.ShaderSkin = {
 
 			"passID": { type: "i", value: 0 },
 
-			"tDiffuse"	: { type: "t", value: 0, texture: null },
-			"tNormal"	: { type: "t", value: 1, texture: null },
+			"tDiffuse"	: { type: "t", value: null },
+			"tNormal"	: { type: "t", value: null },
 
-			"tBlur1"	: { type: "t", value: 2, texture: null },
-			"tBlur2"	: { type: "t", value: 3, texture: null },
-			"tBlur3"	: { type: "t", value: 4, texture: null },
-			"tBlur4"	: { type: "t", value: 5, texture: null },
+			"tBlur1"	: { type: "t", value: null },
+			"tBlur2"	: { type: "t", value: null },
+			"tBlur3"	: { type: "t", value: null },
+			"tBlur4"	: { type: "t", value: null },
 
-			"tBeckmann"	: { type: "t", value: 6, texture: null },
+			"tBeckmann"	: { type: "t", value: null },
 
 			"uNormalScale": { type: "f", value: 1.0 },
 

+ 6 - 6
examples/js/ShaderTerrain.js

@@ -26,12 +26,12 @@ THREE.ShaderTerrain = {
 			"enableSpecular"  : { type: "i", value: 0 },
 			"enableReflection": { type: "i", value: 0 },
 
-			"tDiffuse1"	   : { type: "t", value: 0, texture: null },
-			"tDiffuse2"	   : { type: "t", value: 1, texture: null },
-			"tDetail"	   : { type: "t", value: 2, texture: null },
-			"tNormal"	   : { type: "t", value: 3, texture: null },
-			"tSpecular"	   : { type: "t", value: 4, texture: null },
-			"tDisplacement": { type: "t", value: 5, texture: null },
+			"tDiffuse1"	   : { type: "t", value: null },
+			"tDiffuse2"	   : { type: "t", value: null },
+			"tDetail"	   : { type: "t", value: null },
+			"tNormal"	   : { type: "t", value: null },
+			"tSpecular"	   : { type: "t", value: null },
+			"tDisplacement": { type: "t", value: null },
 
 			"uNormalScale": { type: "f", value: 1.0 },
 

+ 4 - 4
examples/js/effects/AnaglyphEffect.js

@@ -32,8 +32,8 @@ THREE.AnaglyphEffect = function ( renderer ) {
 
 		uniforms: {
 
-			"mapLeft": { type: "t", value: 0, texture: _renderTargetL },
-			"mapRight": { type: "t", value: 1, texture: _renderTargetR }
+			"mapLeft": { type: "t", value: _renderTargetL },
+			"mapRight": { type: "t", value: _renderTargetR }
 
 		},
 
@@ -82,8 +82,8 @@ THREE.AnaglyphEffect = function ( renderer ) {
 		_renderTargetL = new THREE.WebGLRenderTarget( width, height, _params );
 		_renderTargetR = new THREE.WebGLRenderTarget( width, height, _params );
 
-		_material.uniforms[ "mapLeft" ].texture = _renderTargetL;
-		_material.uniforms[ "mapRight" ].texture = _renderTargetR;
+		_material.uniforms[ "mapLeft" ].value = _renderTargetL;
+		_material.uniforms[ "mapRight" ].value = _renderTargetR;
 
 		renderer.setSize( width, height );
 

+ 4 - 4
examples/js/effects/ParallaxBarrierEffect.js

@@ -32,8 +32,8 @@ THREE.ParallaxBarrierEffect = function ( renderer ) {
 
 		uniforms: {
 
-			"mapLeft": { type: "t", value: 0, texture: _renderTargetL },
-			"mapRight": { type: "t", value: 1, texture: _renderTargetR }
+			"mapLeft": { type: "t", value: _renderTargetL },
+			"mapRight": { type: "t", value: _renderTargetR }
 
 		},
 
@@ -84,8 +84,8 @@ THREE.ParallaxBarrierEffect = function ( renderer ) {
 		_renderTargetL = new THREE.WebGLRenderTarget( width, height, _params );
 		_renderTargetR = new THREE.WebGLRenderTarget( width, height, _params );
 
-		_material.uniforms[ "mapLeft" ].texture = _renderTargetL;
-		_material.uniforms[ "mapRight" ].texture = _renderTargetR;
+		_material.uniforms[ "mapLeft" ].value = _renderTargetL;
+		_material.uniforms[ "mapRight" ].value = _renderTargetR;
 
 		renderer.setSize( width, height );
 

+ 3 - 3
examples/js/postprocessing/BloomPass.js

@@ -67,7 +67,7 @@ THREE.BloomPass.prototype = {
 
 		THREE.EffectComposer.quad.material = this.materialConvolution;
 
-		this.convolutionUniforms[ "tDiffuse" ].texture = readBuffer;
+		this.convolutionUniforms[ "tDiffuse" ].value = readBuffer;
 		this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurX;
 
 		renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, this.renderTargetX, true );
@@ -75,7 +75,7 @@ THREE.BloomPass.prototype = {
 
 		// Render quad with blured scene into texture (convolution pass 2)
 
-		this.convolutionUniforms[ "tDiffuse" ].texture = this.renderTargetX;
+		this.convolutionUniforms[ "tDiffuse" ].value = this.renderTargetX;
 		this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurY;
 
 		renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, this.renderTargetY, true );
@@ -84,7 +84,7 @@ THREE.BloomPass.prototype = {
 
 		THREE.EffectComposer.quad.material = this.materialScreen;
 
-		this.screenUniforms[ "tDiffuse" ].texture = this.renderTargetY;
+		this.screenUniforms[ "tDiffuse" ].value = this.renderTargetY;
 
 		if ( maskActive ) renderer.context.enable( renderer.context.STENCIL_TEST );
 

+ 1 - 1
examples/js/postprocessing/DotScreenPass.js

@@ -32,7 +32,7 @@ THREE.DotScreenPass.prototype = {
 
 	render: function ( renderer, writeBuffer, readBuffer, delta ) {
 
-		this.uniforms[ "tDiffuse" ].texture = readBuffer;
+		this.uniforms[ "tDiffuse" ].value = readBuffer;
 		this.uniforms[ "tSize" ].value.set( readBuffer.width, readBuffer.height );
 
 		THREE.EffectComposer.quad.material = this.material;

+ 1 - 1
examples/js/postprocessing/FilmPass.js

@@ -31,7 +31,7 @@ THREE.FilmPass.prototype = {
 
 	render: function ( renderer, writeBuffer, readBuffer, delta ) {
 
-		this.uniforms[ "tDiffuse" ].texture = readBuffer;
+		this.uniforms[ "tDiffuse" ].value = readBuffer;
 		this.uniforms[ "time" ].value += delta;
 
 		THREE.EffectComposer.quad.material = this.material;

+ 1 - 1
examples/js/postprocessing/SavePass.js

@@ -39,7 +39,7 @@ THREE.SavePass.prototype = {
 
 		if ( this.uniforms[ this.textureID ] ) {
 
-			this.uniforms[ this.textureID ].texture = readBuffer;
+			this.uniforms[ this.textureID ].value = readBuffer;
 
 		}
 

+ 1 - 1
examples/js/postprocessing/ShaderPass.js

@@ -30,7 +30,7 @@ THREE.ShaderPass.prototype = {
 
 		if ( this.uniforms[ this.textureID ] ) {
 
-			this.uniforms[ this.textureID ].texture = readBuffer;
+			this.uniforms[ this.textureID ].value = readBuffer;
 
 		}
 

+ 1 - 1
examples/js/postprocessing/TexturePass.js

@@ -9,7 +9,7 @@ THREE.TexturePass = function ( texture, opacity ) {
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
 	this.uniforms[ "opacity" ].value = ( opacity !== undefined ) ? opacity : 1.0;
-	this.uniforms[ "tDiffuse" ].texture = texture;
+	this.uniforms[ "tDiffuse" ].value = texture;
 
 	this.material = new THREE.ShaderMaterial( {
 

+ 3 - 3
examples/misc_camera_fly.html

@@ -117,11 +117,11 @@
 				var shader = THREE.ShaderUtils.lib[ "normal" ];
 				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tNormal" ].texture = normalTexture;
+				uniforms[ "tNormal" ].value = normalTexture;
 				uniforms[ "uNormalScale" ].value = 0.85;
 
-				uniforms[ "tDiffuse" ].texture = planetTexture;
-				uniforms[ "tSpecular" ].texture = specularTexture;
+				uniforms[ "tDiffuse" ].value = planetTexture;
+				uniforms[ "tSpecular" ].value = specularTexture;
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;

+ 2 - 2
examples/webgl_custom_attributes.html

@@ -115,11 +115,11 @@
 
 				amplitude: { type: "f", value: 1.0 },
 				color:     { type: "c", value: new THREE.Color( 0xff2200 ) },
-				texture:   { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/water.jpg" ) },
+				texture:   { type: "t", value: THREE.ImageUtils.loadTexture( "textures/water.jpg" ) },
 
 			};
 
-			uniforms.texture.texture.wrapS = uniforms.texture.texture.wrapT = THREE.RepeatWrapping;
+			uniforms.texture.value.wrapS = uniforms.texture.value.wrapT = THREE.RepeatWrapping;
 
 			var shaderMaterial = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_custom_attributes_particles.html

@@ -113,7 +113,7 @@
 
 				amplitude: { type: "f", value: 1.0 },
 				color:     { type: "c", value: new THREE.Color( 0xffffff ) },
-				texture:   { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/sprites/spark1.png" ) },
+				texture:   { type: "t", value: THREE.ImageUtils.loadTexture( "textures/sprites/spark1.png" ) },
 
 			};
 

+ 2 - 2
examples/webgl_custom_attributes_particles2.html

@@ -109,11 +109,11 @@
 
 				amplitude: { type: "f", value: 1.0 },
 				color:     { type: "c", value: new THREE.Color( 0xffffff ) },
-				texture:   { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/sprites/disc.png" ) },
+				texture:   { type: "t", value: THREE.ImageUtils.loadTexture( "textures/sprites/disc.png" ) },
 
 			};
 
-			uniforms.texture.texture.wrapS = uniforms.texture.texture.wrapT = THREE.RepeatWrapping;
+			uniforms.texture.value.wrapS = uniforms.texture.value.wrapT = THREE.RepeatWrapping;
 
 			var shaderMaterial = new THREE.ShaderMaterial( {
 

+ 2 - 2
examples/webgl_custom_attributes_particles3.html

@@ -117,11 +117,11 @@
 
 				amplitude: { type: "f", value: 1.0 },
 				color:     { type: "c", value: new THREE.Color( 0xffffff ) },
-				texture:   { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/sprites/ball.png" ) },
+				texture:   { type: "t", value: THREE.ImageUtils.loadTexture( "textures/sprites/ball.png" ) },
 
 			};
 
-			uniforms.texture.texture.wrapS = uniforms.texture.texture.wrapT = THREE.RepeatWrapping;
+			uniforms.texture.value.wrapS = uniforms.texture.value.wrapT = THREE.RepeatWrapping;
 
 			var shaderMaterial = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_hdr.html

@@ -133,7 +133,7 @@
 				materialHDR = new THREE.ShaderMaterial( {
 
 					uniforms: {
-						tDiffuse:  { type: "t", value: 0, texture: texture },
+						tDiffuse:  { type: "t", value: texture },
 						exposure:  { type: "f", value: 0.125 },
 						brightMax: { type: "f", value: 0.5 }
 						},

+ 1 - 1
examples/webgl_kinect.html

@@ -166,7 +166,7 @@
 
 						uniforms: {
 
-							"map": { type: "t", value: 0, texture: texture },
+							"map": { type: "t", value: texture },
 							"width": { type: "f", value: width },
 							"height": { type: "f", value: height },
 							"nearClipping": { type: "f", value: nearClipping },

+ 3 - 3
examples/webgl_loader_ctm.html

@@ -194,11 +194,11 @@
 					var shader = THREE.ShaderUtils.lib[ "normal" ];
 					var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-					uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+					uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 					uniforms[ "uNormalScale" ].value = 0.8;
 
-					uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
-					uniforms[ "tSpecular" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" );
+					uniforms[ "tDiffuse" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+					uniforms[ "tSpecular" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" );
 
 					uniforms[ "enableAO" ].value = false;
 					uniforms[ "enableDiffuse" ].value = true;

+ 1 - 1
examples/webgl_loader_ctm_materials.html

@@ -106,7 +106,7 @@
 				textureCube = THREE.ImageUtils.loadTextureCube( urls );
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 4 - 4
examples/webgl_materials_bumpmap_skin.html

@@ -277,11 +277,11 @@
 				uniforms[ "enableBump" ].value = true;
 				uniforms[ "enableSpecular" ].value = true;
 
-				uniforms[ "tBeckmann" ].texture = composerBeckmann.renderTarget1;
-				uniforms[ "tDiffuse" ].texture = mapColor;
+				uniforms[ "tBeckmann" ].value = composerBeckmann.renderTarget1;
+				uniforms[ "tDiffuse" ].value = mapColor;
 
-				uniforms[ "bumpMap" ].texture = mapHeight;
-				uniforms[ "specularMap" ].texture = mapSpecular;
+				uniforms[ "bumpMap" ].value = mapHeight;
+				uniforms[ "specularMap" ].value = mapSpecular;
 
 				uniforms[ "uAmbientColor" ].value.setHex( 0xa0a0a0 );
 				uniforms[ "uDiffuseColor" ].value.setHex( 0xa0a0a0 );

+ 1 - 1
examples/webgl_materials_cars.html

@@ -190,7 +190,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cars_anaglyph.html

@@ -185,7 +185,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cars_parallaxbarrier.html

@@ -185,7 +185,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap.html

@@ -117,7 +117,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = reflectionCube;
+				shader.uniforms[ "tCube" ].value = reflectionCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_balls_reflection.html

@@ -109,7 +109,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

@@ -107,7 +107,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_balls_refraction.html

@@ -108,7 +108,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -108,7 +108,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_dynamic.html

@@ -445,7 +445,7 @@
 
 				// motion blur
 
-				effectBlend.uniforms[ 'tDiffuse2' ].texture = effectSave.renderTarget;
+				effectBlend.uniforms[ 'tDiffuse2' ].value = effectSave.renderTarget;
 				effectBlend.uniforms[ 'mixRatio' ].value = 0.65;
 
 				var renderModel = new THREE.RenderPass( scene, camera );

+ 1 - 1
examples/webgl_materials_cubemap_escher.html

@@ -87,7 +87,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 1 - 1
examples/webgl_materials_cubemap_refraction.html

@@ -110,7 +110,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 4 - 4
examples/webgl_materials_normalmap.html

@@ -162,10 +162,10 @@
 				uniforms[ "enableReflection" ].value = true;
 				uniforms[ "enableDisplacement" ].value = true;
 
-				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/normal.jpg" );
-				uniforms[ "tAO" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/ao.jpg" );
+				uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/normal.jpg" );
+				uniforms[ "tAO" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/ao.jpg" );
 
-				uniforms[ "tDisplacement" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/displacement.jpg" );
+				uniforms[ "tDisplacement" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/displacement.jpg" );
 				uniforms[ "uDisplacementBias" ].value = - 0.428408;
 				uniforms[ "uDisplacementScale" ].value = 2.436143;
 
@@ -175,7 +175,7 @@
 
 				uniforms[ "uShininess" ].value = shininess;
 
-				uniforms[ "tCube" ].texture = reflectionCube;
+				uniforms[ "tCube" ].value = reflectionCube;
 				uniforms[ "uReflectivity" ].value = 0.1;
 
 				uniforms[ "uDiffuseColor" ].value.convertGammaToLinear();

+ 3 - 3
examples/webgl_materials_normalmap2.html

@@ -124,11 +124,11 @@
 				var shader = THREE.ShaderUtils.lib[ "normal" ];
 				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+				uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 				uniforms[ "uNormalScale" ].value = 0.8;
 
-				uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
-				uniforms[ "tSpecular" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" );
+				uniforms[ "tDiffuse" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+				uniforms[ "tSpecular" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-SPEC.jpg" );
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;

+ 2 - 2
examples/webgl_materials_shaders_fresnel.html

@@ -93,7 +93,7 @@
 				var shader = THREE.ShaderUtils.lib[ "fresnel" ];
 				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tCube" ].texture = textureCube;
+				uniforms[ "tCube" ].value = textureCube;
 
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
 				var material = new THREE.ShaderMaterial( parameters );
@@ -119,7 +119,7 @@
 				// Skybox
 
 				var shader = THREE.ShaderUtils.lib[ "cube" ];
-				shader.uniforms[ "tCube" ].texture = textureCube;
+				shader.uniforms[ "tCube" ].value = textureCube;
 
 				var material = new THREE.ShaderMaterial( {
 

+ 9 - 9
examples/webgl_materials_skin.html

@@ -114,10 +114,10 @@
 
 				var uniformsUV = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniformsUV[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+				uniformsUV[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 				uniformsUV[ "uNormalScale" ].value = 0.75;
 
-				uniformsUV[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+				uniformsUV[ "tDiffuse" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
 
 				uniformsUV[ "passID" ].value = 0;
 
@@ -129,8 +129,8 @@
 				uniformsUV[ "uSpecularBrightness" ].value = 0.8;
 
 				var uniforms = THREE.UniformsUtils.clone( uniformsUV );
-				uniforms[ "tDiffuse" ].texture = uniformsUV[ "tDiffuse" ].texture;
-				uniforms[ "tNormal" ].texture = uniformsUV[ "tNormal" ].texture;
+				uniforms[ "tDiffuse" ].value = uniformsUV[ "tDiffuse" ].value;
+				uniforms[ "tNormal" ].value = uniformsUV[ "tNormal" ].value;
 				uniforms[ "passID" ].value = 1;
 
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true };
@@ -246,12 +246,12 @@
 
 				//
 
-				uniforms[ "tBlur1" ].texture = composerScene.renderTarget2;
-				uniforms[ "tBlur2" ].texture = composerUV1.renderTarget2;
-				uniforms[ "tBlur3" ].texture = composerUV2.renderTarget2;
-				uniforms[ "tBlur4" ].texture = composerUV3.renderTarget2;
+				uniforms[ "tBlur1" ].value = composerScene.renderTarget2;
+				uniforms[ "tBlur2" ].value = composerUV1.renderTarget2;
+				uniforms[ "tBlur3" ].value = composerUV2.renderTarget2;
+				uniforms[ "tBlur4" ].value = composerUV3.renderTarget2;
 
-				uniforms[ "tBeckmann" ].texture = composerBeckmann.renderTarget1;
+				uniforms[ "tBeckmann" ].value = composerBeckmann.renderTarget1;
 
 				//
 

+ 1 - 1
examples/webgl_particles_shapes.html

@@ -262,7 +262,7 @@
 
 				uniforms = {
 
-					texture:   { type: "t", value: 0, texture: texture }
+					texture:   { type: "t", value: texture }
 
 				};
 

+ 4 - 4
examples/webgl_postprocessing.html

@@ -275,7 +275,7 @@
 
 				//onWindowResize();
 
-				renderScene.uniforms[ "tDiffuse" ].texture = composerScene.renderTarget2;
+				renderScene.uniforms[ "tDiffuse" ].value = composerScene.renderTarget2;
 
 				window.addEventListener( 'resize', onWindowResize, false );
 
@@ -305,7 +305,7 @@
 				composer3.reset( new THREE.WebGLRenderTarget( halfWidth, halfHeight, rtParameters ) );
 				composer4.reset( new THREE.WebGLRenderTarget( halfWidth, halfHeight, rtParameters ) );
 
-				renderScene.uniforms[ "tDiffuse" ].texture = composerScene.renderTarget2;
+				renderScene.uniforms[ "tDiffuse" ].value = composerScene.renderTarget2;
 
 				quadBG.scale.set( window.innerWidth, 1, window.innerHeight );
 				quadMask.scale.set( window.innerWidth / 2, 1, window.innerHeight / 2 );
@@ -327,10 +327,10 @@
 				var shader = THREE.ShaderUtils.lib[ "normal" ];
 				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+				uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 				uniforms[ "uNormalScale" ].value = 0.75;
 
-				uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+				uniforms[ "tDiffuse" ].value = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;

+ 2 - 2
examples/webgl_postprocessing_dof.html

@@ -247,8 +247,8 @@
 
 				postprocessing.bokeh_uniforms = THREE.UniformsUtils.clone( bokeh_shader.uniforms );
 
-				postprocessing.bokeh_uniforms[ "tColor" ].texture = postprocessing.rtTextureColor;
-				postprocessing.bokeh_uniforms[ "tDepth" ].texture = postprocessing.rtTextureDepth;
+				postprocessing.bokeh_uniforms[ "tColor" ].value = postprocessing.rtTextureColor;
+				postprocessing.bokeh_uniforms[ "tDepth" ].value = postprocessing.rtTextureDepth;
 				postprocessing.bokeh_uniforms[ "focus" ].value = 1.1;
 				postprocessing.bokeh_uniforms[ "aspect" ].value = window.innerWidth / height;
 

+ 5 - 5
examples/webgl_postprocessing_godrays.html

@@ -370,7 +370,7 @@
 					var stepLen = filterLen * Math.pow( TAPS_PER_PASS, -pass );
 
 					postprocessing.godrayGenUniforms[ "fStepSize" ].value = stepLen;
-					postprocessing.godrayGenUniforms[ "tInput" ].texture = postprocessing.rtTextureDepth;
+					postprocessing.godrayGenUniforms[ "tInput" ].value = postprocessing.rtTextureDepth;
 
 					postprocessing.scene.overrideMaterial = postprocessing.materialGodraysGenerate;
 
@@ -382,7 +382,7 @@
 					stepLen = filterLen * Math.pow( TAPS_PER_PASS, -pass );
 
 					postprocessing.godrayGenUniforms[ "fStepSize" ].value = stepLen;
-					postprocessing.godrayGenUniforms[ "tInput" ].texture = postprocessing.rtTextureGodRays2;
+					postprocessing.godrayGenUniforms[ "tInput" ].value = postprocessing.rtTextureGodRays2;
 
 					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTextureGodRays1  );
 
@@ -392,14 +392,14 @@
 					stepLen = filterLen * Math.pow( TAPS_PER_PASS, -pass );
 
 					postprocessing.godrayGenUniforms[ "fStepSize" ].value = stepLen;
-					postprocessing.godrayGenUniforms[ "tInput" ].texture = postprocessing.rtTextureGodRays1;
+					postprocessing.godrayGenUniforms[ "tInput" ].value = postprocessing.rtTextureGodRays1;
 
 					renderer.render( postprocessing.scene, postprocessing.camera , postprocessing.rtTextureGodRays2  );
 
 					// final pass - composite god-rays onto colors
 
-					postprocessing.godrayCombineUniforms["tColors"].texture = postprocessing.rtTextureColors;
-					postprocessing.godrayCombineUniforms["tGodRays"].texture = postprocessing.rtTextureGodRays2;
+					postprocessing.godrayCombineUniforms["tColors"].value = postprocessing.rtTextureColors;
+					postprocessing.godrayCombineUniforms["tGodRays"].value = postprocessing.rtTextureGodRays2;
 
 					postprocessing.scene.overrideMaterial = postprocessing.materialGodraysCombine;
 

+ 1 - 1
examples/webgl_rtt.html

@@ -139,7 +139,7 @@
 
 				var materialScreen = new THREE.ShaderMaterial( {
 
-					uniforms: { tDiffuse: { type: "t", value: 0, texture: rtTexture } },
+					uniforms: { tDiffuse: { type: "t", value: rtTexture } },
 					vertexShader: document.getElementById( 'vertexShader' ).textContent,
 					fragmentShader: document.getElementById( 'fragment_shader_screen' ).textContent,
 

+ 3 - 3
examples/webgl_shader2.html

@@ -12,7 +12,7 @@
 				text-align:center;
 				font-weight: bold;
 
-				background-color: #000000;
+				background-color: #050505;
 				margin: 0px;
 				overflow: hidden;
 			}
@@ -207,10 +207,10 @@
 				uniforms2 = {
 					time: { type: "f", value: 1.0 },
 					resolution: { type: "v2", value: new THREE.Vector2() },
-					texture: { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/disturb.jpg" ) }
+					texture: { type: "t", value: THREE.ImageUtils.loadTexture( "textures/disturb.jpg" ) }
 				};
 
-				uniforms2.texture.texture.wrapS = uniforms2.texture.texture.wrapT = THREE.RepeatWrapping;
+				uniforms2.texture.value.wrapS = uniforms2.texture.value.wrapT = THREE.RepeatWrapping;
 
 				var size = 0.75, mlib = [],
 					params = [ [ 'fragment_shader1', uniforms1 ],  [ 'fragment_shader2', uniforms2 ], [ 'fragment_shader3', uniforms1 ], [ 'fragment_shader4', uniforms1 ] ];

+ 4 - 4
examples/webgl_shader_lava.html

@@ -154,13 +154,13 @@
 					time: { type: "f", value: 1.0 },
 					resolution: { type: "v2", value: new THREE.Vector2() },
 					uvScale: { type: "v2", value: new THREE.Vector2( 3.0, 1.0 ) },
-					texture1: { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/lava/cloud.png" ) },
-					texture2: { type: "t", value: 1, texture: THREE.ImageUtils.loadTexture( "textures/lava/lavatile.jpg" ) }
+					texture1: { type: "t", value: THREE.ImageUtils.loadTexture( "textures/lava/cloud.png" ) },
+					texture2: { type: "t", value: THREE.ImageUtils.loadTexture( "textures/lava/lavatile.jpg" ) }
 
 				};
 
-				uniforms.texture1.texture.wrapS = uniforms.texture1.texture.wrapT = THREE.RepeatWrapping;
-				uniforms.texture2.texture.wrapS = uniforms.texture2.texture.wrapT = THREE.RepeatWrapping;
+				uniforms.texture1.value.wrapS = uniforms.texture1.value.wrapT = THREE.RepeatWrapping;
+				uniforms.texture2.value.wrapS = uniforms.texture2.value.wrapT = THREE.RepeatWrapping;
 
 				var size = 0.65;
 

+ 8 - 8
examples/webgl_terrain_dynamic.html

@@ -339,7 +339,7 @@
 
 				uniformsNormal.height.value = 0.05;
 				uniformsNormal.resolution.value.set( rx, ry );
-				uniformsNormal.heightMap.texture = heightMap;
+				uniformsNormal.heightMap.value = heightMap;
 
 				var vertexShader = document.getElementById( 'vertexShader' ).textContent;
 
@@ -368,15 +368,15 @@
 
 				uniformsTerrain = THREE.UniformsUtils.clone( terrainShader.uniforms );
 
-				uniformsTerrain[ "tNormal" ].texture = normalMap;
+				uniformsTerrain[ "tNormal" ].value = normalMap;
 				uniformsTerrain[ "uNormalScale" ].value = 3.5;
 
-				uniformsTerrain[ "tDisplacement" ].texture = heightMap;
+				uniformsTerrain[ "tDisplacement" ].value = heightMap;
 
-				uniformsTerrain[ "tDiffuse1" ].texture = diffuseTexture1;
-				uniformsTerrain[ "tDiffuse2" ].texture = diffuseTexture2;
-				uniformsTerrain[ "tSpecular" ].texture = specularMap;
-				uniformsTerrain[ "tDetail" ].texture = detailTexture;
+				uniformsTerrain[ "tDiffuse1" ].value = diffuseTexture1;
+				uniformsTerrain[ "tDiffuse2" ].value = diffuseTexture2;
+				uniformsTerrain[ "tSpecular" ].value = specularMap;
+				uniformsTerrain[ "tDetail" ].value = detailTexture;
 
 				uniformsTerrain[ "enableDiffuse1" ].value = true;
 				uniformsTerrain[ "enableDiffuse2" ].value = true;
@@ -625,7 +625,7 @@
 
 				} );
 
-				shaderMaterial.uniforms[ "tDiffuse" ].texture = texture;
+				shaderMaterial.uniforms[ "tDiffuse" ].value = texture;
 
 				var sceneTmp = new THREE.Scene();
 

+ 3 - 3
examples/webgl_trackballcamera_earth.html

@@ -132,11 +132,11 @@
 				var shader = THREE.ShaderUtils.lib[ "normal" ],
 				uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tNormal" ].texture = normalTexture;
+				uniforms[ "tNormal" ].value = normalTexture;
 				uniforms[ "uNormalScale" ].value = 0.85;
 
-				uniforms[ "tDiffuse" ].texture = planetTexture;
-				uniforms[ "tSpecular" ].texture = specularTexture;
+				uniforms[ "tDiffuse" ].value = planetTexture;
+				uniforms[ "tSpecular" ].value = specularTexture;
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;

+ 8 - 8
src/extras/ShaderUtils.js

@@ -29,7 +29,7 @@ THREE.ShaderUtils = {
 				"mFresnelBias": { type: "f", value: 0.1 },
 				"mFresnelPower": { type: "f", value: 2.0 },
 				"mFresnelScale": { type: "f", value: 1.0 },
-				"tCube": { type: "t", value: 1, texture: null }
+				"tCube": { type: "t", value: null }
 
 			},
 
@@ -114,12 +114,12 @@ THREE.ShaderUtils = {
 				"enableReflection": { type: "i", value: 0 },
 				"enableDisplacement": { type: "i", value: 0 },
 
-				"tDiffuse"	   : { type: "t", value: 0, texture: null },
-				"tCube"		   : { type: "t", value: 1, texture: null },
-				"tNormal"	   : { type: "t", value: 2, texture: null },
-				"tSpecular"	   : { type: "t", value: 3, texture: null },
-				"tAO"		   : { type: "t", value: 4, texture: null },
-				"tDisplacement": { type: "t", value: 5, texture: null },
+				"tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
+				"tDiffuse"	   : { type: "t", value: null },
+				"tCube"		   : { type: "t", value: null },
+				"tNormal"	   : { type: "t", value: null },
+				"tSpecular"	   : { type: "t", value: null },
+				"tAO"		   : { type: "t", value: null },
 
 				"uNormalScale": { type: "f", value: 1.0 },
 
@@ -660,7 +660,7 @@ THREE.ShaderUtils = {
 
 		'cube': {
 
-			uniforms: { "tCube": { type: "t", value: 1, texture: null },
+			uniforms: { "tCube": { type: "t", value: null },
 						"tFlip": { type: "f", value: -1 } },
 
 			vertexShader: [

+ 2 - 4
src/extras/renderers/plugins/ShadowMapPlugin.js

@@ -266,10 +266,8 @@ THREE.ShadowMapPlugin = function ( ) {
 						material = object.customDepthMaterial;
 
 					} else if ( object instanceof THREE.SkinnedMesh ) {
-						
-						material = object.geometry.morphTargets.length ?
-						
-							_depthMaterialMorphSkin : _depthMaterialSkin;
+
+						material = object.geometry.morphTargets.length ? _depthMaterialMorphSkin : _depthMaterialSkin;
 
 					} else if ( object.geometry.morphTargets.length ) {
 

+ 4 - 4
src/loaders/GeometryLoader.js

@@ -332,7 +332,7 @@ THREE.GeometryLoader.prototype = {
 					var shader = THREE.ShaderUtils.lib[ "normal" ];
 					var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-					uniforms[ "tNormal" ].texture = mpars.normalMap;
+					uniforms[ "tNormal" ].value = mpars.normalMap;
 
 					if ( m.mapNormalFactor ) {
 
@@ -342,21 +342,21 @@ THREE.GeometryLoader.prototype = {
 
 					if ( mpars.map ) {
 
-						uniforms[ "tDiffuse" ].texture = mpars.map;
+						uniforms[ "tDiffuse" ].value = mpars.map;
 						uniforms[ "enableDiffuse" ].value = true;
 
 					}
 
 					if ( mpars.specularMap ) {
 
-						uniforms[ "tSpecular" ].texture = mpars.specularMap;
+						uniforms[ "tSpecular" ].value = mpars.specularMap;
 						uniforms[ "enableSpecular" ].value = true;
 
 					}
 
 					if ( mpars.lightMap ) {
 
-						uniforms[ "tAO" ].texture = mpars.lightMap;
+						uniforms[ "tAO" ].value = mpars.lightMap;
 						uniforms[ "enableAO" ].value = true;
 
 					}

+ 4 - 4
src/loaders/Loader.js

@@ -342,7 +342,7 @@ THREE.Loader.prototype = {
 			var shader = THREE.ShaderUtils.lib[ "normal" ];
 			var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-			uniforms[ "tNormal" ].texture = mpars.normalMap;
+			uniforms[ "tNormal" ].value = mpars.normalMap;
 
 			if ( m.mapNormalFactor ) {
 
@@ -352,21 +352,21 @@ THREE.Loader.prototype = {
 
 			if ( mpars.map ) {
 
-				uniforms[ "tDiffuse" ].texture = mpars.map;
+				uniforms[ "tDiffuse" ].value = mpars.map;
 				uniforms[ "enableDiffuse" ].value = true;
 
 			}
 
 			if ( mpars.specularMap ) {
 
-				uniforms[ "tSpecular" ].texture = mpars.specularMap;
+				uniforms[ "tSpecular" ].value = mpars.specularMap;
 				uniforms[ "enableSpecular" ].value = true;
 
 			}
 
 			if ( mpars.lightMap ) {
 
-				uniforms[ "tAO" ].texture = mpars.lightMap;
+				uniforms[ "tAO" ].value = mpars.lightMap;
 				uniforms[ "enableAO" ].value = true;
 
 			}

+ 7 - 6
src/loaders/SceneLoader.js

@@ -131,14 +131,15 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 
 	}
 
-        // handle all the children from the loaded json and attach them to given parent        
+	// handle all the children from the loaded json and attach them to given parent
+
 	function handle_children( parent, children ) {
 
 		var object;
 
 		for ( dd in children ) {
 
-			// check by id if child has already been handled, 
+			// check by id if child has already been handled,
 			// if not, create new object
 
 			if ( result.objects[ dd ] === undefined ) {
@@ -724,7 +725,7 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 			var ambient = m.parameters.ambient;
 			var shininess = m.parameters.shininess;
 
-			uniforms[ "tNormal" ].texture = result.textures[ m.parameters.normalMap ];
+			uniforms[ "tNormal" ].value = result.textures[ m.parameters.normalMap ];
 
 			if ( m.parameters.normalMapFactor ) {
 
@@ -734,21 +735,21 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 
 			if ( m.parameters.map ) {
 
-				uniforms[ "tDiffuse" ].texture = m.parameters.map;
+				uniforms[ "tDiffuse" ].value = m.parameters.map;
 				uniforms[ "enableDiffuse" ].value = true;
 
 			}
 
 			if ( m.parameters.lightMap ) {
 
-				uniforms[ "tAO" ].texture = m.parameters.lightMap;
+				uniforms[ "tAO" ].value = m.parameters.lightMap;
 				uniforms[ "enableAO" ].value = true;
 
 			}
 
 			if ( m.parameters.specularMap ) {
 
-				uniforms[ "tSpecular" ].texture = result.textures[ m.parameters.specularMap ];
+				uniforms[ "tSpecular" ].value = result.textures[ m.parameters.specularMap ];
 				uniforms[ "enableSpecular" ].value = true;
 
 			}

+ 32 - 28
src/renderers/WebGLRenderer.js

@@ -4707,6 +4707,35 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		// skinning uniforms must be set even if material didn't change
+		// auto-setting of texture unit for bone texture must go before other textures
+		// not sure why, but otherwise weird things happen
+
+		if ( material.skinning ) {
+
+			if ( _supportsBoneTextures && object.useVertexTexture ) {
+
+				if ( p_uniforms.boneTexture !== null ) {
+
+					var textureUnit = getTextureUnit();
+
+					_gl.uniform1i( p_uniforms.boneTexture, textureUnit );
+					_this.setTexture( object.boneTexture, textureUnit );
+
+				}
+
+			} else {
+
+				if ( p_uniforms.boneGlobalMatrices !== null ) {
+
+					_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices );
+
+				}
+
+			}
+
+		}
+
 		if ( refreshMaterial ) {
 
 			// refresh uniforms common to several materials
@@ -4811,31 +4840,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( material.skinning ) {
-
-			if ( _supportsBoneTextures && object.useVertexTexture ) {
-
-				if ( p_uniforms.boneTexture !== null ) {
-
-					var textureUnit = getTextureUnit();
-
-					_gl.uniform1i( p_uniforms.boneTexture, textureUnit );
-					_this.setTexture( object.boneTexture, textureUnit );
-
-				}
-
-			} else {
-
-				if ( p_uniforms.boneGlobalMatrices !== null ) {
-
-					_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices );
-
-				}
-
-			}
-
-		}
-
 		loadUniformsMatrices( p_uniforms, object );
 
 		if ( p_uniforms.modelMatrix !== null ) {
@@ -5260,11 +5264,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					uniform._array = [];
 
-					for( i = 0, il = uniform.value.length; i < il; i ++ ) {
+				}
 
-						uniform._array[ i ] = getTextureUnit();
+				for( i = 0, il = uniform.value.length; i < il; i ++ ) {
 
-					}
+					uniform._array[ i ] = getTextureUnit();
 
 				}
 

+ 1 - 1
src/renderers/WebGLShaders.js

@@ -1573,7 +1573,7 @@ THREE.UniformsUtils = {
 
 		var u, p, tmp, merged = {};
 
-		for ( u = 0; u < uniforms.length; u++ ) {
+		for ( u = 0; u < uniforms.length; u ++ ) {
 
 			tmp = this.clone( uniforms[ u ] );
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio