<commit_before>require.config({
	baseUrl : "./",
	paths : {
		goo : "../src/goo",
	}
});
require(['goo/entities/World', 'goo/entities/Entity', 'goo/entities/systems/System', 'goo/entities/systems/TransformSystem',
		'goo/entities/systems/RenderSystem', 'goo/entities/components/TransformComponent', 'goo/entities/components/MeshDataComponent',
		'goo/entities/components/MeshRendererComponent', 'goo/entities/systems/PartitioningSystem', 'goo/renderer/MeshData', 'goo/renderer/Renderer',
		'goo/renderer/Material', 'goo/renderer/Shader', 'goo/entities/GooRunner', 'goo/renderer/TextureCreator', 'goo/loaders/Loader',
		'goo/loaders/JSONImporter', 'goo/entities/components/ScriptComponent', 'goo/util/DebugUI', 'goo/shapes/ShapeCreator',
		'goo/entities/EntityUtils', 'goo/renderer/Texture', 'goo/renderer/Camera', 'goo/entities/components/CameraComponent', 'goo/math/Vector3',
		'goo/scripts/BasicControlScript', 'goo/renderer/shaders/ShaderLib',
		'goo/util/MeshBuilder',
		'goo/math/Transform',
		'goo/scripts/OrbitCamControlScript',
		'goo/renderer/light/PointLight',
		'goo/entities/components/LightComponent'
		], function(World, Entity, System, TransformSystem, RenderSystem, TransformComponent, MeshDataComponent,
	MeshRendererComponent, PartitioningSystem, MeshData, Renderer, Material, Shader, GooRunner, TextureCreator, Loader, JSONImporter,
	ScriptComponent, DebugUI, ShapeCreator, EntityUtils, Texture, Camera, CameraComponent, Vector3, 
	BasicControlScript, ShaderLib,
	MeshBuilder,
	Transform,
	OrbitCamControlScript,
	PointLight,
	LightComponent
		) {
	"use strict";

	function init() {
		// Create typical goo application
		var goo = new GooRunner({
			showStats : true
		});
		goo.renderer.domElement.id = 'goo';
		document.body.appendChild(goo.renderer.domElement);
		goo.renderer.setClearColor(0.0,0.0,0.0,1.0);

		createShapes(goo);

		// Add camera
		var camera = new Camera(45, 1, 1, 1000);
		var cameraEntity = goo.world.createEntity("CameraEntity");
		cameraEntity.transformComponent.transform.translation.set(0, 0, 10);
		cameraEntity.transformComponent.transform.lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
		cameraEntity.setComponent(new CameraComponent(camera));
		cameraEntity.addToWorld();
		var scripts = new ScriptComponent();
		scripts.scripts.push(new OrbitCamControlScript({
			domElement : goo.renderer.domElement,
			spherical : new Vector3(50, Math.PI / 2, 0)
		}));
		cameraEntity.setComponent(scripts);

		var entity = createBox(goo, 1, 1, ShaderLib.simple, 1);
		var light = new PointLight();
		entity.setComponent(new LightComponent(light));
		entity.addToWorld();
		var script = {
			run: function (entity) {
				var t = entity._world.time * 0.4;

				var transformComponent = entity.transformComponent;
				transformComponent.transform.translation.x = Math.sin(t * 1.0) * 200;
				transformComponent.transform.translation.y = 200;
				transformComponent.transform.translation.z = Math.cos(t * 1.0) * 200;
				transformComponent.setUpdated();
			}
		};
		entity.setComponent(new ScriptComponent(script));
	}

	// Create simple quad
	function createShapes(goo) {
		var sphereData = ShapeCreator.createSphere(10, 10, 1);
		var boxData = ShapeCreator.createBox(1, 1, 1);
		var torusData = ShapeCreator.createTorus(10, 6, 0.5, 1.0);

		var meshBuilder = new MeshBuilder();
		var transform = new Transform();
		var spread = 30.0;
		var count = 5000;
		for (var x=0;x<count;x++) {
			transform.translation.x = (Math.random() * 2.0 - 1.0) * spread;
			transform.translation.y = (Math.random() * 2.0 - 1.0) * spread;
			transform.translation.z = (Math.random() * 2.0 - 1.0) * spread;
			transform.setRotationXYZ(0, Math.random() * Math.PI * 2, 0);
			transform.update();
			
			if (x < count/3) {
				meshBuilder.addMeshData(boxData, transform);
			} else if (x < count*2/3) {
				meshBuilder.addMeshData(sphereData, transform);
			} else {
				meshBuilder.addMeshData(torusData, transform);
			}
		}
		var meshDatas = meshBuilder.build();
		console.log(meshDatas);

		var material = Material.createMaterial(ShaderLib.texturedLit, 'test');
		var texture = new TextureCreator().loadTexture2D('../resources/fieldstone-c.jpg');
		material.textures.push(texture);
		for (var key in meshDatas) {
			var entity = goo.world.createEntity();
			var meshDataComponent = new MeshDataComponent(meshDatas[key]);
			entity.setComponent(meshDataComponent);<commit_msg>Fixed up meshbuilder example<commit_after>require.config({
	baseUrl : "./",
	paths : {
		goo : "../src/goo",
	}
});
require(['goo/entities/World', 'goo/entities/Entity', 'goo/entities/systems/System', 'goo/entities/systems/TransformSystem',
		'goo/entities/systems/RenderSystem', 'goo/entities/components/TransformComponent', 'goo/entities/components/MeshDataComponent',
		'goo/entities/components/MeshRendererComponent', 'goo/entities/systems/PartitioningSystem', 'goo/renderer/MeshData', 'goo/renderer/Renderer',
		'goo/renderer/Material', 'goo/renderer/Shader', 'goo/entities/GooRunner', 'goo/renderer/TextureCreator', 'goo/loaders/Loader',
		'goo/loaders/JSONImporter', 'goo/entities/components/ScriptComponent', 'goo/util/DebugUI', 'goo/shapes/ShapeCreator',
		'goo/entities/EntityUtils', 'goo/renderer/Texture', 'goo/renderer/Camera', 'goo/entities/components/CameraComponent', 'goo/math/Vector3',
		'goo/scripts/BasicControlScript', 'goo/renderer/shaders/ShaderLib',
		'goo/util/MeshBuilder',
		'goo/math/Transform',
		'goo/scripts/OrbitCamControlScript',
		'goo/renderer/light/PointLight',
		'goo/entities/components/LightComponent'
		], function(World, Entity, System, TransformSystem, RenderSystem, TransformComponent, MeshDataComponent,
	MeshRendererComponent, PartitioningSystem, MeshData, Renderer, Material, Shader, GooRunner, TextureCreator, Loader, JSONImporter,
	ScriptComponent, DebugUI, ShapeCreator, EntityUtils, Texture, Camera, CameraComponent, Vector3, 
	BasicControlScript, ShaderLib,
	MeshBuilder,
	Transform,
	OrbitCamControlScript,
	PointLight,
	LightComponent
		) {
	"use strict";

	function init() {
		// Create typical goo application
		var goo = new GooRunner({
			showStats : true
		});
		goo.renderer.domElement.id = 'goo';
		document.body.appendChild(goo.renderer.domElement);
		goo.renderer.setClearColor(0.0,0.0,0.0,1.0);

		createShapes(goo);

		// Add camera
		var camera = new Camera(45, 1, 1, 1000);
		var cameraEntity = goo.world.createEntity("CameraEntity");
		cameraEntity.transformComponent.transform.translation.set(0, 0, 10);
		cameraEntity.transformComponent.transform.lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
		cameraEntity.setComponent(new CameraComponent(camera));
		cameraEntity.addToWorld();
		var scripts = new ScriptComponent();
		scripts.scripts.push(new OrbitCamControlScript({
			domElement : goo.renderer.domElement,
			spherical : new Vector3(50, Math.PI / 2, 0)
		}));
		cameraEntity.setComponent(scripts);

		var entity = createBox(goo, 1, 1, ShaderLib.simple, 1);
		var light = new PointLight();
		entity.setComponent(new LightComponent(light));
		entity.addToWorld();
		var script = {
			run: function (entity) {
				var t = entity._world.time * 0.4;

				var transformComponent = entity.transformComponent;
				transformComponent.transform.translation.x = Math.sin(t * 1.0) * 200;
				transformComponent.transform.translation.y = 200;
				transformComponent.transform.translation.z = Math.cos(t * 1.0) * 200;
				transformComponent.setUpdated();
			}
		};
		entity.setComponent(new ScriptComponent(script));
	}

	// Create simple quad
	function createShapes(goo) {
		var sphereData = ShapeCreator.createSphere(10, 10, 1);
		var boxData = ShapeCreator.createBox(1, 1, 1);
		var torusData = ShapeCreator.createTorus(10, 6, 0.5, 1.0);

		var meshBuilder = new MeshBuilder();
		var transform = new Transform();
		var spread = 30.0;
		var count = 5000;
		for (var x=0;x<count;x++) {
			transform.translation.x = (Math.random() * 2.0 - 1.0) * spread;
			transform.translation.y = (Math.random() * 2.0 - 1.0) * spread;
			transform.translation.z = (Math.random() * 2.0 - 1.0) * spread;
			transform.setRotationXYZ(0, Math.random() * Math.PI * 2, 0);
			transform.update();
			
			if (x < count/3) {
				meshBuilder.addMeshData(boxData, transform);
			} else if (x < count*2/3) {
				meshBuilder.addMeshData(sphereData, transform);
			} else {
				meshBuilder.addMeshData(torusData, transform);
			}
		}
		var meshDatas = meshBuilder.build();

		var material = Material.createMaterial(ShaderLib.texturedLit, 'test');
		var texture = new TextureCreator().loadTexture2D('../resources/fieldstone-c.jpg');
		material.textures.push(texture);
		for (var key in meshDatas) {
			var entity = goo.world.createEntity();
			var meshDataComponent = new MeshDataComponent(meshDatas[key]);
			entity.setComponent(meshDataComponent);
{'fraction_non_alphanumeric': 0.14345991561181434, 'fraction_numerical': 0.020983008324780478, 'mean_word_length': 4.769736842105263, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4705078', 'n_tokens_mistral': 3262, 'n_tokens_neox': 2926, 'n_words': 529}