From 8abf0adcb91e528e0a01842e6bd436dba515ddd6 Mon Sep 17 00:00:00 2001 From: roblevesque Date: Thu, 7 Jul 2016 12:04:28 -0400 Subject: [PATCH] move JSON load back to top. --- mapview/js/mapviewgl.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mapview/js/mapviewgl.js b/mapview/js/mapviewgl.js index 051a270..66cf262 100644 --- a/mapview/js/mapviewgl.js +++ b/mapview/js/mapviewgl.js @@ -1,5 +1,20 @@ if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); +// Load Data + var xmlhttp = new XMLHttpRequest(); + var url = "js/empiredata.json"; + var jsonEmpire=[]; + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + jsonEmpire = JSON.parse(xmlhttp.responseText); + + } + }; + xmlhttp.open("GET", url, true); + xmlhttp.send(); + + var camera, controls, scene, renderer; var canvas_t=[]; var context_t=[]; @@ -14,21 +29,7 @@ render(); function init() { - // Load Data - var xmlhttp = new XMLHttpRequest(); - var url = "js/empiredata.json"; - var jsonEmpire=[]; - - xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - jsonEmpire = JSON.parse(xmlhttp.responseText); - - } - }; - xmlhttp.open("GET", url, true); - xmlhttp.send(); - - scene = new THREE.Scene(); + scene = new THREE.Scene(); //scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight );