move JSON load to init()
This commit is contained in:
parent
79b2eacc3e
commit
246ddb2e12
@ -1,17 +1,3 @@
|
|||||||
// 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();
|
|
||||||
|
|
||||||
|
|
||||||
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
||||||
var camera, controls, scene, renderer;
|
var camera, controls, scene, renderer;
|
||||||
@ -28,6 +14,20 @@ render();
|
|||||||
|
|
||||||
|
|
||||||
function init() {
|
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 );
|
//scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );
|
||||||
renderer = new THREE.WebGLRenderer();
|
renderer = new THREE.WebGLRenderer();
|
||||||
|
Loading…
Reference in New Issue
Block a user