<commit_before>const CAMERA_MOVE = 5;

//Vars
var mouseDownX = 0, 
mouseDownY = 0,
windowHalfX = window.innerWidth/2, 
windowHalfY = window.innerHeight/2, 
mouseX = 0,
mouseY = 0,
targetRotationX = 0, 
targetRotationY = 0,
mouseDownRotationX = 0,
mouseDownRotationY = 0,
wheelData = 0,
noinertia = 0,
newrotationmatrix,
newrotation,
slowRotationX=0,
slowRotationY=0,
home,
maxDimension,
stats,
vslider,
time = new Date().getTime(),
timedelay = 3000,
refinestep = 10,
timeLastRefine = new Date().getTime(),
loaded = false,
offset=0,
minfps = 1,
fps=0,
framescounter=0,

//Renderer
WIDTH = window.innerWidth,
HEIGHT = window.innerHeight,

//Camera
VIEW_ANGLE = 60,
ASPECT = WIDTH / HEIGHT,
NEAR = 1,
FAR = 10000,

//important vars
webgl = isWebGLSupported(),
loader,
scene,
camera,
renderer,
mesh;

init();
animate();

function isWebGLSupported() {
	try { 
	 !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); 
	} catch( e ) { 
		return 0;
	}
	return 1;
}

function init() {

//	if(webgl) {
	//	renderer = new THREE.WebGLRenderer({antialias: true});
	//	
	//}
	//else {
		renderer = new THREE.CanvasRenderer({antialias: true});
	//}
		
	renderer.setSize(WIDTH, HEIGHT);
	renderer.setClearColorHex(0xEEEEEE, 1.0);
	renderer.clear();
	
	camera = new THREE.PerspectiveCamera(
			   VIEW_ANGLE,
			   ASPECT,
			   NEAR,
			   FAR );
	
	stats = new Stats();
	stats.domElement.style.position = 'absolute';
	stats.domElement.style.top = '0px';
	document.body.appendChild( stats.domElement );
	
	
	scene = new THREE.Scene();
	scene.add(camera);
		
	scene.add( new THREE.AmbientLight( 0x505050, 2000 ) );
	var light1 = new THREE.PointLight( 0x707070, 1, 2000 );
	light1.position.x = 100;
	light1.position.z = 30;
	scene.add( light1 );
	
	var light2 = new THREE.PointLight( 0x707070, 1, 2000 );
	light2.position.x = -100;
	light2.position.z = 30;
	scene.add( light2 );
	
	
	loadMesh();

	document.body.appendChild( renderer.domElement );
	
	vslider = new Slider(document.getElementById("slider-vertical"), document.getElementById("slider-vertical-input"), "vertical");
	vslider.onchange = onSliderChange;
	
	renderer.domElement.addEventListener('mousedown', onMouseDown, false);
	renderer.domElement.addEventListener('DOMMouseScroll', onMouseScroll, false);
	renderer.domElement.addEventListener('mousewheel', onMouseScroll, false);
	renderer.domElement.addEventListener('touchstart', onTouchStart, false);
	renderer.domElement.addEventListener('touchmove', onTouchMove, false);
	renderer.domElement.addEventListener('touchend', onTouchEnd, false);
	renderer.domElement.addEventListener('contextmenu', onContextMenu, false);
}

 function onContextMenu(event) {
	
	event = event ? event : document.event;
	
	event.preventDefault();
	return false;
}

function loadMesh() {
	
	mesh = new THREE.Mesh(new THREE.Geometry(), new THREE.MeshLambertMaterial({color: 0xffffff, shading: THREE.FlatShading}));
	loadBaseMesh();
	scene.add(mesh);
}

function setParameters() {
	
		mesh.name = 'mesh';
		mesh.overdraw = true;
		mesh.doubleSided = true;
		mesh.geometry.computeBoundingBox();
		var box = mesh.geometry.boundingBox;
		if(box) {
			maxDimension = Math.max(box.x[1]-box.x[0], box.y[1]-box.y[0]);
			maxDimension = Math.ceil(Math.max(maxDimension, box.z[1]-box.z[0]));
			camera.position.z = maxDimension*2;
			camera.position.x = box.x[0] + (box.x[1]-box.x[0])/2;
			camera.position.y = box.y[0] + (box.y[1]-box.y[0])/2;
			
			vslider.setMinimum(-maxDimension);
			vslider.setMaximum(maxDimension*1.5);
			vslider.setValue(maxDimension*0.25);
		}
}

