Add dataloading back

This commit is contained in:
Rob L 2016-07-07 12:49:32 -04:00
parent ffbed442e8
commit 14ea3776c8
2 changed files with 35 additions and 15 deletions

View File

@ -1,7 +1,7 @@
{
"CU": {
"name": "Cardasian Union",
"color": "0xCC9933",
"color": "#CC9933",
"cenx": -9337.944,
"ceny": 310,
"cenz": 20,
@ -80,7 +80,7 @@
},
"UFP": {
"name": "United Federation Of Planets",
"color": "0x0000FF",
"color": "#0000FF",
"cenx": -9197.944,
"ceny": 0,
"cenz": 0,
@ -243,7 +243,7 @@
},
"BFN": {
"name": "Bajoran Free Nation",
"color": "0xffaaaa",
"color": "#ffaaaa",
"cenx": -9325.944,
"ceny": 221.7,
"cenz": -45.1,
@ -267,7 +267,7 @@
},
"BC": {
"name": "Breen Confederacy",
"color": "0x00AAAA",
"color": "#00AAAA",
"cenx": 9376.050179,
"ceny": 203.150816,
"cenz": -46.281517,
@ -294,7 +294,7 @@
},
"KE": {
"name": "Klingon Empire",
"color": "0xFF0000",
"color": "#FF0000",
"cenx": -9577.944,
"ceny": 120,
"cenz": -90.160,
@ -371,7 +371,7 @@
},
"RSE": {
"name": "Romulan Star Empire",
"color": "0x00ff00",
"color": "#00ff00",
"cenx": -9477.00,
"ceny": -230.00,
"cenz": 10.00,
@ -443,7 +443,7 @@
},
"GFA": {
"name": "Galactic Ferengal Alliance",
"color": "0xFFFF00",
"color": "#FFFF00",
"cenx": -8977.944,
"ceny": 260.00,
"cenz": -50.00,
@ -510,7 +510,7 @@
},
"OA": {
"name": "Orion Alliance",
"color": "0x00FFFF",
"color": "#00FFFF",
"cenx": 0,
"ceny": 0,
"cenz": 0,
@ -542,7 +542,7 @@
},
"DOM": {
"name": "Dominion",
"color": "0xA9FFEE",
"color": "#A9FFEE",
"cenx": 0,
"ceny": 0,
"cenz": 0,
@ -624,7 +624,7 @@
},
"UNITY": {
"name": "The Unity",
"color": "0xFFA9EE",
"color": "#FFA9EE",
"cenx": 0,
"ceny": 0,
"cenz": 0,
@ -712,7 +712,7 @@
},
"TA": {
"name": "Tholian Assembly",
"color": "0xFEA901",
"color": "#FEA901",
"cenx": -9107.944,
"ceny": -290.00,
"cenz": -10.00,
@ -744,7 +744,7 @@
},
"UQS": {
"name": "Unified Qvarne Systems",
"color": "0x990103",
"color": "#990103",
"cenx": -9109.941,
"ceny": 228.477,
"cenz": -135.785,
@ -797,7 +797,7 @@
},
"GORN": {
"name": "Gorn",
"color": "0xFF02FF",
"color": "#FF02FF",
"cenx": -9267.944,
"ceny": -330.00,
"cenz": 80.00,
@ -844,7 +844,7 @@
},
"20": {
"abr": "UNK",
"color": "0xB3B3B3",
"color": "#B3B3B3",
"cenx": 0,
"ceny": 0,
"cenz": 0,

View File

@ -1068,11 +1068,31 @@ 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 );