<commit_before>require.config({
    paths: {
        "goo": "../../../src/goo"
    }
});

require([
    'goo/entities/GooRunner',
    'goo/entities/World',
    'goo/renderer/Material',
    'goo/renderer/shaders/ShaderLib',
    'goo/renderer/Camera',
    'goo/shapes/ShapeCreator',
    'goo/entities/components/CameraComponent',
    'goo/scripts/OrbitCamControlScript',
    'goo/entities/EntityUtils',
    'goo/entities/components/ScriptComponent',
    'goo/renderer/MeshData',
    'goo/entities/components/MeshRendererComponent',
    'goo/math/Vector3',
    'goo/renderer/light/PointLight',
    'goo/renderer/light/DirectionalLight',
    'goo/renderer/light/SpotLight',
    'goo/entities/components/LightComponent',
    'goo/shapes/TerrainSurface',
    'goo/shapes/Sphere',
    'goo/scripts/WASDControlScript',
    'goo/scripts/MouseLookControlScript',
    'goo/scripts/WorldFittedTerrainScript',
	'goo/scripts/GroundBoundMovementScript',
    'goo/renderer/TextureCreator',
    'goo/util/CanvasUtils'
], function (
    GooRunner,
    World,
    Material,
    ShaderLib,
    Camera,
    ShapeCreator,
    CameraComponent,
    OrbitCamControlScript,
    EntityUtils,
    ScriptComponent,
    MeshData,
    MeshRendererComponent,
    Vector3,
    PointLight,
    DirectionalLight,
    SpotLight,
    LightComponent,
    TerrainSurface,
    Sphere,
    WASDControlScript,
    MouseLookControlScript,
    WorldFittedTerrainScript,
	GroundBoundMovementScript,
    TextureCreator,
    CanvasUtils
    ) {
    'use strict';

    var goo;
    var worldFittedTerrainScript = new WorldFittedTerrainScript();


    function addSpheres(goo, worldFittedTerrainScript, dims) {
        /*jshint loopfunc: true */
        var meshData = new Sphere(32, 32);

        var nSpheres = 4;
        var ak = Math.PI * 2 / nSpheres;
        for (var i = 0, k = 0; i < nSpheres; i++, k += ak) {
            var material = Material.createMaterial(ShaderLib.simpleColored, '');
            material.uniforms.color = [
                Math.cos(k) * 0.5 + 0.5,
                Math.cos(k + Math.PI / 3 * 2) * 0.5 + 0.5,
                Math.cos(k + Math.PI / 3 * 4) * 0.5 + 0.5
            ];
            var sphereEntity = EntityUtils.createTypicalEntity(goo.world, meshData, material);
            sphereEntity.transformComponent.transform.translation.setd(i+dims.minX*0.5+dims.maxX*0.5, dims.maxY*0.5+dims.minY*0.5, dims.maxZ*0.5+dims.minZ*0.5);
			sphereEntity.transformComponent.transform.scale.setd(1, 5, 2);

			var groundBoundMovementScript = new GroundBoundMovementScript();
			groundBoundMovementScript.setTerrainSystem(worldFittedTerrainScript);

			var scripts = new ScriptComponent();
            (function(i) {
                scripts.scripts.push({
                    run: function(entity) {
                        var translation = entity.transformComponent.transform.translation;

                        translation.data[0] = Math.cos(World.time * 0.07 * (i + 3)) * (i * 1.6 + 4) + dims.minX*0.5+dims.maxX*0.5;
                        translation.data[2] = Math.sin(World.time * 0.07 * (i + 3)) * (i * 1.6 + 4) + dims.maxZ*0.5+dims.minZ*0.5;

                        entity.transformComponent.setUpdated();
                    }
                });
            })(i);
            scripts.scripts.push(groundBoundMovementScript);
            sphereEntity.setComponent(scripts);

            sphereEntity.addToWorld();<commit_msg>Use movement component in World Terrain vtest<commit_after>require.config({
    paths: {
        "goo": "../../../src/goo"
    }
});

require([
    'goo/entities/GooRunner',
    'goo/entities/World',
    'goo/renderer/Material',
    'goo/renderer/shaders/ShaderLib',
    'goo/renderer/Camera',
    'goo/shapes/ShapeCreator',
    'goo/entities/components/CameraComponent',
    'goo/scripts/OrbitCamControlScript',
    'goo/entities/EntityUtils',
    'goo/entities/components/ScriptComponent',
    'goo/renderer/MeshData',
    'goo/entities/components/MeshRendererComponent',
    'goo/math/Vector3',
    'goo/renderer/light/PointLight',
    'goo/renderer/light/DirectionalLight',
    'goo/renderer/light/SpotLight',
    'goo/entities/components/LightComponent',
    'goo/shapes/TerrainSurface',
    'goo/shapes/Sphere',
    'goo/scripts/WASDControlScript',
    'goo/scripts/MouseLookControlScript',
    'goo/scripts/WorldFittedTerrainScript',
	'goo/entities/components/MovementComponent',
	'goo/scripts/GroundBoundMovementScript',
    'goo/renderer/TextureCreator',
    'goo/util/CanvasUtils'
], function (
    GooRunner,
    World,
    Material,
    ShaderLib,
    Camera,
    ShapeCreator,
    CameraComponent,
    OrbitCamControlScript,
    EntityUtils,
    ScriptComponent,
    MeshData,
    MeshRendererComponent,
    Vector3,
    PointLight,
    DirectionalLight,
    SpotLight,
    LightComponent,
    TerrainSurface,
    Sphere,
    WASDControlScript,
    MouseLookControlScript,
    WorldFittedTerrainScript,
	MovementComponent,
	GroundBoundMovementScript,
    TextureCreator,
    CanvasUtils
    ) {
    'use strict';

    var goo;
    var worldFittedTerrainScript = new WorldFittedTerrainScript();


    function addSpheres(goo, worldFittedTerrainScript, dims) {
        /*jshint loopfunc: true */
        var meshData = new Sphere(32, 32);

        var nSpheres = 4;
        var ak = Math.PI * 2 / nSpheres;
        for (var i = 0, k = 0; i < nSpheres; i++, k += ak) {
            var material = Material.createMaterial(ShaderLib.simpleColored, '');
            material.uniforms.color = [
                Math.cos(k) * 0.5 + 0.5,
                Math.cos(k + Math.PI / 3 * 2) * 0.5 + 0.5,
                Math.cos(k + Math.PI / 3 * 4) * 0.5 + 0.5
            ];
            var sphereEntity = EntityUtils.createTypicalEntity(goo.world, meshData, material);
            sphereEntity.transformComponent.transform.translation.setd(i+dims.minX*0.5+dims.maxX*0.5, dims.maxY*0.5+dims.minY*0.5, dims.maxZ*0.5+dims.minZ*0.5);
			sphereEntity.transformComponent.transform.scale.setd(1, 5, 2);

			sphereEntity.setComponent(new MovementComponent());
			var groundBoundMovementScript = new GroundBoundMovementScript();
			groundBoundMovementScript.setTerrainSystem(worldFittedTerrainScript);

			var scripts = new ScriptComponent();
            (function(i) {
                scripts.scripts.push({
                    run: function(entity) {
                        var translation = entity.transformComponent.transform.translation;

                        translation.data[0] = Math.cos(World.time * 0.07 * (i + 3)) * (i * 1.6 + 4) + dims.minX*0.5+dims.maxX*0.5;
                        translation.data[2] = Math.sin(World.time * 0.07 * (i + 3)) * (i * 1.6 + 4) + dims.maxZ*0.5+dims.minZ*0.5;

                        entity.transformComponent.setUpdated();
                    }
                });
            })(i);
            scripts.scripts.push(groundBoundMovementScript);
            sphereEntity.setComponent(scripts);

            sphereEntity.addToWorld();
{'fraction_non_alphanumeric': 0.12834454142223495, 'fraction_numerical': 0.0186006581771355, 'mean_word_length': 2.481075697211155, 'pattern_counts': {'":': 2, '<': 5, '<?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': '5834682', 'n_tokens_mistral': 2396, 'n_tokens_neox': 2277, 'n_words': 337}