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

ArrowHelper: Removed no longer needed closure.

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