Browse Source

GeometryExporter: Changed manual string concatenation with JSON.stringify with prettify. Thanks @sole!
Something tells me that I'll have to refactor (or re-create) SceneExporter...

Mr.doob 12 years ago
parent
commit
d54f2e3f05
1 changed files with 12 additions and 12 deletions
  1. 12 12
      examples/js/exporters/GeometryExporter.js

+ 12 - 12
examples/js/exporters/GeometryExporter.js

@@ -161,18 +161,18 @@ THREE.GeometryExporter.prototype = {
 
 		//
 
-		var output = [
-			'{',
-			'	"metadata": {',
-			'		"formatVersion" : 3.1,',
-			'		"generatedBy"	: "GeometryExporter"',
-			'	},',
-			'	"vertices": ' + JSON.stringify( vertices ) + ',',
-			'	"normals": ' + JSON.stringify( normals ) + ',',
-			'	"uvs": ' + JSON.stringify( uvs ) + ',',
-			'	"faces": ' + JSON.stringify( faces ),
-			'}'
-		].join( '\n' );
+		var output = JSON.stringify( {
+			metadata: {
+				formatVersion: 3.1,
+				generatedBy: "GeometryExporter",
+			},
+			vertices: vertices,
+			normals: normals,
+			uvs: uvs,
+			faces: faces
+		}, null, '\t' );
+
+		// output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 
 		return output;