Add Callback for data loading
This commit is contained in:
parent
677dc706ee
commit
79ce122988
@ -8,13 +8,14 @@ var clock = new THREE.Clock();
|
|||||||
var WIDTH = window.innerWidth , HEIGHT = window.innerHeight
|
var WIDTH = window.innerWidth , HEIGHT = window.innerHeight
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
loadData();
|
loadData( {
|
||||||
init();
|
init();
|
||||||
animate();
|
animate();
|
||||||
render();
|
render();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData() {
|
function loadData(_callback) {
|
||||||
// Load Data (hopefully) before the rest of the place loads.
|
// Load Data (hopefully) before the rest of the place loads.
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
var url = "js/empiredata.json";
|
var url = "js/empiredata.json";
|
||||||
@ -27,6 +28,7 @@ function loadData() {
|
|||||||
};
|
};
|
||||||
xmlhttp.open("GET", url, true);
|
xmlhttp.open("GET", url, true);
|
||||||
xmlhttp.send();
|
xmlhttp.send();
|
||||||
|
_callback();
|
||||||
}
|
}
|
||||||
function init() {
|
function init() {
|
||||||
scene = new THREE.Scene();
|
scene = new THREE.Scene();
|
||||||
|
Loading…
Reference in New Issue
Block a user