<commit_before><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - materials - bump map [<NAME>-Smith]</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background:#555;
				color:#fff;
				padding:0;
				margin:0;
				font-weight: bold;
				overflow:hidden;
			}
		</style>
		<script src="../libs/dat.gui.min.js"></script>
		<script src="../assets/assets.js"></script>
		<script src="../libs/three.min.js"></script>
	</head>

	<body>
		<script>
			var container, loader;
			var camera, scene, renderer;
			var mesh, model, bgcolor = [22, 22, 22];
			var directionalLight, directionalLight2, pointLight, ambientLight, spotLight;
			var mouseX = 0;
			var mouseY = 0;
			var targetX = 0;
			var targetY = 0;
			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;

			init();
			render();

			function init() {

				container = document.createElement('div');
				document.body.appendChild(container);

				camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 50);
				camera.position.z = 3;

				scene = new THREE.Scene();

				ambientLight = new THREE.AmbientLight(0x444444);
				scene.add(ambientLight);

				pointLight = new THREE.PointLight(0xffffff, 1.5, 10);
				pointLight.color.setHSV(0.05, 0.05, 1);
				pointLight.position.set(3, 0, 3);
				scene.add(pointLight);

				var objects = [];
				for (i in assets.objects) objects.push(i);
				model = objects[objects.length-1];

				loader = new THREE.JSONLoader(true);
				document.body.appendChild(loader.statusDomElement);
				loader.load("../assets/models/" + model + "/" + model + ".js", createScene);

				var c = (new THREE.Color()).setRGB(bgcolor[0]/255, bgcolor[1]/255, bgcolor[2]/255);
				renderer = new THREE.WebGLRenderer({
					antialias: true, clearColor: c.getHex(), clearAlpha: 1
				});
				renderer.setSize(window.innerWidth, window.innerHeight);
				container.appendChild(renderer.domElement);

				renderer.gammaInput = true;
				renderer.gammaOutput = true;
				renderer.physicallyBasedShading = true;

				var gui = new dat.GUI();
				gui.add(window, "model", objects).onChange(function() {
					loader.statusDomElement.style.display = "block";
					scene.remove(mesh);
					loader.load("../assets/models/" + model + "/" + model + ".js", createScene);
				});
				gui.addColor(window, "bgcolor").onChange(function() {
					if (typeof bgcolor == "string") {
						bgcolor = bgcolor.charAt(0) == "#" ? bgcolor.substring(1,7) : bgcolor;
						bgcolor = [
							parseInt(bgcolor.substring(0, 2), 16),
							parseInt(bgcolor.substring(2, 4), 16),
							parseInt(bgcolor.substring(4, 6), 16),
						];
					}
					var c = (new THREE.Color()).setRGB(bgcolor[0]/255, bgcolor[1]/255, bgcolor[2]/255);
					console.log(bgcolor);
					renderer.setClearColor(c, 1.0);
				});
				gui.add(window, "squareCanvas");

				document.addEventListener('mousemove', onDocumentMouseMove, false);
				window.addEventListener('resize', onWindowResize, false);
			}

			function createScene(geometry) {
				mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
				mesh.castShadow = true;
				mesh.receiveShadow = true;
				scene.add(mesh);
				loader.statusDomElement.style.display = "none";
			}

			function squareCanvas() {
				renderer.setSize(512, 512);
				camera.aspect = 1;
				camera.updateProjectionMatrix();
			}

			function onWindowResize(event) {
				renderer.setSize(window.innerWidth, window.innerHeight);
				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();
			}

			function onDocumentMouseMove(event) {
				mouseX = (event.clientX - windowHalfX);
				mouseY = (event.clientY - windowHalfY);
			}

			function render() {
				requestAnimationFrame(render);

				targetX = mouseX * .01;
				targetY = mouseY * .01;

				if (mesh) {
					mesh.rotation.y += targetX - mesh.rotation.y;
					mesh.rotation.x += targetY - mesh.rotation.x;
				}

				renderer.render(scene, camera);
			}

		</script>

	</body><commit_msg>Model-viewer: screenshot and drag-to-rotate.<commit_after><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - materials - bump map [Lee Perry-Smith]</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background:#555;
				color:#fff;
				padding:0;
				margin:0;
				font-weight: bold;
				overflow:hidden;
			}
		</style>
		<script src="../libs/dat.gui.min.js"></script>
		<script src="../assets/assets.js"></script>
		<script src="../libs/three.min.js"></script>
	</head>

	<body>
		<script>
			var container, loader;
			var camera, scene, renderer;
			var mesh, model, bgcolor = [22, 22, 22];
			var pointLight, ambientLight;
			var mouseX = 0;
			var mouseY = 0;
			var targetX = 0;
			var targetY = 0;
			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;
			var mouseDown = false;

			init();
			render();

			function init() {

				container = document.createElement('div');
				document.body.appendChild(container);

				camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 50);
				camera.position.y = 4;
				camera.position.z = 4;
				camera.lookAt({ x: 0, y: 0, z: 0 });

				scene = new THREE.Scene();

				ambientLight = new THREE.AmbientLight(0x444444);
				scene.add(ambientLight);

				pointLight = new THREE.PointLight(0xffffff, 2.5, 10);
				pointLight.color.setHSV(0.05, 0.05, 1);
				pointLight.position.set(3, 6, 2);
				scene.add(pointLight);

				var objects = [];
				for (i in assets.objects) objects.push(i);
				model = objects[objects.length-1];

				loader = new THREE.JSONLoader(true);
				document.body.appendChild(loader.statusDomElement);
				loader.load("../assets/models/" + model + "/" + model + ".js", createScene);

				var c = (new THREE.Color()).setRGB(bgcolor[0]/255, bgcolor[1]/255, bgcolor[2]/255);
				renderer = new THREE.WebGLRenderer({
					antialias: true, clearColor: c.getHex(), preserveDrawingBuffer: true, clearAlpha: 1
				});
				renderer.setSize(window.innerWidth, window.innerHeight);
				container.appendChild(renderer.domElement);

				renderer.gammaInput = true;
				renderer.gammaOutput = true;
				renderer.physicallyBasedShading = true;

				var gui = new dat.GUI();
				gui.add(window, "model", objects).onChange(function() {
					loader.statusDomElement.style.display = "block";
					scene.remove(mesh);
					loader.load("../assets/models/" + model + "/" + model + ".js", createScene);
				});
				gui.addColor(window, "bgcolor").onChange(function() {
					if (typeof bgcolor == "string") {
						bgcolor = bgcolor.charAt(0) == "#" ? bgcolor.substring(1,7) : bgcolor;
						bgcolor = [
							parseInt(bgcolor.substring(0, 2), 16),
							parseInt(bgcolor.substring(2, 4), 16),
							parseInt(bgcolor.substring(4, 6), 16),
						];
					}
					var c = (new THREE.Color()).setRGB(bgcolor[0]/255, bgcolor[1]/255, bgcolor[2]/255);
					console.log(bgcolor);
					renderer.setClearColor(c, 1.0);
				});
				gui.add(window, "squareCanvas");
				gui.add(window, "screenshot");

				document.addEventListener('mousedown', function() { mouseDown = true; }, false);
				document.addEventListener('mouseup', function() { mouseDown = false; }, false);
				document.addEventListener('mousemove', onMouseMove, false);
				window.addEventListener('resize', onWindowResize, false);
			}

			function createScene(geometry) {
				mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
				mesh.castShadow = true;
				mesh.receiveShadow = true;
				scene.add(mesh);
				loader.statusDomElement.style.display = "none";
			}

			function squareCanvas() {
				renderer.setSize(512, 512);
				camera.aspect = 1;
				camera.updateProjectionMatrix();
			}

			function screenshot() {
				var dataUrl	= renderer.domElement.toDataURL("image/png");
				window.open(dataUrl, "_blank");
			}

			function onWindowResize(event) {
				renderer.setSize(window.innerWidth, window.innerHeight);
				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();
			}

			function onMouseMove(event) {
				if (!mouseDown) return;
				mouseX = (event.clientX - windowHalfX);
				mouseY = (event.clientY - windowHalfY);
			}

			function render() {
				requestAnimationFrame(render);

				targetX = mouseX * .01;
				targetY = mouseY * .01;

				if (mesh) {
					mesh.rotation.y += targetX - mesh.rotation.y;
					mesh.rotation.x += targetY - mesh.rotation.x;
				}

				renderer.render(scene, camera);
			}

		</script>

	</body>
{'fraction_non_alphanumeric': 0.15708724524845433, 'fraction_numerical': 0.0246164414930158, 'mean_word_length': 3.26513671875, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 44, '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': '1969420', 'n_tokens_mistral': 3707, 'n_tokens_neox': 2829, 'n_words': 566}