<commit_before>define([
	'../../internals'
], function( internals ){
	
	var OBJWriter = function(){
		this.VERSION = "0.3";
		this.__bufferString = "";
		this.objStream;
		this.__filename = "objwriter.obj";
		this._numVerticesWritten = 0;
		this._numNormalsWritten = 0;
	};


	OBJWriter.prototype = {
		/**
		 * begin saving
		 * @param {WritableStream | String} [stream] stream can be a node.js WritableStream, or it can be a filename or undefined
		 */
		beginSave: function( stream ){
			if( typeof stream == 'string' ){

			} else if( internals.hasProperties(stream,['write','end','writable'] && stream.writable)){
				this.objStream = stream;
				this._handleBeginSave();
			} else {

			}
		},

		endSave: function(){
			if(this.objStream !== undefined ){
				try {
					this.objStream.destroy();
				} catch( e ){

				}
			}
		},

		face: function( a, b, c ){
			this.__bufferString += "f " + a + " " + b + " " + c + "\n";
		},

		faceList: function(){
			this.__bufferString += "s off \n";
		},

		faceWithNormals: function( a, na, b, nb, c, nc ){
			this.__bufferString += "f " + a + "//" + na + " " + b + "//" + nb + " " + c + "//" + nc + "\n";
		},

		getCurrNormalOffset: function(){
			return this._numNormalsWritten;
		},

		getCurrVertexOffset: function(){
			return this._numVerticesWritten;
		},

		_handleBeginSave: function(){

		},

		newObject: function( name ){
			this.__bufferString += "o " + name + "\n";
		},

		normal: function( vecN ){
			this.__bufferString +="vn " + vecN.x + " " + vecN.y + " " + vecN.z + "\n";
			this._numNormalsWritten++;
		},

		vertex: function( vecV ){
			this.__bufferString += "v " + vecV.x + " " + vecV.y + " " + vecV.z +"\n";
			this._numVerticesWritten++;
		}
	}


	return OBJWriter;

});<commit_msg>OBJWriter progress<commit_after>define([
	'../../internals'
], function( internals ){

	//faster than str += " "
	var StringBuffer = function(){
		this.buffer = [];
	};
	StringBuffer.prototype.append = function(string){
		this.buffer.push(string);
		return this;
	};
	StringBuffer.prototype.toString = function(){
		return this.buffer.join("");
	};
	
	var OBJWriter = function(){
		this.VERSION = "0.3";
		this.__stringBuffer = new StringBuffer();
		this.objStream;
		this.__filename = "objwriter.obj";
		this._numVerticesWritten = 0;
		this._numNormalsWritten = 0;
	};


	OBJWriter.prototype = {
		/**
		 * begin saving
		 * @param {WritableStream | String} [stream] stream can be a node.js WritableStream, or it can be a filename or undefined
		 */
		beginSave: function( stream ){
			if( typeof stream == 'string' ){
				//if node.js create a writeable stream with this filename
			} else if( internals.hasProperties(stream,['write','end','writable'] && stream.writable)){
				this.objStream = stream;
				this._handleBeginSave();
			} else {
				this._handleBeginSave();
			}
		},

		endSave: function(){
			if(this.objStream !== undefined ){
				try {
					this.objStream.destroy();
				} catch( e ){

				}
			}
		},

		face: function( a, b, c ){
			this.__stringBuffer.append("f " + a + " " + b + " " + c + "\n");
		},

		faceList: function(){
			this.__bufferString += "s off \n";
		},

		faceWithNormals: function( a, na, b, nb, c, nc ){
			this.__stringBuffer.append("f " + a + "//" + na + " " + b + "//" + nb + " " + c + "//" + nc + "\n");
		},

		getCurrNormalOffset: function(){
			return this._numNormalsWritten;
		},

		getCurrVertexOffset: function(){
			return this._numVerticesWritten;
		},

		//not in java version
		getOutput: function(){
			return this.__stringBuffer.toString();
		},

		_handleBeginSave: function(){
			this.numVerticesWritten = 0;
			this.numNormalsWrittern = 0;
			this.__stringBuffer.append("# generated by OBJExport v" + VERSION);
		},

		newObject: function( name ){
			this.__stringBuffer.append("o " + name + "\n");
		},

		normal: function( vecN ){
			this.__stringBuffer.append("vn " + vecN.x + " " + vecN.y + " " + vecN.z + "\n");
			this._numNormalsWritten++;
		},

		vertex: function( vecV ){
			this.__stringBuffer.append("v " + vecV.x + " " + vecV.y + " " + vecV.z +"\n");
			this._numVerticesWritten++;
		}
	}


	return OBJWriter;

});
{'fraction_non_alphanumeric': 0.18032786885245902, 'fraction_numerical': 0.0024108003857280617, 'mean_word_length': 2.9551954242135365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5978513', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1418, 'n_words': 310}