提交 e2f85057 编写于 作者: M Mr.doob

Removing ShaderMaterial attributes support.

上级 6f9dc56b
...@@ -174,7 +174,6 @@ THREE.BufferGeometry.prototype = { ...@@ -174,7 +174,6 @@ THREE.BufferGeometry.prototype = {
this.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) ); this.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) );
this.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) ); this.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) );
} }
if ( geometry instanceof THREE.DynamicGeometry ) { if ( geometry instanceof THREE.DynamicGeometry ) {
...@@ -189,41 +188,6 @@ THREE.BufferGeometry.prototype = { ...@@ -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; return this;
}, },
...@@ -264,44 +228,6 @@ THREE.BufferGeometry.prototype = { ...@@ -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 ) { fromGeometry: function ( geometry, material ) {
material = material || { 'vertexColors': THREE.NoColors }; material = material || { 'vertexColors': THREE.NoColors };
......
...@@ -36,7 +36,13 @@ THREE.ShaderMaterial = function ( parameters ) { ...@@ -36,7 +36,13 @@ THREE.ShaderMaterial = function ( parameters ) {
this.defines = {}; this.defines = {};
this.uniforms = {}; 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.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}'; this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}';
......
...@@ -114,11 +114,6 @@ THREE.WebGLObjects = function ( gl, info ) { ...@@ -114,11 +114,6 @@ THREE.WebGLObjects = function ( gl, info ) {
if ( object.geometry instanceof THREE.DynamicGeometry ) { if ( object.geometry instanceof THREE.DynamicGeometry ) {
geometry.updateFromObject( object ); geometry.updateFromObject( object );
geometry.updateFromMaterial( object.material );
} else if ( object.geometry instanceof THREE.Geometry ) {
geometry.updateFromMaterial( object.material );
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册