<commit_before>var camera, scene, renderer, controls;
var container;
window.onload = init;
var cubeSize = 20;
var lastAddedSnakePart;
var YouBitTheWrongStuff = false;
var FoodID;
var collidableMeshList = [];
var collidableMeshListIndex;
var windowWidth;
var	windowHeight;
var spaceTreeColors = [ 0xa17c04, 0xffa500, 0x0205fa, 0xf8093b, 0x93f154, 0x93f154];
var firstTime = true;
var foodCount = 0;


	var views = [
	{
		left: 0,
		bottom: 0,
		width: 0.7,
		height: 1.0,
		background: new THREE.Color().setRGB( 0.5, 0.5, 0.7 ),
		eye: [ 0, 30, 18 ],
		up: [ 0, 1, 0 ],
		fov: 70,
		updateCamera: function ( camera, scene, obj ) {
		  //camera.position.x += mouseX * 0.05;
		  //camera.position.x = Math.max( Math.min( camera.position.x, 2000 ), -2000 );
		  camera.lookAt( scene.position );
		}
	},
	{
		left: 0.7,
		bottom: 0,
		width: 0.3,
		height: 0.5,
		background: new THREE.Color().setRGB( 0.7, 0.5, 0.5 ),
		eye: [ 0, 36, 0 ],
		up: [ 0, 0, 1 ],
		fov: 45,
		updateCamera: function ( camera, scene, obj) {
		  //camera.position.x -= mouseX * 0.05;
		  //camera.position.x = Math.max( Math.min( camera.position.x, 2000 ), -2000 );
		  camera.lookAt( camera.position.clone().setY( 0 ) );
		}
	},
	{
		left: 0.7,
		bottom: 0.5,
		width: 0.3,
		height: 0.5,
		background: new THREE.Color().setRGB( 0.5, 0.7, 0.7 ),
		eye: [ 0, 0, 50 ],
		up: [ 0, 1, 0 ],
		fov: 30,
		updateCamera: function ( camera, scene, obj ) {
		  //camera.position.y -= mouseX * 0.05;
		  //camera.position.y = Math.max( Math.min( camera.position.y, 1600 ), -1600 );
		  camera.lookAt( scene.position );
		}
	}
];


