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

ArrowHelper: Removed no longer needed closure.

上级 11aac1d8
...@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh'; ...@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh';
import { LineBasicMaterial } from '../../materials/LineBasicMaterial'; import { LineBasicMaterial } from '../../materials/LineBasicMaterial';
import { Line } from '../../objects/Line'; import { Line } from '../../objects/Line';
var ArrowHelper;
/** /**
* @author WestLangley / http://github.com/WestLangley * @author WestLangley / http://github.com/WestLangley
* @author zz85 / http://github.com/zz85 * @author zz85 / http://github.com/zz85
...@@ -26,41 +24,37 @@ var ArrowHelper; ...@@ -26,41 +24,37 @@ var ArrowHelper;
* headWidth - Number * headWidth - Number
*/ */
ArrowHelper = ( function () { var lineGeometry = new BufferGeometry();
lineGeometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
var lineGeometry = new BufferGeometry();
lineGeometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 ); var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
coneGeometry.translate( 0, - 0.5, 0 ); coneGeometry.translate( 0, - 0.5, 0 );
return function ArrowHelper( dir, origin, length, color, headLength, headWidth ) { function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
// dir is assumed to be normalized
Object3D.call( this ); // dir is assumed to be normalized
if ( color === undefined ) color = 0xffff00; Object3D.call( this );
if ( length === undefined ) length = 1;
if ( headLength === undefined ) headLength = 0.2 * length;
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
this.position.copy( origin ); if ( color === undefined ) color = 0xffff00;
if ( length === undefined ) length = 1;
if ( headLength === undefined ) headLength = 0.2 * length;
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) ); this.position.copy( origin );
this.line.matrixAutoUpdate = false;
this.add( this.line );
this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) ); this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
this.cone.matrixAutoUpdate = false; this.line.matrixAutoUpdate = false;
this.add( this.cone ); this.add( this.line );
this.setDirection( dir ); this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) );
this.setLength( length, headLength, headWidth ); this.cone.matrixAutoUpdate = false;
this.add( this.cone );
}; this.setDirection( dir );
this.setLength( length, headLength, headWidth );
}() ); }
ArrowHelper.prototype = Object.create( Object3D.prototype ); ArrowHelper.prototype = Object.create( Object3D.prototype );
ArrowHelper.prototype.constructor = ArrowHelper; ArrowHelper.prototype.constructor = ArrowHelper;
...@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) { ...@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) {
}; };
export { ArrowHelper }; export { ArrowHelper };
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册