提交 fdb44520 编写于 作者: M Mugen87

Geometry/BufferGeometry: Changed semantics of .center()

上级 04a73aef
......@@ -212,7 +212,7 @@
<h3>[method:null applyMatrix]( [param:Matrix4 matrix] )</h3>
<div>Bakes matrix transform directly into vertex coordinates.</div>
<h3>[method:null center] ()</h3>
<h3>[method:BufferGeometry center] ()</h3>
<div>Center the geometry based on the bounding box.</div>
<h3>[method:BufferGeometry clone]()</h3>
......
......@@ -214,7 +214,7 @@
<h3>[method:null applyMatrix]( [param:Matrix4 matrix] )</h3>
<div>Bakes matrix transform directly into vertex coordinates.</div>
<h3>[method:null center] ()</h3>
<h3>[method:Geometry center] ()</h3>
<div>Center the geometry based on the bounding box.</div>
<h3>[method:Geometry clone]()</h3>
......
......@@ -278,15 +278,21 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
center: function () {
this.computeBoundingBox();
var offset = new Vector3();
var offset = this.boundingBox.getCenter().negate();
return function center() {
this.translate( offset.x, offset.y, offset.z );
this.computeBoundingBox();
return offset;
this.boundingBox.getCenter( offset ).negate();
},
this.translate( offset.x, offset.y, offset.z );
return this;
};
}(),
setFromObject: function ( object ) {
......
......@@ -354,15 +354,21 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
center: function () {
this.computeBoundingBox();
var offset = new Vector3();
var offset = this.boundingBox.getCenter().negate();
return function center() {
this.translate( offset.x, offset.y, offset.z );
this.computeBoundingBox();
return offset;
this.boundingBox.getCenter( offset ).negate();
},
this.translate( offset.x, offset.y, offset.z );
return this;
};
}(),
normalize: function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册