function init() {
	
	document.getElementById("info").innerHTML = "Zaehler: " + foodCount;
	
	var gameover = document.getElementById( 'gameover' );
	var gameoverblocker = document.getElementById( 'gameoverblocker' );
	
	gameover.addEventListener( 'click', function (event) {
		gameover.style.display = 'none';
		gameoverblocker.style.display = 'none';
		window.location.reload();
	}, false );
	
	var clock = new THREE.Clock();
    scene = new THREE.Scene();
    camera = new THREE.PerspectiveCamera(45 , window.innerWidth / window.innerHeight , 0.1, 1000);
    var renderer = new THREE.WebGLRenderer({ 
        alpha: true,
      });
    renderer.setClearColor(new THREE.Color(0xEEEEEE, 1.0));
    renderer.setSize(window.innerWidth, window.innerHeight);
    renderer.shadowMapEnabled = true;
	
	//Create head of snake with texture
    var snakeHeadTexture = THREE.ImageUtils.loadTexture('snakehead.jpg');
    var snakeHeadGeometry = new THREE.SphereGeometry(1,5,5);
    var snakeHeadMaterial = new THREE.MeshPhongMaterial();
    snakeHeadMaterial.map = snakeHeadTexture;
    var snakeHead = new THREE.Mesh(snakeHeadGeometry, snakeHeadMaterial);
	snakeHeadTexture.wrapS = THREE.RepeatWrapping; // You do not need to set `.wrapT` in this case
	snakeHeadTexture.offset.x = -( 2 * Math.PI );	
    snakeHead.material.map.repeat.set(1, 1);
    snakeHead.name ="Snake";
    snakeHead.position.y = -cubeSize/2 + 2;

	collidableMeshList.push(snakeHead);

    var snaketexture = THREE.ImageUtils.loadTexture('snakeskin.jpg');
    var snakeGeometry = new THREE.SphereGeometry(1,5,5);
    var snakeMaterial = new THREE.MeshPhongMaterial();
    snakeMaterial.map = snaketexture;
    var snake = new THREE.Mesh(snakeGeometry, snakeMaterial);
	snake.name = "SnakeFirstPart";
    snake.material.map.wrapS = THREE.RepeatWrapping;
    snake.material.map.wrapT = THREE.RepeatWrapping;
    snake.material.map.repeat.set(1, 1);
    snake.position.z = 1; 

    var test = new THREE.SphereGeometry(1,1,1)

    var testGeometry = new THREE.SphereGeometry(0.2,5,5);
    var testMaterial = new THREE.MeshLambertMaterial({color: 0xffffff});
    var test = new THREE.Mesh(testGeometry, testMaterial);
    test.position.z = -4;

    snakeHead.add(test);

    snakeHead.add(snake);
	// add the snakeparts to collidable Objects
	//collidableMeshList.push(snake);
	lastAddedSnakePart = snake;
	scene.add(snakeHead);


	//Kameras
	for (var ii =  0; ii < views.length; ++ii ) {
		var view = views[ii];
		camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 1, 10000 );
		camera.position.x = view.eye[ 0 ];
		camera.position.y = view.eye[ 1 ];
		camera.position.z = view.eye[ 2 ];
		camera.up.x = view.up[ 0 ];
		camera.up.y = view.up[ 1 ];
		camera.up.z = view.up[ 2 ];
		view.camera = camera;
	}

	camera = views[0].camera;


    // create a playgroundCube
    var playgroundCubeGeometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize);
   
    var playgroundCubeMaterial = new THREE.MeshLambertMaterial( {
            color: 0xffffff,
            opacity: 0.4,
            transparent: true,
            shading: THREE.FlatShading,
            outline: true,
    } );
    var playgroundCube = new THREE.Mesh(playgroundCubeGeometry, playgroundCubeMaterial);<commit_msg>Small Fixes for Cameras<commit_after>var camera, scene, renderer, controls;
var container;
window.onload = init;
var cubeSize = 20;
var lastAddedSnakePart;
var YouBitTheWrongStuff = false;
var FoodID;
var collidableMeshList = [];
var collidableMeshListIndex;
var windowWidth;
var	windowHeight;
var spaceTreeColors = [ 0xa17c04, 0xffa500, 0x0205fa, 0xf8093b, 0x93f154, 0x93f154];
var firstTime = true;
var foodCount = 0;


	var views = [
	{
		left: 0,
		bottom: 0,
		width: 0.7,
		height: 1.0,
		background: new THREE.Color().setRGB( 0.5, 0.5, 0.5 ),
		eye: [ 0, 30, 18 ],
		up: [ 0, 1, 0 ],
		fov: 70,
		updateCamera: function ( camera, scene, obj ) {
		  camera.lookAt( scene.position );
		}
	},
	{
		left: 0.7,
		bottom: 0,
		width: 0.3,
		height: 0.5,
		background: new THREE.Color().setRGB( 0.5, 0.5, 0.5 ),
		eye: [ 0, 40, 0 ],
		up: [ 0, 0, 1 ],
		fov: 45,
		updateCamera: function ( camera, scene, obj) {
		  camera.lookAt( scene.position );
		}
	},
	{
		left: 0.7,
		bottom: 0.5,
		width: 0.3,
		height: 0.5,
		background: new THREE.Color().setRGB( 0.5, 0.5, 0.5 ),
		eye: [ 0, 0, 40 ],
		up: [ 0, 1, 0 ],
		fov: 45,
		updateCamera: function ( camera, scene, obj ) {
		  //camera.position.y -= mouseX * 0.05;
		  //camera.position.y = Math.max( Math.min( camera.position.y, 1600 ), -1600 );
		  camera.lookAt( scene.position );
		}
	}
];


