Kaynağa Gözat

Merge pull request #1544 from sebavan/Development

Fix gulp doc
David Catuhe 8 yıl önce
ebeveyn
işleme
49b54f9d95

+ 33 - 18
Tools/DevLoader/BabylonLoader.js

@@ -32,21 +32,36 @@ var BABYLONDEVTOOLS;
         var dependencies;
         var useDist;
         var min;
+        var babylonJSPath;
 
         function Loader() {
             queue = [];
             dependencies = [];
             callback = null;
             min = (document.location.href.toLowerCase().indexOf('dist=min') > 0);
-            useDist = (min || document.location.href.toLowerCase().indexOf('dist=true') > 0);
+            useDist = (min || document.location.href.toLowerCase().indexOf('dist=true') > 0);            
+            babylonJSPath = '';
         }
 
-        Loader.prototype.onReady = function (callback) {
-            this.callback = callback;
+        Loader.prototype.root = function (newBabylonJSPath) {
+            babylonJSPath = newBabylonJSPath;
+            return this;
+        }
+
+        Loader.prototype.require = function (newDependencies) {
+            if (typeof newDependencies === 'string') {
+                dependencies.push(newDependencies);
+            }
+            else if (newDependencies) {
+                for (var i = 0; i < newDependencies.length; i++) {
+                    dependencies.push(newDependencies[i]);
+                }
+            }
+            return this;
         }
 
-        Loader.prototype.require = function (dependencies) {
-            this.dependencies = dependencies;
+        Loader.prototype.onReady = function (newCallback) {
+            callback = newCallback;
             return this;
         }
 
@@ -54,8 +69,8 @@ var BABYLONDEVTOOLS;
             if (queue.length == 0) {
                 console.log('Scripts loaded');
                 BABYLON.Engine.ShadersRepository = "/src/Shaders/"; 
-                if (this.callback) {                    
-                    this.callback();
+                if (callback) {                    
+                    callback();
                 }
                 return;                
             }
@@ -90,6 +105,8 @@ var BABYLONDEVTOOLS;
                 for (; i < library.files.length; i++) {
                     var file = library.files[i];
                     file = file.replace('.ts', '.js');
+                    file = file.replace('../', '');
+                    file = babylonJSPath + '/' + file;
                     this.loadScript(file);
                 }
 
@@ -98,14 +115,16 @@ var BABYLONDEVTOOLS;
                     var endDirectoryIndex = shaderFile.lastIndexOf('/');
                     shaderFile = shaderFile.substring(0, endDirectoryIndex + 1);
                     shaderFile += library.output.replace('.js', '.js.fx');
+                    file = file.replace('../', '');
+                    file = babylonJSPath + '/' + file;
                     this.loadScript(shaderFile);
                 }
             }
             else if (min) {
-                this.loadScript('/dist/preview release' + module.build.distOutputDirectory + library.output.replace('.js', '.min.js'));
+                this.loadScript(babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + library.output.replace('.js', '.min.js'));
             }
             else {
-                this.loadScript('/dist/preview release' + module.build.distOutputDirectory + library.output);
+                this.loadScript(babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + library.output);
             }
         }
 
@@ -136,20 +155,16 @@ var BABYLONDEVTOOLS;
             }
         }
 
-        Loader.prototype.load = function (callback) {
+        Loader.prototype.load = function (newCallback) {
             var self = this;
-            if (callback) {
-                self.callback = callback;
+            if (newCallback) {
+                callback = newCallback;
             }
             getJson('/Tools/Gulp/config.json',
                 function(data) {
                     self.loadBJSScripts(data);
-                    
-                    if (typeof self.dependencies === 'string') {
-                        self.loadScript(self.dependencies);
-                    }
-                    else if (self.dependencies) {
-                        self.loadScripts(self.dependencies);
+                    if (dependencies) {
+                        self.loadScripts(dependencies);
                     }
 
                     self.dequeue();

+ 24 - 6
Tools/Gulp/readme.md

@@ -41,11 +41,6 @@ Will be generated :
 - babylon.noworker.js (minified version without collisions workers)
 - babylon.max.js (unminified)
 
-### Build Babylon.js when you save a javascript file:
-```
-gulp watch
-```
-
 ## From the typescript source
 ### Build Babylon.js from the typescript files:
 
@@ -62,12 +57,35 @@ Be aware that all js files content will be overwrite.
 
 ### Build Babylon.js when you save a typescript file:
 ```
-gulp watch-typescript
+gulp watch
+```
+
+### Run Integrated Web Server and watch for changes:
+```
+gulp run
 ```
 
+you can now freely test in the following URLs:
+- [Playground]("http://localhost:1338/Playground/index-local.html")
+- [Materials Library]("http://localhost:1338/materialsLibrary/index.html")
+- [Postprocess Library]("http://localhost:1338/postProcessLibrary/index.html")
+- [Procedural Textures Library]("http://localhost:1338/proceduralTexturesLibrary/index.html")
+- [Local Dev Samples]("http://localhost:1338/localDev/index.html")
+
 ### Compile all the typscript files to their javascript respective files including declaration file
 ```
 gulp typescript-compile
 ```
 
 Be aware that all js files content will be overwritten.
+
+### Compile all the libraries
+```
+gulp typescript-libraries
+```
+
+Be aware that all js files content will be overwritten.
+
+### Compile all the typscript and the library
+```
+gulp typescript-all

+ 1 - 1
materialsLibrary/readme.md

@@ -15,7 +15,7 @@ sphere.material = simple;
 
 ## Adding a new material to the library
 
-To add a new material, you have to create your own folder in *materials* folder. Then you need to add a .ts file an two .fx files:
+To add a new material, you have to create your own folder in *materials* folder in src. Then you need to add a .ts file an two .fx files:
 * The .ts is the TypeScript code of your material
 * .fx files: GLSL code for vertex and fragment shaders
 

+ 1 - 1
proceduralTexturesLibrary/readme.md

@@ -9,7 +9,7 @@ sphere.material.diffuseTexture = fire;
 
 ## Adding a new procedural texture to the library
 
-To add a new procedural texture, you have to create your own folder in *proceduralTextures* folder. Then you need to add a .ts file and one .fragment.fx files:
+To add a new procedural texture, you have to create your own folder in *proceduralTextures* folder in src. Then you need to add a .ts file and one .fragment.fx files:
 * The .ts is the TypeScript code of your procedural texture
 * .fx file: GLSL code for fragment shaders