浏览代码

Updated builds.

Mr.doob 11 年之前
父节点
当前提交
6bfadb8be4
共有 2 个文件被更改,包括 142 次插入121 次删除
  1. 41 18
      build/three.js
  2. 101 103
      build/three.min.js

+ 41 - 18
build/three.js

@@ -32511,7 +32511,7 @@ THREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
 THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
 THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
 
 
-	THREE.Geometry.call( this );
+	THREE.BufferGeometry.call( this );
 
 
 	this.parameters = {
 	this.parameters = {
 		radius: radius,
 		radius: radius,
@@ -32526,41 +32526,64 @@ THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
 	thetaStart = thetaStart !== undefined ? thetaStart : 0;
 	thetaStart = thetaStart !== undefined ? thetaStart : 0;
 	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 
 
-	var i, uvs = [],
-	center = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );
+	//
+
+	var length = segments + 2;
+
+	var indices = new Uint16Array( ( segments + 1 ) * 3 );
+	var vertices = new Float32Array( length * 3 );
+	var normals = new Float32Array( length * 3 );
+	var uvs = new Float32Array( length * 2 );
 
 
-	this.vertices.push(center);
-	uvs.push( centerUV );
+	normals[ 2 ] = 1;
 
 
-	for ( i = 0; i <= segments; i ++ ) {
+	uvs[ 0 ] = 0.5;
+	uvs[ 1 ] = 0.5;
+
+	var offset = 3, offset2 = 2;
+
+	for ( var i = 0; i <= segments; i ++ ) {
+
+		indices[ offset     ] = i + 1;
+		indices[ offset + 1 ] = i + 2;
+		indices[ offset + 2 ] = 0;
 
 
-		var vertex = new THREE.Vector3();
 		var segment = thetaStart + i / segments * thetaLength;
 		var segment = thetaStart + i / segments * thetaLength;
 
 
-		vertex.x = radius * Math.cos( segment );
-		vertex.y = radius * Math.sin( segment );
+		var x = radius * Math.cos( segment );
+		var y = radius * Math.sin( segment );
 
 
-		this.vertices.push( vertex );
-		uvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) );
+		vertices[ offset     ] = x;
+		vertices[ offset + 1 ] = y;
 
 
-	}
+		normals[ offset + 2 ] = 1;
 
 
-	var n = new THREE.Vector3( 0, 0, 1 );
+		uvs[ offset2     ] = ( x / radius + 1 ) / 2;
+		uvs[ offset2 + 1 ] = ( y / radius + 1 ) / 2;
+
+		offset += 3;
+		offset2 += 2;
 
 
-	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() ] );
+	for ( var i = 1; i <= segments; i ++ ) {
+
+		indices[ offset     ] = i;
+		indices[ offset + 1 ] = i + 1;
+		indices[ offset + 2 ] = 0;
 
 
 	}
 	}
 
 
-	this.computeFaceNormals();
+	this.attributes[ 'index' ] = { array: indices, itemSize: 1 };
+	this.attributes[ 'position' ] = { array: vertices, itemSize: 3 };
+	this.attributes[ 'normal' ] = { array: normals, itemSize: 3 };
+	this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 };
 
 
 	this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
 	this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
 
 
 };
 };
 
 
-THREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype );
+THREE.CircleGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
 
 
 // DEPRECATED
 // DEPRECATED
 
 

文件差异内容过多而无法显示
+ 101 - 103
build/three.min.js


部分文件因为文件数量过多而无法显示