function init() {
	
	document.getElementById("info").innerHTML = "Zaehler: " + foodCount;
	
	var gameover = document.getElementById( 'gameover' );
	var gameoverblocker = document.getElementById( 'gameoverblocker' );
	
	gameover.addEventListener( 'click', function (event) {
		gameover.style.display = 'none';
		gameoverblocker.style.display = 'none';
		window.location.reload();
	}, false );
	
	var clock = new THREE.Clock();
    scene = new THREE.Scene();
    camera = new THREE.PerspectiveCamera(45 , window.innerWidth / window.innerHeight , 0.1, 1000);
    var renderer = new THREE.WebGLRenderer({ 
        alpha: true,
      });
    renderer.setClearColor(new THREE.Color(0xEEEEEE, 1.0));
    renderer.setSize(window.innerWidth, window.innerHeight);
    renderer.shadowMapEnabled = true;
	
	//Create head of snake with texture
    var snakeHeadTexture = THREE.ImageUtils.loadTexture('snakehead.jpg');
    var snakeHeadGeometry = new THREE.SphereGeometry(1,5,5);
    var snakeHeadMaterial = new THREE.MeshPhongMaterial();
    snakeHeadMaterial.map = snakeHeadTexture;
    var snakeHead = new THREE.Mesh(snakeHeadGeometry, snakeHeadMaterial);
	snakeHeadTexture.wrapS = THREE.RepeatWrapping; // You do not need to set `.wrapT` in this case
	snakeHeadTexture.offset.x = -( 2 * Math.PI );	
    snakeHead.material.map.repeat.set(1, 1);
    snakeHead.name ="Snake";
    snakeHead.position.y = -cubeSize/2 + 2;

	collidableMeshList.push(snakeHead);

    var snaketexture = THREE.ImageUtils.loadTexture('snakeskin.jpg');
    var snakeGeometry = new THREE.SphereGeometry(1,5,5);
    var snakeMaterial = new THREE.MeshPhongMaterial();
    snakeMaterial.map = snaketexture;
    var snake = new THREE.Mesh(snakeGeometry, snakeMaterial);
	snake.name = "SnakeFirstPart";
    snake.material.map.wrapS = THREE.RepeatWrapping;
    snake.material.map.wrapT = THREE.RepeatWrapping;
    snake.material.map.repeat.set(1, 1);
    snake.position.z = 1; 

    var test = new THREE.SphereGeometry(1,1,1)

    var testGeometry = new THREE.SphereGeometry(0.2,5,5);
    var testMaterial = new THREE.MeshLambertMaterial({color: 0xffffff});
    var test = new THREE.Mesh(testGeometry, testMaterial);
    test.position.z = -4;

    snakeHead.add(test);

    snakeHead.add(snake);
	// add the snakeparts to collidable Objects
	//collidableMeshList.push(snake);
	lastAddedSnakePart = snake;
	scene.add(snakeHead);


	//Kameras
	for (var ii =  0; ii < views.length; ++ii ) {
		var view = views[ii];
		camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 0.1, 10000 );
		camera.position.x = view.eye[ 0 ];
		camera.position.y = view.eye[ 1 ];
		camera.position.z = view.eye[ 2 ];
		camera.up.x = view.up[ 0 ];
		camera.up.y = view.up[ 1 ];
		camera.up.z = view.up[ 2 ];
		view.camera = camera;
	}

	camera = views[0].camera;


    // create a playgroundCube
    var playgroundCubeGeometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize);
   
    var playgroundCubeMaterial = new THREE.MeshLambertMaterial( {
            color: 0xffffff,
            opacity: 0.4,
            transparent: true,
            shading: THREE.FlatShading,
            outline: true,
    } );
    var playgroundCube = new THREE.Mesh(playgroundCubeGeometry, playgroundCubeMaterial);
{'fraction_non_alphanumeric': 0.13990511333684766, 'fraction_numerical': 0.03690036900369004, 'mean_word_length': 3.335466179159049, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6784191', 'n_tokens_mistral': 3787, 'n_tokens_neox': 3313, 'n_words': 763}