<commit_before><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
		<title>NEHE Tutorial 16</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

		<!-- Set the viewport size to the screen size, so it will be displayed maximized, but unscaled. -->
		<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">		
    <link href="../../../../images/favicon.png"  rel="shortcut icon" type="image/png" />
    <link rel="stylesheet" type="text/css" href="../../css/NeHe.css" />

		<!-- Include several libraries from THREE.js and the Scene class  -->
		<script src="../../js/three.js" type="text/javascript"></script>
		<script src="../../js/Detector.js" type="text/javascript"></script>
		<script src="../../js/OrbitControls-Touch-Ortho.js" type="text/javascript"></script>
		<script src="../../js/stats.js" type="text/javascript"></script>
		<script src="../../js/gfx-scene.js" type="text/javascript"></script>
	</head>
	<body>
    <!-- Create a DIV element, which will be shown over the WebGL canvas. -->
    <div style="position: absolute; top: 10px; left: 10px;color:white">
        'r,g,b,w,k': Color of the fog<br/>
        '+,-' intensity of the fog
    </div>
    <script type="text/javascript"> 
            var MAX_FOG = 0.5;
            var MIN_FOG = 0.0;
            var FOG_INCR = 0.025;
            var CUBE_SIZE = 0.25;

			var crateTexture;
			var	yTranslation = CUBE_SIZE/2.0;
			var	zTranslation = 0.0;
			var	xPos, yPos;
            var fogType = "exponential";
			var fogDensity = 0.10;

			// allocate the Scene object, request orbitControls, some of 3D axes 10 units high and the stats
			var gfxScene = new GFX.Scene( {
				cameraPos:[2,2,10],
				controls:true,
				displayStats:true,
				floorRepeat:10,
				floorImage: "../../images/checkerboard.jpg",
                fogType : fogType,
				fogDensity : fogDensity,
				fogColor: 0xffffff });
	
			// then initialize our demo's stuff
			initializeDemo();
	
			// Animate the scene
			animateScene();
	
			/**
			 * Initialize the Demo.  
			 */
			function initializeDemo() {
	
				// Create the cubes
				var boxGeometry = new THREE.BoxGeometry(CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
	
				// Load an image as texture
				crateTexture = new THREE.ImageUtils.loadTexture("images/Crate.jpg");
	
				var boxMaterial = new THREE.MeshLambertMaterial({
					map:crateTexture,
					side:THREE.DoubleSide
				});

				var boxMesh;
				for ( var x=-5; x<=5; x += 1) {
					boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
					boxMesh.position.set(x, yTranslation, zTranslation);
					gfxScene.add(boxMesh);
				}
				
				for ( var z=-5; z<=5; z += 1 ) {
					boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
					boxMesh.position.set(0.0, yTranslation, z);
					gfxScene.add(boxMesh);
				}

				document.addEventListener("keydown", onDocumentKeyDown, false);
			}
	
			function onDocumentKeyDown(event) {

				// Get the key code of the pressed key
				var keyChar = String.fromCharCode(event.which);

				if (keyChar == '+') {
					if (fogDensity < MAX_FOG )
						fogDensity += FOG_INCR;
					else 
						fogDensity = MAX_FOG;
					gfxScene.addFog( { fogDensity: fogDensity } );
				}
				else if (keyChar == '-') {  
					if (fogDensity > MIN_FOG)
						fogDensity -= FOG_INCR;
					else
						fogDensity = 0;
					gfxScene.addFog( { fogDensity: fogDensity } );
				}
				else if (keyChar == 'r') {
					gfxScene.addFog( { fogColor: 0xff0000 } );
				}
				else if (keyChar == 'g') {
					gfxScene.addFog( { fogColor: 0x00ff00 } );
				}	
				else if (keyChar == 'b') {
					gfxScene.addFog( { fogColor: 0x0000ff } );
				}
				else if (keyChar == 'k') {
					gfxScene.addFog( { fogColor: 0x000000 } );
				}	
				else if (keyChar == 'w') {
					gfxScene.addFog( { fogColor: 0xffffff } );
				}

				// need to stop propagation of the event or the Reading System will probably take back the focus
				event.stopPropagation();
 			}

			/**
			 * Animate the scene and call rendering.
			 */
			function animateScene() {
	
				// Tell the browser to call this function when page is visible
				requestAnimationFrame(animateScene);
				
				// Map the 3D scene down to the 2D screen (render the frame)
				gfxScene.renderScene();
			}
		</script>

	</body>
</html><commit_msg>Changed key tracking from event.which to simply event.key.  Removed unused variables.<commit_after><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
		<title>NEHE Tutorial 16</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

		<!-- Set the viewport size to the screen size, so it will be displayed maximized, but unscaled. -->
		<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">		
    <link href="../../../../images/favicon.png"  rel="shortcut icon" type="image/png" />
    <link rel="stylesheet" type="text/css" href="../../css/NeHe.css" />

		<!-- Include several libraries from THREE.js and the Scene class  -->
		<script src="../../js/three.js" type="text/javascript"></script>
		<script src="../../js/Detector.js" type="text/javascript"></script>
		<script src="../../js/OrbitControls-Touch-Ortho.js" type="text/javascript"></script>
		<script src="../../js/stats.js" type="text/javascript"></script>
		<script src="../../js/gfx-scene.js" type="text/javascript"></script>
	</head>
	<body>
    <!-- Create a DIV element, which will be shown over the WebGL canvas. -->
    <div style="position: absolute; top: 10px; left: 10px;color:white">
        'r,g,b,w,k': Color of the fog<br/>
        '+,-' intensity of the fog
    </div>
    <script type="text/javascript"> 
            var MAX_FOG = 0.5;
            var MIN_FOG = 0.0;
            var FOG_INCR = 0.025;
            var CUBE_SIZE = 0.25;

			var crateTexture;
			var	yTranslation = CUBE_SIZE/2.0;
			var	zTranslation = 0.0;
      var fogType = "exponential";
			var fogDensity = 0.10;

			// allocate the Scene object, request orbitControls, some of 3D axes 10 units high and the stats
			var gfxScene = new GFX.Scene( {
				cameraPos:[2,2,10],
				controls:true,
				displayStats:true,
				floorRepeat:10,
				floorImage: "../../images/checkerboard.jpg",
                fogType : fogType,
				fogDensity : fogDensity,
				fogColor: 0xffffff });
	
			// then initialize our demo's stuff
			initializeDemo();
	
			// Animate the scene
			animateScene();
	
			/**
			 * Initialize the Demo.  
			 */
			function initializeDemo() {
	
				// Create the cubes
				var boxGeometry = new THREE.BoxGeometry(CUBE_SIZE, CUBE_SIZE, CUBE_SIZE);
	
				// Load an image as texture
				crateTexture = new THREE.ImageUtils.loadTexture("images/Crate.jpg");
	
				var boxMaterial = new THREE.MeshLambertMaterial({
					map:crateTexture,
					side:THREE.DoubleSide
				});

				var boxMesh;
				for ( var x=-5; x<=5; x += 1) {
					boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
					boxMesh.position.set(x, yTranslation, zTranslation);
					gfxScene.add(boxMesh);
				}
				
				for ( var z=-5; z<=5; z += 1 ) {
					boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
					boxMesh.position.set(0.0, yTranslation, z);
					gfxScene.add(boxMesh);
				}

				document.addEventListener("keydown", onDocumentKeyDown, false);
			}
	
			function onDocumentKeyDown(event) {

				// Get the key code of the pressed key
				var keyChar = event.key;
				keyChar = keyChar.toLowerCase();

				
				if (keyChar === '+') {
					if (fogDensity < MAX_FOG )
						fogDensity += FOG_INCR;
					else 
						fogDensity = MAX_FOG;
					gfxScene.addFog( { fogDensity: fogDensity } );
				}
				else if (keyChar === '-') {  
					if (fogDensity > MIN_FOG)
						fogDensity -= FOG_INCR;
					else
						fogDensity = 0;
					gfxScene.addFog( { fogDensity: fogDensity } );
				}
				else if (keyChar === 'r') {
					gfxScene.addFog( { fogColor: 0xff0000 } );
				}
				else if (keyChar === 'g') {
					gfxScene.addFog( { fogColor: 0x00ff00 } );
				}	
				else if (keyChar === 'b') {
					gfxScene.addFog( { fogColor: 0x0000ff } );
				}
				else if (keyChar === 'k') {
					gfxScene.addFog( { fogColor: 0x000000 } );
				}	
				else if (keyChar === 'w') {
					gfxScene.addFog( { fogColor: 0xffffff } );
				}

				// need to stop propagation of the event or the Reading System will probably take back the focus
				event.stopPropagation();
 			}

			/**
			 * Animate the scene and call rendering.
			 */
			function animateScene() {
	
				// Tell the browser to call this function when page is visible
				requestAnimationFrame(animateScene);
				
				// Map the 3D scene down to the 2D screen (render the frame)
				gfxScene.renderScene();
			}
		</script>

	</body>
</html>
{'fraction_non_alphanumeric': 0.14932332537245535, 'fraction_numerical': 0.017968838849084498, 'mean_word_length': 2.6011466011466013, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '2403361', 'n_tokens_mistral': 3667, 'n_tokens_neox': 2901, 'n_words': 730}