|
@@ -141,36 +141,11 @@ THREE.Geometry.prototype = {
|
|
|
|
|
|
var v, vl, f, fl, face, vertices;
|
|
|
|
|
|
- // create internal buffers for reuse when calling this method repeatedly
|
|
|
- // (otherwise memory allocation / deallocation every frame is big resource hog)
|
|
|
+ vertices = new Array( this.vertices.length );
|
|
|
|
|
|
- if ( this.__tmpVertices === undefined ) {
|
|
|
-
|
|
|
- this.__tmpVertices = new Array( this.vertices.length );
|
|
|
- vertices = this.__tmpVertices;
|
|
|
-
|
|
|
- for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
|
|
|
-
|
|
|
- vertices[ v ] = new THREE.Vector3();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
|
|
|
-
|
|
|
- face = this.faces[ f ];
|
|
|
- face.vertexNormals = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- vertices = this.__tmpVertices;
|
|
|
-
|
|
|
- for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
|
|
|
-
|
|
|
- vertices[ v ].set( 0, 0, 0 );
|
|
|
+ for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
|
|
|
|
|
|
- }
|
|
|
+ vertices[ v ] = new THREE.Vector3();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -225,9 +200,9 @@ THREE.Geometry.prototype = {
|
|
|
|
|
|
face = this.faces[ f ];
|
|
|
|
|
|
- face.vertexNormals[ 0 ].copy( vertices[ face.a ] );
|
|
|
- face.vertexNormals[ 1 ].copy( vertices[ face.b ] );
|
|
|
- face.vertexNormals[ 2 ].copy( vertices[ face.c ] );
|
|
|
+ face.vertexNormals[ 0 ] = vertices[ face.a ].clone();
|
|
|
+ face.vertexNormals[ 1 ] = vertices[ face.b ].clone();
|
|
|
+ face.vertexNormals[ 2 ] = vertices[ face.c ].clone();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -517,9 +492,6 @@ THREE.Geometry.prototype = {
|
|
|
var i,il, face;
|
|
|
var indices, k, j, jl, u;
|
|
|
|
|
|
- // reset cache of vertices as it now will be changing.
|
|
|
- this.__tmpVertices = undefined;
|
|
|
-
|
|
|
for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
|
|
|
|
|
|
v = this.vertices[ i ];
|
|
@@ -573,7 +545,7 @@ THREE.Geometry.prototype = {
|
|
|
|
|
|
for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {
|
|
|
var idx = faceIndicesToRemove[ i ];
|
|
|
-
|
|
|
+
|
|
|
this.faces.splice( idx, 1 );
|
|
|
|
|
|
for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {
|