提交 8b201481 编写于 作者: T tschw

Avoid exception from "new ShaderMaterial()".

上级 6def65f4
......@@ -38,13 +38,6 @@ THREE.ShaderMaterial = function ( parameters ) {
this.uniforms = {};
this.attributes = [];
if ( parameters.attributes !== undefined && Array.isArray( parameters.attributes ) === false ) {
console.warn( 'THREE.ShaderMaterial: attributes should now be an array of attribute names.' );
parameters.attributes = Object.keys( parameters.attributes );
}
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}';
......@@ -78,7 +71,18 @@ THREE.ShaderMaterial = function ( parameters ) {
this.index0AttributeName = undefined;
this.setValues( parameters );
if ( parameters !== undefined ) {
if ( parameters.attributes !== undefined && Array.isArray( parameters.attributes ) === false ) {
console.warn( 'THREE.ShaderMaterial: attributes should now be an array of attribute names.' );
parameters.attributes = Object.keys( parameters.attributes );
}
this.setValues( parameters );
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册