|
@@ -15,43 +15,7 @@ THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
|
|
|
thetaLength: thetaLength
|
|
|
};
|
|
|
|
|
|
- radius = radius || 50;
|
|
|
- segments = segments !== undefined ? Math.max( 3, segments ) : 8;
|
|
|
-
|
|
|
- thetaStart = thetaStart !== undefined ? thetaStart : 0;
|
|
|
- thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
|
|
|
-
|
|
|
- var i, uvs = [],
|
|
|
- center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );
|
|
|
-
|
|
|
- this.vertices.push( center );
|
|
|
- uvs.push( centerUV );
|
|
|
-
|
|
|
- for ( i = 0; i <= segments; i ++ ) {
|
|
|
-
|
|
|
- var vertex = new THREE.Vector3();
|
|
|
- var segment = thetaStart + i / segments * thetaLength;
|
|
|
-
|
|
|
- vertex.x = radius * Math.cos( segment );
|
|
|
- vertex.y = radius * Math.sin( segment );
|
|
|
-
|
|
|
- this.vertices.push( vertex );
|
|
|
- uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- var n = new THREE.Vector3( 0, 0, 1 );
|
|
|
-
|
|
|
- for ( i = 1; i <= segments; i ++ ) {
|
|
|
-
|
|
|
- this.faces.push( new THREE.Face3( i, i + 1, 0, [ n.clone(), n.clone(), n.clone() ] ) );
|
|
|
- this.faceVertexUvs[ 0 ].push( [ uvs[ i ].clone(), uvs[ i + 1 ].clone(), centerUV.clone() ] );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.computeFaceNormals();
|
|
|
-
|
|
|
- this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
|
|
|
+ this.fromBufferGeometry( new THREE.CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) );
|
|
|
|
|
|
};
|
|
|
|