Browse Source

ShaderMaterial: Rescuing attributes but as an Array.

Mr.doob 10 years ago
parent
commit
cbff3b261c
2 changed files with 8 additions and 5 deletions
  1. 4 3
      src/materials/ShaderMaterial.js
  2. 4 2
      src/renderers/webgl/WebGLProgram.js

+ 4 - 3
src/materials/ShaderMaterial.js

@@ -36,11 +36,12 @@ THREE.ShaderMaterial = function ( parameters ) {
 
 	this.defines = {};
 	this.uniforms = {};
-	// this.attributes = null;
+	this.attributes = [];
 
-	if ( parameters.attributes !== undefined ) {
+	if ( parameters.attributes !== undefined && Array.isArray( parameters.attributes ) === false ) {
 
-		console.warn( 'THREE.ShaderMaterial: Materials no longer support attributes. Use THREE.BufferGeometry attributes instead.' );
+		console.warn( 'THREE.ShaderMaterial: attributes should now be an Array.' );
+		parameters.attributes = Object.keys( parameters.attributes );
 
 	}
 

+ 4 - 2
src/renderers/webgl/WebGLProgram.js

@@ -441,9 +441,11 @@ THREE.WebGLProgram = ( function () {
 
 		}
 
-		for ( var a in attributes ) {
+		// ShaderMaterial attributes
 
-			identifiers.push( a );
+		if ( Array.isArray( attributes ) ) {
+
+			identifiers = identifiers.concat( attributes );
 
 		}