提交 c2083af0 编写于 作者: T Tristan VALCKE

Protect Geometry against the closure circular reference bug

上级 c4cb5817
...@@ -59,7 +59,7 @@ function Geometry() { ...@@ -59,7 +59,7 @@ function Geometry() {
} }
Geometry.prototype = { Object.assign( Geometry.prototype, EventDispatcher.prototype, {
constructor: Geometry, constructor: Geometry,
...@@ -714,15 +714,15 @@ Geometry.prototype = { ...@@ -714,15 +714,15 @@ Geometry.prototype = {
} }
var normalMatrix, var normalMatrix,
vertexOffset = this.vertices.length, vertexOffset = this.vertices.length,
vertices1 = this.vertices, vertices1 = this.vertices,
vertices2 = geometry.vertices, vertices2 = geometry.vertices,
faces1 = this.faces, faces1 = this.faces,
faces2 = geometry.faces, faces2 = geometry.faces,
uvs1 = this.faceVertexUvs[ 0 ], uvs1 = this.faceVertexUvs[ 0 ],
uvs2 = geometry.faceVertexUvs[ 0 ], uvs2 = geometry.faceVertexUvs[ 0 ],
colors1 = this.colors, colors1 = this.colors,
colors2 = geometry.colors; colors2 = geometry.colors;
if ( materialIndexOffset === undefined ) materialIndexOffset = 0; if ( materialIndexOffset === undefined ) materialIndexOffset = 0;
...@@ -759,8 +759,8 @@ Geometry.prototype = { ...@@ -759,8 +759,8 @@ Geometry.prototype = {
for ( i = 0, il = faces2.length; i < il; i ++ ) { for ( i = 0, il = faces2.length; i < il; i ++ ) {
var face = faces2[ i ], faceCopy, normal, color, var face = faces2[ i ], faceCopy, normal, color,
faceVertexNormals = face.vertexNormals, faceVertexNormals = face.vertexNormals,
faceVertexColors = face.vertexColors; faceVertexColors = face.vertexColors;
faceCopy = new Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset ); faceCopy = new Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset );
faceCopy.normal.copy( face.normal ); faceCopy.normal.copy( face.normal );
...@@ -1171,28 +1171,28 @@ Geometry.prototype = { ...@@ -1171,28 +1171,28 @@ Geometry.prototype = {
clone: function () { clone: function () {
/* /*
// Handle primitives // Handle primitives
var parameters = this.parameters; var parameters = this.parameters;
if ( parameters !== undefined ) { if ( parameters !== undefined ) {
var values = []; var values = [];
for ( var key in parameters ) { for ( var key in parameters ) {
values.push( parameters[ key ] ); values.push( parameters[ key ] );
} }
var geometry = Object.create( this.constructor.prototype ); var geometry = Object.create( this.constructor.prototype );
this.constructor.apply( geometry, values ); this.constructor.apply( geometry, values );
return geometry; return geometry;
} }
return new this.constructor().copy( this ); return new this.constructor().copy( this );
*/ */
return new Geometry().copy( this ); return new Geometry().copy( this );
...@@ -1267,8 +1267,7 @@ Geometry.prototype = { ...@@ -1267,8 +1267,7 @@ Geometry.prototype = {
} }
}; } );
Object.assign( Geometry.prototype, EventDispatcher.prototype );
export { GeometryIdCount, Geometry }; export { GeometryIdCount, Geometry };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册