Jelajahi Sumber

Depolluted primitive generators.

Mr.doob 11 tahun lalu
induk
melakukan
f8bd805b1c

+ 6 - 6
editor/js/Sidebar.Geometry.BoxGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// width
 
 	var widthRow = new UI.Panel();
-	var width = new UI.Number( geometry.width ).onChange( update );
+	var width = new UI.Number( geometry.parameters.width ).onChange( update );
 
 	widthRow.add( new UI.Text( 'Width' ).setWidth( '90px' ) );
 	widthRow.add( width );
@@ -17,7 +17,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// height
 
 	var heightRow = new UI.Panel();
-	var height = new UI.Number( geometry.height ).onChange( update );
+	var height = new UI.Number( geometry.parameters.height ).onChange( update );
 
 	heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
 	heightRow.add( height );
@@ -27,7 +27,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// depth
 
 	var depthRow = new UI.Panel();
-	var depth = new UI.Number( geometry.depth ).onChange( update );
+	var depth = new UI.Number( geometry.parameters.depth ).onChange( update );
 
 	depthRow.add( new UI.Text( 'Depth' ).setWidth( '90px' ) );
 	depthRow.add( depth );
@@ -37,7 +37,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// widthSegments
 
 	var widthSegmentsRow = new UI.Panel();
