<commit_before>var renderer, scene, camera, clock;
var material, mesh, uniforms, attributes;
var mouseX = 100,
    mouseY = 100,
    mouseWheel = 1.0;
var winWidth = 400;
var winHeight = 400;

init();
animate();

function init() {

	// renderer
	renderer = new THREE.WebGLRenderer();
	renderer.setSize( winWidth, winHeight );
	//document.body.appendChild( renderer.domElement );
	document.getElementById("coolGalaxyBox").appendChild(renderer.domElement);

	// scene
	scene = new THREE.Scene();

	// camera
//var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
    camera = new THREE.PerspectiveCamera( 40, winWidth / winHeight, 1, 1000 );
	camera.position.set( 0, 0, 60 );

	// axes
	//scene.add( new THREE.AxisHelper( 20 ) );

	// uniforms
	uniforms = {
		color: { type: "c", value: new THREE.Color( 0xaaaadd ) },

		iResolution: { type: "v3", value: new THREE.Vector3(500.0,400.0, 0.0) },
		iGlobalTime: { type: "f", value: 1.0 },
		iMouse: { type: "v4", value: new THREE.Vector4(5.0,40.0, 0.0, 0.0) },
	};

	// attributes
	attributes = {
	};

	// material
	material = new THREE.ShaderMaterial( {
		attributes      : attributes,
		uniforms        : uniforms,
		vertexShader    : document.getElementById( 'vertex_shader' ).textContent,
		fragmentShader  : document.getElementById( 'fragment_shader' ).textContent
	} );
    
	// plane geometry
	var geometry = new THREE.PlaneGeometry( 40, 40 );

	// plane
	mesh = new THREE.Mesh( geometry, material );
	scene.add( mesh );
    
    document.addEventListener('mousemove', onMouseMove, false);
    document.addEventListener('mousedown', onMouseDown, false);
    document.addEventListener('mouseup', onMouseUp, false);
    document.addEventListener('mousewheel', onMouseWheel, false);
    clock = new THREE.Clock();

}

function animate() {
    time = clock.getElapsedTime();
    delta = clock.getDelta();

    uniforms.iGlobalTime.value = time;
    //uniforms.cameraPos.value = camera.position;
    //uniforms.iGlobalTime.needsUpdate = true; // doesn't seem to be needed.?
    uniforms.iMouse.value = new THREE.Vector4(mouseX*400.01,mouseY*400.01, 400.0);
    uniforms.iMouse.needsUpdate;
    uniforms.needsUpdate = true;

	requestAnimationFrame( animate );

	renderer.render( scene, camera );

}

var mouseIsDown = false;
//event listener
function onMouseDown(event_info) {<commit_msg>fix up canvas element to match size of static image, and remove black padding/margin<commit_after>var renderer, scene, camera, clock;
var material, mesh, uniforms, attributes;
var mouseX = 100,
    mouseY = 100,
    mouseWheel = 1.0;
var winWidth = 424;
var winHeight = 424;

init();
animate();

function init() {

	// renderer
	renderer = new THREE.WebGLRenderer();
	renderer.setSize( winWidth, winHeight );
	//document.body.appendChild( renderer.domElement );
	document.getElementById("coolGalaxyBox").appendChild(renderer.domElement);

	// scene
	scene = new THREE.Scene();

	// camera
//var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
    camera = new THREE.PerspectiveCamera( 40, winWidth / winHeight, 1, 1000 );
	camera.position.set( 0, 0, 55 );

	// axes
	//scene.add( new THREE.AxisHelper( 20 ) );

	// uniforms
	uniforms = {
		color: { type: "c", value: new THREE.Color( 0xaaaadd ) },

		iResolution: { type: "v3", value: new THREE.Vector3(500.0,400.0, 0.0) },
		iGlobalTime: { type: "f", value: 1.0 },
		iMouse: { type: "v4", value: new THREE.Vector4(5.0,40.0, 0.0, 0.0) },
	};

	// attributes
	attributes = {
	};

	// material
	material = new THREE.ShaderMaterial( {
		attributes      : attributes,
		uniforms        : uniforms,
		vertexShader    : document.getElementById( 'vertex_shader' ).textContent,
		fragmentShader  : document.getElementById( 'fragment_shader' ).textContent
	} );

	// plane geometry
	var geometry = new THREE.PlaneGeometry( 40, 40 );

	// plane
	mesh = new THREE.Mesh( geometry, material );
	scene.add( mesh );

    document.addEventListener('mousemove', onMouseMove, false);
    document.addEventListener('mousedown', onMouseDown, false);
    document.addEventListener('mouseup', onMouseUp, false);
    document.addEventListener('mousewheel', onMouseWheel, false);
    clock = new THREE.Clock();

}

function animate() {
    time = clock.getElapsedTime();
    delta = clock.getDelta();

    uniforms.iGlobalTime.value = time;
    //uniforms.cameraPos.value = camera.position;
    //uniforms.iGlobalTime.needsUpdate = true; // doesn't seem to be needed.?
    uniforms.iMouse.value = new THREE.Vector4(mouseX*400.01,mouseY*400.01, 400.0);
    uniforms.iMouse.needsUpdate;
    uniforms.needsUpdate = true;

	requestAnimationFrame( animate );

	renderer.render( scene, camera );

}

var mouseIsDown = false;
//event listener
function onMouseDown(event_info) {
{'fraction_non_alphanumeric': 0.1419408235050693, 'fraction_numerical': 0.0335195530726257, 'mean_word_length': 3.6795740561471444, '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': '4114387', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1542, 'n_words': 387}