提交 f5116882 编写于 作者: B Ben Houston

reduce GC load on Ray.recastSelf(), simplify Ray.at().

上级 d2ec2d88
......@@ -34,19 +34,15 @@ THREE.Ray.prototype = {
at: function( t, optionalTarget ) {
if( optionalTarget === undefined ) {
optionalTarget = this.direction.clone();
}
else {
optionalTarget.copy( this.direction );
}
return optionalTarget.multiplyScalar( t ).addSelf( this.origin );
var result = optionalTarget || new THREE.Vector3();
return result.copy( this.direction ).multiplyScalar( t ).addSelf( this.origin );
},
recastSelf: function ( t ) {
this.origin = this.at( t );
this.origin.copy( this.at( t, THREE.Ray.__v1 ) );
return this;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册