<commit_before>(function()
{
    "use strict";
    var wgl = cns("sfme.internals.webgl");
    var tManager = cns("sfme.internals.textureManager");
    var log = cns("sfme.log");
    var _ = cns("sfme.types");
    var iManager = cns("sfme.internal.inputManager");
    var utils = cns("sfme.utils");
    var globalTiming = null;
    var geometry = cns("sfme.geometry");

    var activeScene = null;

    this.init = function(globalTiming_)
    {
        globalTiming = globalTiming_;
    };
    
    function createsfmeObject(obj)
    {
        (function()
        {
            this.setPosition = function(v)
            {
                this.position=v;
            };
            this.setScale = function(v)
            {
                this.scale=v;
            };
            this.setScaleX = function(v)
            {
                this.scale[0]=v;
            };
            this.setScaleY = function(v)
            {
                this.scale[1]=v;
            };
            this.setScaleZ = function(v)
            {
                this.scale[2]=v;
            };
            this.updateMvMatrixForObject = function()
            {
                if (!this.mvMatrix)
                {
                    this.mvMatrix = mat4.create();
                }
                mat4.identity(this.mvMatrix);
                if (this.position)
                {
                    mat4.translate(this.mvMatrix, this.position);
                }
                if (this.scale)
                {
                    mat4.scale(this.mvMatrix, this.scale);
                }
            };
            this.leftDownFront = function()
            {
                return this.boundingBox.leftDownFront;
            };
            this.rightTopFar = function()
            {
                return this.boundingBox.rightTopFar;
            };
            this.distance = function()
            {
                return this.boundingBox.distance;
            };
            this.clone = function()
            {
                return utils.cloneObject(this);
            };
            this.addClone = function(name)
            {
                if (this.parentCamera)
                {
                    var tmp = this.clone();
                    createObject(this.parentScene,tmp);
                    this.parentCamera.objects[name] = tmp;
                    return tmp;
                }
                else
                {
                    log.error("No camera no put the clone on");
                }
            };
        }).apply(obj);
    }

    function updateBoundingBox(object)
    {
        var leftDownFront = vec3.create();
        var rightTopFar = vec3.create();
        
        for (var i=0;i<object.vertex.length;++i)
        {
            var v=[object.vertex[i],object.vertex[++i],object.vertex[++i]];
            for (var j=0;j<3;++j)
            {
                if (i===0 || v[j] < leftDownFront[j])
                {
                    leftDownFront[j]=v[j];
                }
                if (i===0 || v[j] > rightTopFar[j])
                {
                    rightTopFar[j]=v[j];
                }
            }
        }
        object.boundingBox = {};
        object.boundingBox.leftDownFront = leftDownFront;
        object.boundingBox.rightTopFar = rightTopFar;
        object.boundingBox.distance = vec3.subtract(object.boundingBox.rightTopFar,object.boundingBox.leftDownFront,vec3.create());
    }
    
    function createObject(parentScene_,obj)
    {
        obj.parentScene = parentScene_;
        var vertex = [];
        var vertexIndices = [];
        if (obj.shapeType)
        {
            switch (obj.shapeType)
            {
                case geometry.MeshType.Triangle:
                    var size = [ obj.width || 1.0, obj.height || 1.0, obj.deep || 1.0];

                    geometry.vertexFor(obj,geometry.MeshType.Triangle,size);

                    break;
                case geometry.MeshType.Quad:
                    var size = [ obj.width || 1.0, obj.height || 1.0, obj.deep || 1.0];
                    
                    geometry.vertexFor(obj,geometry.MeshType.Quad,size);
                    break;
                case geometry.MeshType.CubeType0:
                    var size = [ obj.width || 1.0, obj.height || 1.0, obj.deep || 1.0];
                    geometry.vertexFor(obj,geometry.MeshType.CubeType0,size);
                    break;
            }
//            obj.vertexIndices = vertexIndices;<commit_msg>start color refactoring<commit_after>(function()
{
    "use strict";
    var wgl = cns("sfme.internals.webgl");
    var tManager = cns("sfme.internals.textureManager");
    var log = cns("sfme.log");
    var _ = cns("sfme.types");
    var iManager = cns("sfme.internal.inputManager");
    var utils = cns("sfme.utils");
    var globalTiming = null;
    var geometry = cns("sfme.geometry");

    var activeScene = null;

    this.init = function(globalTiming_)
    {
        globalTiming = globalTiming_;
    };
    
    function createsfmeObject(obj)
    {
        (function()
        {
            this.setPosition = function(v)
            {
                this.position=v;
            };
            this.setScale = function(v)
            {
                this.scale=v;
            };
            this.setScaleX = function(v)
            {
                this.scale[0]=v;
            };
            this.setScaleY = function(v)
            {
                this.scale[1]=v;
            };
            this.setScaleZ = function(v)
            {
                this.scale[2]=v;
            };
            this.updateMvMatrixForObject = function()
            {
                if (!this.mvMatrix)
                {
                    this.mvMatrix = mat4.create();
                }
                mat4.identity(this.mvMatrix);
                if (this.position)
                {
                    mat4.translate(this.mvMatrix, this.position);
                }
                if (this.scale)
                {
                    mat4.scale(this.mvMatrix, this.scale);
                }
            };
            this.leftDownFront = function()
            {
                return this.boundingBox.leftDownFront;
            };
            this.rightTopFar = function()
            {
                return this.boundingBox.rightTopFar;
            };
            this.distance = function()
            {
                return this.boundingBox.distance;
            };
            this.clone = function()
            {
                return utils.cloneObject(this);
            };
            this.addClone = function(name)
            {
                if (this.parentCamera)
                {
                    var tmp = this.clone();
                    createObject(this.parentScene,tmp);
                    this.parentCamera.objects[name] = tmp;
                    return tmp;
                }
                else
                {
                    log.error("No camera no put the clone on");
                }
            };
        }).apply(obj);
    }

    function updateBoundingBox(object)
    {
        var leftDownFront = vec3.create();
        var rightTopFar = vec3.create();
        
        for (var i=0;i<object.vertex.length;++i)
        {
            var v=[object.vertex[i],object.vertex[++i],object.vertex[++i]];
            for (var j=0;j<3;++j)
            {
                if (i===0 || v[j] < leftDownFront[j])
                {
                    leftDownFront[j]=v[j];
                }
                if (i===0 || v[j] > rightTopFar[j])
                {
                    rightTopFar[j]=v[j];
                }
            }
        }
        object.boundingBox = {};
        object.boundingBox.leftDownFront = leftDownFront;
        object.boundingBox.rightTopFar = rightTopFar;
        object.boundingBox.distance = vec3.subtract(object.boundingBox.rightTopFar,object.boundingBox.leftDownFront,vec3.create());
    }
    
    function createObject(parentScene_,obj)
    {
        obj.parentScene = parentScene_;
        obj.material.color = obj.material.color || [1.0,1.0,1.0,1.0];

        if (obj.shapeType)
        {
            var size = [ obj.width || 1.0, obj.height || 1.0, obj.deep || 1.0];

            geometry.vertexFor(obj,obj.shapeType,size);
//            obj.vertexIndices = vertexIndices;
{'fraction_non_alphanumeric': 0.11547647480296155, 'fraction_numerical': 0.007881538094100788, 'mean_word_length': 1.1663217796171754, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '3505624', 'n_tokens_mistral': 2393, 'n_tokens_neox': 2267, 'n_words': 343}