function animate() {

	requestAnimationFrame(animate);
	if(mesh) {
		rotateMesh();
		time = new Date().getTime();
		
		if((time - timeLastRefine) > timedelay) {
			var refine = true;<commit_msg>Zamiast dwóch świateł umieszczonych daleko po obu stronach obiektu i "za kamerą" jest jedno, które ustawia swoje położenie w punkcie kamery.<commit_after>const CAMERA_MOVE = 5;

//Vars
var mouseDownX = 0, 
mouseDownY = 0,
windowHalfX = window.innerWidth/2, 
windowHalfY = window.innerHeight/2, 
mouseX = 0,
mouseY = 0,
targetRotationX = 0, 
targetRotationY = 0,
mouseDownRotationX = 0,
mouseDownRotationY = 0,
wheelData = 0,
noinertia = 0,
newrotationmatrix,
newrotation,
slowRotationX=0,
slowRotationY=0,
home,
maxDimension,
stats,
vslider,
time = new Date().getTime(),
timedelay = 3000,
refinestep = 10,
timeLastRefine = new Date().getTime(),
loaded = false,
offset=0,
minfps = 1,
fps=0,
framescounter=0,

//Renderer
WIDTH = window.innerWidth,
HEIGHT = window.innerHeight,

//Camera
VIEW_ANGLE = 60,
ASPECT = WIDTH / HEIGHT,
NEAR = 1,
FAR = 10000,

//important vars
webgl = isWebGLSupported(),
loader,
scene,
camera,
renderer,
mesh,
light;

init();
animate();

function isWebGLSupported() {
	try { 
	 !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); 
	} catch( e ) { 
		return 0;
	}
	return 1;
}

function init() {

//	if(webgl) {
	//	renderer = new THREE.WebGLRenderer({antialias: true});
	//	
	//}
	//else {
		renderer = new THREE.CanvasRenderer({antialias: true});
	//}
		
	renderer.setSize(WIDTH, HEIGHT);
	renderer.setClearColorHex(0xEEEEEE, 1.0);
	renderer.clear();
	
	camera = new THREE.PerspectiveCamera(
			   VIEW_ANGLE,
			   ASPECT,
			   NEAR,
			   FAR );
	
	stats = new Stats();
	stats.domElement.style.position = 'absolute';
	stats.domElement.style.top = '0px';
	document.body.appendChild( stats.domElement );
	
	scene = new THREE.Scene();
	scene.add(camera);
	scene.add( new THREE.AmbientLight( 0x505050, 2000 ) );
	light = new THREE.PointLight( 0x707070, 1, 2000 );
	scene.add( light );

	/*var light2 = new THREE.PointLight( 0x707070, 1, 2000 );
	light2.position.x = -100;
	light2.position.z = 30;
	scene.add( light2 );	scene.add(p1); */
	loadMesh();

	document.body.appendChild( renderer.domElement );
	
	vslider = new Slider(document.getElementById("slider-vertical"), document.getElementById("slider-vertical-input"), "vertical");
	vslider.onchange = onSliderChange;
	
	renderer.domElement.addEventListener('mousedown', onMouseDown, false);
	renderer.domElement.addEventListener('DOMMouseScroll', onMouseScroll, false);
	renderer.domElement.addEventListener('mousewheel', onMouseScroll, false);
	renderer.domElement.addEventListener('touchstart', onTouchStart, false);
	renderer.domElement.addEventListener('touchmove', onTouchMove, false);
	renderer.domElement.addEventListener('touchend', onTouchEnd, false);
	renderer.domElement.addEventListener('contextmenu', onContextMenu, false);
}

 function onContextMenu(event) {
	
	event = event ? event : document.event;
	
	event.preventDefault();
	return false;
}

function loadMesh() {
	
	mesh = new THREE.Mesh(new THREE.Geometry(), new THREE.MeshLambertMaterial({color: 0xffffff, shading: THREE.FlatShading}));
	loadBaseMesh();
	scene.add(mesh);
}

function setParameters() {
	
		mesh.name = 'mesh';
		mesh.overdraw = true;
		mesh.doubleSided = true;
		mesh.geometry.computeBoundingBox();
		var box = mesh.geometry.boundingBox;
		if(box) {
			maxDimension = Math.max(box.x[1]-box.x[0], box.y[1]-box.y[0]);
			maxDimension = Math.ceil(Math.max(maxDimension, box.z[1]-box.z[0]));
			camera.position.z = light.position.z = maxDimension*2;
			camera.position.x = box.x[0] + (box.x[1]-box.x[0])/2;
			camera.position.y = box.y[0] + (box.y[1]-box.y[0])/2;
			
			vslider.setMinimum(-maxDimension);
			vslider.setMaximum(maxDimension*1.5);
			vslider.setValue(maxDimension*0.25);
		}		
}

function animate() {

	requestAnimationFrame(animate);
	if(mesh) {
		rotateMesh();
		time = new Date().getTime();
		
		if((time - timeLastRefine) > timedelay) {
			var refine = true;
{'fraction_non_alphanumeric': 0.1494013534617387, 'fraction_numerical': 0.028370640291514836, 'mean_word_length': 4.572878897751994, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4287185', 'n_tokens_mistral': 3025, 'n_tokens_neox': 2727, 'n_words': 535}