-	var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
+	var widthSegments = new UI.Integer( geometry.parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
 
 	widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
 	widthSegmentsRow.add( widthSegments );
@@ -47,7 +47,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// heightSegments
 
 	var heightSegmentsRow = new UI.Panel();
-	var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
+	var heightSegments = new UI.Integer( geometry.parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
 
 	heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
 	heightSegmentsRow.add( heightSegments );
@@ -57,7 +57,7 @@ Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
 	// depthSegments
 
 	var depthSegmentsRow = new UI.Panel();
-	var depthSegments = new UI.Integer( geometry.depthSegments ).setRange( 1, Infinity ).onChange( update );
+	var depthSegments = new UI.Integer( geometry.parameters.depthSegments ).setRange( 1, Infinity ).onChange( update );
 
 	depthSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
 	depthSegmentsRow.add( depthSegments );

+ 2 - 2
editor/js/Sidebar.Geometry.CircleGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.CircleGeometry = function ( signals, object ) {
 	// radius
 
 	var radiusRow = new UI.Panel();
-	var radius = new UI.Number( geometry.radius ).onChange( update );
+	var radius = new UI.Number( geometry.parameters.radius ).onChange( update );
 
 	radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
 	radiusRow.add( radius );
@@ -17,7 +17,7 @@ Sidebar.Geometry.CircleGeometry = function ( signals, object ) {
 	// segments
 
 	var segmentsRow = new UI.Panel();
-	var segments = new UI.Integer( geometry.segments ).onChange( update );
+	var segments = new UI.Integer( geometry.parameters.segments ).onChange( update );
 
 	segmentsRow.add( new UI.Text( 'Segments' ).setWidth( '90px' ) );
 	segmentsRow.add( segments );

+ 6 - 6
editor/js/Sidebar.Geometry.CylinderGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// radiusTop
 
 	var radiusTopRow = new UI.Panel();
-	var radiusTop = new UI.Number( geometry.radiusTop ).onChange( update );
+	var radiusTop = new UI.Number( geometry.parameters.radiusTop ).onChange( update );
 
 	radiusTopRow.add( new UI.Text( 'Radius top' ).setWidth( '90px' ) );
 	radiusTopRow.add( radiusTop );
@@ -17,7 +17,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// radiusBottom
 
 	var radiusBottomRow = new UI.Panel();
-	var radiusBottom = new UI.Number( geometry.radiusBottom ).onChange( update );
+	var radiusBottom = new UI.Number( geometry.parameters.radiusBottom ).onChange( update );
 
 	radiusBottomRow.add( new UI.Text( 'Radius bottom' ).setWidth( '90px' ) );
 	radiusBottomRow.add( radiusBottom );
@@ -27,7 +27,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// height
 
 	var heightRow = new UI.Panel();
-	var height = new UI.Number( geometry.height ).onChange( update );
+	var height = new UI.Number( geometry.parameters.height ).onChange( update );
 
 	heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
 	heightRow.add( height );
@@ -37,7 +37,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// radialSegments
 
 	var radialSegmentsRow = new UI.Panel();
-	var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
+	var radialSegments = new UI.Integer( geometry.parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
 
 	radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
 	radialSegmentsRow.add( radialSegments );
@@ -47,7 +47,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// heightSegments
 
 	var heightSegmentsRow = new UI.Panel();
-	var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
+	var heightSegments = new UI.Integer( geometry.parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
 
 	heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
 	heightSegmentsRow.add( heightSegments );
@@ -57,7 +57,7 @@ Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
 	// openEnded
 
 	var openEndedRow = new UI.Panel();
-	var openEnded = new UI.Checkbox( geometry.openEnded ).onChange( update );
+	var openEnded = new UI.Checkbox( geometry.parameters.openEnded ).onChange( update );
 
 	openEndedRow.add( new UI.Text( 'Open ended' ).setWidth( '90px' ) );
 	openEndedRow.add( openEnded );

+ 2 - 2
editor/js/Sidebar.Geometry.IcosahedronGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.IcosahedronGeometry = function ( signals, object ) {
 	// radius
 
 	var radiusRow = new UI.Panel();
-	var radius = new UI.Number( geometry.radius ).onChange( update );
+	var radius = new UI.Number( geometry.parameters.radius ).onChange( update );
 
 	radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
 	radiusRow.add( radius );
@@ -17,7 +17,7 @@ Sidebar.Geometry.IcosahedronGeometry = function ( signals, object ) {
 	// detail
 
 	var detailRow = new UI.Panel();
-	var detail = new UI.Integer( geometry.detail ).setRange( 0, Infinity ).onChange( update );
+	var detail = new UI.Integer( geometry.parameters.detail ).setRange( 0, Infinity ).onChange( update );
 
 	detailRow.add( new UI.Text( 'Detail' ).setWidth( '90px' ) );
 	detailRow.add( detail );

+ 4 - 4
editor/js/Sidebar.Geometry.PlaneGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.PlaneGeometry = function ( signals, object ) {
 	// width
 
 	var widthRow = new UI.Panel();
-	var width = new UI.Number( geometry.width ).onChange( update );
+	var width = new UI.Number( geometry.parameters.width ).onChange( update );
 
 	widthRow.add( new UI.Text( 'Width' ).setWidth( '90px' ) );
 	widthRow.add( width );
@@ -17,7 +17,7 @@ Sidebar.Geometry.PlaneGeometry = function ( signals, object ) {
 	// height
 
 	var heightRow = new UI.Panel();
-	var height = new UI.Number( geometry.height ).onChange( update );
+	var height = new UI.Number( geometry.parameters.height ).onChange( update );
 
 	heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
 	heightRow.add( height );
@@ -27,7 +27,7 @@ Sidebar.Geometry.PlaneGeometry = function ( signals, object ) {
 	// widthSegments
 
 	var widthSegmentsRow = new UI.Panel();
-	var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
+	var widthSegments = new UI.Integer( geometry.parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
 
 	widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
 	widthSegmentsRow.add( widthSegments );
@@ -37,7 +37,7 @@ Sidebar.Geometry.PlaneGeometry = function ( signals, object ) {
 	// heightSegments
 
 	var heightSegmentsRow = new UI.Panel();
-	var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
+	var heightSegments = new UI.Integer( geometry.parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
 
 	heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
 	heightSegmentsRow.add( heightSegments );

+ 7 - 7
editor/js/Sidebar.Geometry.SphereGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// radius
 
 	var radiusRow = new UI.Panel();
-	var radius = new UI.Number( geometry.radius ).onChange( update );
+	var radius = new UI.Number( geometry.parameters.radius ).onChange( update );
 
 	radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
 	radiusRow.add( radius );
@@ -17,7 +17,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// widthSegments
 
 	var widthSegmentsRow = new UI.Panel();
-	var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
+	var widthSegments = new UI.Integer( geometry.parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
 
 	widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
 	widthSegmentsRow.add( widthSegments );
@@ -27,7 +27,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// heightSegments
 
 	var heightSegmentsRow = new UI.Panel();
-	var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
+	var heightSegments = new UI.Integer( geometry.parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
 
 	heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
 	heightSegmentsRow.add( heightSegments );
@@ -37,7 +37,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// phiStart
 
 	var phiStartRow = new UI.Panel();
-	var phiStart = new UI.Number( geometry.phiStart ).onChange( update );
+	var phiStart = new UI.Number( geometry.parameters.phiStart ).onChange( update );
 
 	phiStartRow.add( new UI.Text( 'Phi start' ).setWidth( '90px' ) );
 	phiStartRow.add( phiStart );
@@ -47,7 +47,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// phiLength
 
 	var phiLengthRow = new UI.Panel();
-	var phiLength = new UI.Number( geometry.phiLength ).onChange( update );
+	var phiLength = new UI.Number( geometry.parameters.phiLength ).onChange( update );
 
 	phiLengthRow.add( new UI.Text( 'Phi length' ).setWidth( '90px' ) );
 	phiLengthRow.add( phiLength );
@@ -57,7 +57,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// thetaStart
 
 	var thetaStartRow = new UI.Panel();
-	var thetaStart = new UI.Number( geometry.thetaStart ).onChange( update );
+	var thetaStart = new UI.Number( geometry.parameters.thetaStart ).onChange( update );
 
 	thetaStartRow.add( new UI.Text( 'Theta start' ).setWidth( '90px' ) );
 	thetaStartRow.add( thetaStart );
@@ -67,7 +67,7 @@ Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
 	// thetaLength
 
 	var thetaLengthRow = new UI.Panel();
-	var thetaLength = new UI.Number( geometry.thetaLength ).onChange( update );
+	var thetaLength = new UI.Number( geometry.parameters.thetaLength ).onChange( update );
 
 	thetaLengthRow.add( new UI.Text( 'Theta length' ).setWidth( '90px' ) );
 	thetaLengthRow.add( thetaLength );

+ 5 - 5
editor/js/Sidebar.Geometry.TorusGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
 	// radius
 
 	var radiusRow = new UI.Panel();
-	var radius = new UI.Number( geometry.radius ).onChange( update );
+	var radius = new UI.Number( geometry.parameters.radius ).onChange( update );
 
 	radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
 	radiusRow.add( radius );
@@ -17,7 +17,7 @@ Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
 	// tube
 
 	var tubeRow = new UI.Panel();
-	var tube = new UI.Number( geometry.tube ).onChange( update );
+	var tube = new UI.Number( geometry.parameters.tube ).onChange( update );
 
 	tubeRow.add( new UI.Text( 'Tube' ).setWidth( '90px' ) );
 	tubeRow.add( tube );
@@ -27,7 +27,7 @@ Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
 	// radialSegments
 
 	var radialSegmentsRow = new UI.Panel();
-	var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
+	var radialSegments = new UI.Integer( geometry.parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
 
 	radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
 	radialSegmentsRow.add( radialSegments );
@@ -37,7 +37,7 @@ Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
 	// tubularSegments
 
 	var tubularSegmentsRow = new UI.Panel();
-	var tubularSegments = new UI.Integer( geometry.tubularSegments ).setRange( 1, Infinity ).onChange( update );
+	var tubularSegments = new UI.Integer( geometry.parameters.tubularSegments ).setRange( 1, Infinity ).onChange( update );
 
 	tubularSegmentsRow.add( new UI.Text( 'Tubular segments' ).setWidth( '90px' ) );
 	tubularSegmentsRow.add( tubularSegments );
@@ -47,7 +47,7 @@ Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
 	// arc
 
 	var arcRow = new UI.Panel();
-	var arc = new UI.Number( geometry.arc ).onChange( update );
+	var arc = new UI.Number( geometry.parameters.arc ).onChange( update );
 
 	arcRow.add( new UI.Text( 'Arc' ).setWidth( '90px' ) );
 	arcRow.add( arc );

+ 7 - 7
editor/js/Sidebar.Geometry.TorusKnotGeometry.js

@@ -7,7 +7,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// radius
 
 	var radiusRow = new UI.Panel();
-	var radius = new UI.Number( geometry.radius ).onChange( update );
+	var radius = new UI.Number( geometry.parameters.radius ).onChange( update );
 
 	radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
 	radiusRow.add( radius );
@@ -17,7 +17,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// tube
 
 	var tubeRow = new UI.Panel();
-	var tube = new UI.Number( geometry.tube ).onChange( update );
+	var tube = new UI.Number( geometry.parameters.tube ).onChange( update );
 
 	tubeRow.add( new UI.Text( 'Tube' ).setWidth( '90px' ) );
 	tubeRow.add( tube );
@@ -27,7 +27,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// radialSegments
 
 	var radialSegmentsRow = new UI.Panel();
-	var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
+	var radialSegments = new UI.Integer( geometry.parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
 
 	radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
 	radialSegmentsRow.add( radialSegments );
@@ -37,7 +37,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// tubularSegments
 
 	var tubularSegmentsRow = new UI.Panel();
-	var tubularSegments = new UI.Integer( geometry.tubularSegments ).setRange( 1, Infinity ).onChange( update );
+	var tubularSegments = new UI.Integer( geometry.parameters.tubularSegments ).setRange( 1, Infinity ).onChange( update );
 
 	tubularSegmentsRow.add( new UI.Text( 'Tubular segments' ).setWidth( '90px' ) );
 	tubularSegmentsRow.add( tubularSegments );
@@ -47,7 +47,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// p
 
 	var pRow = new UI.Panel();
-	var p = new UI.Number( geometry.p ).onChange( update );
+	var p = new UI.Number( geometry.parameters.p ).onChange( update );
 
 	pRow.add( new UI.Text( 'P' ).setWidth( '90px' ) );
 	pRow.add( p );
@@ -57,7 +57,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// q
 
 	var qRow = new UI.Panel();
-	var q = new UI.Number( geometry.q ).onChange( update );
+	var q = new UI.Number( geometry.parameters.q ).onChange( update );
 
 	pRow.add( new UI.Text( 'Q' ).setWidth( '90px' ) );
 	pRow.add( q );
@@ -67,7 +67,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( signals, object ) {
 	// heightScale
 
 	var heightScaleRow = new UI.Panel();
-	var heightScale = new UI.Number( geometry.heightScale ).onChange( update );
+	var heightScale = new UI.Number( geometry.parameters.heightScale ).onChange( update );
 
 	pRow.add( new UI.Text( 'Height scale' ).setWidth( '90px' ) );
 	pRow.add( heightScale );

+ 24 - 46
examples/js/exporters/ObjectExporter.js

@@ -43,76 +43,61 @@ THREE.ObjectExporter.prototype = {
 
 				if ( geometry.name !== "" ) data.name = geometry.name;
 
+				var handleParameters = function ( parameters ) {
+
+					for ( var i = 0; i < parameters.length; i ++ ) {
+
+						var parameter = parameters[ i ];
+
+						if ( geometry.parameters[ parameter ] !== undefined ) {
+
+							data[ parameter ] = geometry.parameters[ parameter ];
+
+						}
+
+					}
+
+				};
+
 				if ( geometry instanceof THREE.PlaneGeometry ) {
 
 					data.type = 'PlaneGeometry';
-					data.width = geometry.width;
-					data.height = geometry.height;
-					data.widthSegments = geometry.widthSegments;
-					data.heightSegments = geometry.heightSegments;
+					handleParameters( [ 'width', 'height', 'widthSegments', 'heightSegments' ] );
 
 				} else if ( geometry instanceof THREE.BoxGeometry ) {
 
 					data.type = 'BoxGeometry';
-					data.width = geometry.width;
-					data.height = geometry.height;
-					data.depth = geometry.depth;
-					data.widthSegments = geometry.widthSegments;
-					data.heightSegments = geometry.heightSegments;
-					data.depthSegments = geometry.depthSegments;
+					handleParameters( [ 'width', 'height', 'depth', 'widthSegments', 'heightSegments', 'depthSegments' ] );
 
 				} else if ( geometry instanceof THREE.CircleGeometry ) {
 
 					data.type = 'CircleGeometry';
-					data.radius = geometry.radius;
-					data.segments = geometry.segments;
+					handleParameters( [ 'radius', 'segments' ] );
 
 				} else if ( geometry instanceof THREE.CylinderGeometry ) {
 
 					data.type = 'CylinderGeometry';
-					data.radiusTop = geometry.radiusTop;
-					data.radiusBottom = geometry.radiusBottom;
-					data.height = geometry.height;
-					data.radialSegments = geometry.radialSegments;
-					data.heightSegments = geometry.heightSegments;
-					data.openEnded = geometry.openEnded;
+					handleParameters( [ 'radiusTop', 'radiusBottom', 'height', 'radialSegments', 'heightSegments', 'openEnded' ] );
 
 				} else if ( geometry instanceof THREE.SphereGeometry ) {
 
 					data.type = 'SphereGeometry';
-					data.radius = geometry.radius;
-					data.widthSegments = geometry.widthSegments;
-					data.heightSegments = geometry.heightSegments;
-					data.phiStart = geometry.phiStart;
-					data.phiLength = geometry.phiLength;
-					data.thetaStart = geometry.thetaStart;
-					data.thetaLength = geometry.thetaLength;
+					handleParameters( [ 'radius', 'widthSegments', 'heightSegments', 'phiStart', 'phiLength', 'thetaStart', 'thetaLength' ] );
 
 				} else if ( geometry instanceof THREE.IcosahedronGeometry ) {
 
 					data.type = 'IcosahedronGeometry';
-					data.radius = geometry.radius;
-					data.detail = geometry.detail;
+					handleParameters( [ 'radius', 'detail' ] );
 
 				} else if ( geometry instanceof THREE.TorusGeometry ) {
 
 					data.type = 'TorusGeometry';
-					data.radius = geometry.radius;
-					data.tube = geometry.tube;
-					data.radialSegments = geometry.radialSegments;
-					data.tubularSegments = geometry.tubularSegments;
-					data.arc = geometry.arc;
+					handleParameters( [ 'radius', 'tube', 'radialSegments', 'tubularSegments', 'arc' ] );
 
 				} else if ( geometry instanceof THREE.TorusKnotGeometry ) {
 
 					data.type = 'TorusKnotGeometry';
-					data.radius = geometry.radius;
-					data.tube = geometry.tube;
-					data.radialSegments = geometry.radialSegments;
-					data.tubularSegments = geometry.tubularSegments;
-					data.p = geometry.p;
-					data.q = geometry.q;
-					data.heightScale = geometry.heightScale;
+					handleParameters( [ 'radius', 'tube', 'radialSegments', 'tubularSegments', 'p', 'q', 'heightScale' ] );
 
 				} else if ( geometry instanceof THREE.BufferGeometry ) {
 
@@ -121,13 +106,6 @@ THREE.ObjectExporter.prototype = {
 
 					delete data.data.metadata;
 
-				} else if ( geometry instanceof THREE.Geometry2 ) {
-
-					data.type = 'Geometry2';
-					data.data = geometry2Exporter.parse( geometry );
-
-					delete data.data.metadata;
-
 				} else if ( geometry instanceof THREE.Geometry ) {
 
 					data.type = 'Geometry';

+ 19 - 14
src/extras/geometries/BoxGeometry.js

@@ -7,26 +7,31 @@ THREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegmen
 
 	THREE.Geometry.call( this );
 
-	var scope = this;
-
-	this.width = width;
-	this.height = height;
-	this.depth = depth;
+	this.parameters = {
+		width: width,
+		height: height,
+		depth: depth,
+		widthSegments: widthSegments,
+		heightSegments: heightSegments,
+		depthSegments: depthSegments
+	};
 
 	this.widthSegments = widthSegments || 1;
 	this.heightSegments = heightSegments || 1;
 	this.depthSegments = depthSegments || 1;
 
-	var width_half = this.width / 2;
-	var height_half = this.height / 2;
-	var depth_half = this.depth / 2;
+	var scope = this;
+
+	var width_half = width / 2;
+	var height_half = height / 2;
+	var depth_half = depth / 2;
 
-	buildPlane( 'z', 'y', - 1, - 1, this.depth, this.height, width_half, 0 ); // px
-	buildPlane( 'z', 'y',   1, - 1, this.depth, this.height, - width_half, 1 ); // nx
-	buildPlane( 'x', 'z',   1,   1, this.width, this.depth, height_half, 2 ); // py
-	buildPlane( 'x', 'z',   1, - 1, this.width, this.depth, - height_half, 3 ); // ny
-	buildPlane( 'x', 'y',   1, - 1, this.width, this.height, depth_half, 4 ); // pz
-	buildPlane( 'x', 'y', - 1, - 1, this.width, this.height, - depth_half, 5 ); // nz
+	buildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, 0 ); // px
+	buildPlane( 'z', 'y',   1, - 1, depth, height, - width_half, 1 ); // nx
+	buildPlane( 'x', 'z',   1,   1, width, depth, height_half, 2 ); // py
+	buildPlane( 'x', 'z',   1, - 1, width, depth, - height_half, 3 ); // ny
+	buildPlane( 'x', 'y',   1, - 1, width, height, depth_half, 4 ); // pz
+	buildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, 5 ); // nz
 
 	function buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) {
 

+ 12 - 9
src/extras/geometries/CircleGeometry.js

@@ -6,11 +6,18 @@ THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
 
 	THREE.Geometry.call( this );
 
-	this.radius = radius = radius || 50;
-	this.segments = segments = segments !== undefined ? Math.max( 3, segments ) : 8;
+	this.parameters = {
+		radius: radius,
+		segments: segments,
+		thetaStart: thetaStart,
+		thetaLength: thetaLength
+	};
 
-	this.thetaStart = thetaStart = thetaStart !== undefined ? thetaStart : 0;
-	this.thetaLength = thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
+	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 );
@@ -35,11 +42,7 @@ THREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {
 
 	for ( i = 1; i <= segments; i ++ ) {
 
-		var v1 = i;
-		var v2 = i + 1 ;
-		var v3 = 0;
-
-		this.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) );
+		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() ] );
 
 	}

+ 17 - 8
src/extras/geometries/CylinderGeometry.js

@@ -6,14 +6,23 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme
 
 	THREE.Geometry.call( this );
 
-	this.radiusTop = radiusTop = radiusTop !== undefined ? radiusTop : 20;
-	this.radiusBottom = radiusBottom = radiusBottom !== undefined ? radiusBottom : 20;
-	this.height = height = height !== undefined ? height : 100;
-
-	this.radialSegments = radialSegments = radialSegments || 8;
-	this.heightSegments = heightSegments = heightSegments || 1;
-
-	this.openEnded = openEnded = openEnded !== undefined ? openEnded : false;
+	this.parameters = {
+		radiusTop: radiusTop,
+		radiusBottom: radiusBottom,
+		height: height,
+		radialSegments: radialSegments,
+		heightSegments: heightSegments,
+		openEnded: openEnded
+	};
+
+	radiusTop = radiusTop !== undefined ? radiusTop : 20;
+	radiusBottom = radiusBottom !== undefined ? radiusBottom : 20;
+	height = height !== undefined ? height : 100;
+
+	radialSegments = radialSegments || 8;
+	heightSegments = heightSegments || 1;
+
+	openEnded = openEnded !== undefined ? openEnded : false;
 
 	var heightHalf = height / 2;
 

+ 4 - 2
src/extras/geometries/IcosahedronGeometry.js

@@ -4,8 +4,10 @@
 
 THREE.IcosahedronGeometry = function ( radius, detail ) {
 
-	this.radius = radius;
-	this.detail = detail;
+	this.parameters = {
+		radius: radius,
+		detail: detail
+	};
 
 	var t = ( 1 + Math.sqrt( 5 ) ) / 2;
 

+ 5 - 0
src/extras/geometries/OctahedronGeometry.js

@@ -4,6 +4,11 @@
 
 THREE.OctahedronGeometry = function ( radius, detail ) {
 
+	this.parameters = {
+		radius: radius,
+		detail: detail
+	};
+
 	var vertices = [
 		[ 1, 0, 0 ], [ -1, 0, 0 ], [ 0, 1, 0 ], [ 0, -1, 0 ], [ 0, 0, 1 ], [ 0, 0, -1 ]
 	];

+ 12 - 10
src/extras/geometries/PlaneGeometry.js

@@ -7,33 +7,35 @@ THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments )
 
 	THREE.Geometry.call( this );
 
-	this.width = width;
-	this.height = height;
-
-	this.widthSegments = widthSegments || 1;
-	this.heightSegments = heightSegments || 1;
+	this.parameters = {
+		width: width,
+		height: height,
+		widthSegments: widthSegments,
+		heightSegments: heightSegments
+	};
 
 	var ix, iz;
 	var width_half = width / 2;
 	var height_half = height / 2;
 
-	var gridX = this.widthSegments;
-	var gridZ = this.heightSegments;
+	var gridX = widthSegments || 1;
+	var gridZ = heightSegments || 1;
 
 	var gridX1 = gridX + 1;
 	var gridZ1 = gridZ + 1;
 
-	var segment_width = this.width / gridX;
-	var segment_height = this.height / gridZ;
+	var segment_width = width / gridX;
+	var segment_height = height / gridZ;
 
 	var normal = new THREE.Vector3( 0, 0, 1 );
 
 	for ( iz = 0; iz < gridZ1; iz ++ ) {
 
+		var y = iz * segment_height - height_half;
+
 		for ( ix = 0; ix < gridX1; ix ++ ) {
 
 			var x = ix * segment_width - width_half;
-			var y = iz * segment_height - height_half;
 
 			this.vertices.push( new THREE.Vector3( x, - y, 0 ) );
 

+ 21 - 11
src/extras/geometries/SphereGeometry.js

@@ -6,16 +6,26 @@ THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStar
 
 	THREE.Geometry.call( this );
 
-	this.radius = radius = radius || 50;
+	this.parameters = {
+		radius: radius,
+		widthSegments: widthSegments,
+		heightSegments: heightSegments,
+		phiStart: phiStart,
+		phiLength: phiLength,
+		thetaStart: thetaStart,
+		thetaLength: thetaLength 
+	};
 
-	this.widthSegments = widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
-	this.heightSegments = heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );
+	radius = radius || 50;
 
-	this.phiStart = phiStart = phiStart !== undefined ? phiStart : 0;
-	this.phiLength = phiLength = phiLength !== undefined ? phiLength : Math.PI * 2;
+	widthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );
+	heightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );
 
-	this.thetaStart = thetaStart = thetaStart !== undefined ? thetaStart : 0;
-	this.thetaLength = thetaLength = thetaLength !== undefined ? thetaLength : Math.PI;
+	phiStart = phiStart !== undefined ? phiStart : 0;
+	phiLength = phiLength !== undefined ? phiLength : Math.PI * 2;
+
+	thetaStart = thetaStart !== undefined ? thetaStart : 0;
+	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI;
 
 	var x, y, vertices = [], uvs = [];
 
@@ -46,9 +56,9 @@ THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStar
 
 	}
 
-	for ( y = 0; y < this.heightSegments; y ++ ) {
+	for ( y = 0; y < heightSegments; y ++ ) {
 
-		for ( x = 0; x < this.widthSegments; x ++ ) {
+		for ( x = 0; x < widthSegments; x ++ ) {
 
 			var v1 = vertices[ y ][ x + 1 ];
 			var v2 = vertices[ y ][ x ];
@@ -65,13 +75,13 @@ THREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStar
 			var uv3 = uvs[ y + 1 ][ x ].clone();
 			var uv4 = uvs[ y + 1 ][ x + 1 ].clone();
 
-			if ( Math.abs( this.vertices[ v1 ].y ) === this.radius ) {
+			if ( Math.abs( this.vertices[ v1 ].y ) === radius ) {
 
 				uv1.x = ( uv1.x + uv2.x ) / 2;
 				this.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) );
 				this.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] );
 
-			} else if ( Math.abs( this.vertices[ v3 ].y ) === this.radius ) {
+			} else if ( Math.abs( this.vertices[ v3 ].y ) === radius ) {
 
 				uv3.x = ( uv3.x + uv4.x ) / 2;
 				this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );

+ 29 - 24
src/extras/geometries/TorusGeometry.js

@@ -8,49 +8,54 @@ THREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments,
 
 	THREE.Geometry.call( this );
 
-	var scope = this;
-
-	this.radius = radius || 100;
-	this.tube = tube || 40;
-	this.radialSegments = radialSegments || 8;
-	this.tubularSegments = tubularSegments || 6;
-	this.arc = arc || Math.PI * 2;
+	this.parameters = {
+		radius: radius,
+		tube: tube,
+		radialSegments: radialSegments,
+		tubularSegments: tubularSegments,
+		arc: arc
+	};
+
+	radius = radius || 100;
+	tube = tube || 40;
+	radialSegments = radialSegments || 8;
+	tubularSegments = tubularSegments || 6;
+	arc = arc || Math.PI * 2;
 
 	var center = new THREE.Vector3(), uvs = [], normals = [];
 
-	for ( var j = 0; j <= this.radialSegments; j ++ ) {
+	for ( var j = 0; j <= radialSegments; j ++ ) {
 
-		for ( var i = 0; i <= this.tubularSegments; i ++ ) {
+		for ( var i = 0; i <= tubularSegments; i ++ ) {
 
-			var u = i / this.tubularSegments * this.arc;
-			var v = j / this.radialSegments * Math.PI * 2;
+			var u = i / tubularSegments * arc;
+			var v = j / radialSegments * Math.PI * 2;
 
-			center.x = this.radius * Math.cos( u );
-			center.y = this.radius * Math.sin( u );
+			center.x = radius * Math.cos( u );
+			center.y = radius * Math.sin( u );
 
 			var vertex = new THREE.Vector3();
-			vertex.x = ( this.radius + this.tube * Math.cos( v ) ) * Math.cos( u );
-			vertex.y = ( this.radius + this.tube * Math.cos( v ) ) * Math.sin( u );
-			vertex.z = this.tube * Math.sin( v );
+			vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );
+			vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );
+			vertex.z = tube * Math.sin( v );
 
 			this.vertices.push( vertex );
 
-			uvs.push( new THREE.Vector2( i / this.tubularSegments, j / this.radialSegments ) );
+			uvs.push( new THREE.Vector2( i / tubularSegments, j / radialSegments ) );
 			normals.push( vertex.clone().sub( center ).normalize() );
 
 		}
 
 	}
 
+	for ( var j = 1; j <= radialSegments; j ++ ) {
 
-	for ( var j = 1; j <= this.radialSegments; j ++ ) {
-
-		for ( var i = 1; i <= this.tubularSegments; i ++ ) {
+		for ( var i = 1; i <= tubularSegments; i ++ ) {
 
-			var a = ( this.tubularSegments + 1 ) * j + i - 1;
-			var b = ( this.tubularSegments + 1 ) * ( j - 1 ) + i - 1;
-			var c = ( this.tubularSegments + 1 ) * ( j - 1 ) + i;
-			var d = ( this.tubularSegments + 1 ) * j + i;
+			var a = ( tubularSegments + 1 ) * j + i - 1;
+			var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;
+			var c = ( tubularSegments + 1 ) * ( j - 1 ) + i;
+			var d = ( tubularSegments + 1 ) * j + i;
 
 			var face = new THREE.Face3( a, b, d, [ normals[ a ].clone(), normals[ b ].clone(), normals[ d ].clone() ] );
 			this.faces.push( face );

+ 41 - 33
src/extras/geometries/TorusKnotGeometry.js

@@ -7,27 +7,35 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen
 
 	THREE.Geometry.call( this );
 
-	var scope = this;
-
-	this.radius = radius || 100;
-	this.tube = tube || 40;
-	this.radialSegments = radialSegments || 64;
-	this.tubularSegments = tubularSegments || 8;
-	this.p = p || 2;
-	this.q = q || 3;
-	this.heightScale = heightScale || 1;
-	this.grid = new Array( this.radialSegments );
-
+	this.parameters = {
+		radius: radius,
+		tube: tube,
+		radialSegments: radialSegments,
+		tubularSegments: tubularSegments,
+		p: p,
+		q: q,
+		heightScale: heightScale
+	};
+
+	radius = radius || 100;
+	tube = tube || 40;
+	radialSegments = radialSegments || 64;
+	tubularSegments = tubularSegments || 8;
+	p = p || 2;
+	q = q || 3;
+	heightScale = heightScale || 1;
+	
+	var grid = new Array( radialSegments );
 	var tang = new THREE.Vector3();
 	var n = new THREE.Vector3();
 	var bitan = new THREE.Vector3();
 
-	for ( var i = 0; i < this.radialSegments; ++ i ) {
+	for ( var i = 0; i < radialSegments; ++ i ) {
 
-		this.grid[ i ] = new Array( this.tubularSegments );
-		var u = i / this.radialSegments * 2 * this.p * Math.PI;
-		var p1 = getPos( u, this.q, this.p, this.radius, this.heightScale );
-		var p2 = getPos( u + 0.01, this.q, this.p, this.radius, this.heightScale );
+		grid[ i ] = new Array( tubularSegments );
+		var u = i / radialSegments * 2 * p * Math.PI;
+		var p1 = getPos( u, q, p, radius, heightScale );
+		var p2 = getPos( u + 0.01, q, p, radius, heightScale );
 		tang.subVectors( p2, p1 );
 		n.addVectors( p2, p1 );
 
@@ -36,39 +44,39 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen
 		bitan.normalize();
 		n.normalize();
 
-		for ( var j = 0; j < this.tubularSegments; ++ j ) {
+		for ( var j = 0; j < tubularSegments; ++ j ) {
 
-			var v = j / this.tubularSegments * 2 * Math.PI;
-			var cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.
-			var cy = this.tube * Math.sin( v );
+			var v = j / tubularSegments * 2 * Math.PI;
+			var cx = - tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.
+			var cy = tube * Math.sin( v );
 
 			var pos = new THREE.Vector3();
 			pos.x = p1.x + cx * n.x + cy * bitan.x;
 			pos.y = p1.y + cx * n.y + cy * bitan.y;
 			pos.z = p1.z + cx * n.z + cy * bitan.z;
 
-			this.grid[ i ][ j ] = scope.vertices.push( pos ) - 1;
+			grid[ i ][ j ] = this.vertices.push( pos ) - 1;
 
 		}
 
 	}
 
-	for ( var i = 0; i < this.radialSegments; ++ i ) {
+	for ( var i = 0; i < radialSegments; ++ i ) {
 
-		for ( var j = 0; j < this.tubularSegments; ++ j ) {
+		for ( var j = 0; j < tubularSegments; ++ j ) {
 
-			var ip = ( i + 1 ) % this.radialSegments;
-			var jp = ( j + 1 ) % this.tubularSegments;
+			var ip = ( i + 1 ) % radialSegments;
+			var jp = ( j + 1 ) % tubularSegments;
 
-			var a = this.grid[ i ][ j ];
-			var b = this.grid[ ip ][ j ];
-			var c = this.grid[ ip ][ jp ];
-			var d = this.grid[ i ][ jp ];
+			var a = grid[ i ][ j ];
+			var b = grid[ ip ][ j ];
+			var c = grid[ ip ][ jp ];
+			var d = grid[ i ][ jp ];
 
-			var uva = new THREE.Vector2( i / this.radialSegments, j / this.tubularSegments );
-			var uvb = new THREE.Vector2( ( i + 1 ) / this.radialSegments, j / this.tubularSegments );
-			var uvc = new THREE.Vector2( ( i + 1 ) / this.radialSegments, ( j + 1 ) / this.tubularSegments );
-			var uvd = new THREE.Vector2( i / this.radialSegments, ( j + 1 ) / this.tubularSegments );
+			var uva = new THREE.Vector2( i / radialSegments, j / tubularSegments );
+			var uvb = new THREE.Vector2( ( i + 1 ) / radialSegments, j / tubularSegments );
+			var uvc = new THREE.Vector2( ( i + 1 ) / radialSegments, ( j + 1 ) / tubularSegments );
+			var uvd = new THREE.Vector2( i / radialSegments, ( j + 1 ) / tubularSegments );
 
 			this.faces.push( new THREE.Face3( a, b, d ) );
 			this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );

+ 35 - 29
src/extras/geometries/TubeGeometry.js

@@ -11,17 +11,24 @@
  * http://www.cs.indiana.edu/pub/techreports/TR425.pdf
  */
 
-THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed ) {
+THREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed ) {
 
 	THREE.Geometry.call( this );
 
-	this.path = path;
-	this.segments = segments || 64;
-	this.radius = radius || 1;
-	this.radialSegments = radialSegments || 8;
-	this.closed = closed || false;
+	this.parameters = {
+		path: path,
+		segments: segments,
+		radius: radius,
+		radialSegments: radialSegments,
+		closed: closed
+	};
 
-	this.grid = [];
+	segments = segments || 64;
+	radius = radius || 1;
+	radialSegments = radialSegments || 8;
+	closed = closed || false;
+
+	var grid = [];
 
 	var scope = this,
 
@@ -29,7 +36,7 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
 		normal,
 		binormal,
 
-		numpoints = this.segments + 1,
+		numpoints = segments + 1,
 
 		x, y, z,
 		tx, ty, tz,
@@ -42,7 +49,7 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
 		a, b, c, d,
 		uva, uvb, uvc, uvd;
 
-	var frames = new THREE.TubeGeometry.FrenetFrames( this.path, this.segments, this.closed ),
+	var frames = new THREE.TubeGeometry.FrenetFrames( path, segments, closed ),
 		tangents = frames.tangents,
 		normals = frames.normals,
 		binormals = frames.binormals;
@@ -58,12 +65,11 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
 
 	}
 
-
 	// consruct the grid
 
 	for ( i = 0; i < numpoints; i++ ) {
 
-		this.grid[ i ] = [];
+		grid[ i ] = [];
 
 		u = i / ( numpoints - 1 );
 
@@ -73,19 +79,19 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
 		normal = normals[ i ];
 		binormal = binormals[ i ];
 
-		for ( j = 0; j < this.radialSegments; j++ ) {
+		for ( j = 0; j < radialSegments; j++ ) {
 
-			v = j / this.radialSegments * 2 * Math.PI;
+			v = j / radialSegments * 2 * Math.PI;
 
-			cx = -this.radius * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.
-			cy = this.radius * Math.sin( v );
+			cx = -radius * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.
+			cy = radius * Math.sin( v );
 
 			pos2.copy( pos );
 			pos2.x += cx * normal.x + cy * binormal.x;
 			pos2.y += cx * normal.y + cy * binormal.y;
 			pos2.z += cx * normal.z + cy * binormal.z;
 
-			this.grid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z );
+			grid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z );
 
 		}
 	}
@@ -93,22 +99,22 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
 
 	// construct the mesh
 
-	for ( i = 0; i < this.segments; i++ ) {
+	for ( i = 0; i < segments; i++ ) {
 
-		for ( j = 0; j < this.radialSegments; j++ ) {
+		for ( j = 0; j < radialSegments; j++ ) {
 
-			ip = ( this.closed ) ? (i + 1) % this.segments : i + 1;
-			jp = (j + 1) % this.radialSegments;
+			ip = ( closed ) ? (i + 1) % segments : i + 1;
+			jp = (j + 1) % radialSegments;
 
-			a = this.grid[ i ][ j ];		// *** NOT NECESSARILY PLANAR ! ***
-			b = this.grid[ ip ][ j ];
-			c = this.grid[ ip ][ jp ];
-			d = this.grid[ i ][ jp ];
+			a = grid[ i ][ j ];		// *** NOT NECESSARILY PLANAR ! ***
+			b = grid[ ip ][ j ];
+			c = grid[ ip ][ jp ];
+			d = grid[ i ][ jp ];
 
-			uva = new THREE.Vector2( i / this.segments, j / this.radialSegments );
-			uvb = new THREE.Vector2( ( i + 1 ) / this.segments, j / this.radialSegments );
-			uvc = new THREE.Vector2( ( i + 1 ) / this.segments, ( j + 1 ) / this.radialSegments );
-			uvd = new THREE.Vector2( i / this.segments, ( j + 1 ) / this.radialSegments );
+			uva = new THREE.Vector2( i / segments, j / radialSegments );
+			uvb = new THREE.Vector2( ( i + 1 ) / segments, j / radialSegments );
+			uvc = new THREE.Vector2( ( i + 1 ) / segments, ( j + 1 ) / radialSegments );
+			uvd = new THREE.Vector2( i / segments, ( j + 1 ) / radialSegments );
 
 			this.faces.push( new THREE.Face3( a, b, d ) );
 			this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );
@@ -128,7 +134,7 @@ THREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
 // For computing of Frenet frames, exposing the tangents, normals and binormals the spline
-THREE.TubeGeometry.FrenetFrames = function(path, segments, closed) {
+THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 
 	var	tangent = new THREE.Vector3(),
 		normal = new THREE.Vector3(),