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

Merge remote-tracking branch 'hayfield/master'

...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888 * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888
*/ */
THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT ) { THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT, arc ) {
THREE.Geometry.call( this ); THREE.Geometry.call( this );
...@@ -13,14 +13,15 @@ THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT ) { ...@@ -13,14 +13,15 @@ THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT ) {
this.tube = tube || 40; this.tube = tube || 40;
this.segmentsR = segmentsR || 8; this.segmentsR = segmentsR || 8;
this.segmentsT = segmentsT || 6; this.segmentsT = segmentsT || 6;
this.arc = arc || (2 * Math.PI);
var temp_uv = []; var temp_uv = [];
for ( var j = 0; j <= this.segmentsR; ++j ) { for ( var j = 0; j <= this.segmentsR; ++j ) {
for ( var i = 0; i <= this.segmentsT; ++i ) { for ( var i = 0; i <= this.segmentsT; ++i ) {
var u = i / this.segmentsT * 2 * Math.PI; var u = i / this.segmentsT * this.arc;
var v = j / this.segmentsR * 2 * Math.PI; var v = j / this.segmentsR * 2 * Math.PI;
var x = (this.radius + this.tube*Math.cos(v))*Math.cos(u); var x = (this.radius + this.tube*Math.cos(v))*Math.cos(u);
var y = (this.radius + this.tube*Math.cos(v))*Math.sin(u); var y = (this.radius + this.tube*Math.cos(v))*Math.sin(u);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册