<commit_before>define([
'threejs',
'lib/viz/vizStats',
'lib/viz/threeTrans',
'lib/viz/threeLights',
'lib/viz/cube',
'lib/viz/cubeMatrix',
'THREE.TrackballControls'
],
function( 
    THREE,
    vizStats,
    threeTrans, 
    threeLights,
    cube,
    cubeMatrix ){
    
    // test threejs
    
    var cubeTest = function( config ){
        var self = this;
        self.config = config;
        self.reset();
    };
    
    cubeTest.prototype.reset = function(){
        var self = this;
        self.cubes = [];
        self.transforms = new threeTrans();
        self.matrix = new cubeMatrix( self );
        self.build();
        self.newCube();
        self.default().position();
        self.startLights();
        self.render();
        self.running = true;
    }
    
    cubeTest.prototype.start = function(){
        var self = this;
        self.running = true;
    }
    
    cubeTest.prototype.stop = function(){
        var self = this;
        self.transforms.clear();
        self.running = false;
    }
    
    cubeTest.prototype.showAxis = function(){
        var self = this;
        self.axis = new THREE.AxisHelper( 5 );
        self.scene.add( self.axis );
    }
    
    cubeTest.prototype.showGridHelper = function(){
        var self = this;
        self.gridHelper = new THREE.GridHelper( 10, 1 );
        self.scene.add( self.gridHelper );
    }
    
    cubeTest.prototype.setupCamera = function(){
        var self = this;
        self.camera = new THREE.PerspectiveCamera( 
            75, 
            window.innerWidth / window.innerHeight, 
            0.1,
            1000 
        );
        
        // setup camera controls
        
        self.cameraControls = new THREE.TrackballControls( self.camera, self.config.elem );
        self.cameraControls.rotateSpeed = 1.0;
        self.cameraControls.zoomSpeed = 1.2;
        self.cameraControls.panSpeed = 0.8;
        self.cameraControls.noZoom = false;
        self.cameraControls.noPan = false;
        self.cameraControls.staticMoving = true;
        self.cameraControls.dynamicDampingFactor = 0.3;
        self.cameraControls.keys = [ 65, 83, 68 ];
        self.cameraControls.addEventListener( 'change', self.render );
    }
    
    cubeTest.prototype.build = function(){
        var self = this;
        self.scene = new THREE.Scene();
        self.setupRenderer();
        self.setupCamera();
        
        // get fps stats
        
        self.stats = new vizStats({ elem: self.config.elem });
    };
    
    cubeTest.prototype.setupRenderer = function(){
        var self = this;
        self.config.elem.innerHTML = '';
        self.renderer = new THREE.WebGLRenderer({ 
            antialias: true, 
            alpha: false
        });
        self.renderer.setSize( window.innerWidth, window.innerHeight );
        window.addEventListener("resize", function(){
            self.renderer.setSize( window.innerWidth, window.innerHeight );
        })
        
        // append rendered element
        
        self.config.elem.appendChild( self.renderer.domElement );
    }
    
    cubeTest.prototype.newCube = function(){
        var self =this;
        var newCube = new cube();
        self.cubes.push( newCube );
        self.scene.add( newCube.mesh );
        return newCube
    };
    
    cubeTest.prototype.render = function(){
        var self = this;
        requestAnimationFrame( function(){ return self.render() });
        if ( self.running ){
            self.transforms.run();
        }
        self.renderer.render( self.scene, self.camera );
        self.stats.update();<commit_msg>got trackball controls working properly<commit_after>define([
'threejs',
'lib/viz/vizStats',
'lib/viz/threeTrans',
'lib/viz/threeLights',
'lib/viz/cube',
'lib/viz/cubeMatrix',
'THREE.TrackballControls'
],
function( 
    THREE,
    vizStats,
    threeTrans, 
    threeLights,
    cube,
    cubeMatrix ){
    
    // test threejs
    
    var cubeTest = function( config ){
        var self = this;
        self.config = config;
        self.reset();
    };
    
    cubeTest.prototype.reset = function(){
        var self = this;
        self.cubes = [];
        self.transforms = new threeTrans();
        self.matrix = new cubeMatrix( self );
        self.build();
        self.newCube();
        self.default().position();
        self.startLights();
        self.render();
        self.running = true;
    }
    
    cubeTest.prototype.start = function(){
        var self = this;
        self.running = true;
    }
    
    cubeTest.prototype.stop = function(){
        var self = this;
        self.transforms.clear();
        self.running = false;
    }
    
    cubeTest.prototype.showAxis = function(){
        var self = this;
        self.axis = new THREE.AxisHelper( 5 );
        self.scene.add( self.axis );
    }
    
    cubeTest.prototype.showGridHelper = function(){
        var self = this;
        self.gridHelper = new THREE.GridHelper( 10, 1 );
        self.scene.add( self.gridHelper );
    }
    
    cubeTest.prototype.setupCamera = function(){
        var self = this;
        self.camera = new THREE.PerspectiveCamera( 
            75, 
            window.innerWidth / window.innerHeight, 
            0.1,
            1000 
        );
        
        // setup camera controls
        
        self.cameraControls = new THREE.TrackballControls( self.camera );
        self.cameraControls.rotateSpeed = 1.0;
        self.cameraControls.zoomSpeed = 1.2;
        self.cameraControls.panSpeed = 0.8;
        self.cameraControls.noZoom = false;
        self.cameraControls.noPan = false;
        self.cameraControls.staticMoving = true;
        self.cameraControls.dynamicDampingFactor = 0.3;
        self.cameraControls.keys = [ 65, 83, 68 ];
        self.cameraControls.addEventListener( 'change', function(){ 
//            self.render();
        });
    }
    
    cubeTest.prototype.build = function(){
        var self = this;
        self.scene = new THREE.Scene();
        self.setupRenderer();
        self.setupCamera();
        
        // get fps stats
        
        self.stats = new vizStats({ elem: self.config.elem });
    };
    
    cubeTest.prototype.setupRenderer = function(){
        var self = this;
        self.config.elem.innerHTML = '';
        self.renderer = new THREE.WebGLRenderer({ 
            antialias: true, 
            alpha: false
        });
        self.renderer.setSize( window.innerWidth, window.innerHeight );
        window.addEventListener("resize", function(){
            self.renderer.setSize( window.innerWidth, window.innerHeight );
        })
        
        // append rendered element
        
        self.config.elem.appendChild( self.renderer.domElement );
    }
    
    cubeTest.prototype.newCube = function(){
        var self =this;
        var newCube = new cube();
        self.cubes.push( newCube );
        self.scene.add( newCube.mesh );
        return newCube
    };
    
    cubeTest.prototype.render = function(){
        var self = this;
        requestAnimationFrame( function(){ return self.render() });
        self.cameraControls.update();
        if ( self.running ){
            self.transforms.run();
        }
        self.renderer.render( self.scene, self.camera );
        self.stats.update();
{'fraction_non_alphanumeric': 0.12002189681127685, 'fraction_numerical': 0.007116463664978787, 'mean_word_length': 1.833656455990694, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4403914', 'n_tokens_mistral': 2164, 'n_tokens_neox': 2095, 'n_words': 408}