提交 782e4a83 编写于 作者: W WestLangley

Remove optionalTarget

上级 ed7cafe5
......@@ -69,16 +69,14 @@
Copy the properties from the source camera into this one.
</div>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )</h3>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 target] )</h3>
<div>
Returns a [page:Vector3] representing the world space direction in which the camera is looking.<br /><br />
Note: This is not the camera’s positive, but its negative z-axis, in contrast to
[page:Object3D.getWorldDirection getWorldDirection] of the base class (Object3D).<br /><br />
If an [page:Vector3 optionalTarget] vector is specified, the result will be copied into this vector
(which can be reused in this way), otherwise a new vector will be created.
</div>
[page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
Returns a [page:Vector3] representing the world space direction in which the camera is looking.
(Note: A camera looks down its local, negative z-axis).<br /><br />
<h2>Source</h2>
......
......@@ -240,41 +240,37 @@
Searches through the object's children and returns the first with a property that matches the value given.
</div>
<h3>[method:Vector3 getWorldPosition]( [page:Vector3 optionalTarget] )</h3>
<h3>[method:Vector3 getWorldPosition]( [page:Vector3 target] )</h3>
<div>
optionalTarget — (optional) target to set the result. Otherwise, a new [page:Vector3] is instantiated. <br /><br />
[page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
Returns a vector representing the position of the object in world space.
</div>
<h3>[method:Quaternion getWorldQuaternion]( [page:Quaternion optionalTarget] )</h3>
<h3>[method:Quaternion getWorldQuaternion]( [page:Quaternion target] )</h3>
<div>
optionalTarget — (optional) if specified, the result will be copied into this Quaternion,
otherwise a new Quaternion will be created. <br /><br />
[page:Quaternion target] — the result will be copied into this Quaternion. <br /><br />
Returns a quaternion representing the rotation of the object in world space.
</div>
<h3>[method:Euler getWorldRotation]( [page:Euler optionalTarget] )</h3>
<h3>[method:Euler getWorldRotation]( [page:Euler target] )</h3>
<div>
optionalTarget — (optional) if specified, the result will be copied into this Euler,
otherwise a new Euler will be created. <br /><br />
[page:Euler target] — the result will be copied into this Euler. <br /><br />
Returns the euler angles representing the rotation of the object in world space.
</div>
<h3>[method:Vector3 getWorldScale]( [page:Vector3 optionalTarget] )</h3>
<h3>[method:Vector3 getWorldScale]( [page:Vector3 target] )</h3>
<div>
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
[page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
Returns a vector of the scaling factors applied to the object for each axis in world space.
</div>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 optionalTarget] )</h3>
<h3>[method:Vector3 getWorldDirection]( [page:Vector3 target] )</h3>
<div>
[page:Vector3 optionalTarget] — (optional) if specified, the result will be copied into this Vector3,
otherwise a new Vector3 will be created. <br /><br />
[page:Vector3 target] — the result will be copied into this Vector3. <br /><br />
Returns a vector representing the direction of object's positive z-axis in world space.
</div>
......
......@@ -41,13 +41,18 @@ Camera.prototype = Object.assign( Object.create( Object3D.prototype ), {
var quaternion = new Quaternion();
return function getWorldDirection( optionalTarget ) {
return function getWorldDirection( target ) {
var result = optionalTarget || new Vector3();
if ( target === undefined ) {
console.warn( 'THREE.Camera: .getWorldDirection() target is now required' );
target = new Vector3();
}
this.getWorldQuaternion( quaternion );
return result.set( 0, 0, - 1 ).applyQuaternion( quaternion );
return target.set( 0, 0, - 1 ).applyQuaternion( quaternion );
};
......
......@@ -441,13 +441,18 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
},
getWorldPosition: function ( optionalTarget ) {
getWorldPosition: function ( target ) {
var result = optionalTarget || new Vector3();
if ( target === undefined ) {
console.warn( 'THREE.Object3D: .getWorldPosition() target is now required' );
target = new Vector3();
}
this.updateMatrixWorld( true );
return result.setFromMatrixPosition( this.matrixWorld );
return target.setFromMatrixPosition( this.matrixWorld );
},
......@@ -456,15 +461,20 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
var position = new Vector3();
var scale = new Vector3();
return function getWorldQuaternion( optionalTarget ) {
return function getWorldQuaternion( target ) {
if ( target === undefined ) {
var result = optionalTarget || new Quaternion();
console.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' );
target = new Quaternion();
}
this.updateMatrixWorld( true );
this.matrixWorld.decompose( position, result, scale );
this.matrixWorld.decompose( position, target, scale );
return result;
return target;
};
......@@ -474,13 +484,18 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
var quaternion = new Quaternion();
return function getWorldRotation( optionalTarget ) {
return function getWorldRotation( target ) {
var result = optionalTarget || new Euler();
if ( target === undefined ) {
console.warn( 'THREE.Object3D: .getWorldRotation() target is now required' );
target = new Euler();
}
this.getWorldQuaternion( quaternion );
return result.setFromQuaternion( quaternion, this.rotation.order, false );
return target.setFromQuaternion( quaternion, this.rotation.order, false );
};
......@@ -491,15 +506,20 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
var position = new Vector3();
var quaternion = new Quaternion();
return function getWorldScale( optionalTarget ) {
return function getWorldScale( target ) {
if ( target === undefined ) {
var result = optionalTarget || new Vector3();
console.warn( 'THREE.Object3D: .getWorldScale() target is now required' );
target = new Vector3();
}
this.updateMatrixWorld( true );
this.matrixWorld.decompose( position, quaternion, result );
this.matrixWorld.decompose( position, quaternion, target );
return result;
return target;
};
......@@ -509,13 +529,18 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
var quaternion = new Quaternion();
return function getWorldDirection( optionalTarget ) {
return function getWorldDirection( target ) {
var result = optionalTarget || new Vector3();
if ( target === undefined ) {
console.warn( 'THREE.Object3D: .getWorldDirection() target is now required' );
target = new Vector3();
}
this.getWorldQuaternion( quaternion );
return result.set( 0, 0, 1 ).applyQuaternion( quaternion );
return target.set( 0, 0, 1 ).applyQuaternion( quaternion );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册