From 54c8cab4e865dabdc2f715cac1755d4bde01d5f9 Mon Sep 17 00:00:00 2001 From: roblevesque Date: Thu, 7 Jul 2016 12:21:25 -0400 Subject: [PATCH] Move empire data to JS file --- mapview/js/mapviewgl.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/mapview/js/mapviewgl.js b/mapview/js/mapviewgl.js index a1b7670..9dd1dea 100644 --- a/mapview/js/mapviewgl.js +++ b/mapview/js/mapviewgl.js @@ -1,36 +1,18 @@ - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); +require(./empiredata.js) var camera, controls, scene, renderer; -var jsonEmpire = []; var canvas_t=[]; var context_t=[]; var clock = new THREE.Clock(); var WIDTH = window.innerWidth , HEIGHT = window.innerHeight window.onload = function() { -loadData(function() { init(); animate(); render(); }); } -function loadData(_callback) { - // Load Data (hopefully) before the rest of the place loads. - var xmlhttp = new XMLHttpRequest(); - var url = "js/empiredata.json"; - - xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - jsonEmpire = JSON.parse(xmlhttp.responseText); - _callback(); - - } - }; - xmlhttp.open("GET", url, true); - xmlhttp.send(); - -} function init() { scene = new THREE.Scene(); //scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );