From d3e7b5708deffbed864c916de22663f48333c58b Mon Sep 17 00:00:00 2001 From: yo mama Date: Tue, 22 Sep 2015 00:51:40 -0700 Subject: finishing server --- frontend/imlandscape/js/3D_Landscape.js | 248 -------------------------------- 1 file changed, 248 deletions(-) delete mode 100644 frontend/imlandscape/js/3D_Landscape.js (limited to 'frontend/imlandscape/js/3D_Landscape.js') diff --git a/frontend/imlandscape/js/3D_Landscape.js b/frontend/imlandscape/js/3D_Landscape.js deleted file mode 100644 index 411bfe7..0000000 --- a/frontend/imlandscape/js/3D_Landscape.js +++ /dev/null @@ -1,248 +0,0 @@ -var container, stats; -var camera, controls, scene, renderer; -var mesh, texture, material; -//FIXME experiment with these fixed params -var worldWidth = 256, worldDepth = 256, worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2; -var textureFile = 'img/Texture.jpg'; -var heightmapFile = 'img/Heightmap.jpg'; -var pos_x, pos_y, pos_z, rot_x, rot_y, rot_z; -var wf = false; - - -function runWebGLSimulation(){ - //Detect WebGL - if (!Detector.webgl) { - Detector.addGetWebGLMessage(); - document.getElementById('container').innerHTML = ""; - } - - //Start Graphics - initGraphics(textureFile, heightmapFile, function(){ animate() }); - //Start Scene Animation -} - -function initGraphics(textureFile, heightmapFile, cb) { - - container = document.getElementById('container'); - //Set camera - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 20000); - //Set scene - scene = new THREE.Scene(); - - //Get heightmap data - //Generates the heightmap data from the heightmap image - var size = worldWidth * worldDepth, data = new Float32Array(size); - - var canvas = document.createElement('canvas'); - canvas.width = worldWidth; - canvas.height = worldDepth; - context = canvas.getContext('2d'); - context.fillStyle = '#000'; - context.fillRect(0, 0, worldWidth, worldDepth); - - var img = new Image(); - img.src = heightmapFile; - img.onerror = function() { - alert("The following url did not work: \n"+heightmapFile.slice(15)); - is_generating = false; - toggle_background(); - }; - - img.onload = function(){ - context.drawImage(img, 0, 0); - image = context.getImageData(0, 0, worldWidth, worldDepth); - var imageData = image.data; - var pixels = size; - for (var i=0; i