|
@@ -1,12 +1,12 @@
|
|
// Old Fashion Way for IE 11 Devs. Yes, that still exists ;-)
|
|
// Old Fashion Way for IE 11 Devs. Yes, that still exists ;-)
|
|
|
|
|
|
var BABYLONDEVTOOLS;
|
|
var BABYLONDEVTOOLS;
|
|
-(function (BABYLONDEVTOOLS) {
|
|
|
|
|
|
+(function(BABYLONDEVTOOLS) {
|
|
|
|
|
|
- var getJson = function (url, callback, errorCallback) {
|
|
|
|
|
|
+ var getJson = function(url, callback, errorCallback) {
|
|
var xhr = new XMLHttpRequest();
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open('GET', url);
|
|
xhr.open('GET', url);
|
|
- xhr.onload = function () {
|
|
|
|
|
|
+ xhr.onload = function() {
|
|
if (this.status >= 200 && this.status < 300) {
|
|
if (this.status >= 200 && this.status < 300) {
|
|
var data = JSON.parse(xhr.response);
|
|
var data = JSON.parse(xhr.response);
|
|
callback(data)
|
|
callback(data)
|
|
@@ -17,7 +17,7 @@ var BABYLONDEVTOOLS;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- xhr.onerror = function () {
|
|
|
|
|
|
+ xhr.onerror = function() {
|
|
errorCallback({
|
|
errorCallback({
|
|
status: this.status,
|
|
status: this.status,
|
|
statusText: xhr.statusText
|
|
statusText: xhr.statusText
|
|
@@ -26,7 +26,7 @@ var BABYLONDEVTOOLS;
|
|
xhr.send();
|
|
xhr.send();
|
|
}
|
|
}
|
|
|
|
|
|
- var Loader = (function () {
|
|
|
|
|
|
+ var Loader = (function() {
|
|
var queue;
|
|
var queue;
|
|
var callback;
|
|
var callback;
|
|
var dependencies;
|
|
var dependencies;
|
|
@@ -43,10 +43,10 @@ var BABYLONDEVTOOLS;
|
|
babylonJSPath = '';
|
|
babylonJSPath = '';
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.debugShortcut = function (engine) {
|
|
|
|
|
|
+ Loader.prototype.debugShortcut = function(engine) {
|
|
// Add inspector shortcut
|
|
// Add inspector shortcut
|
|
var map = {};
|
|
var map = {};
|
|
- var onkey = function (e) {
|
|
|
|
|
|
+ var onkey = function(e) {
|
|
e = e || event; // to deal with IE
|
|
e = e || event; // to deal with IE
|
|
map[e.keyCode] = e.type == 'keydown';
|
|
map[e.keyCode] = e.type == 'keydown';
|
|
if (map[17] && map[16] && map[18] && map[73]) {
|
|
if (map[17] && map[16] && map[18] && map[73]) {
|
|
@@ -69,12 +69,12 @@ var BABYLONDEVTOOLS;
|
|
document.addEventListener("keyup", onkey);
|
|
document.addEventListener("keyup", onkey);
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.root = function (newBabylonJSPath) {
|
|
|
|
|
|
+ Loader.prototype.root = function(newBabylonJSPath) {
|
|
babylonJSPath = newBabylonJSPath;
|
|
babylonJSPath = newBabylonJSPath;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.require = function (newDependencies) {
|
|
|
|
|
|
+ Loader.prototype.require = function(newDependencies) {
|
|
if (typeof newDependencies === 'string') {
|
|
if (typeof newDependencies === 'string') {
|
|
dependencies.push(newDependencies);
|
|
dependencies.push(newDependencies);
|
|
}
|
|
}
|
|
@@ -86,17 +86,17 @@ var BABYLONDEVTOOLS;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.onReady = function (newCallback) {
|
|
|
|
|
|
+ Loader.prototype.onReady = function(newCallback) {
|
|
callback = newCallback;
|
|
callback = newCallback;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.useDist = function () {
|
|
|
|
|
|
+ Loader.prototype.useDist = function() {
|
|
useDist = true;
|
|
useDist = true;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.dequeue = function () {
|
|
|
|
|
|
+ Loader.prototype.dequeue = function() {
|
|
if (queue.length == 0) {
|
|
if (queue.length == 0) {
|
|
console.log('Scripts loaded');
|
|
console.log('Scripts loaded');
|
|
BABYLON.Engine.ShadersRepository = "/src/Shaders/";
|
|
BABYLON.Engine.ShadersRepository = "/src/Shaders/";
|
|
@@ -114,17 +114,17 @@ var BABYLONDEVTOOLS;
|
|
script.src = url;
|
|
script.src = url;
|
|
|
|
|
|
var self = this;
|
|
var self = this;
|
|
- script.onload = function () {
|
|
|
|
|
|
+ script.onload = function() {
|
|
self.dequeue();
|
|
self.dequeue();
|
|
};
|
|
};
|
|
head.appendChild(script);
|
|
head.appendChild(script);
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadScript = function (url) {
|
|
|
|
|
|
+ Loader.prototype.loadScript = function(url) {
|
|
queue.push(url);
|
|
queue.push(url);
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadCss = function (url) {
|
|
|
|
|
|
+ Loader.prototype.loadCss = function(url) {
|
|
var head = document.getElementsByTagName('head')[0];
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
|
var style = document.createElement('link');
|
|
var style = document.createElement('link');
|
|
@@ -134,20 +134,21 @@ var BABYLONDEVTOOLS;
|
|
document.head.appendChild(style);
|
|
document.head.appendChild(style);
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadScripts = function (urls) {
|
|
|
|
|
|
+ Loader.prototype.loadScripts = function(urls) {
|
|
for (var i = 0; i < urls.length; i++) {
|
|
for (var i = 0; i < urls.length; i++) {
|
|
this.loadScript(urls[i]);
|
|
this.loadScript(urls[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadLibrary = function (library, module) {
|
|
|
|
|
|
+ Loader.prototype.loadLibrary = function(library, module) {
|
|
if (library.preventLoadLibrary) {
|
|
if (library.preventLoadLibrary) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
if (!useDist) {
|
|
if (!useDist) {
|
|
if (library.useOutputForDebugging) {
|
|
if (library.useOutputForDebugging) {
|
|
- this.loadScript(babylonJSPath + '/.temp' + module.build.distOutputDirectory + library.output);
|
|
|
|
|
|
+ var tempDirectory = '/.temp' + module.build.distOutputDirectory;
|
|
|
|
+ this.loadScript(babylonJSPath + tempDirectory + library.output);
|
|
} else {
|
|
} else {
|
|
var i = 0;
|
|
var i = 0;
|
|
for (; i < library.files.length; i++) {
|
|
for (; i < library.files.length; i++) {
|
|
@@ -201,13 +202,13 @@ var BABYLONDEVTOOLS;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadModule = function (module) {
|
|
|
|
|
|
+ Loader.prototype.loadModule = function(module) {
|
|
for (var i = 0; i < module.libraries.length; i++) {
|
|
for (var i = 0; i < module.libraries.length; i++) {
|
|
this.loadLibrary(module.libraries[i], module);
|
|
this.loadLibrary(module.libraries[i], module);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.processDependency = function (settings, dependency, filesToLoad) {
|
|
|
|
|
|
+ Loader.prototype.processDependency = function(settings, dependency, filesToLoad) {
|
|
if (dependency.dependUpon) {
|
|
if (dependency.dependUpon) {
|
|
for (var i = 0; i < dependency.dependUpon.length; i++) {
|
|
for (var i = 0; i < dependency.dependUpon.length; i++) {
|
|
var dependencyName = dependency.dependUpon[i];
|
|
var dependencyName = dependency.dependUpon[i];
|
|
@@ -225,7 +226,7 @@ var BABYLONDEVTOOLS;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.loadBJSScripts = function (settings) {
|
|
|
|
|
|
+ Loader.prototype.loadBJSScripts = function(settings) {
|
|
var loadModules = true;
|
|
var loadModules = true;
|
|
|
|
|
|
// Main bjs files
|
|
// Main bjs files
|
|
@@ -262,13 +263,13 @@ var BABYLONDEVTOOLS;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Loader.prototype.load = function (newCallback) {
|
|
|
|
|
|
+ Loader.prototype.load = function(newCallback) {
|
|
var self = this;
|
|
var self = this;
|
|
if (newCallback) {
|
|
if (newCallback) {
|
|
callback = newCallback;
|
|
callback = newCallback;
|
|
}
|
|
}
|
|
getJson('/Tools/Gulp/config.json',
|
|
getJson('/Tools/Gulp/config.json',
|
|
- function (data) {
|
|
|
|
|
|
+ function(data) {
|
|
if (!min) {
|
|
if (!min) {
|
|
self.loadScript('/dist/preview release/split.js');
|
|
self.loadScript('/dist/preview release/split.js');
|
|
}
|
|
}
|
|
@@ -280,7 +281,7 @@ var BABYLONDEVTOOLS;
|
|
|
|
|
|
self.dequeue();
|
|
self.dequeue();
|
|
},
|
|
},
|
|
- function (reason) {
|
|
|
|
|
|
+ function(reason) {
|
|
console.error(reason);
|
|
console.error(reason);
|
|
}
|
|
}
|
|
);
|
|
);
|