Browse Source

Removing ShaderMaterial attributes support.

Mr.doob 10 years ago
parent
commit
e2f85057e4
3 changed files with 7 additions and 80 deletions
  1. 0 74
      src/core/BufferGeometry.js
  2. 7 1
      src/materials/ShaderMaterial.js
  3. 0 5
      src/renderers/webgl/WebGLObjects.js

+ 0 - 74
src/core/BufferGeometry.js

@@ -174,7 +174,6 @@ THREE.BufferGeometry.prototype = {
 				this.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) );
 				this.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) );
 
-
 			}
 
 			if ( geometry instanceof THREE.DynamicGeometry ) {
@@ -189,41 +188,6 @@ THREE.BufferGeometry.prototype = {
 
 		}
 
-		if ( material.attributes !== undefined ) {
-
-			var attributes = material.attributes;
-
-			for ( var name in attributes ) {
-
-				var attribute = attributes[ name ];
-
-				var type = attribute.type;
-				var array = attribute.value;
-
-				switch ( type ) {
-
-					case "f":
-						this.addAttribute( name, new THREE.Float32Attribute( array.length, 1 ).copyArray( array ) );
-						break;
-
-					case "c":
-						this.addAttribute( name, new THREE.Float32Attribute( array.length * 3, 3 ).copyColorsArray( array ) );
-						break;
-
-					case "v3":
-						this.addAttribute( name, new THREE.Float32Attribute( array.length * 3, 3 ).copyVector3sArray( array ) );
-						break;
-
-					default:
-						console.warn( 'THREE.BufferGeometry.setFromObject(). TODO: attribute unsupported', type );
-						break;
-
-				}
-
-			}
-
-		}
-
 		return this;
 
 	},
@@ -264,44 +228,6 @@ THREE.BufferGeometry.prototype = {
 
 	},
 
-	updateFromMaterial: function ( material ) {
-
-		if ( material.attributes !== undefined ) {
-
-			var attributes = material.attributes;
-
-			for ( var name in attributes ) {
-
-				var attribute = attributes[ name ];
-
-				var type = attribute.type;
-				var array = attribute.value;
-
-				switch ( type ) {
-
-					case "f":
-						this.attributes[ name ].copyArray( array );
-						this.attributes[ name ].needsUpdate = true;
-						break;
-
-					case "c":
-						this.attributes[ name ].copyColorsArray( array );
-						this.attributes[ name ].needsUpdate = true;
-						break;
-
-					case "v3":
-						this.attributes[ name ].copyVector3sArray( array );
-						this.attributes[ name ].needsUpdate = true;
-						break;
-
-				}
-
-			}
-
-		}
-
-	},
-
 	fromGeometry: function ( geometry, material ) {
 
 		material = material || { 'vertexColors': THREE.NoColors };

+ 7 - 1
src/materials/ShaderMaterial.js

@@ -36,7 +36,13 @@ THREE.ShaderMaterial = function ( parameters ) {
 
 	this.defines = {};
 	this.uniforms = {};
-	this.attributes = null;
+	// this.attributes = null;
+
+	if ( parameters.attributes !== undefined ) {
+
+		console.warn( 'THREE.ShaderMaterial: Materials no longer support attributes. Use THREE.BufferGeometry attributes instead.' );
+
+	}
 
 	this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}';
 	this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}';

+ 0 - 5
src/renderers/webgl/WebGLObjects.js

@@ -114,11 +114,6 @@ THREE.WebGLObjects = function ( gl, info ) {
 		if ( object.geometry instanceof THREE.DynamicGeometry ) {
 
 			geometry.updateFromObject( object );
-			geometry.updateFromMaterial( object.material );
-
-		} else if ( object.geometry instanceof THREE.Geometry ) {
-
-			geometry.updateFromMaterial( object.material );
 
 		}