瀏覽代碼

Merge pull request #2 from BabylonJS/master

sync master with upstream
André Reschke 6 年之前
父節點
當前提交
4db10d5bb1
共有 100 個文件被更改,包括 65699 次插入62972 次删除
  1. 5 2
      .github/ISSUE_TEMPLATE.md
  2. 7 3
      .gitignore
  3. 24 7
      .travis.yml
  4. 18 6
      .vscode/settings.json
  5. 3 10
      .vscode/tasks.json
  6. 63922 57065
      Playground/babylon.d.txt
  7. 2 1
      Playground/full.html
  8. 1 1
      Playground/index-local.html
  9. 406 405
      Playground/index.html
  10. 1 1
      Playground/js/frame.js
  11. 1 1
      Playground/js/index.js
  12. 二進制
      Playground/textures/BJS-logo_v3-astc.ktx
  13. 二進制
      Playground/textures/BJS-logo_v3-dxt.ktx
  14. 二進制
      Playground/textures/BJS-logo_v3-etc2.ktx
  15. 二進制
      Playground/textures/BJS-logo_v3-pvrtc.ktx
  16. 二進制
      Playground/textures/Runyon_Canyon_A_2k_cube_specular.env
  17. 二進制
      Playground/textures/SpecularHDR.dds_thumb.jpg
  18. 二進制
      Playground/textures/SpecularHDR.env
  19. 二進制
      Playground/textures/Studio_Softbox_2Umbrellas_cube_specular.env
  20. 二進制
      Playground/textures/checkerBJS-astc.ktx
  21. 二進制
      Playground/textures/checkerBJS-dxt.ktx
  22. 二進制
      Playground/textures/checkerBJS-etc2.ktx
  23. 二進制
      Playground/textures/checkerBJS-pvrtc.ktx
  24. 二進制
      Playground/textures/country.dds
  25. 二進制
      Playground/textures/country.env
  26. 二進制
      Playground/textures/country.hdr_thumb.jpg
  27. 二進制
      Playground/textures/cubemapDebug/_nx-astc.ktx
  28. 二進制
      Playground/textures/cubemapDebug/_nx-dxt.ktx
  29. 二進制
      Playground/textures/cubemapDebug/_nx-etc1.ktx
  30. 二進制
      Playground/textures/cubemapDebug/_nx-etc2.ktx
  31. 二進制
      Playground/textures/cubemapDebug/_nx-pvrtc.ktx
  32. 二進制
      Playground/textures/cubemapDebug/_nx.jpg
  33. 二進制
      Playground/textures/cubemapDebug/_ny-astc.ktx
  34. 二進制
      Playground/textures/cubemapDebug/_ny-dxt.ktx
  35. 二進制
      Playground/textures/cubemapDebug/_ny-etc1.ktx
  36. 二進制
      Playground/textures/cubemapDebug/_ny-etc2.ktx
  37. 二進制
      Playground/textures/cubemapDebug/_ny-pvrtc.ktx
  38. 二進制
      Playground/textures/cubemapDebug/_ny.jpg
  39. 二進制
      Playground/textures/cubemapDebug/_nz-astc.ktx
  40. 二進制
      Playground/textures/cubemapDebug/_nz-dxt.ktx
  41. 二進制
      Playground/textures/cubemapDebug/_nz-etc1.ktx
  42. 二進制
      Playground/textures/cubemapDebug/_nz-etc2.ktx
  43. 二進制
      Playground/textures/cubemapDebug/_nz-pvrtc.ktx
  44. 二進制
      Playground/textures/cubemapDebug/_nz.jpg
  45. 二進制
      Playground/textures/cubemapDebug/_px-astc.ktx
  46. 二進制
      Playground/textures/cubemapDebug/_px-dxt.ktx
  47. 二進制
      Playground/textures/cubemapDebug/_px-etc1.ktx
  48. 二進制
      Playground/textures/cubemapDebug/_px-etc2.ktx
  49. 二進制
      Playground/textures/cubemapDebug/_px-pvrtc.ktx
  50. 二進制
      Playground/textures/cubemapDebug/_px.jpg
  51. 二進制
      Playground/textures/cubemapDebug/_py-astc.ktx
  52. 二進制
      Playground/textures/cubemapDebug/_py-dxt.ktx
  53. 二進制
      Playground/textures/cubemapDebug/_py-etc1.ktx
  54. 二進制
      Playground/textures/cubemapDebug/_py-etc2.ktx
  55. 二進制
      Playground/textures/cubemapDebug/_py-pvrtc.ktx
  56. 二進制
      Playground/textures/cubemapDebug/_py.jpg
  57. 二進制
      Playground/textures/cubemapDebug/_pz-astc.ktx
  58. 二進制
      Playground/textures/cubemapDebug/_pz-dxt.ktx
  59. 二進制
      Playground/textures/cubemapDebug/_pz-etc1.ktx
  60. 二進制
      Playground/textures/cubemapDebug/_pz-etc2.ktx
  61. 二進制
      Playground/textures/cubemapDebug/_pz-pvrtc.ktx
  62. 二進制
      Playground/textures/cubemapDebug/_pz.jpg
  63. 二進制
      Playground/textures/cubemap_blank.jpg
  64. 二進制
      Playground/textures/environment.dds_thumb.jpg
  65. 二進制
      Playground/textures/environment.hdr_thumb.jpg
  66. 二進制
      Playground/textures/forest.dds
  67. 二進制
      Playground/textures/forest.env
  68. 二進制
      Playground/textures/forest.hdr_thumb.jpg
  69. 二進制
      Playground/textures/grass.dds_thumb.jpg
  70. 二進制
      Playground/textures/night.dds
  71. 二進制
      Playground/textures/night.env
  72. 二進制
      Playground/textures/night.hdr_thumb.jpg
  73. 二進制
      Playground/textures/parking.dds
  74. 二進制
      Playground/textures/parking.env
  75. 二進制
      Playground/textures/parking.hdr_thumb.jpg
  76. 二進制
      Playground/textures/room.dds
  77. 二進制
      Playground/textures/room.env
  78. 二進制
      Playground/textures/room.hdr_thumb.jpg
  79. 2 2
      Playground/ts.html
  80. 122 0
      Tools/Config/config.js
  81. 718 0
      Tools/Config/config.json
  82. 58 92
      Tools/DevLoader/BabylonLoader.js
  83. 0 2132
      Tools/Gulp/config.json
  84. 0 58
      Tools/Gulp/gulp-addDtsExport.js
  85. 0 89
      Tools/Gulp/gulp-addES6Exports.js
  86. 0 113
      Tools/Gulp/gulp-addModuleExports.js
  87. 0 99
      Tools/Gulp/gulp-appendSrcToVariable.js
  88. 0 133
      Tools/Gulp/gulp-babylonModule.js
  89. 0 80
      Tools/Gulp/gulp-calculateDependencies.js
  90. 0 37
      Tools/Gulp/gulp-decorateAndExtends.js
  91. 0 96
      Tools/Gulp/gulp-dtsModuleSupport.js
  92. 0 214
      Tools/Gulp/gulp-es6ModuleExports.js
  93. 0 97
      Tools/Gulp/gulp-removeShaderComments.js
  94. 0 747
      Tools/Gulp/gulp-validateTypedoc.js
  95. 54 1481
      Tools/Gulp/gulpfile.js
  96. 113 0
      Tools/Gulp/helpers/gulp-addModuleExports.js
  97. 156 0
      Tools/Gulp/helpers/gulp-processAmdDeclarationToModule.js
  98. 42 0
      Tools/Gulp/helpers/gulp-processImportsToEs6.js
  99. 44 0
      Tools/Gulp/helpers/gulp-processLooseDeclarationsEs6.js
  100. 0 0
      Tools/Gulp/helpers/gulp-processModuleDeclarationToNamespace.js

+ 5 - 2
.github/ISSUE_TEMPLATE.md

@@ -1,5 +1,8 @@
-Before creating an issue, please make sure to provide the following template (based on why you create the issue):
-(Please do not use Github issues for questions - We have a really active forum to help answering questions (https://forum.babylonjs.com/))
+**Use Github issues ONLY for validated bugs**
+
+We have a really active forum to help answering questions (https://forum.babylonjs.com/)
+
+*If you are convinced that you found a bug, please use the following template for your issue:*
 
 # Bugs
 

+ 7 - 3
.gitignore

@@ -1,6 +1,5 @@
 # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
 [Bb]in/
-[Oo]bj/
 
 # mstest test results
 TestResults
@@ -17,7 +16,9 @@ TestResults
 
 # javascript files
 src/**/*.js
+!src/webpack.config.js
 src/**/*.d.ts
+!src/LibDeclarations/*.d.ts
 loaders/src/**/*.js
 materialsLibrary/src/**/*.js
 proceduralTexturesLibrary/src/**/*.js
@@ -107,7 +108,6 @@ AppPackages/
 
 # Others
 [Bb]in
-[Oo]bj
 sql
 TestResults
 [Tt]est[Rr]esult*
@@ -164,6 +164,10 @@ node_modules
 !dist/**/*.d.ts
 !dist/**/*.js.map
 !lib.d.ts
+!src/LibDeclarations/*.d.ts
+*.fragment.ts
+*.vertex.ts
+**/ShadersInclude/**/*.ts
 
 # Split declaration file
 !ISplit.d.ts
@@ -192,4 +196,4 @@ gui/dist/
 /Viewer/tests/tsc
 /Viewer/tests/tsc.cmd
 /Viewer/tests/tsserver
-/Viewer/tests/tsserver.cmd
+/Viewer/tests/tsserver.cmd

+ 24 - 7
.travis.yml

@@ -4,14 +4,16 @@ language: node_js
 node_js:
 - '8'
 git:
-  depth: 3
+  depth: 2
 cache:
   directories:
-  - Tools/Gulp/node_modules
+  - node_modules
   - Playground/node_modules
-  - tests/unit/node_modules
 install:
-- travis_retry npm install -g gulp
+- rm node_modules/@babylonjs/core -f
+- rm node_modules/@babylonjs/materials -f
+- travis_retry npm install -g gulp@4.0.0
+- travis_retry npm install -g typescript
 - cd ./Tools/Gulp
 - travis_retry npm install
 jobs:
@@ -21,8 +23,8 @@ jobs:
     script: gulp tests-whatsnew
   - env: JOB=DocumentationCheck
     script: gulp typedoc-check
-  - env: JOB=Styling
-    script: gulp tsLint
+  - env: JOB=Linting
+    script: gulp fullLint
   - env: JOB=Build
     script: gulp typescript-all
   - env: JOB=Tests
@@ -31,11 +33,26 @@ jobs:
     - sh -e /etc/init.d/xvfb start
     - sleep 3
     - set -e
+    - export CHROME_BIN=chromium-browser
     - gulp typescript-all
-    - gulp tests-unit
+    - gulp tests-babylon-unit
     - travis_retry gulp tests-validation-virtualscreen
     - travis_retry gulp tests-validation-browserstack
+  - env: JOB=ModuleTests
+    script:
+    - gulp typescript-all
+    - export CHROME_BIN=chromium-browser
     - gulp tests-modules
+    - gulp deployAndTests-es6Modules
+  - env: JOB=ViewerTests
+    script:
+    - export DISPLAY=:99.0
+    - sh -e /etc/init.d/xvfb start
+    - sleep 3
+    - set -e
+    - export CHROME_BIN=chromium-browser
+    - gulp typescript-all
+    - gulp tests-viewer-unit
     - travis_retry gulp tests-viewer-validation-virtualscreen
     - travis_retry gulp tests-viewer-validation-browserstack
 notifications:

+ 18 - 6
.vscode/settings.json

@@ -11,20 +11,29 @@
         "**/node_modules": true,
         "**/temp": true,
         "**/.temp": true,
-        "src/**/*.d.ts": true,
         "gui/**/*.d.ts": true,
         "inspector/**/*.d.ts": true,
         "loaders/**/*.d.ts": true,
         "materialsLibrary/**/*.d.ts": true,
         "postProcessesLibrary/**/*.d.ts": true,
         "proceduralTexturesLibrary/**/*.d.ts": true,
-        "serielazers/**/*.d.ts": true,
+        "serializers/**/*.d.ts": true,
         "Viewer/**/*.d.ts": true,
-        "**/*.js.map": true,
+        "src/**/*.js.map": true,
+        "gui/**/*.js.map": true,
+        "inspector/**/*.js.map": true,
+        "loaders/**/*.js.map": true,
+        "materialsLibrary/**/*.js.map": true,
+        "postProcessesLibrary/**/*.js.map": true,
+        "proceduralTexturesLibrary/**/*.js.map": true,
+        "serielazers/**/*.js.map": true,
         "**/*.js.fx": true,
         "**/*.js": {
             "when": "$(basename).ts"
-        }
+        },
+        "**/*.fragment.ts": true,
+        "**/*.vertex.ts": true,
+        "**/ShadersInclude/**/*.ts": true
     },
     "files.associations": {
         "*.fx": "glsl"
@@ -40,9 +49,12 @@
         "**/*.js": {
             "when": "$(basename).ts"
         },
-        "**/*.d.ts": true,
+        "dist/**/*.d.ts": true,
+        "**/*.fragment.ts": true,
+        "**/*.vertex.ts": true,
+        "**/ShadersInclude/**/*.ts": true,
         "assets": true
     },
     "editor.tabSize": 4,
-    "typescript.tsdk": "./Tools/Gulp/node_modules/typescript/lib"
+    "typescript.tsdk": "node_modules\\typescript\\lib"
 }

+ 3 - 10
.vscode/tasks.json

@@ -3,7 +3,7 @@
     // for the documentation about the tasks.json format
     "version": "2.0.0",
     "command": "gulp",
-    "args": [],
+    "args": ["--max-old-space-size=8192"],
     "type": "shell",
     "options": {
         "cwd": "${workspaceRoot}/Tools/Gulp"
@@ -35,19 +35,12 @@
                 },
                 "background": {
                     "activeOnStart": true,
-                    "beginsPattern": "Starting \\'watch\\'",
-                    "endsPattern": "Entrypoint babylonjs-inspector"
+                    "beginsPattern": "Starting \\'watchCore\\'",
+                    "endsPattern": "Watching for file changes"
                 }
             }
         },
         {
-            "taskName": "typescript-all",
-            "isBuildCommand": true,
-            "problemMatcher": [
-                "$tsc"
-            ]
-        },
-        {
             "label": "serve-viewer",
             "type": "npm",
             "script": "start:server",

文件差異過大導致無法顯示
+ 63922 - 57065
Playground/babylon.d.txt


+ 2 - 1
Playground/full.html

@@ -50,7 +50,8 @@
     </head>
 
     <body>
-        <canvas touch-action="none" id="renderCanvas" tabindex="1"></canvas>
+        <!-- Override frame style -->
+        <canvas touch-action="none" id="renderCanvas" tabindex="1" style="height: 100%"></canvas>
         <script src="https://code.jquery.com/jquery.js"></script>
         <script src="js/frame.js"></script>
 

+ 1 - 1
Playground/index-local.html

@@ -23,7 +23,7 @@
     <!-- Monaco -->
 
     <!-- Babylon.js -->
-    <script src="../tools/DevLoader/BabylonLoader.js"></script>
+    <script src="../Tools/DevLoader/BabylonLoader.js"></script>
 
     <link href="css/index.css" rel="stylesheet" />
 </head>

+ 406 - 405
Playground/index.html

@@ -1,490 +1,491 @@
 <!DOCTYPE html>
 <html>
 
-    <head>
-        <title>Babylon.js Playground</title>
-        <meta charset='utf-8' />
-        <meta name="viewport" content="width=device-width, user-scalable=no">
-        <link rel="shortcut icon" href="https://www.babylonjs.com/img/favicon/favicon.ico">
-        <link rel="apple-touch-icon" sizes="57x57" href="https://www.babylonjs.com/img/favicon/apple-icon-57x57.png">
-        <link rel="apple-touch-icon" sizes="60x60" href="https://www.babylonjs.com/img/favicon/apple-icon-60x60.png">
-        <link rel="apple-touch-icon" sizes="72x72" href="https://www.babylonjs.com/img/favicon/apple-icon-72x72.png">
-        <link rel="apple-touch-icon" sizes="76x76" href="https://www.babylonjs.com/img/favicon/apple-icon-76x76.png">
-        <link rel="apple-touch-icon" sizes="114x114" href="https://www.babylonjs.com/img/favicon/apple-icon-114x114.png">
-        <link rel="apple-touch-icon" sizes="120x120" href="https://www.babylonjs.com/img/favicon/apple-icon-120x120.png">
-        <link rel="apple-touch-icon" sizes="144x144" href="https://www.babylonjs.com/img/favicon/apple-icon-144x144.png">
-        <link rel="apple-touch-icon" sizes="152x152" href="https://www.babylonjs.com/img/favicon/apple-icon-152x152.png">
-        <link rel="apple-touch-icon" sizes="180x180" href="https://www.babylonjs.com/img/favicon/apple-icon-180x180.png">
-        <link rel="icon" type="image/png" sizes="192x192" href="https://www.babylonjs.com/img/favicon/android-icon-192x192.png">
-        <link rel="icon" type="image/png" sizes="32x32" href="https://www.babylonjs.com/img/favicon/favicon-32x32.png">
-        <link rel="icon" type="image/png" sizes="96x96" href="https://www.babylonjs.com/img/favicon/favicon-96x96.png">
-        <link rel="icon" type="image/png" sizes="16x16" href="https://www.babylonjs.com/img/favicon/favicon-16x16.png">
-        <link rel="manifest" href="https://www.babylonjs.com/img/favicon/manifest.json">
-        <meta name="msapplication-TileColor" content="#ffffff">
-        <meta name="msapplication-TileImage" content="https://www.babylonjs.com/img/favicon/ms-icon-144x144.png">
-        <meta name="msapplication-config" content="https://www.babylonjs.com/img/favicon/browserconfig.xml">
-        <meta name="theme-color" content="#ffffff">
-
-        <script src="js/libs/pep.min.js"></script>
-        <!--For canvas/code separator-->
-        <script src="js/libs/split.js"></script>
-
-        <script src="js/libs/dat.gui.min.js"></script>
-        <!-- jszip -->
-        <script src="js/libs/jszip.min.js"></script>
-        <script src="js/libs/fileSaver.js"></script>
-        <!-- Dependencies -->
-        <script src="https://preview.babylonjs.com/ammo.js"></script>
-        <script src="https://preview.babylonjs.com/cannon.js"></script>
-        <script src="https://preview.babylonjs.com/Oimo.js"></script>
-        <script src="https://preview.babylonjs.com/gltf_validator.js"></script>
-        <script src="https://preview.babylonjs.com/earcut.min.js"></script>
-        <!-- Babylon.js -->
-        <script src="https://preview.babylonjs.com/babylon.js"></script>
-        <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
-        <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
-        <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
-        <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
-        <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
-        <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
-        <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
-
-        <!-- Monaco -->
-        <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
-
-
-        <!-- Extensions -->
-        <script src="https://rawgit.com/BabylonJS/Extensions/master/ClonerSystem/src/babylonx.cloner.js" async></script>
-        <script src="https://rawgit.com/BabylonJS/Extensions/master/CompoundShader/src/babylonx.CompoundShader.js" async></script>
-        <script src="https://www.babylontoolkit.com/playground/scripts/babylon.navmesh.js"></script>
-        <script src="https://www.babylontoolkit.com/playground/scripts/babylon.manager.js"></script>
-
-        <link href="css/index.css" rel="stylesheet" />
-    </head>
-
-    <body>
-        <div class="navbar navBar1600">
-            <div class="title">
-                Babylon.js Playground
-            </div>
-            <div class="version" id="mainTitle">
-            </div>
+<head>
+    <title>Babylon.js Playground</title>
+    <meta charset='utf-8' />
+    <meta name="viewport" content="width=device-width, user-scalable=no">
+    <link rel="shortcut icon" href="https://www.babylonjs.com/img/favicon/favicon.ico">
+    <link rel="apple-touch-icon" sizes="57x57" href="https://www.babylonjs.com/img/favicon/apple-icon-57x57.png">
+    <link rel="apple-touch-icon" sizes="60x60" href="https://www.babylonjs.com/img/favicon/apple-icon-60x60.png">
+    <link rel="apple-touch-icon" sizes="72x72" href="https://www.babylonjs.com/img/favicon/apple-icon-72x72.png">
+    <link rel="apple-touch-icon" sizes="76x76" href="https://www.babylonjs.com/img/favicon/apple-icon-76x76.png">
+    <link rel="apple-touch-icon" sizes="114x114" href="https://www.babylonjs.com/img/favicon/apple-icon-114x114.png">
+    <link rel="apple-touch-icon" sizes="120x120" href="https://www.babylonjs.com/img/favicon/apple-icon-120x120.png">
+    <link rel="apple-touch-icon" sizes="144x144" href="https://www.babylonjs.com/img/favicon/apple-icon-144x144.png">
+    <link rel="apple-touch-icon" sizes="152x152" href="https://www.babylonjs.com/img/favicon/apple-icon-152x152.png">
+    <link rel="apple-touch-icon" sizes="180x180" href="https://www.babylonjs.com/img/favicon/apple-icon-180x180.png">
+    <link rel="icon" type="image/png" sizes="192x192" href="https://www.babylonjs.com/img/favicon/android-icon-192x192.png">
+    <link rel="icon" type="image/png" sizes="32x32" href="https://www.babylonjs.com/img/favicon/favicon-32x32.png">
+    <link rel="icon" type="image/png" sizes="96x96" href="https://www.babylonjs.com/img/favicon/favicon-96x96.png">
+    <link rel="icon" type="image/png" sizes="16x16" href="https://www.babylonjs.com/img/favicon/favicon-16x16.png">
+    <link rel="manifest" href="https://www.babylonjs.com/img/favicon/manifest.json">
+    <meta name="msapplication-TileColor" content="#ffffff">
+    <meta name="msapplication-TileImage" content="https://www.babylonjs.com/img/favicon/ms-icon-144x144.png">
+    <meta name="msapplication-config" content="https://www.babylonjs.com/img/favicon/browserconfig.xml">
+    <meta name="theme-color" content="#ffffff">
+
+    <script src="js/libs/pep.min.js"></script>
+    <!--For canvas/code separator-->
+    <script src="js/libs/split.js"></script>
+
+    <script src="js/libs/dat.gui.min.js"></script>
+    <!-- jszip -->
+    <script src="js/libs/jszip.min.js"></script>
+    <script src="js/libs/fileSaver.js"></script>
+    <!-- Dependencies -->
+    <script src="https://preview.babylonjs.com/ammo.js"></script>
+    <script src="https://preview.babylonjs.com/cannon.js"></script>
+    <script src="https://preview.babylonjs.com/Oimo.js"></script>
+    <script src="https://preview.babylonjs.com/gltf_validator.js"></script>
+    <script src="https://preview.babylonjs.com/earcut.min.js"></script>
+    <!-- Babylon.js -->
+    <script src="https://preview.babylonjs.com/babylon.js"></script>
+    <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
+    <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
+    <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
+    <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
+    <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
+    <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
+    <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
+
+    <!-- Monaco -->
+    <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
+
+    <!-- Extensions -->
+    <script src="https://rawgit.com/BabylonJS/Extensions/master/ClonerSystem/src/babylonx.cloner.js" async></script>
+    <script src="https://rawgit.com/BabylonJS/Extensions/master/CompoundShader/src/babylonx.CompoundShader.js" async></script>
+
+    <!-- Scene Manager -->
+    <script src="https://mackeyk24.github.io/toolkit/babylon.manager.js"></script>
+    <script src="https://mackeyk24.github.io/toolkit/babylon.navmesh.js"></script>
+
+    <link href="css/index.css" rel="stylesheet" />
+</head>
+
+<body>
+    <div class="navbar navBar1600">
+        <div class="title">
+            Babylon.js Playground
+        </div>
+        <div class="version" id="mainTitle">
+        </div>
 
-            <div class="category">
-                <div class="button run" id="runButton1600">Run
-                    <i class="fa fa-play" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button run" id="runButton1600">Run
+                <i class="fa fa-play" aria-hidden="true"></i>
             </div>
+        </div>
 
 
-            <div class="category">
-                <div class="button" id="newButton1600">New
-                    <i class="fa fa-file" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="clearButton1600">Clear
-                    <i class="fa fa-trash" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="newButton1600">New
+                <i class="fa fa-file" aria-hidden="true"></i>
+            </div>
+            <div class="button removeOnPhone" id="clearButton1600">Clear
+                <i class="fa fa-trash" aria-hidden="true"></i>
             </div>
+        </div>
 
-            <div class="category">
-                <div class="button" id="saveButton1600">Save
-                    <i class="fa fa-floppy-o" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="zipButton1600">Zip
-                    <i class="fa fa-download" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="saveButton1600">Save
+                <i class="fa fa-floppy-o" aria-hidden="true"></i>
+            </div>
+            <div class="button removeOnPhone" id="zipButton1600">Zip
+                <i class="fa fa-download" aria-hidden="true"></i>
             </div>
+        </div>
 
-            <div class="category">
-                <div class="button select">Settings
-                    <div class="toDisplay">
-                        <div class="option subSelect">Theme
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" id="darkTheme1600">Dark</div>
-                                <div class="option" id="lightTheme1600">Light</div>
-                            </div>
+        <div class="category">
+            <div class="button select">Settings
+                <div class="toDisplay">
+                    <div class="option subSelect">Theme
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" id="darkTheme1600">Dark</div>
+                            <div class="option" id="lightTheme1600">Light</div>
                         </div>
-                        <div class="option subSelect">
-                            <span id="currentFontSize1600">Font: 14</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setFontSize(12);">12</div>
-                                <div class="option" onclick="setFontSize(14);">14</div>
-                                <div class="option" onclick="setFontSize(16);">16</div>
-                                <div class="option" onclick="setFontSize(18);">18</div>
-                                <div class="option" onclick="setFontSize(20);">20</div>
-                                <div class="option" onclick="setFontSize(22);">22</div>
-                            </div>
-                        </div>
-                        <div class="option" id="safemodeToggle1600">Safe mode
-                            <i class="far fa-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option checked" id="editorButton1600">Editor
-                            <i class="fa fa-check-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="fullscreenButton1600">Fullscreen</div>
-                        <div class="option" id="editorFullscreenButton1600">Editor Fullscreen</div>
-                        <div class="option" id="formatButton1600">Format code</div>
-                        <div class="option" id="minimapToggle1600">Minimap
-                            <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option subSelect">
+                        <span id="currentFontSize1600">Font: 14</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setFontSize(12);">12</div>
+                            <div class="option" onclick="setFontSize(14);">14</div>
+                            <div class="option" onclick="setFontSize(16);">16</div>
+                            <div class="option" onclick="setFontSize(18);">18</div>
+                            <div class="option" onclick="setFontSize(20);">20</div>
+                            <div class="option" onclick="setFontSize(22);">22</div>
                         </div>
                     </div>
+                    <div class="option" id="safemodeToggle1600">Safe mode
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option checked" id="editorButton1600">Editor
+                        <i class="fa fa-check-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="fullscreenButton1600">Fullscreen</div>
+                    <div class="option" id="editorFullscreenButton1600">Editor Fullscreen</div>
+                    <div class="option" id="formatButton1600">Format code</div>
+                    <div class="option" id="minimapToggle1600">Minimap
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
                 </div>
-
-                <div class="button uncheck" id="debugButton1600">Inspector</div>
-                <div class="button" id="metadataButton1600">Metadata</div>
             </div>
 
+            <div class="button uncheck" id="debugButton1600">Inspector</div>
+            <div class="button" id="metadataButton1600">Metadata</div>
+        </div>
 
 
-            <div class="category right">
-                <div class="button select">
-                    <span id="currentVersion1600">Version: Latest</span>
-                    <div class="toDisplay">
-                        <div class="option" onclick="setVersion('latest');">Latest</div>
-                        <div class="option" onclick="setVersion('stable');">Stable</div>
-                    </div>
-                </div>
-                <div class="button select">
-                    <span class="examplesButton">Examples</span>
+
+        <div class="category right">
+            <div class="button select">
+                <span id="currentVersion1600">Version: Latest</span>
+                <div class="toDisplay">
+                    <div class="option" onclick="setVersion('latest');">Latest</div>
+                    <div class="option" onclick="setVersion('stable');">Stable</div>
                 </div>
             </div>
+            <div class="button select">
+                <span class="examplesButton">Examples</span>
+            </div>
         </div>
+    </div>
 
-        <div class="navbar navBar1475">
-            <div class="title">
-                Babylon.js Playground
-            </div>
-            <div class="version" id="mainTitle">
-            </div>
+    <div class="navbar navBar1475">
+        <div class="title">
+            Babylon.js Playground
+        </div>
+        <div class="version" id="mainTitle">
+        </div>
 
-            <div class="category">
-                <div class="button run" id="runButton1475">Run
-                    <i class="fa fa-play" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button run" id="runButton1475">Run
+                <i class="fa fa-play" aria-hidden="true"></i>
             </div>
+        </div>
 
 
-            <div class="category">
-                <div class="button" id="newButton1475">New
-                    <i class="fa fa-file" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="clearButton1475">Clear
-                    <i class="fa fa-trash" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="newButton1475">New
+                <i class="fa fa-file" aria-hidden="true"></i>
             </div>
+            <div class="button removeOnPhone" id="clearButton1475">Clear
+                <i class="fa fa-trash" aria-hidden="true"></i>
+            </div>
+        </div>
 
-            <div class="category">
-                <div class="button" id="saveButton1475">Save
-                    <i class="fa fa-floppy-o" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="zipButton1475">Zip
-                    <i class="fa fa-download" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="saveButton1475">Save
+                <i class="fa fa-floppy-o" aria-hidden="true"></i>
             </div>
+            <div class="button removeOnPhone" id="zipButton1475">Zip
+                <i class="fa fa-download" aria-hidden="true"></i>
+            </div>
+        </div>
 
-            <div class="category">
-                <div class="button select">Settings
-                    <div class="toDisplay">
-                        <div class="option subSelect">Theme
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" id="darkTheme1475">Dark</div>
-                                <div class="option" id="lightTheme1475">Light</div>
-                            </div>
-                        </div>
-                        <div class="option subSelect">
-                            <span id="currentFontSize1475">Font: 14</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setFontSize(12);">12</div>
-                                <div class="option" onclick="setFontSize(14);">14</div>
-                                <div class="option" onclick="setFontSize(16);">16</div>
-                                <div class="option" onclick="setFontSize(18);">18</div>
-                                <div class="option" onclick="setFontSize(20);">20</div>
-                                <div class="option" onclick="setFontSize(22);">22</div>
-                            </div>
+        <div class="category">
+            <div class="button select">Settings
+                <div class="toDisplay">
+                    <div class="option subSelect">Theme
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" id="darkTheme1475">Dark</div>
+                            <div class="option" id="lightTheme1475">Light</div>
                         </div>
-                        <div class="option" id='safemodeToggle1475'>Safe mode
-                            <i class="far fa-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option checked" id="editorButton1475">Editor
-                            <i class="fa fa-check-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="fullscreenButton1475">Fullscreen</div>
-                        <div class="option" id="editorFullscreenButton1475">Editor Fullscreen</div>
-                        <div class="option" id="formatButton1475">Format code</div>
-                        <div class="option" id="minimapToggle1475">Minimap
-                            <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option subSelect">
+                        <span id="currentFontSize1475">Font: 14</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setFontSize(12);">12</div>
+                            <div class="option" onclick="setFontSize(14);">14</div>
+                            <div class="option" onclick="setFontSize(16);">16</div>
+                            <div class="option" onclick="setFontSize(18);">18</div>
+                            <div class="option" onclick="setFontSize(20);">20</div>
+                            <div class="option" onclick="setFontSize(22);">22</div>
                         </div>
-                        <div class="option" id="debugButton1475">Inspector</div>
-                        <div class="option" id="metadataButton1475">Metadata</div>
-                        <div class="option subSelect">
-                            <span id="currentVersion1475">Vers. : Latest</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setVersion('latest');">Latest</div>
-                                <div class="option" onclick="setVersion('stable');">Stable</div>
-                            </div>
+                    </div>
+                    <div class="option" id='safemodeToggle1475'>Safe mode
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option checked" id="editorButton1475">Editor
+                        <i class="fa fa-check-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="fullscreenButton1475">Fullscreen</div>
+                    <div class="option" id="editorFullscreenButton1475">Editor Fullscreen</div>
+                    <div class="option" id="formatButton1475">Format code</div>
+                    <div class="option" id="minimapToggle1475">Minimap
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="debugButton1475">Inspector</div>
+                    <div class="option" id="metadataButton1475">Metadata</div>
+                    <div class="option subSelect">
+                        <span id="currentVersion1475">Vers. : Latest</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setVersion('latest');">Latest</div>
+                            <div class="option" onclick="setVersion('stable');">Stable</div>
                         </div>
                     </div>
                 </div>
             </div>
+        </div>
 
-            <div class="category right">
-                <div class="button select">
-                    <span class="examplesButton">Examples</span>
-                </div>
+        <div class="category right">
+            <div class="button select">
+                <span class="examplesButton">Examples</span>
             </div>
         </div>
+    </div>
 
-        <div class="navbar navBar1030">
-            <div class="category">
-                <div class="button run" id="runButton1030">Run
-                    <i class="fa fa-play" aria-hidden="true"></i>
-                </div>
+    <div class="navbar navBar1030">
+        <div class="category">
+            <div class="button run" id="runButton1030">Run
+                <i class="fa fa-play" aria-hidden="true"></i>
             </div>
+        </div>
 
 
-            <div class="category">
-                <div class="button" id="newButton1030">New
-                    <i class="fa fa-file" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="clearButton1030">Clear
-                    <i class="fa fa-trash" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="newButton1030">New
+                <i class="fa fa-file" aria-hidden="true"></i>
+            </div>
+            <div class="button removeOnPhone" id="clearButton1030">Clear
+                <i class="fa fa-trash" aria-hidden="true"></i>
             </div>
+        </div>
 
-            <div class="category">
-                <div class="button" id="saveButton1030">Save
-                    <i class="fa fa-floppy-o" aria-hidden="true"></i>
-                </div>
-                <div class="button removeOnPhone" id="zipButton1030">Zip
-                    <i class="fa fa-download" aria-hidden="true"></i>
-                </div>
+        <div class="category">
+            <div class="button" id="saveButton1030">Save
+                <i class="fa fa-floppy-o" aria-hidden="true"></i>
+            </div>
+            <div class="button removeOnPhone" id="zipButton1030">Zip
+                <i class="fa fa-download" aria-hidden="true"></i>
             </div>
+        </div>
 
-            <div class="category">
-                <div class="button select">Settings
-                    <div class="toDisplay">
-                        <div class="option subSelect">Theme
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" id="darkTheme1030">Dark</div>
-                                <div class="option" id="lightTheme1030">Light</div>
-                            </div>
-                        </div>
-                        <div class="option subSelect">
-                            <span id="currentFontSize1030">Font: 14</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setFontSize(12);">12</div>
-                                <div class="option" onclick="setFontSize(14);">14</div>
-                                <div class="option" onclick="setFontSize(16);">16</div>
-                                <div class="option" onclick="setFontSize(18);">18</div>
-                                <div class="option" onclick="setFontSize(20);">20</div>
-                                <div class="option" onclick="setFontSize(22);">22</div>
-                            </div>
-                        </div>
-                        <div class="option" id="safemodeToggle1030">Safe mode
-                            <i class="far fa-square" aria-hidden="true"></i>
+        <div class="category">
+            <div class="button select">Settings
+                <div class="toDisplay">
+                    <div class="option subSelect">Theme
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" id="darkTheme1030">Dark</div>
+                            <div class="option" id="lightTheme1030">Light</div>
                         </div>
-                        <div class="option checked" id="editorButton1030">Editor
-                            <i class="fa fa-check-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="fullscreenButton1030">Fullscreen</div>
-                        <div class="option" id="editorFullscreenButton1030">Editor Fullscreen</div>
-                        <div class="option" id="formatButton1030">Format code</div>
-                        <div class="option" id="minimapToggle1030">Minimap
-                            <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option subSelect">
+                        <span id="currentFontSize1030">Font: 14</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setFontSize(12);">12</div>
+                            <div class="option" onclick="setFontSize(14);">14</div>
+                            <div class="option" onclick="setFontSize(16);">16</div>
+                            <div class="option" onclick="setFontSize(18);">18</div>
+                            <div class="option" onclick="setFontSize(20);">20</div>
+                            <div class="option" onclick="setFontSize(22);">22</div>
                         </div>
-                        <div class="option" id="debugButton1030">Inspector</div>
-                        <div class="option" id="metadataButton1030">Metadata</div>
-                        <div class="option subSelect">
-                            <span id="currentVersion1030">Vers. : Latest</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setVersion('latest');">Latest</div>
-                                <div class="option" onclick="setVersion('stable');">Stable</div>
-                            </div>
+                    </div>
+                    <div class="option" id="safemodeToggle1030">Safe mode
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option checked" id="editorButton1030">Editor
+                        <i class="fa fa-check-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="fullscreenButton1030">Fullscreen</div>
+                    <div class="option" id="editorFullscreenButton1030">Editor Fullscreen</div>
+                    <div class="option" id="formatButton1030">Format code</div>
+                    <div class="option" id="minimapToggle1030">Minimap
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="debugButton1030">Inspector</div>
+                    <div class="option" id="metadataButton1030">Metadata</div>
+                    <div class="option subSelect">
+                        <span id="currentVersion1030">Vers. : Latest</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setVersion('latest');">Latest</div>
+                            <div class="option" onclick="setVersion('stable');">Stable</div>
                         </div>
                     </div>
                 </div>
             </div>
+        </div>
 
-            <div class="category right">
-                <div class="button select">
-                    <span class="examplesButton">Examples</span>
-                </div>
+        <div class="category right">
+            <div class="button select">
+                <span class="examplesButton">Examples</span>
             </div>
         </div>
-
-        <div class="navbar navBar750">
-            <div class="category">
-                <div class="button select">File
-                    <div class="toDisplay">
-                        <div class="option" id="runButton750">Run
-                            <i class="fa fa-play" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="newButton750">New
-                            <i class="fa fa-file" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="clearButton750">Clear
-                            <i class="fa fa-trash" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="saveButton750">Save
-                            <i class="fa fa-floppy-o" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="zipButton750">Zip
-                            <i class="fa fa-download" aria-hidden="true"></i>
-                        </div>
+    </div>
+
+    <div class="navbar navBar750">
+        <div class="category">
+            <div class="button select">File
+                <div class="toDisplay">
+                    <div class="option" id="runButton750">Run
+                        <i class="fa fa-play" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="newButton750">New
+                        <i class="fa fa-file" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="clearButton750">Clear
+                        <i class="fa fa-trash" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="saveButton750">Save
+                        <i class="fa fa-floppy-o" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="zipButton750">Zip
+                        <i class="fa fa-download" aria-hidden="true"></i>
                     </div>
                 </div>
             </div>
+        </div>
 
-            <div class="category">
-                <div class="button select">Settings
-                    <div class="toDisplay">
-                        <div class="option subSelect">Theme
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" id="darkTheme750">Dark</div>
-                                <div class="option" id="lightTheme750">Light</div>
-                            </div>
-                        </div>
-                        <div class="option subSelect">
-                            <span id="currentFontSize750">Font: 14</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setFontSize(12);">12</div>
-                                <div class="option" onclick="setFontSize(14);">14</div>
-                                <div class="option" onclick="setFontSize(16);">16</div>
-                                <div class="option" onclick="setFontSize(18);">18</div>
-                                <div class="option" onclick="setFontSize(20);">20</div>
-                                <div class="option" onclick="setFontSize(22);">22</div>
-                            </div>
-                        </div>
-                        <div class="option" id="safemodeToggle750">Safe mode
-                            <i class="far fa-square" aria-hidden="true"></i>
+        <div class="category">
+            <div class="button select">Settings
+                <div class="toDisplay">
+                    <div class="option subSelect">Theme
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" id="darkTheme750">Dark</div>
+                            <div class="option" id="lightTheme750">Light</div>
                         </div>
-                        <div style="display:none;" class="option checked" id="editorButton750">Editor
-                            <i class="fa fa-check-square" aria-hidden="true"></i>
-                        </div>
-                        <div class="option" id="fullscreenButton750">Fullscreen</div>
-                        <div class="option" id="editorFullscreenButton750">Editor Fullscreen</div>
-                        <div class="option" id="formatButton750">Format code</div>
-                        <div class="option" id="minimapToggle750">Minimap
-                            <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option subSelect">
+                        <span id="currentFontSize750">Font: 14</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setFontSize(12);">12</div>
+                            <div class="option" onclick="setFontSize(14);">14</div>
+                            <div class="option" onclick="setFontSize(16);">16</div>
+                            <div class="option" onclick="setFontSize(18);">18</div>
+                            <div class="option" onclick="setFontSize(20);">20</div>
+                            <div class="option" onclick="setFontSize(22);">22</div>
                         </div>
-                        <div class="option" id="debugButton750">Inspector</div>
-                        <div class="option" id="metadataButton750">Metadata</div>
-                        <div class="option subSelect">
-                            <span id="currentVersion750">Vers. : Latest</span>
-                            <i class="fa fa-chevron-right" aria-hidden="true"></i>
-                            <div class="toDisplaySub">
-                                <div class="option" onclick="setVersion('latest');">Latest</div>
-                                <div class="option" onclick="setVersion('stable');">Stable</div>
-                            </div>
+                    </div>
+                    <div class="option" id="safemodeToggle750">Safe mode
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div style="display:none;" class="option checked" id="editorButton750">Editor
+                        <i class="fa fa-check-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="fullscreenButton750">Fullscreen</div>
+                    <div class="option" id="editorFullscreenButton750">Editor Fullscreen</div>
+                    <div class="option" id="formatButton750">Format code</div>
+                    <div class="option" id="minimapToggle750">Minimap
+                        <i class="far fa-square" aria-hidden="true"></i>
+                    </div>
+                    <div class="option" id="debugButton750">Inspector</div>
+                    <div class="option" id="metadataButton750">Metadata</div>
+                    <div class="option subSelect">
+                        <span id="currentVersion750">Vers. : Latest</span>
+                        <i class="fa fa-chevron-right" aria-hidden="true"></i>
+                        <div class="toDisplaySub">
+                            <div class="option" onclick="setVersion('latest');">Latest</div>
+                            <div class="option" onclick="setVersion('stable');">Stable</div>
                         </div>
                     </div>
                 </div>
             </div>
+        </div>
 
-            <div class="category right">
-                <div class="button select">
-                    <span id="currentScript750">Examples</span>
-                </div>
+        <div class="category right">
+            <div class="button select">
+                <span id="currentScript750">Examples</span>
             </div>
         </div>
+    </div>
 
-        <div class="wrapper">
-            <div id="jsEditor"></div>
-            <div id="canvasZone">
-                <canvas touch-action="none" id="renderCanvas"></canvas>
-            </div>
+    <div class="wrapper">
+        <div id="jsEditor"></div>
+        <div id="canvasZone">
+            <canvas touch-action="none" id="renderCanvas"></canvas>
         </div>
-        <div id="exampleList" class="javascript">
-            <div id="exampleBanner">
-                <h1>Examples</h1>
-            </div>
-            <div class="horizontalSeparator"></div>
-            <input id="filterBar" type="text" placeholder="Filter examples...">
-            <img id="filterBarClear" src="https://d33wubrfki0l68.cloudfront.net/17ca450bae302631f4857cd8c3992234ec5dd9a7/057f9/img/ui/clear_button.png">
+    </div>
+    <div id="exampleList" class="javascript">
+        <div id="exampleBanner">
+            <h1>Examples</h1>
         </div>
+        <div class="horizontalSeparator"></div>
+        <input id="filterBar" type="text" placeholder="Filter examples...">
+        <img id="filterBarClear" src="https://d33wubrfki0l68.cloudfront.net/17ca450bae302631f4857cd8c3992234ec5dd9a7/057f9/img/ui/clear_button.png">
+    </div>
 
-        <span class="label" id="fpsLabel">FPS</span>
+    <span class="label" id="fpsLabel">FPS</span>
 
-        <div id="errorZone">
-        </div>
+    <div id="errorZone">
+    </div>
 
-        <div class="navbarBottom">
-            <div id="statusBar"></div>
-            <div class="links">
-                <div class='link'>
-                    <a target='_new' href="https://www.netlify.com/">Deployed by Netlify</a>
-                </div>
-                <div class='link'>
-                    <a target='_new' href="https://forum.babylonjs.com/">Forum</a>
-                </div>
-                <div class='link'>
-                    <a target='_new' href="https://www.babylonjs.com/sandbox">Sandbox</a>
-                </div>
-                <div class='link'>
-                    <a target='_new' href="https://doc.babylonjs.com">Documentation</a>
-                </div>
-                <div class='link'>
-                    <a target='_new' href="https://doc.babylonjs.com/playground">Search</a>
-                </div>
+    <div class="navbarBottom">
+        <div id="statusBar"></div>
+        <div class="links">
+            <div class='link'>
+                <a target='_new' href="https://www.netlify.com/">Deployed by Netlify</a>
+            </div>
+            <div class='link'>
+                <a target='_new' href="https://forum.babylonjs.com/">Forum</a>
+            </div>
+            <div class='link'>
+                <a target='_new' href="https://www.babylonjs.com/sandbox">Sandbox</a>
+            </div>
+            <div class='link'>
+                <a target='_new' href="https://doc.babylonjs.com">Documentation</a>
+            </div>
+            <div class='link'>
+                <a target='_new' href="https://doc.babylonjs.com/playground">Search</a>
             </div>
         </div>
+    </div>
 
-        <div id="saveLayer" class="save-layer">
-            <div class="save-form">
-                <label for="saveFormTitle">TITLE</label>
-                <div class="separator"></div>
-                <input type="text" maxlength="120" id="saveFormTitle" class="save-form-title">
+    <div id="saveLayer" class="save-layer">
+        <div class="save-form">
+            <label for="saveFormTitle">TITLE</label>
+            <div class="separator"></div>
+            <input type="text" maxlength="120" id="saveFormTitle" class="save-form-title">
 
-                <label for="saveFormDescription">DESCRIPTION</label>
-                <div class="separator"></div>
-                <textarea id="saveFormDescription" rows="4" cols="10"></textarea>
+            <label for="saveFormDescription">DESCRIPTION</label>
+            <div class="separator"></div>
+            <textarea id="saveFormDescription" rows="4" cols="10"></textarea>
 
-                <label for="saveFormTags">TAGS (separated by comma)</label>
-                <div class="separator"></div>
-                <textarea id="saveFormTags" rows="4" cols="10"></textarea>
+            <label for="saveFormTags">TAGS (separated by comma)</label>
+            <div class="separator"></div>
+            <textarea id="saveFormTags" rows="4" cols="10"></textarea>
 
-                <div class="save-form-buttons" id="saveFormButtons">
+            <div class="save-form-buttons" id="saveFormButtons">
 
-                    <div id="saveFormButtonOk" class="button">OK</div>
-                    <div id="saveFormButtonCancel" class="button">Cancel</div>
-                </div>
+                <div id="saveFormButtonOk" class="button">OK</div>
+                <div id="saveFormButtonCancel" class="button">Cancel</div>
             </div>
         </div>
-
-        <div id="waitDiv">
-            <span id="waitTitle">Babylon.js Playground
-                <BR>
-                <BR>
-                <BR>
-            </span>
-            <img src="waitlogo.png" id="waitLogo" />
-        </div>
-
-        <script src="js/libs/jquery.min.js"></script>
-
-        <script src="js/actions.js"></script>
-        <script src="js/pbt.js"></script>
-        <script src="js/index.js"></script>
-
-        <!-- Global site tag (gtag.js) - Google Analytics -->
-        <script async src="https://www.googletagmanager.com/gtag/js?id=UA-41767310-2"></script>
-        <script>
-            window.dataLayer = window.dataLayer || [];
-            function gtag() { dataLayer.push(arguments); }
-            gtag('js', new Date());
-
-            gtag('config', 'UA-41767310-2');
-        </script>
-    </body>
-
-</html>
+    </div>
+
+    <div id="waitDiv">
+        <span id="waitTitle">Babylon.js Playground
+            <BR>
+            <BR>
+            <BR>
+        </span>
+        <img src="waitlogo.png" id="waitLogo" />
+    </div>
+
+    <script src="js/libs/jquery.min.js"></script>
+
+    <script src="js/actions.js"></script>
+    <script src="js/pbt.js"></script>
+    <script src="js/index.js"></script>
+
+    <!-- Global site tag (gtag.js) - Google Analytics -->
+    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-41767310-2"></script>
+    <script>
+        window.dataLayer = window.dataLayer || [];
+        function gtag() { dataLayer.push(arguments); }
+        gtag('js', new Date());
+
+        gtag('config', 'UA-41767310-2');
+    </script>
+</body>
+
+</html>

+ 1 - 1
Playground/js/frame.js

@@ -203,4 +203,4 @@
 
     checkHash();
 
-})();
+})();

+ 1 - 1
Playground/js/index.js

@@ -651,7 +651,7 @@ function showError(errorMessage, errorEvent) {
 
         // Zip
         var addContentToZip = function(zip, name, url, replace, buffer, then) {
-            if (url.substring(0, 5) == "http:" || url.substring(0, 5) == "blob:" || url.substring(0, 6) == "https:") {
+            if (url.substring(0, 5) == "data:" || url.substring(0, 5) == "http:" || url.substring(0, 5) == "blob:" || url.substring(0, 6) == "https:") {
                 then();
                 return;
             }

二進制
Playground/textures/BJS-logo_v3-astc.ktx


二進制
Playground/textures/BJS-logo_v3-dxt.ktx


二進制
Playground/textures/BJS-logo_v3-etc2.ktx


二進制
Playground/textures/BJS-logo_v3-pvrtc.ktx


二進制
Playground/textures/Runyon_Canyon_A_2k_cube_specular.env


二進制
Playground/textures/SpecularHDR.dds_thumb.jpg


二進制
Playground/textures/SpecularHDR.env


二進制
Playground/textures/Studio_Softbox_2Umbrellas_cube_specular.env


二進制
Playground/textures/checkerBJS-astc.ktx


二進制
Playground/textures/checkerBJS-dxt.ktx


二進制
Playground/textures/checkerBJS-etc2.ktx


二進制
Playground/textures/checkerBJS-pvrtc.ktx


二進制
Playground/textures/country.dds


二進制
Playground/textures/country.env


二進制
Playground/textures/country.hdr_thumb.jpg


二進制
Playground/textures/cubemapDebug/_nx-astc.ktx


二進制
Playground/textures/cubemapDebug/_nx-dxt.ktx


二進制
Playground/textures/cubemapDebug/_nx-etc1.ktx


二進制
Playground/textures/cubemapDebug/_nx-etc2.ktx


二進制
Playground/textures/cubemapDebug/_nx-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_nx.jpg


二進制
Playground/textures/cubemapDebug/_ny-astc.ktx


二進制
Playground/textures/cubemapDebug/_ny-dxt.ktx


二進制
Playground/textures/cubemapDebug/_ny-etc1.ktx


二進制
Playground/textures/cubemapDebug/_ny-etc2.ktx


二進制
Playground/textures/cubemapDebug/_ny-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_ny.jpg


二進制
Playground/textures/cubemapDebug/_nz-astc.ktx


二進制
Playground/textures/cubemapDebug/_nz-dxt.ktx


二進制
Playground/textures/cubemapDebug/_nz-etc1.ktx


二進制
Playground/textures/cubemapDebug/_nz-etc2.ktx


二進制
Playground/textures/cubemapDebug/_nz-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_nz.jpg


二進制
Playground/textures/cubemapDebug/_px-astc.ktx


二進制
Playground/textures/cubemapDebug/_px-dxt.ktx


二進制
Playground/textures/cubemapDebug/_px-etc1.ktx


二進制
Playground/textures/cubemapDebug/_px-etc2.ktx


二進制
Playground/textures/cubemapDebug/_px-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_px.jpg


二進制
Playground/textures/cubemapDebug/_py-astc.ktx


二進制
Playground/textures/cubemapDebug/_py-dxt.ktx


二進制
Playground/textures/cubemapDebug/_py-etc1.ktx


二進制
Playground/textures/cubemapDebug/_py-etc2.ktx


二進制
Playground/textures/cubemapDebug/_py-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_py.jpg


二進制
Playground/textures/cubemapDebug/_pz-astc.ktx


二進制
Playground/textures/cubemapDebug/_pz-dxt.ktx


二進制
Playground/textures/cubemapDebug/_pz-etc1.ktx


二進制
Playground/textures/cubemapDebug/_pz-etc2.ktx


二進制
Playground/textures/cubemapDebug/_pz-pvrtc.ktx


二進制
Playground/textures/cubemapDebug/_pz.jpg


二進制
Playground/textures/cubemap_blank.jpg


二進制
Playground/textures/environment.dds_thumb.jpg


二進制
Playground/textures/environment.hdr_thumb.jpg


二進制
Playground/textures/forest.dds


二進制
Playground/textures/forest.env


二進制
Playground/textures/forest.hdr_thumb.jpg


二進制
Playground/textures/grass.dds_thumb.jpg


二進制
Playground/textures/night.dds


二進制
Playground/textures/night.env


二進制
Playground/textures/night.hdr_thumb.jpg


二進制
Playground/textures/parking.dds


二進制
Playground/textures/parking.env


二進制
Playground/textures/parking.hdr_thumb.jpg


二進制
Playground/textures/room.dds


二進制
Playground/textures/room.env


二進制
Playground/textures/room.hdr_thumb.jpg


+ 2 - 2
Playground/ts.html

@@ -54,8 +54,8 @@
         <!-- Extensions -->
         <script src="https://rawgit.com/BabylonJS/Extensions/master/ClonerSystem/src/babylonx.cloner.js" async></script>
         <script src="https://rawgit.com/BabylonJS/Extensions/master/CompoundShader/src/babylonx.CompoundShader.js" async></script>
-        <script src="https://www.babylontoolkit.com/playground/scripts/babylon.navmesh.js"></script>
-        <script src="https://www.babylontoolkit.com/playground/scripts/babylon.manager.js"></script>
+        <script src="https://www.babylontoolkit.com/Playground/scripts/babylon.navmesh.js"></script>
+        <script src="https://www.babylontoolkit.com/Playground/scripts/babylon.manager.js"></script>
                                
         <link href="css/index.css" rel="stylesheet" />
         <link href="css/color_ts.css" rel="stylesheet" />

+ 122 - 0
Tools/Config/config.js

@@ -0,0 +1,122 @@
+const path = require("path");
+const fs = require("fs-extra");
+
+const config = require("./config.json");
+const configFolder = __dirname;
+
+const rootFolder = path.resolve(configFolder, "../../");
+const tempFolder = path.resolve(rootFolder, config.build.tempDirectory);
+const outputFolder = path.resolve(configFolder, config.build.outputDirectory);
+const localDevES6Folder = path.join(tempFolder, config.build.localDevES6FolderName);
+const localDevUMDFolder = path.join(tempFolder, config.build.localDevUMDFolderName);
+const packageUMDFolder = path.join(tempFolder, config.build.packageUMDFolderName);
+const packageUMDDevFolder = path.join(tempFolder, config.build.packageUMDDevFolderName);
+const sourceES6Folder = path.join(tempFolder, config.build.sourceES6FolderName);
+const distES6Folder = path.join(tempFolder, config.build.distES6FolderName);
+const packageES6Folder = path.join(tempFolder, config.build.packageES6FolderName);
+const packageES6DevFolder = path.join(tempFolder, config.build.packageES6DevFolderName);
+
+const tempTypingsAMDFileName = config.build.tempTypingsAMDFileName;
+const tempTypingsFileName = tempTypingsAMDFileName.replace(".js", ".d.ts");
+const tempTypingsAMDFilePath = path.join(tempFolder, tempTypingsAMDFileName);
+const tempTypingsFilePath = path.join(tempFolder, tempTypingsFileName);
+
+const tscPath = path.resolve(rootFolder, "node_modules/typescript/bin/tsc");
+
+config.computed = {
+    rootFolder,
+    tempFolder,
+    outputFolder,
+    localDevES6Folder,
+    localDevUMDFolder,
+    packageUMDFolder,
+    packageUMDDevFolder,
+    sourceES6Folder,
+    distES6Folder,
+    packageES6Folder,
+    packageES6DevFolder,
+    tempTypingsAMDFileName,
+    tempTypingsFileName,
+    tempTypingsAMDFilePath,
+    tempTypingsFilePath,
+    tscPath
+}
+
+config.additionalNpmPackages.forEach(package => {
+    let packagePath = path.join(rootFolder, package.path);
+    let packageDevDirectory = path.join(localDevUMDFolder, package.name);
+
+    package.computed = {
+        path: packagePath,
+        packageDevDirectory
+    };
+});
+
+config.es6modules.map(function(module) {
+    const settings = config[module];
+
+    const mainDirectory = path.resolve(rootFolder, settings.build.mainFolder);
+    const distFolder = (settings.build.distOutputDirectory !== undefined) ? settings.build.distOutputDirectory : module;
+    const distDirectory = path.join(outputFolder, distFolder);
+    const localDevES6Directory = path.join(localDevES6Folder, module);
+    const localDevUMDDirectory = path.join(localDevUMDFolder, distFolder);
+    const packageUMDDirectory = path.join(packageUMDFolder, module);
+    const packageUMDDevDirectory = path.join(packageUMDDevFolder, module);
+    const sourceES6Directory = path.join(sourceES6Folder, module);
+    const distES6Directory = path.join(distES6Folder, module);
+    const packageES6Directory = path.join(packageES6Folder, module);
+    const packageES6DevDirectory = path.join(packageES6DevFolder, module);
+
+    const webpackConfigPath = path.join(mainDirectory, "webpack.config.js");
+    const tsConfigPath = path.join(mainDirectory, "tsconfig.json");
+    const packageJSONPath = settings.build.packageJSON ? 
+        path.join(rootFolder, settings.build.packageJSON) : 
+        path.join(distDirectory, 'package.json');
+
+    settings.computed = {
+        mainDirectory,
+        distDirectory,
+        localDevES6Directory,
+        localDevUMDDirectory,
+        packageUMDDirectory,
+        packageUMDDevDirectory,
+        sourceES6Directory,
+        distES6Directory,
+        packageES6Directory,
+        packageES6DevDirectory,
+        webpackConfigPath,
+        tsConfigPath,
+        packageJSONPath
+    }
+
+    // Prevent es6 bundled lib crash.
+    if (fs.existsSync(tsConfigPath)) {
+        const tsConfig = require(tsConfigPath);
+        const srcDirectory = path.resolve(mainDirectory, tsConfig.compilerOptions.rootDir);
+
+        const shaderGlob = srcDirectory.replace(/\\/g, "/") + "/**/*.fx";
+        const shaderTSGlob = [
+            srcDirectory.replace(/\\/g, "/") + "/**/*.fragment.ts",
+            srcDirectory.replace(/\\/g, "/") + "/**/*.vertex.ts",
+            srcDirectory.replace(/\\/g, "/") + "/**/ShadersInclude/*.ts",
+        ];
+        const tsGlob = srcDirectory.replace(/\\/g, "/") + "/**/*.ts*";
+
+        for (let library of settings.libraries) {
+            if(library.entry){
+                const entryPath = path.join(srcDirectory, library.entry);
+
+                library.computed = {
+                    entryPath
+                };
+            }
+        }
+
+        settings.computed.srcDirectory = srcDirectory;
+        settings.computed.shaderGlob = shaderGlob;
+        settings.computed.shaderTSGlob = shaderTSGlob;
+        settings.computed.tsGlob = tsGlob;
+    }
+});
+
+module.exports = config;

+ 718 - 0
Tools/Config/config.json

@@ -0,0 +1,718 @@
+{
+    "build": {
+        "outputDirectory": "../../dist/preview release",
+        "tempDirectory": "./.temp/",
+        "tempTypingsAMDFileName": "tempTypings.js",
+        "localDevES6FolderName": "localDevES6",
+        "localDevUMDFolderName": "localDevUMD",
+        "packageUMDFolderName": "packageUMD",
+        "packageUMDDevFolderName": "packageUMDDev",
+        "sourceES6FolderName": "sourceES6",
+        "distES6FolderName": "distES6",
+        "packageES6FolderName": "packageES6",
+        "packageES6DevFolderName": "packageES6Dev",
+        "playgroundDirectory": "../../Playground/",
+        "intellisenseFile": "babylon.d.txt",
+        "intellisenseSources": [
+            "../../dist/preview release/babylon.d.ts",
+            "../../dist/preview release/gui/babylon.gui.d.ts",
+            "../../dist/preview release/loaders/babylonjs.loaders.d.ts",
+            "../../dist/preview release/serializers/babylonjs.serializers.d.ts",
+            "../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts",
+            "../../dist/preview release/materialsLibrary/babylonjs.materials.d.ts",
+            "../../dist/preview release/postProcessesLibrary/babylonjs.postProcess.d.ts",
+            "../../dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.d.ts"
+        ],
+        "typedocGenerationFiles": [
+            "../../dist/preview release/babylon.d.ts",
+            "../../dist/preview release/gui/babylon.gui.d.ts",
+            "../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts",
+            "../../dist/preview release/loaders/babylonjs.loaders.d.ts",
+            "../../dist/preview release/serializers/babylonjs.serializers.d.ts"
+        ],
+        "typedocEntryPoint": [
+            "\"babylon.d\"",
+            "BABYLON"
+        ],
+        "typedocJSON": "../../.temp/babylon.typedoc.json",
+        "typedocValidationBaseline": "../../dist/preview release/typedocValidationBaseline.json"
+    },
+    "modules": [
+        "core",
+        "materialsLibrary",
+        "postProcessesLibrary",
+        "proceduralTexturesLibrary",
+        "loaders",
+        "serializers",
+        "gui",
+        "inspector"
+    ],
+    "es6modules": [
+        "core",
+        "materialsLibrary",
+        "postProcessesLibrary",
+        "proceduralTexturesLibrary",
+        "loaders",
+        "serializers",
+        "gui",
+        "inspector",
+        "viewer"
+    ],
+    "lintModules": [
+        "core",
+        "materialsLibrary",
+        "postProcessesLibrary",
+        "proceduralTexturesLibrary",
+        "loaders",
+        "serializers",
+        "gui"
+    ],
+    "viewerModules": [
+        "viewer",
+        "viewer-assets"
+    ],
+    "additionalNpmPackages": [
+        {
+            "name": "gltf2interface",
+            "path": "dist/preview release/glTF2Interface"
+        }
+    ],
+    "core": {
+        "isCore": true,
+        "libraries": [
+            {
+                "output": "babylon.js",
+                "entry": "./Legacy/legacy.ts"
+            }
+        ],
+        "build": {
+            "mainFolder": "./src/",
+            "loseDTSFiles": {
+                "glob": "LibDeclarations/*.d.ts",
+                "destFileES6": "Engines/engine.d.ts"
+            },
+            "distOutputDirectory": "",
+            "packageJSON": "package.json",
+            "umd": {
+                "packageName": "babylonjs",
+                "webpackRoot": "BABYLON",
+                "processDeclaration": {
+                    "filename": "babylon.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "moduleSpecifics": [
+                        {
+                            "path": "babylonjs/Debug/axesViewer",
+                            "namespace": "BABYLON.Debug"
+                        },
+                        {
+                            "path": "babylonjs/Debug/boneAxesViewer",
+                            "namespace": "BABYLON.Debug"
+                        },
+                        {
+                            "path": "babylonjs/Debug/physicsViewer",
+                            "namespace": "BABYLON.Debug"
+                        },
+                        {
+                            "path": "babylonjs/Debug/skeletonViewer",
+                            "namespace": "BABYLON.Debug"
+                        }
+                    ],
+                    "hiddenConsts": ["Debug"]
+                },
+                "requiredFiles": [
+                    "readme.md"
+                ],
+                "packagesFiles": [
+                    "babylon.module.d.ts",
+                    "babylon.js",
+                    "babylon.max.js",
+                    "babylon.max.js.map",
+                    "Oimo.js",
+                    "readme.md"
+                ],
+                "typings": "babylon.module.d.ts",
+                "index": "babylon.js",
+                "dependencies": [],
+                "devDependencies": []
+            },
+            "es6": {
+                "packageName": "@babylonjs/core",
+                "readme": "readme-es6.md"
+            }
+        }
+    },
+    "materialsLibrary": {
+        "libraries": [
+            {
+                "output": "babylonjs.materials.min.js",
+                "entry": "./legacy/legacy.ts"
+            },
+            {
+                "output": "babylon.cellMaterial.min.js",
+                "entry": "./legacy/legacy-cell.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.customMaterial.min.js",
+                "entry": "./legacy/legacy-custom.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.fireMaterial.min.js",
+                "entry": "./legacy/legacy-fire.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.furMaterial.min.js",
+                "entry": "./legacy/legacy-fur.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.gradientMaterial.min.js",
+                "entry": "./legacy/legacy-gradient.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.gridMaterial.min.js",
+                "entry": "./legacy/legacy-grid.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.lavaMaterial.min.js",
+                "entry": "./legacy/legacy-lava.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.mixMaterial.min.js",
+                "entry": "./legacy/legacy-mix.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.normalMaterial.min.js",
+                "entry": "./legacy/legacy-normal.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.shadowOnlyMaterial.min.js",
+                "entry": "./legacy/legacy-shadowOnly.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.simpleMaterial.min.js",
+                "entry": "./legacy/legacy-simple.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.skyMaterial.min.js",
+                "entry": "./legacy/legacy-sky.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.terrainMaterial.min.js",
+                "entry": "./legacy/legacy-terrain.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.triPlanarMaterial.min.js",
+                "entry": "./legacy/legacy-triPlanar.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.waterMaterial.min.js",
+                "entry": "./legacy/legacy-water.ts",
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./materialsLibrary/",
+            "umd": {
+                "packageName": "babylonjs-materials",
+                "webpackRoot": "MATERIALS",
+                "processDeclaration": {
+                    "filename": "babylonjs.materials.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON"
+                    }
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/materials",
+                "readme": "dist/preview release/materialsLibrary/readme-es6.md"
+            }
+        }
+    },
+    "postProcessesLibrary": {
+        "libraries": [
+            {
+                "output": "babylonjs.postProcess.min.js",
+                "entry": "./legacy/legacy.ts"
+            },
+            {
+                "output": "babylon.asciiArtPostProcess.min.js",
+                "entry": "./legacy/legacy-asciiArt.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.digitalRainPostProcess.min.js",
+                "entry": "./legacy/legacy-digitalRain.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.oceanPostProcess.min.js",
+                "entry": "./legacy/legacy-ocean.ts",
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./postProcessLibrary/",
+            "umd": {
+                "packageName": "babylonjs-post-process",
+                "webpackRoot": "POSTPROCESSES",
+                "processDeclaration": {
+                    "filename": "babylonjs.postProcess.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON"
+                    }
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/post-processes",
+                "readme": "dist/preview release/postProcessesLibrary/readme-es6.md"
+            }
+        }
+    },
+    "proceduralTexturesLibrary": {
+        "libraries": [
+            {
+                "output": "babylonjs.proceduralTextures.min.js",
+                "entry": "./legacy/legacy.ts"
+            },
+            {
+                "output": "babylon.brickProceduralTexture.min.js",
+                "entry": "./legacy/legacy-brick.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.cloudProceduralTexture.min.js",
+                "entry": "./legacy/legacy-cloud.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.fireProceduralTexture.min.js",
+                "entry": "./legacy/legacy-fire.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.grassProceduralTexture.min.js",
+                "entry": "./legacy/legacy-grass.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.marbleProceduralTexture.min.js",
+                "entry": "./legacy/legacy-marble.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.normalMapProceduralTexture.min.js",
+                "entry": "./legacy/legacy-normalMap.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.perlinNoiseProceduralTexture.min.js",
+                "entry": "./legacy/legacy-perlinNoise.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.roadProceduralTexture.min.js",
+                "entry": "./legacy/legacy-road.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.starfieldProceduralTexture.min.js",
+                "entry": "./legacy/legacy-starfield.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.woodProceduralTexture.min.js",
+                "entry": "./legacy/legacy-wood.ts",
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./proceduralTexturesLibrary/",
+            "umd": {
+                "packageName": "babylonjs-procedural-textures",
+                "webpackRoot": "PROCEDURALTEXTURES",
+                "processDeclaration": {
+                    "filename": "babylonjs.proceduralTextures.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON"
+                    }
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/procedural-textures",
+                "readme": "dist/preview release/proceduralTexturesLibrary/readme-es6.md"
+            }
+        }
+    },
+    "loaders": {
+        "libraries": [
+            {
+                "output": "babylonjs.loaders.min.js",
+                "entry": "./legacy/legacy.ts"
+            },
+            {
+                "output": "babylon.objFileLoader.min.js",
+                "entry": "./legacy/legacy-objFileLoader.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.stlFileLoader.min.js",
+                "entry": "./legacy/legacy-stlFileLoader.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.glTF1FileLoader.min.js",
+                "entry": "./legacy/legacy-glTF1FileLoader.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.glTF2FileLoader.min.js",
+                "entry": "./legacy/legacy-glTF2FileLoader.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.glTFFileLoader.min.js",
+                "entry": "./legacy/legacy-glTFFileLoader.ts",
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./loaders/",
+            "umd": {
+                "packageName": "babylonjs-loaders",
+                "webpackRoot": "LOADERS",
+                "processDeclaration": {
+                    "filename": "babylonjs.loaders.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "moduleSpecifics": [
+                        {
+                            "path": "babylonjs-loaders/glTF/1.0",
+                            "namespace": "BABYLON.GLTF1"
+                        },
+                        {
+                            "path": "babylonjs-loaders/glTF/2.0",
+                            "namespace": "BABYLON.GLTF2"
+                        },
+                        {
+                            "path": "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces",
+                            "namespace": "BABYLON.GLTF2.Loader"
+                        },
+                        {
+                            "path": "babylonjs-loaders/glTF/2.0/Extensions",
+                            "namespace": "BABYLON.GLTF2.Loader.Extensions"
+                        }
+                    ],
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON",
+                        "babylonjs-gltf2interface": "BABYLON.GLTF2"
+                    }
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/loaders",
+                "readme": "dist/preview release/loaders/readme-es6.md"
+            }
+        }
+    },
+    "serializers": {
+        "libraries": [
+            {
+                "output": "babylonjs.serializers.min.js",
+                "entry": "./legacy/legacy.ts"
+            },
+            {
+                "output": "babylon.objSerializer.min.js",
+                "entry": "./legacy/legacy-objSerializer.ts",
+                "preventLoadLibrary": true
+            },
+            {
+                "output": "babylon.glTF2Serializer.min.js",
+                "entry": "./legacy/legacy-glTF2Serializer.ts",
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./serializers/",
+            "umd": {
+                "packageName": "babylonjs-serializers",
+                "webpackRoot": "SERIALIZERS",
+                "processDeclaration": {
+                    "filename": "babylonjs.serializers.module.d.ts",
+                    "moduleName": "BABYLON",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON",
+                        "babylonjs-loaders": "BABYLON",
+                        "babylonjs-serializers": "BABYLON",
+                        "babylonjs-gltf2interface": "BABYLON.GLTF2"
+                    },
+                    "moduleSpecifics": [
+                        {
+                            "path": "babylonjs-serializers/glTF/2.0",
+                            "namespace": "BABYLON.GLTF2.Exporter"
+                        },
+                        {
+                            "path": "babylonjs-serializers/glTF/2.0/Extensions",
+                            "namespace": "BABYLON.GLTF2.Exporter.Extensions"
+                        },
+                        {
+                            "path": "babylonjs-serializers/glTF/2.0/glTFData",
+                            "namespace": "BABYLON"
+                        },
+                        {
+                            "path": "babylonjs-serializers/glTF/2.0/glTFSerializer",
+                            "namespace": "BABYLON"
+                        }
+                    ]
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/serializers",
+                "readme": "dist/preview release/serializers/readme-es6.md"
+            }
+        }
+    },
+    "gui": {
+        "libraries": [
+            {
+                "output": "babylon.gui.min.js",
+                "entry": "./legacy/legacy.ts"
+            }
+        ],
+        "build": {
+            "mainFolder": "./gui/",
+            "umd": {
+                "packageName": "babylonjs-gui",
+                "webpackRoot": "BABYLON.GUI",
+                "processDeclaration": {
+                    "filename": "babylon.gui.module.d.ts",
+                    "moduleName": "BABYLON.GUI",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON",
+                        "babylonjs-loaders": "BABYLON",
+                        "babylonjs-serializers": "BABYLON"
+                    }
+                }
+            },
+            "es6": {
+                "packageName": "@babylonjs/gui",
+                "readme": "dist/preview release/gui/readme-es6.md"
+            }
+        }
+    },
+    "inspector": {
+        "libraries": [
+            {
+                "output": "babylon.inspector.bundle.js",
+                "entry": "./legacy/legacy.ts"
+            }
+        ],
+        "build": {
+            "ignoreInTestMode": true,
+            "mainFolder": "./inspector/",
+            "uncheckedLintImports": [
+                "react",
+                "react-dom",
+                "re-resizable",
+                "glTF"
+            ],
+            "umd": {
+                "packageName": "babylonjs-inspector",
+                "webpackRoot": "INSPECTOR",
+                "processDeclaration": {
+                    "filename": "babylon.inspector.module.d.ts",
+                    "moduleName": "INSPECTOR",
+                    "importsToRemove": [],
+                    "classMap": {
+                        "babylonjs": "BABYLON",
+                        "babylonjs-loaders": "BABYLON",
+                        "babylonjs-serializers": "BABYLON",
+                        "babylonjs-gltf2interface": "BABYLON.GLTF2",
+                        "react": "React",
+                        "babylonjs-gui": "BABYLON.GUI",
+                        "@babylonjs/core": "BABYLON",
+                        "@babylonjs/loaders": "BABYLON",
+                        "@babylonjs/serializers": "BABYLON",
+                        "@babylonjs/gui": "BABYLON.GUI",
+                        "@fortawesome": false,
+                        "react-contextmenu": false
+                    }
+                }
+            },
+            "es6": {
+                "webpackBuild": true,
+                "buildDependencies": [
+                    "node_modules/re-resizable/lib/index.es5.js",
+                    "Tools/**/*"
+                ],
+                "packageName": "@babylonjs/inspector",
+                "readme": "dist/preview release/inspector/readme-es6.md",
+                "packagesFiles": [
+                    "babylon.inspector.bundle.max.js",
+                    "babylon.inspector.bundle.max.js.map",
+                    "babylon.inspector.module.d.ts",
+                    "readme.md"
+                ],
+                "typings": "babylon.inspector.module.d.ts",
+                "index": "babylon.inspector.bundle.max.js"
+            }
+        }
+    },
+    "viewer": {
+        "libraries": [
+            {
+                "output": "babylon.viewer.js",
+                "moduleDeclaration": {
+                    "name": "BabylonViewer",
+                    "module": "babylonjs-viewer"
+                },
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "mainFolder": "./Viewer/",
+            "webpack": "../../../Viewer/webpack.gulp.config.js",
+            "distOutputDirectory": "/viewer/",
+            "dtsBundle": {
+                "name": "babylonjs-viewer",
+                "main": "../../dist/preview release/viewer/build/src/index.d.ts",
+                "out": "../../babylon.viewer.module.d.ts"
+            },
+            "umd": {
+                "packageName": "babylonjs-viewer",
+                "processDeclaration": {
+                    "moduleName": "BabylonViewer",
+                    "doNotAppendNamespace": true,
+                    "prependText": "/// <reference path=\"./babylon.module.d.ts\"/>\n/// <reference path=\"./babylon.glTF2Interface.d.ts\"/>\n/// <reference path=\"./babylonjs.loaders.module.d.ts\"/>\n",
+                    "importsToRemove": [
+                        "pep",
+                        "babylonjs-loaders"
+                    ],
+                    "classMap": {
+                        "babylonjs": "BABYLON",
+                        "babylonjs-loaders": "BABYLON"
+                    },
+                    "replacements": [
+                        {
+                            "from": "import(\"./configuration\")",
+                            "to": "import(\"babylonjs-viewer/configuration/configuration\")"
+                        },
+                        {
+                            "from": "import(\"./viewer\")",
+                            "to": "import(\"babylonjs-viewer/viewer/viewer\")"
+                        }
+                    ]
+                },
+                "requiredFiles": [
+                    "dist/preview release/viewer/readme.md",
+                    "dist/preview release/viewer/package.json",
+                    "dist/preview release/viewer/babylon.viewer.js",
+                    "dist/preview release/viewer/babylon.viewer.max.js"
+                ]
+            },
+            "outputs": [
+                {
+                    "destinations": [
+                        {
+                            "filename": "viewer.js",
+                            "outputDirectory": "/../../Viewer/dist/"
+                        },
+                        {
+                            "filename": "babylon.viewer.js",
+                            "outputDirectory": "/viewer/",
+                            "addBabylonDeclaration": [
+                                "babylon.module.d.ts",
+                                "loaders/babylonjs.loaders.module.d.ts",
+                                "glTF2Interface/babylon.glTF2Interface.d.ts"
+                            ]
+                        }
+                    ],
+                    "minified": true
+                },
+                {
+                    "destinations": [
+                        {
+                            "filename": "viewer.max.js",
+                            "outputDirectory": "/../../Viewer/dist/"
+                        },
+                        {
+                            "filename": "babylon.viewer.max.js",
+                            "outputDirectory": "/viewer/"
+                        }
+                    ]
+                }
+            ],
+            "legacyPackageOutputDirectory": "../../../Viewer/build/src/",
+            "es6": {
+                "buildDependencies": [
+                    "node_modules/handlebars/**/*",
+                    "node_modules/@types/**/*"
+                ],
+                "packageName": "@babylonjs/viewer",
+                "readme": "Viewer/README-ES6.md",
+                "skipLibCheck": true,
+                "packageBuildFolder": "src"
+            }
+        }
+    },
+    "viewer-assets": {
+        "libraries": [
+            {
+                "output": "babylon.viewer.assets.js",
+                "moduleDeclaration": {
+                    "name": "BabylonViewerAssets",
+                    "module": "babylonjs-viewer-assets"
+                },
+                "preventLoadLibrary": true
+            }
+        ],
+        "build": {
+            "webpack": "../../../Viewer/webpack.assets.config.js",
+            "distOutputDirectory": "/viewer/",
+            "umd": {
+                "packageName": "babylonjs-viewer-assets",
+                "requiredFiles": [
+                    "Viewer/assets/readme.md",
+                    "Viewer/assets/package.json"
+                ]
+            },
+            "dtsBundle": {
+                "name": "babylonjs-viewer-assets",
+                "main": "../../dist/preview release/viewer/build/src/assets/index.d.ts",
+                "out": "../../../../../../Viewer/build/assets/babylon.viewer.assets.module.d.ts"
+            },
+            "outputs": [
+                {
+                    "destinations": [
+                        {
+                            "filename": "babylon.viewer.assets.js",
+                            "outputDirectory": "/../../Viewer/build/assets/"
+                        }
+                    ],
+                    "minified": true
+                }
+            ],
+            "legacyPackageOutputDirectory": "../../../Viewer/build/assets/"
+        }
+    }
+}

+ 58 - 92
Tools/DevLoader/BabylonLoader.js

@@ -28,6 +28,7 @@ var BABYLONDEVTOOLS;
 
     var Loader = (function() {
         var queue;
+        var esmQueue;
         var callback;
         var dependencies;
         var useDist;
@@ -35,8 +36,12 @@ var BABYLONDEVTOOLS;
         var min;
         var babylonJSPath;
 
+        var localDevES6FolderName;
+        var localDevUMDFolderName;
+
         function Loader() {
             queue = [];
+            esmQueue = [];
             dependencies = [];
             callback = null;
             min = (document.location.href.toLowerCase().indexOf('dist=min') > 0);
@@ -103,7 +108,7 @@ var BABYLONDEVTOOLS;
         }
 
         Loader.prototype.dequeue = function() {
-            if (queue.length == 0) {
+            if (queue.length + esmQueue.length == 0) {
                 console.log('Scripts loaded');
                 BABYLON.Engine.ShadersRepository = "/src/Shaders/";
                 if (callback) {
@@ -112,12 +117,17 @@ var BABYLONDEVTOOLS;
                 return;
             }
 
-            var url = queue.shift();
-
             var head = document.getElementsByTagName('head')[0];
             var script = document.createElement('script');
-            script.type = 'text/javascript';
-            script.src = url;
+
+            if (esmQueue.length) {
+                script.type = 'module';
+                script.src = esmQueue.shift();
+            }
+            else {
+                script.type = 'text/javascript';
+                script.src = queue.shift();
+            }
 
             var self = this;
             script.onload = function() {
@@ -130,9 +140,11 @@ var BABYLONDEVTOOLS;
             queue.push(url);
         }
 
-        Loader.prototype.loadCss = function(url) {
-            var head = document.getElementsByTagName('head')[0];
+        Loader.prototype.loadESMScript = function(url) {
+            esmQueue.push(url);
+        }
 
+        Loader.prototype.loadCss = function(url) {
             var style = document.createElement('link');
             style.href = url;
             style.rel = "stylesheet";
@@ -146,70 +158,51 @@ var BABYLONDEVTOOLS;
             }
         }
 
-        Loader.prototype.loadLibrary = function(library, module) {
+        Loader.prototype.loadLibrary = function(moduleName, library, module) {
             if (library.preventLoadLibrary) {
                 return;
             }
 
+            var distFolder = (module.build.distOutputDirectory !== undefined) ?
+                module.build.distOutputDirectory :
+                "/" + moduleName;
+            distFolder += "/";
+            
             if (!useDist) {
-                if (library.useOutputForDebugging) {
-                    this.loadScript(babylonJSPath + '/.temp' + module.build.distOutputDirectory + library.output);
-                } else {
-                    var i = 0;
-                    for (; i < library.files.length; i++) {
-                        var file = library.files[i];
-                        if (file.indexOf('lib.d.ts') > 0) {
-                            continue;
-                        }
-                        // Manage exclude files.
-                        if (library.excludeFromLoader && library.excludeFromLoader.indexOf(file) > -1) {
-                            continue;
-                        }
-
-                        file = file.replace('.ts', '.js');
-                        file = file.replace('../', '');
-                        file = babylonJSPath + '/' + file;
-                        this.loadScript(file);
-                    }
-
-                    if (library.shaderFiles && library.shaderFiles.length > 0) {
-                        var shaderFile = library.shaderFiles[0];
-                        var endDirectoryIndex = shaderFile.lastIndexOf('/');
-                        shaderFile = shaderFile.substring(0, endDirectoryIndex + 1);
-                        shaderFile += library.output.replace('.js', '.js.fx');
-                        this.loadScript(shaderFile);
-                        if (library.shadersIncludeFiles) {
-                            var includeShaderFile = shaderFile.replace('.js.fx', '.js.include.fx');
-                            this.loadScript(includeShaderFile);
-                        }
-                    }
-                }
+                var tempDirectory = '/.temp/' + localDevUMDFolderName + distFolder;
+                this.loadScript((babylonJSPath + tempDirectory + library.output)
+                    .replace(".min.", ".")
+                    .replace(".max.", "."));
             }
-            else if (min) {
-                if (library.webpack) {
-                    if (module.build.distOutputDirectory)
-                        this.loadScript(babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + library.output);
+            else if (!testMode || !module.build.ignoreInTestMode) {
+                if (min) {
+                    this.loadScript(babylonJSPath + '/dist/preview release' + distFolder + library.output);
                 }
                 else {
-                    this.loadScript(babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + library.output.replace('.js', '.min.js'));
+                    var isMinOutputName = library.output.indexOf(".min.") > -1;
+                    if (isMinOutputName) {
+                        this.loadScript(babylonJSPath + '/dist/preview release' + distFolder + library.output.replace(".min", ""));
+                    }
+                    else {
+                        this.loadScript(babylonJSPath + '/dist/preview release' + distFolder + library.output.replace(".js", ".max.js"));
+                    }
                 }
             }
-            else {
-                if (module.build.distOutputDirectory && (!testMode || !module.build.ignoreInTestMode))
-                    this.loadScript(babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + library.output);
-            }
+        }
 
-            // Currently not being used
-            if (!min && library.sassFiles && library.sassFiles.length > 0) {
-                var cssFile = library.output.replace('.js', '.css');
-                cssFile = babylonJSPath + '/dist/preview release' + module.build.distOutputDirectory + cssFile;
-                this.loadCss(cssFile);
-            }
+        Loader.prototype.loadCoreDev = function() {
+            // Es6 core import
+            this.loadESMScript(babylonJSPath + "/.temp/" + localDevES6FolderName + "/core/Legacy/legacy.js");
         }
 
-        Loader.prototype.loadModule = function(module) {
+        Loader.prototype.loadModule = function(moduleName, module) {
             for (var i = 0; i < module.libraries.length; i++) {
-                this.loadLibrary(module.libraries[i], module);
+                if (!useDist && module.isCore) {
+                    this.loadCoreDev();
+                }
+                else {
+                    this.loadLibrary(moduleName, module.libraries[i], module);
+                }
             }
         }
 
@@ -232,39 +225,9 @@ var BABYLONDEVTOOLS;
         }
 
         Loader.prototype.loadBJSScripts = function(settings) {
-            var loadModules = true;
-
-            // Main bjs files
-            if (!useDist) {
-                var currentConfig = settings.build.currentConfig;
-                var buildConfiguration = settings.buildConfigurations[currentConfig];
-                var filesToLoad = [];
-
-                for (var index = 0; index < buildConfiguration.length; index++) {
-                    var dependencyName = buildConfiguration[index];
-                    var dependency = settings.workloads[dependencyName];
-                    this.processDependency(settings, dependency, filesToLoad);
-                }
-
-                this.loadScripts(filesToLoad);
-
-                if (currentConfig !== "all") {
-                    loadModules = false;
-                }
-            }
-            else if (min) {
-                this.loadScript('/dist/preview release/babylon.js');
-            }
-            else {
-                this.loadScript('/dist/preview release/babylon.max.js');
-            }
-
-            // Modules
-            if (loadModules) {
-
-                for (var i = 0; i < settings.modules.length; i++) {
-                    this.loadModule(settings[settings.modules[i]]);
-                }
+            // Load all the modules from the config.json.
+            for (var i = 0; i < settings.modules.length; i++) {
+                this.loadModule(settings.modules[i], settings[settings.modules[i]]);
             }
         }
 
@@ -273,8 +236,11 @@ var BABYLONDEVTOOLS;
             if (newCallback) {
                 callback = newCallback;
             }
-            getJson('/Tools/Gulp/config.json',
+            getJson('/Tools/Config/config.json',
                 function(data) {
+                    localDevES6FolderName = data.build.localDevES6FolderName;
+                    localDevUMDFolderName = data.build.localDevUMDFolderName;
+
                     self.loadBJSScripts(data);
                     if (dependencies) {
                         self.loadScripts(dependencies);
@@ -294,4 +260,4 @@ var BABYLONDEVTOOLS;
     var loader = new Loader();
     BABYLONDEVTOOLS.Loader = loader;
 
-})(BABYLONDEVTOOLS || (BABYLONDEVTOOLS = {}))
+})(BABYLONDEVTOOLS || (BABYLONDEVTOOLS = {}))

文件差異過大導致無法顯示
+ 0 - 2132
Tools/Gulp/config.json


+ 0 - 58
Tools/Gulp/gulp-addDtsExport.js

@@ -1,58 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-
-module.exports = function (varName, moduleName, subModule, extendsRoot, dependencies) {
-    return through.obj(function (file, enc, cb) {
-
-        let exportText = "BABYLON";
-        if (subModule && !extendsRoot) {
-            exportText += '.' + varName.name;
-        }
-
-        let referenceText = '';
-        if (subModule) {
-            //referenceText = '/// <reference types="babylonjs"/>\n';
-        }
-
-        if (dependencies) {
-            referenceText = '';
-            dependencies.forEach(element => {
-                // was "babylonjs/${element}""
-                referenceText += `/// <reference types="${element}"/>
-`;
-            });
-        }
-
-        var moduleExportsAddition =
-            `${referenceText}
-
-declare module '${moduleName}' { 
-    export = ${exportText}; 
-}
-`;
-
-        //'export = ' + (subModule ? 'BABYLON.' : '') + varName + ';\n';// +
-        //'export as namespace ' + varName + ';\n\n';
-
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            file.contents = Buffer.from(moduleExportsAddition + String(file.contents));
-            this.push(file);
-
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};
-

+ 0 - 89
Tools/Gulp/gulp-addES6Exports.js

@@ -1,89 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-
-/**
- * The parameters for this function has grown during development.
- * Eventually, this function will need to be reorganized. 
- */
-module.exports = function (baseModule, subModule, extendsRoot, externalUsingBabylon) {
-    return through.obj(function (file, enc, cb) {
-
-        var optionalRequire = `var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-var babylonDependency = (globalObject && globalObject.BABYLON) || BABYLON || (typeof require !== 'undefined' && require("babylonjs"));
-var BABYLON = babylonDependency;
-`;
-        let fileContent = file.contents.toString();
-        function moduleExportAddition(varName) {
-
-            let base = subModule ? 'BABYLON' : baseModule;
-
-            let sadGlobalPolution = (!subModule) ? `var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-globalObject["${base}"] = ${base}${(subModule && !extendsRoot) ? '.' + varName : ''};` : '';
-            /*if (extendsRoot) {
-                basicInit = `__extends(root["BABYLON"], factory()); `
-            }*/
-
-            let listOfExports = [];
-            // find the exported members. es6 exports can NOT be generated dynamically.
-            let matcher = new RegExp(base + "\\.(\\w*) = (\\w*);", "g");
-            let match = matcher.exec(fileContent);
-            while (match != null) {
-                if (match[1] && match[2] && match[1] === match[2]) {
-                    listOfExports.push(match[1]);
-                }
-                match = matcher.exec(fileContent);
-            }
-
-            let enumMatcher = new RegExp(`\\(${base}\\.([A-Za-z0-9].*)= {}\\)`, "g");
-            let enumMatch = enumMatcher.exec(fileContent);
-            while (enumMatch != null) {
-                if (enumMatch[1] && listOfExports.indexOf(enumMatch[1]) === -1) {
-                    listOfExports.push(enumMatch[1]);
-                }
-                enumMatch = enumMatcher.exec(fileContent);
-            }
-
-
-            let exportsText = '';
-            listOfExports.forEach(cls => {
-                exportsText += `var ${cls} = ${base}.${cls};`;
-            });
-            exportsText += `
-export { ${listOfExports.join(",")} };`
-
-            return `${sadGlobalPolution}
-${exportsText}
-`;
-        }
-
-        var extendsAddition = `var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])};return function(o,n){function r(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();
-`;
-
-        var decorateAddition = 'var __decorate=this&&this.__decorate||function(e,t,r,c){var o,f=arguments.length,n=f<3?t:null===c?c=Object.getOwnPropertyDescriptor(t,r):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,c);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(n=(f<3?o(n):f>3?o(t,r,n):o(t,r))||n);return f>3&&n&&Object.defineProperty(t,r,n),n};\n';
-
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            if (externalUsingBabylon) {
-                //file.contents = new Buffer(optionalRequire.concat(String(file.contents)));
-                file.contents = Buffer.from(optionalRequire.concat(Buffer.from(String(file.contents).concat(moduleExportAddition(baseModule)))));
-            } else {
-                let pretext = subModule ? optionalRequire : '';
-                file.contents = Buffer.from(pretext.concat(decorateAddition).concat(Buffer.from(extendsAddition.concat(String(file.contents)).concat(moduleExportAddition(baseModule)))));
-            }
-            this.push(file);
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};

+ 0 - 113
Tools/Gulp/gulp-addModuleExports.js

@@ -1,113 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-
-/**
- * The parameters for this function has grown during development.
- * Eventually, this function will need to be reorganized. 
- */
-//  subModule, extendsRoot, externalUsingBabylon, noBabylonInit
-module.exports = function (varName, config) {
-    return through.obj(function (file, enc, cb) {
-        config = config || {};
-        if (typeof varName === 'string') {
-            varName = {
-                name: varName,
-                module: varName
-            }
-            if (varName.name === 'BABYLON') {
-                varName.module = 'babylonjs';
-            }
-        }
-        if (!config.dependencies) {
-            if (config.subModule || config.extendsRoot) {
-                config.dependencies = [
-                    {
-                        name: "BABYLON",
-                        module: "babylonjs",
-                        optional: false
-                    }
-                ]
-            }
-        }
-
-        function moduleExportAddition(varName) {
-
-            let dependenciesDefinition = `var amdDependencies = [];`;
-            let functionVariables = '';
-            let requireText = '';
-            let amdText = '';
-            let afterInitText = '';
-            if (config.dependencies) {
-                config.dependencies.forEach(dep => {
-                    if (functionVariables) functionVariables += ',';
-                    functionVariables += dep.name;
-                    requireText += `        ${dep.optional ? ' try { ' : ''} ${dep.name} = ${dep.name} || require("${dep.module}"); ${dep.optional ? ' } catch(e) {} ' : ''}
-`;
-                    amdText += `        ${dep.optional ? ' if(require.specified && require.specified("' + dep.module + '"))' : ''} amdDependencies.push("${dep.module}");
-`;
-                    dependenciesDefinition += `
-    var ${dep.name} = root.${dep.name} || this.${dep.name};`;
-                    afterInitText += `  ${dep.name} = ${dep.name} || this.${dep.name};
-`
-                });
-
-            }
-
-            let base = config.subModule ? 'BABYLON' : varName.name;
-
-            return `\n\n(function universalModuleDefinition(root, factory) {
-    ${dependenciesDefinition}
-    if(typeof exports === 'object' && typeof module === 'object') {
-${requireText}
-        module.exports = factory(${functionVariables});
-    } else if(typeof define === 'function' && define.amd) {
-${amdText}
-        define("${varName.module}", amdDependencies, factory);
-    } else if(typeof exports === 'object') {
-${requireText}
-        exports["${varName.module}"] = factory(${functionVariables});
-    } else {
-        root["${base}"]${(config.subModule && !config.extendsRoot) ? '["' + varName.name + '"]' : ''} = factory(${functionVariables});
-    }
-})(this, function(${functionVariables}) {
-${afterInitText}
-${String(file.contents)}
-    ${varName.name === 'BABYLON' || varName.name === 'INSPECTOR' ? `
-var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-globalObject["${varName.name}"] = ${varName.name};
-//backwards compatibility
-if(typeof earcut !== 'undefined') {
-    globalObject["Earcut"] = {
-        earcut: earcut
-    };
-}` : ''}
-
-    return ${base}${(config.subModule && !config.extendsRoot) ? '.' + varName.name : ''};
-});
-`;
-        }
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            //if (config.externalUsingBabylon) {
-            file.contents = Buffer.from(String('').concat(moduleExportAddition(varName)));
-            /*} else {
-                let pretext = '';
-                file.contents = new Buffer(decorateAddition.concat(new Buffer(extendsAddition.concat(String('')).concat(moduleExportAddition(varName)))));
-            }*/
-            this.push(file);
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};

+ 0 - 99
Tools/Gulp/gulp-appendSrcToVariable.js

@@ -1,99 +0,0 @@
-var through = require('through2');
-var gutil = require('gulp-util');
-var PluginError = gutil.PluginError;
-var path = require('path');
-var File = gutil.File;
-
-// Consts
-const PLUGIN_NAME = 'gulp-appendSrcToVariable';
-
-var appendSrcToVariable = function appendSrcToVariable(varName, namingCallback, output, moduleType) {
-
-    var content;
-    var firstFile;
-
-    namingCallback = namingCallback || function (filename) { return filename; };
-
-    function bufferContents(file, enc, cb) {
-        // ignore empty files
-        if (file.isNull()) {
-            cb();
-            return;
-        }
-
-        // no stream support, only files.
-        if (file.isStream()) {
-            this.emit('error', new PluginError('gulp-concat', 'Streaming not supported'));
-            cb();
-            return;
-        }
-
-        // construct concat instance
-        if (!content) {
-            content = "";
-        }
-
-        // set first file if not already set
-        if (!firstFile) {
-            if (moduleType === "es6") {
-                content += `
-// import * as BABYLON from 'babylonjs/core/es6';
-`;
-            }
-            firstFile = file;
-        }
-
-
-        var name = namingCallback(file.relative);
-        if (moduleType) {
-            let vars = varName.split(".");
-            // shader support when using modules
-            if (moduleType === "es6") {
-                content += `
-let ${name} = ${JSON.stringify(file.contents.toString())};
-// ${varName}["${name}"] = ${varName}["${name}"] || ${name};
-export { ${name}  };
-`;
-            } else {
-                // commonjs
-                content += `
-if(typeof require !== 'undefined'){
-var BABYLON = require("babylonjs/core");
-let data = ${JSON.stringify(file.contents.toString())};
-${varName}["${name}"] = ${varName}["${name}"] || data;
-module.exports = module.exports || {};
-module.exports["${name}"] = data;
-}
-`;
-            }
-        } else {
-            content += varName + "['" + name + "'] = " + JSON.stringify(file.contents.toString()) + ";\r\n";
-        }
-        cb();
-    }
-
-    function endStream(cb) {
-        if (!firstFile || !content) {
-            cb();
-            return;
-        }
-
-        var pathObject = path.parse(firstFile.path);
-        var joinedPath = path.join(pathObject.dir, output);
-
-        var joinedFile = new File({
-            cwd: firstFile.cwd,
-            base: firstFile.base,
-            path: joinedPath,
-            contents: Buffer.from(content)
-        });
-
-        this.push(joinedFile);
-
-        cb();
-    }
-
-    return through.obj(bufferContents, endStream);
-}
-
-module.exports = appendSrcToVariable;

+ 0 - 133
Tools/Gulp/gulp-babylonModule.js

@@ -1,133 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-var path = require('path');
-
-module.exports = function (moduleName, dependencyTree, generateIndex, perFile, shaders, shaderIncludes) {
-    return through.obj(function (file, enc, cb) {
-
-        let basename = (path.basename(file.path, ".js"));
-
-        //console.log("Compiling module: " + moduleName + "/" + basename.replace("babylon.", ""));
-
-        var extendsAddition =
-            `var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])};return function(o,n){function r(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();
-`;
-
-        var decorateAddition =
-            'var __decorate=this&&this.__decorate||function(e,t,r,c){var o,f=arguments.length,n=f<3?t:null===c?c=Object.getOwnPropertyDescriptor(t,r):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,c);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(n=(f<3?o(n):f>3?o(t,r,n):o(t,r))||n);return f>3&&n&&Object.defineProperty(t,r,n),n};\n';
-
-        let content = file.contents.toString();
-        if (content.indexOf('__extends') === -1 && !dependencyTree.length) {
-            extendsAddition = '';
-        }
-
-        if (content.indexOf('__decorate') === -1) {
-            decorateAddition = '';
-        }
-
-        let dependenciesText = `${extendsAddition}
-${decorateAddition}
-if(typeof require !== 'undefined'){
-    var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-    var BABYLON = globalObject["BABYLON"] || {}; 
-    var EXPORTS = {};
-`;
-        let exportsText = '';
-        if (!generateIndex) {
-            let loadedFiles = [];
-            dependencyTree[basename].forEach(function (d, idx) {
-                if (d.module.indexOf("core") !== -1) return;
-                let name = d.file.split(".").pop();
-
-                if (loadedFiles.indexOf(name) === -1) {
-                    if (d.main)
-                        dependenciesText += `var ${name}Module = require('babylonjs/${d.module[0]}/${name}');
-`;
-                    else
-                        exportsText += `var ${name}Module = require('babylonjs/${d.module[0]}/${name}');
-`;
-                    loadedFiles.push(name);
-                }
-
-                dependenciesText += `BABYLON["${d.name}"] = ${name}Module["${d.name}"];
-`;
-                //dependenciesText += `if(BABYLON !== BABYLON${idx}) __extends(BABYLON, BABYLON${idx});
-            });
-            perFile[basename].declarations.forEach(dec => {
-                exportsText += `EXPORTS['${dec}'] = BABYLON["${dec}"];
-`;
-            });
-            if (shaders) {
-                dependenciesText += `require("babylonjs/${moduleName}/shaders");
-`;
-            }
-            if (shaderIncludes) {
-                dependenciesText += `require("babylonjs/${moduleName}/shaderIncludes");
-`;
-            }
-        } else {
-            content = '';
-            let basenames = Object.keys(perFile).filter(basefilename => {
-                return perFile[basefilename].module.indexOf(moduleName) !== -1;
-            });
-
-            basenames.forEach(bname => {
-                let name = bname.split(".").pop();
-                dependenciesText += `var ${name} = require("babylonjs/${moduleName}/${name}");
-`;
-                // now add the internal dependencies to EXPORTS
-                perFile[bname].declarations.forEach(dec => {
-                    dependenciesText += `EXPORTS['${dec}'] = BABYLON["${dec}"] = ${name}["${dec}"];
-`;
-                });
-            })
-        }
-
-        exportsText += `(function() {
-    globalObject["BABYLON"] = globalObject["BABYLON"] || BABYLON;
-    module.exports = EXPORTS;
-    })();
-}`;
-
-
-
-        /*let exportRegex = /BABYLON.([0-9A-Za-z-_]*) = .*;\n/g
-
-        var match = exportRegex.exec(content);
-
-        let exportsArray = [];
-        while (match != null) {
-            if (match[1]) {
-                exportsArray.push(match[1])
-            }
-            match = exportRegex.exec(content);
-        }*/
-
-
-        /*if (moduleName === "core") {
-            exportsText = `(function() {
-    globalObject["BABYLON"] = globalObject["BABYLON"] || BABYLON;
-    module.exports = BABYLON; 
-})();
-}`
-        }*/
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            file.contents = Buffer.from(dependenciesText.concat(Buffer.from(String(content).concat(exportsText))));
-            this.push(file);
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-add-babylon-module', err, { fileName: file.path }));
-        }
-        cb();
-    });
-}

+ 0 - 80
Tools/Gulp/gulp-calculateDependencies.js

@@ -1,80 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-var path = require('path');
-
-module.exports = function (moduleName, perFile, declared, depTree) {
-    return through.obj(function (file, enc, cb) {
-        let basename = (path.basename(file.path, ".ts"));
-        depTree[basename] = depTree[basename] || [];
-        // detect dependencies
-        let depReg1 = /[:,][ ]{0,1}([A-Z]\w*)/g;
-        let depReg2 = /<([A-Z]\w*)(\[\]){0,1}>/g;
-        let depReg3 = /[\s(]([A-Z]\w*)\./g;
-        let depReg4 = /[extends|implements] ([A-Z]\w*)/g;
-        let depReg5 = /new ([A-Z]\w*)/g;
-
-        let dependencies = [];
-        fileContent = file.contents.toString().replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm, "");
-        function findWhereDeclared(objectName) {
-            let fileLocator;
-            Object.keys(perFile).some((filename => {
-                filedec = perFile[filename];
-                if (filedec.declarations.indexOf(objectName) !== -1) {
-                    fileLocator = filename;
-                    return true;
-                }
-                return false;
-            }))
-            return fileLocator;
-        }
-
-        //if (basename === "babylon.webVRCamera") {
-        [depReg4, depReg1, depReg5, depReg3, depReg2].forEach((reg, idx) => {
-            var match = reg.exec(fileContent);
-            while (match != null) {
-                if (match[1]) {
-                    let dep = match[1];
-                    if (basename === "babylon.poseEnabledController") {
-                        console.log(dep, idx);
-                    }
-                    //find if it is declared internally
-                    if (perFile[basename].declarations.indexOf(dep) === -1) {
-                        // not internally? maybe it is in core?
-                        //if (declared.core.indexOf(dep) === -1) {
-                        // seems like a legit dependency! was it already added?
-                        if (perFile[basename].dependencies.indexOf(dep) === -1) {
-                            //no! add it.
-                            let whereDeclared = (findWhereDeclared(dep));
-                            if (whereDeclared) {
-                                perFile[basename].dependencies.push(dep);
-                                if (basename === "babylon.poseEnabledController") {
-                                    console.log("adding ", dep, idx === 2);
-                                }
-                                depTree[basename].push({
-                                    name: dep,
-                                    file: whereDeclared,
-                                    module: perFile[whereDeclared].module,
-                                    main: idx === 0, // is it a main import
-                                    newDec: idx === 2 // is it "new"
-                                });
-                            }
-                        }
-                        //}
-                    }
-                }
-                match = reg.exec(fileContent);
-            }
-        });
-        //}
-
-
-        try {
-            this.push(file);
-
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-calculateDependencies', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};
-

+ 0 - 37
Tools/Gulp/gulp-decorateAndExtends.js

@@ -1,37 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-
-/**
- * The parameters for this function has grown during development.
- * Eventually, this function will need to be reorganized. 
- */
-//  subModule, extendsRoot, externalUsingBabylon, noBabylonInit
-module.exports = function (varName, config) {
-    return through.obj(function (file, enc, cb) {
-
-        var extendsAddition =
-            `var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])};return function(o,n){function r(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();
-`;
-
-        var decorateAddition = `var __decorate=this&&this.__decorate||function(e,t,r,c){var o,f=arguments.length,n=f<3?t:null===c?c=Object.getOwnPropertyDescriptor(t,r):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,c);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(n=(f<3?o(n):f>3?o(t,r,n):o(t,r))||n);return f>3&&n&&Object.defineProperty(t,r,n),n};
-`;
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            file.contents = Buffer.from(decorateAddition.concat(extendsAddition).concat(file.contents));
-            this.push(file);
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-decorate-and-extends', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};

+ 0 - 96
Tools/Gulp/gulp-dtsModuleSupport.js

@@ -1,96 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-var path = require('path');
-
-// inject - if set to true, it will add all declarations as imports.
-module.exports = function (moduleName, inject, declarations, perFile, dependencyTree) {
-    return through.obj(function (file, enc, cb) {
-        let basename = (path.basename(file.path, ".d.ts"));
-        let fileContent = file.contents.toString();
-        let importsString = '';
-
-        if (!inject) {
-            perFile[basename] = perFile[basename] || {
-                module: [moduleName],
-                dependencies: [],
-                declarations: []
-            };
-            if (perFile[basename].module.indexOf(moduleName) === -1) {
-                perFile[basename].module.push(moduleName);
-            }
-            declarations[moduleName] = declarations[moduleName] || [];
-            let regexp = /    (abstract class|function|class|interface|type|const|enum|var) ([\w]*)/g;
-
-            var match = regexp.exec(fileContent);
-            while (match != null) {
-                if (match[2]) {
-                    // check it is not SIMD:
-                    let simdMatch = /    interface (\w*\dx\d{1,2}\w*)/.exec(match[0]);
-                    if (!simdMatch && match[2] !== 'earcut' && match[2] !== 'deviation' && match[2] !== 'flatten') {
-                        declarations[moduleName].push(match[2]);
-                        perFile[basename].declarations.push(match[2]);
-                    }
-                }
-                match = regexp.exec(fileContent);
-            }
-        } else {
-            /*let declared = [];
-            Object.keys(declarations).forEach(name => {
-                if (name === moduleName) return;
-                let imports = declarations[name].filter(obj => {
-                    let exists = declared.indexOf(obj) !== -1;
-                    if (!exists) {
-                        declared.push(obj);
-                    }
-                    return !exists;
-                });
-                if (imports.length)
-                    importsString += `import {${imports.join(',')}} from 'babylonjs/${name}';
-`;
-            });*/
-
-            // find all of the related files for the dependency tree integration
-            let basenames = Object.keys(perFile).filter(basefilename => {
-                return perFile[basefilename].module.indexOf(moduleName) !== -1;
-            });
-
-            let classesForImports = {} // key : module name, content - array of objects
-            basenames.forEach(bname => {
-                dependencyTree[bname].forEach(dep => {
-                    if (dep.module.indexOf(moduleName) !== -1) return;
-                    let depModule = dep.module.indexOf("core") === -1 ? dep.module[0] : "core";
-                    classesForImports[depModule] = classesForImports[depModule] || [];
-                    if (classesForImports[depModule].indexOf(dep.name) === -1) {
-                        //babylon.imageProcessingPostProcess
-                        classesForImports[depModule].push(dep.name);
-                    }
-                });
-            });
-
-            Object.keys(classesForImports).forEach(modName => {
-                importsString += `import {${classesForImports[modName].join(',')}} from 'babylonjs/${modName}';
-`;
-            });
-        }
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            file.contents = Buffer.from(String(file.contents) + '\n' + importsString);
-            this.push(file);
-
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
-        }
-        cb();
-    });
-};
-

+ 0 - 214
Tools/Gulp/gulp-es6ModuleExports.js

@@ -1,214 +0,0 @@
-var gutil = require('gulp-util');
-var through = require('through2');
-var path = require('path');
-
-module.exports = function (moduleName, dependencyTree, generateIndex, perFile, shaders, shaderIncludes) {
-    return through.obj(function (file, enc, cb) {
-
-        let basename = (path.basename(file.path, ".js"));
-
-        //console.log("Compiling es6 module: " + moduleName + "/" + basename.replace("babylon.", ""));
-
-        var extendsAddition =
-            `var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])};return function(o,n){function r(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();
-`;
-
-        var decorateAddition =
-            'var __decorate=this&&this.__decorate||function(e,t,r,c){var o,f=arguments.length,n=f<3?t:null===c?c=Object.getOwnPropertyDescriptor(t,r):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,c);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(n=(f<3?o(n):f>3?o(t,r,n):o(t,r))||n);return f>3&&n&&Object.defineProperty(t,r,n),n};\n';
-
-        let content = file.contents.toString();
-        if (content.indexOf('__extends') === -1 && !dependencyTree.length) {
-            extendsAddition = '';
-        }
-
-        if (content.indexOf('__decorate') === -1) {
-            decorateAddition = '';
-        }
-
-        let dependenciesText = `${extendsAddition}
-${decorateAddition}
-`;
-        //if (moduleName !== 'core') {
-        dependenciesText += `var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-            var BABYLON = globalObject["BABYLON"] || {};
-`;
-        /*} else {
-            dependenciesText += `var BABYLON;
-`;
-        }*/
-
-        let exportsText = '';
-        if (!generateIndex) {
-
-            // process parenting!
-            let parentRegex = /__extends\(([A-Z]\w*), _super\)/g;
-            var match = parentRegex.exec(content);
-            while (match != null) {
-                let extendingClass = match[1];
-                // find the first row
-                let extendedMatcher = new RegExp("}\\([BABYLON\\.]*([A-Z]\\w*)\\)\\);\\n\\s*BABYLON." + extendingClass + " = " + extendingClass + ";");
-
-                let extendedArray = extendedMatcher.exec(content);
-                if (extendedArray) {
-                    let firstRowReg = new RegExp("var " + extendingClass + " = .* \\(function");
-                    content = content.replace(firstRowReg, "var " + extendingClass + " = function");
-
-                    extended = extendedArray[1];
-                    content = content.replace(extendedMatcher, `};
-    var CLS${extendingClass};
-    BABYLON.__${extendingClass} = function() {
-        CLS${extendingClass} = CLS${extendingClass} || ${extendingClass}.call(null, BABYLON.__${extended} && BABYLON.__${extended}() || BABYLON.${extended});
-    }
-    Object.defineProperty(BABYLON, "${extendingClass}", {
-        get: function () {
-            BABYLON.__${extendingClass}();
-            return CLS${extendingClass};
-        },
-        enumerable: true,
-        configurable: true
-    });`);
-                    console.log(extendingClass, extended);
-                } else {
-                    console.log(extendingClass + " is not exported");
-                }
-
-                match = parentRegex.exec(content);
-            }
-
-            let loadedFiles = [];
-            dependencyTree[basename].forEach(function (d, idx) {
-                //if (d.module.indexOf("core") !== -1) return;
-                let name = d.file.split(".").pop();
-
-                if (loadedFiles.indexOf(name) === -1/* && !d.newDec*/) {
-                    let regexp = new RegExp("BABYLON." + d.name);
-                    let match = regexp.exec(content);
-                    if (!match) return;
-                    if (d.main)
-                        dependenciesText += `import {${d.name}} from 'babylonjs/${d.module[0]}/es6/${name}';
-`;
-                    else
-                        exportsText += `import {${d.name}} from 'babylonjs/${d.module[0]}/es6/${name}';
-`;
-                    loadedFiles.push(name);
-                }
-                //dependenciesText += `if(BABYLON !== BABYLON${idx}) __extends(BABYLON, BABYLON${idx});
-            });
-            let exported = [];
-            perFile[basename].declarations.forEach(dec => {
-                if (exported.indexOf(dec) !== -1) return;
-                exported.push(dec);
-                exportsText += `var ${dec} = BABYLON.${dec}; export {${dec}};
-`;
-            });
-            if (shaders) {
-                dependenciesText += `import * as Shaders from "babylonjs/${moduleName}/es6/shaders";
-if(BABYLON.Effect) Object.keys(Shaders).forEach(function(shaderName) {BABYLON.Effect.ShadersStore[shaderName] = Shaders[shaderName]})
-`;
-            }
-            if (shaderIncludes) {
-                dependenciesText += `import * as ShaderIncludes from "babylonjs/${moduleName}/es6/shaderIncludes";
-if(BABYLON.Effect) Object.keys(ShaderIncludes).forEach(function(shaderName) {BABYLON.Effect.IncludesShadersStore[shaderName] = ShaderIncludes[shaderName]})
-`;
-            }
-
-            //if (moduleName === "core") {
-            exportsText += `(function() {
-    //var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-    globalObject["BABYLON"] = globalObject["BABYLON"] || BABYLON;
-})();
-`;
-            //}
-        } else {
-            content = '';
-            let basenames = Object.keys(perFile).filter(basefilename => {
-                return perFile[basefilename].module.indexOf(moduleName) !== -1;
-            });
-
-            basenames.forEach(bname => {
-                let name = bname.split(".").pop();
-                dependenciesText += `export * from "babylonjs/${moduleName}/es6/${name}";
-`;
-            })
-        }
-
-
-
-        /*exportsText += `(function() {
-    globalObject["BABYLON"] = globalObject["BABYLON"] || BABYLON;
-    })();
-`;*/
-
-        /*if (dependencies) {
-            dependencies.forEach(function (d, idx) {
-                if (d === 'core') return;
-                dependenciesText += `import * as ${d} from 'babylonjs/${d}/es6';
-`;
-                //if (idx > 0) {
-                dependenciesText += `__extends(BABYLON, ${d});
-`;
-                //}
-            });
-        }
- 
- 
- 
-        let exportRegex = /BABYLON.([0-9A-Za-z-_]*) = .*;\n/g
- 
-        var match = exportRegex.exec(content);
- 
-        let exportsArray = [];
-        while (match != null) {
-            if (match[1]) {
-                exportsArray.push(match[1])
-            }
-            match = exportRegex.exec(content);
-        }
- 
-        let exportsText = '';
-        if (moduleName === "core") {
-            exportsText = `(function() {
-    var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-    globalObject["BABYLON"] = BABYLON;
-})();
-`
-        }
- 
-        let exportedItems = '';
-        exportsArray.forEach((e, idx) => {
-            if (e.indexOf('.') === -1) {
-                exportedItems += `${idx ? ',' : ''}${e}`
-                exportsText += `var ${e} = BABYLON.${e};
-`
-            }
-        });
- 
-        exportsText += `
-export { ${exportedItems} };`*/
-
-        /*if (moduleName === "core") {
-            exportsText = `(function() {
-var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
-globalObject["BABYLON"] = BABYLON;
-})();
-`*/
-
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-
-        if (file.isStream()) {
-            //streams not supported, no need for now.
-            return;
-        }
-
-        try {
-            file.contents = Buffer.from(dependenciesText.concat(Buffer.from(String(content).concat(exportsText))));
-            this.push(file);
-        } catch (err) {
-            this.emit('error', new gutil.PluginError('gulp-es6-module-exports', err, { fileName: file.path }));
-        }
-        cb();
-    });
-}

+ 0 - 97
Tools/Gulp/gulp-removeShaderComments.js

@@ -1,97 +0,0 @@
-'use strict';
-
-var through = require('through2');
-var PluginError = require('gulp-util').PluginError;
-var singleComment = 1;
-var multiComment = 2;
-
-function uncomment(str, opts) {
-    opts = opts || {};
-
-    var currentChar;
-    var nextChar;
-    var insideString = false;
-    var insideComment = 0;
-    var offset = 0;
-    var ret = '';
-
-    str = str.replace(/\r\n/g, '\n');
-    str = str.replace(/[ \f\t\v]+/g, ' ');
-    str = str.replace(/^\s*\n/gm, '');
-    str = str.replace(/ \+ /g, '+');
-    str = str.replace(/ \- /g, '-');
-    str = str.replace(/ \/ /g, '/');
-    str = str.replace(/ \* /g, '*');
-    str = str.replace(/ > /g, '>');
-    str = str.replace(/ < /g, '<');
-    str = str.replace(/ >= /g, '>=');
-    str = str.replace(/ <= /g, '<=');
-    str = str.replace(/ \+= /g, '+=');
-    str = str.replace(/ \-= /g, '-=');
-    str = str.replace(/ \/= /g, '/=');
-    str = str.replace(/ \*= /g, '*=');
-    str = str.replace(/ = /g, '=');
-    str = str.replace(/, /g, ',');
-    str = str.replace(/\n\n/g, '\n');
-    str = str.replace(/\n /g, '\n');
-
-    for (var i = 0; i < str.length; i++) {
-        currentChar = str[i];
-        nextChar = str[i + 1];
-
-        if (!insideComment && currentChar === '"') {
-            var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
-            if (!escaped) {
-                insideString = !insideString;
-            }
-        }
-
-        if (insideString) {
-            continue;
-        }
-
-        if (!insideComment && currentChar + nextChar === '//') {
-            ret += str.slice(offset, i);
-            offset = i;
-            insideComment = singleComment;
-            i++;
-        } else if (insideComment === singleComment && currentChar === '\n') {
-            insideComment = 0;
-            offset = i;
-        } else if (!insideComment && currentChar + nextChar === '/*') {
-            ret += str.slice(offset, i);
-            offset = i;
-            insideComment = multiComment;
-            i++;
-            continue;
-        } else if (insideComment === multiComment && currentChar + nextChar === '*/') {
-            i++;
-            insideComment = 0;
-            offset = i + 1;
-            continue;
-        }
-    }
-
-    return ret + (insideComment ? '' : str.substr(offset));
-}
-
-function gulpUncomment(options) {
-    return main(options, uncomment);
-}
-
-function main(options, func) {
-    return through.obj(function (file, enc, cb) {
-        if (file.isNull()) {
-            cb(null, file);
-            return;
-        }
-        if (file.isStream()) {
-            cb(new PluginError("Remove Shader Comments", "Streaming not supported."));
-        }
-        file.contents = Buffer.from(func(file.contents.toString(), options));
-        this.push(file);
-        return cb();
-    });
-}
-
-module.exports = gulpUncomment;

+ 0 - 747
Tools/Gulp/gulp-validateTypedoc.js

@@ -1,747 +0,0 @@
-'use strict';
-
-var fs = require('fs');
-var Vinyl = require('vinyl');
-var path = require('path');
-var through = require('through2');
-var PluginError = require('plugin-error');
-var supportsColor = require('color-support');
-
-// ______________________________________________ LOGS ______________________________________________
-
-var hasColors = supportsColor();
-
-var red = hasColors ? '\x1b[31m' : '';
-var yellow = hasColors ? '\x1b[33m' : '';
-var green = hasColors ? '\x1b[32m' : '';
-var gray = hasColors ? '\x1b[90m' : '';
-var white = hasColors ? '\x1b[97m' : '';
-var clear = hasColors ? '\x1b[0m' : '';
-
-var currentColor = undefined;
-
-function getTimestamp() {
-    var time = new Date();
-    var timeInString = ("0" + time.getHours()).slice(-2) + ":" +
-        ("0" + time.getMinutes()).slice(-2) + ":" +
-        ("0" + time.getSeconds()).slice(-2);
-
-    if (currentColor) {
-        return white + '[' + currentColor + timeInString + clear + white + ']';
-    }
-    else {
-        return white + '[' + gray + timeInString + white + ']';
-    }
-}
-
-function log() {
-    currentColor = gray;
-    var time = getTimestamp();
-    process.stdout.write(time + ' ');
-    currentColor = undefined;
-
-    console.log.apply(console, arguments);
-    return this;
-}
-
-function warn() {
-    currentColor = yellow;
-    var time = getTimestamp();
-    process.stdout.write(time + ' ');
-    currentColor = undefined;
-
-    console.warn.apply(console, arguments);
-    return this;
-}
-
-function err() {
-    currentColor = red;
-    var time = getTimestamp();
-    process.stderr.write(time + ' ');
-    currentColor = undefined;
-
-    console.error.apply(console, arguments);
-    return this;
-}
-
-function success() {
-    currentColor = green;
-    var time = getTimestamp();
-    process.stdout.write(time + ' ');
-    currentColor = undefined;
-
-    console.log.apply(console, arguments);
-    return this;
-}
-
-// ______________________________________________ VALIDATION ____________________________________________
-
-function unixStylePath(filePath) {
-    return filePath.replace(/\\/g, '/');
-}
-
-function Validate(validationBaselineFileName, namespaceName, validateNamingConvention, generateBaseLine) {
-    this.validationBaselineFileName = validationBaselineFileName;
-    this.namespaceName = namespaceName;
-    this.validateNamingConvention = validateNamingConvention;
-    this.generateBaseLine = generateBaseLine;
-
-    this.previousResults = {};
-    this.results = {
-        errors: 0
-    };
-}
-
-Validate.hasTag = function (node, tagName) {
-    tagName = tagName.trim().toLowerCase();
-
-    if (node.comment && node.comment.tags) {
-        for (var i = 0; i < node.comment.tags.length; i++) {
-            if (node.comment.tags[i].tag === tagName) {
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-Validate.position = function (node) {
-    if (!node.sources) {
-        log(node);
-    }
-    return node.sources[0].fileName + ':' + node.sources[0].line;
-}
-
-Validate.upperCase = new RegExp("^[A-Z_]*$");
-Validate.pascalCase = new RegExp("^[A-Z][a-zA-Z0-9_]*$");
-Validate.camelCase = new RegExp("^[a-z][a-zA-Z0-9_]*$");
-Validate.underscoreCamelCase = new RegExp("^_[a-z][a-zA-Z0-9_]*$");
-Validate.underscorePascalCase = new RegExp("^_[A-Z][a-zA-Z0-9_]*$");
-
-Validate.prototype.errorCallback = function (parent, node, nodeKind, category, type, msg, position) {
-    this.results[this.filePath] = this.results[this.filePath] || { errors: 0 };
-    var results = this.results[this.filePath];
-
-    if (node === "toString") {
-        node = "ToString";
-    }
-
-    // Checks against previous results.
-    var previousResults = this.previousResults[this.filePath];
-    if (previousResults) {
-        var previousRootName = parent ? parent : node;
-        var needCheck = true;
-
-        if (Array.isArray(previousRootName)) {
-            while (previousRootName.length > 1) {
-                var previousFirst = previousRootName.shift();
-                previousResults = previousResults[previousFirst];
-                if (!previousResults) {
-                    needCheck = false;
-                    break;
-                }
-            }
-            previousRootName = previousRootName.shift();
-        }
-
-        if (needCheck) {
-            var previousNode = previousResults[previousRootName];
-            if (previousNode) {
-                var previousNodeKind = previousNode[nodeKind];
-                if (previousNodeKind) {
-
-                    if (parent) {
-                        previousNode = previousNodeKind[node];
-                    }
-                    else {
-                        previousNode = previousNodeKind;
-                    }
-
-                    if (previousNode) {
-                        var previousCategory = previousNode[category];
-                        if (previousCategory) {
-                            var previousType = previousCategory[type];
-                            if (previousType) {
-                                // Early exit as it was already in the previous build.
-                                return;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    // Write Error in output JSON.
-    var rootName = parent ? parent : node;
-    var current = results;
-    if (Array.isArray(rootName)) {
-        while (rootName.length > 1) {
-            var first = rootName.shift();
-            current = current[first] = current[first] || {};
-        }
-        rootName = rootName.shift();
-    }
-
-    current = current[rootName] = current[rootName] || {};
-    current = current[nodeKind] = current[nodeKind] || {};
-    if (parent) {
-        current = current[node] = current[node] || {};
-    }
-    current = current[category] = current[category] || {};
-    current = current[type] = true;
-
-    results.errors++;
-
-    if (!this.generateBaseLine) {
-        err(msg, position);
-    }
-}
-
-Validate.prototype.init = function (cb) {
-    var self = this;
-    if (!this.generateBaseLine && fs.existsSync(this.validationBaselineFileName)) {
-        fs.readFile(this.validationBaselineFileName, "utf-8", function (err, data) {
-            self.previousResults = JSON.parse(data);
-            cb();
-        });
-    }
-    else {
-        cb();
-    }
-}
-
-Validate.prototype.add = function (filePath, content) {
-    this.filePath = filePath && unixStylePath(filePath);
-
-    if (!Buffer.isBuffer(content)) {
-        content = Buffer.from(content);
-    }
-
-    var contentString = content.toString();
-    var json = JSON.parse(contentString);
-
-    this.validateTypedoc(json);
-    if (this.results[this.filePath]) {
-        this.results.errors += this.results[this.filePath].errors;
-    }
-}
-
-Validate.prototype.getResults = function () {
-    return this.results;
-}
-
-Validate.prototype.getContents = function () {
-    return Buffer.from(JSON.stringify(this.results));
-}
-
-/**
- * Validate a TypeDoc JSON file
- */
-Validate.prototype.validateTypedoc = function (json) {
-    for (var i = 0; i < json.children.length; i++) {
-        var namespaces = json.children[i].children;
-        this.validateTypedocNamespaces(namespaces);
-    }
-}
-/**
- * Validate namespaces attach to a declaration file from a TypeDoc JSON file
- */
-Validate.prototype.validateTypedocNamespaces = function (namespaces) {
-    var namespace = null;
-
-    // Check for BABYLON namespace
-    for (var child in namespaces) {
-        if (namespaces[child].name === this.namespaceName) {
-            namespace = namespaces[child];
-            break;
-        }
-    }
-
-    // Exit if not BABYLON related.
-    if (!namespace || !namespace.children) {
-        return;
-    }
-
-    // Validate the namespace.
-    this.validateTypedocNamespace(namespace);
-}
-
-/**
- * Validate classes and modules attach to a declaration file from a TypeDoc JSON file
- */
-Validate.prototype.validateTypedocNamespace = function (namespace) {
-    var containerNode;
-    var childNode;
-    var children;
-    var signatures;
-    var signatureNode;
-    var tags;
-    var isPublic;
-
-    for (var a in namespace.children) {
-        containerNode = namespace.children[a];
-
-        // Validate Sub Module
-        if (containerNode.kindString === "Module") {
-            this.validateTypedocNamespace(containerNode);
-            continue;
-        }
-        // else Validate Classes
-
-        // Account for undefined access modifiers.
-        if (!containerNode.flags.isPublic &&
-            !containerNode.flags.isPrivate &&
-            !containerNode.flags.isProtected) {
-            containerNode.flags.isPublic = true;
-        }
-        isPublic = containerNode.flags.isPublic;
-
-        // Validate naming.
-        this.validateNaming(null, containerNode);
-
-        // Validate Comments.
-        if (isPublic && !this.validateComment(containerNode)) {
-            this.errorCallback(null,
-                containerNode.name,
-                containerNode.kindString,
-                "Comments",
-                "MissingText",
-                "Missing text for " + containerNode.kindString + " : " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(containerNode));
-        }
-
-        children = containerNode.children;
-
-        //Validate Properties
-        if (children) {
-            for (var b in children) {
-                childNode = children[b];
-
-                // Account for undefined access modifiers.
-                if (!childNode.flags.isPublic &&
-                    !childNode.flags.isPrivate &&
-                    !childNode.flags.isProtected) {
-                    childNode.flags.isPublic = true;
-                }
-                isPublic = childNode.flags.isPublic;
-
-                // Validate Naming.
-                this.validateNaming(containerNode, childNode);
-
-                if (isPublic) {
-                    tags = this.validateTags(childNode);
-                    if (tags) {
-                        this.errorCallback(containerNode.name,
-                            childNode.name,
-                            childNode.kindString,
-                            "Tags",
-                            tags,
-                            "Unrecognized tag " + tags + " at " + childNode.name + " (id: " + childNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                    }
-                }
-
-                if (!this.validateComment(childNode)) {
-                    //Validate Signatures
-                    signatures = childNode.signatures;
-                    if (signatures) {
-                        for (var c in signatures) {
-                            signatureNode = signatures[c];
-
-                            if (isPublic) {
-                                if (!this.validateComment(signatureNode)) {
-                                    this.errorCallback(containerNode.name,
-                                        signatureNode.name,
-                                        childNode.kindString,
-                                        "Comments",
-                                        "MissingText",
-                                        "Missing text for " + childNode.kindString + " : " + signatureNode.name + " (id: " + signatureNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                                }
-
-                                tags = this.validateTags(signatureNode);
-                                if (tags) {
-                                    this.errorCallback(containerNode.name,
-                                        signatureNode.name,
-                                        childNode.kindString,
-                                        "Tags",
-                                        tags,
-                                        "Unrecognized tag " + tags + " at " + signatureNode.name + " (id: " + signatureNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                                }
-
-                                if (signatureNode.type.name !== "void" && signatureNode.comment && !signatureNode.comment.returns) {
-                                    this.errorCallback(containerNode.name,
-                                        signatureNode.name,
-                                        childNode.kindString,
-                                        "Comments",
-                                        "MissingReturn",
-                                        "No Return Comment at " + signatureNode.name + " (id: " + signatureNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                                }
-
-                                if (signatureNode.type.name === "void" && signatureNode.comment && signatureNode.comment.returns) {
-                                    this.errorCallback(containerNode.name,
-                                        signatureNode.name,
-                                        childNode.kindString,
-                                        "Comments",
-                                        "UselessReturn",
-                                        "No Return Comment Needed at " + signatureNode.name + " (id: " + signatureNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                                }
-                            }
-
-                            this.validateParameters(containerNode, childNode, signatureNode, signatureNode.parameters, isPublic);
-                        }
-                    } else {
-                        this.errorCallback(containerNode.name,
-                            childNode.name,
-                            childNode.kindString,
-                            "Comments",
-                            "MissingText",
-                            "Missing text for " + childNode.kindString + " : " + childNode.name + " (id: " + childNode.id + ") in " + containerNode.name + " (id: " + containerNode.id + ")", Validate.position(childNode));
-                    }
-                }
-
-                // this.validateParameters(containerNode, childNode, childNode.parameters, isPublic);
-            }
-        }
-    }
-}
-
-/**
- * Validate that tags are recognized
- */
-Validate.prototype.validateTags = function (node) {
-    var tags;
-    var errorTags = [];
-
-    if (node.comment) {
-
-        tags = node.comment.tags;
-        if (tags) {
-            for (var i = 0; i < tags.length; i++) {
-                var tag = tags[i];
-                var validTags = ["constructor", "throw", "type", "deprecated", "example", "examples", "remark", "see", "remarks", "ignorenaming"]
-                if (validTags.indexOf(tag.tag) === -1) {
-                    errorTags.push(tag.tag);
-                }
-            }
-        }
-
-    }
-
-    return errorTags.join(",");
-}
-
-/**
- * Validate that a JSON node has the correct TypeDoc comments
- */
-Validate.prototype.validateComment = function (node) {
-
-    // Return-only methods are allowed to just have a @return tag
-    if ((node.kindString === "Call signature" || node.kindString === "Accessor") && !node.parameters && node.comment && node.comment.returns) {
-        return true;
-    }
-
-    // Return true for private properties (dont validate)
-    if ((node.kindString === "Property" || node.kindString === "Object literal") && (node.flags.isPrivate || node.flags.isProtected)) {
-        return true;
-    }
-
-    // Return true for inherited properties
-    if (node.inheritedFrom) {
-        return true;
-    }
-
-    // Return true for overwrited properties
-    if (node.overwrites) {
-        return true;
-    }
-
-    // Check comments.
-    if (node.comment) {
-        if (node.comment.text || node.comment.shortText) {
-            return true;
-        }
-
-        return false;
-    }
-
-    // Return true for inherited properties (need to check signatures)
-    if (node.kindString === "Function") {
-        return true;
-    }
-
-    return false;
-}
-
-/**
- * Validate comments for paramters on a node
- */
-Validate.prototype.validateParameters = function (containerNode, method, signature, parameters, isPublic) {
-    var parametersNode;
-    for (var parameter in parameters) {
-        parametersNode = parameters[parameter];
-
-        if (isPublic && !this.validateComment(parametersNode)) {
-            // throw containerNode.name + " " + method.kindString + " " + method.name + " " + parametersNode.name + " " + parametersNode.kindString;
-            this.errorCallback([containerNode.name, method.kindString, signature.name],
-                parametersNode.name,
-                parametersNode.kindString,
-                "Comments",
-                "MissingText",
-                "Missing text for parameter " + parametersNode.name + " (id: " + parametersNode.id + ") of " + method.name + " (id: " + method.id + ")", Validate.position(method));
-        }
-
-        if (this.validateNamingConvention && !Validate.camelCase.test(parametersNode.name)) {
-            this.errorCallback([containerNode.name, method.kindString, signature.name],
-                parametersNode.name,
-                parametersNode.kindString,
-                "Naming",
-                "NotCamelCase",
-                "Parameter " + parametersNode.name + " should be Camel Case (id: " + method.id + ")", Validate.position(method));
-        }
-    }
-}
-
-/**
- * Validate naming conventions of a node
- */
-Validate.prototype.validateNaming = function (parent, node) {
-    if (!this.validateNamingConvention) {
-        return;
-    }
-
-    // Ignore Naming Tag Check
-    if (Validate.hasTag(node, 'ignoreNaming')) {
-        return;
-    } else {
-        if (node.signatures) {
-            for (var index = 0; index < node.signatures.length; index++) {
-                var signature = node.signatures[index];
-                if (Validate.hasTag(signature, 'ignoreNaming')) {
-                    return;
-                }
-            }
-        }
-    }
-
-    if (node.inheritedFrom) {
-        return;
-    }
-
-    // Internals are not subject to the public visibility policy.
-    if (node.name && node.name.length > 0 && node.name[0] === "_") {
-        return;
-    }
-
-    if ((node.flags.isPrivate || node.flags.isProtected) && node.flags.isStatic) {
-        if (!Validate.underscorePascalCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotUnderscorePascalCase",
-                node.name + " should be Underscore Pascal Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.flags.isPrivate || node.flags.isProtected) {
-        if (!Validate.underscoreCamelCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotUnderscoreCamelCase",
-                node.name + " should be Underscore Camel Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.flags.isStatic) {
-        if (!Validate.pascalCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotPascalCase",
-                node.name + " should be Pascal Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.kindString == "Module") {
-        if (!(Validate.upperCase.test(node.name) || Validate.pascalCase.test(node.name))) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotUpperCase",
-                "Module is not Upper Case or Pascal Case " + node.name + " (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.kindString == "Interface" ||
-        node.kindString == "Class" ||
-        node.kindString == "Enumeration" ||
-        node.kindString == "Enumeration member" ||
-        node.kindString == "Accessor" ||
-        node.kindString == "Type alias") {
-        if (!Validate.pascalCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotPascalCase",
-                node.name + " should be Pascal Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.kindString == "Method" ||
-        node.kindString == "Property" ||
-        node.kindString == "Object literal") {
-
-        // Only warn here as special properties such as FOV may be better capitalized 
-        if (!Validate.camelCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotCamelCase",
-                node.name + " should be Camel Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.kindString == "Variable") {
-        this.errorCallback(parent ? parent.name : null,
-            node.name,
-            node.kindString,
-            "Naming",
-            "ShouldNotBeLooseVariable",
-            node.name + " should not be a variable (id: " + node.id + ")", Validate.position(node));
-    }
-    else if (node.kindString === "Function") {
-        if (!Validate.camelCase.test(node.name)) {
-            this.errorCallback(parent ? parent.name : null,
-                node.name,
-                node.kindString,
-                "Naming",
-                "NotCamelCase",
-                node.name + " should be Camel Case (id: " + node.id + ")", Validate.position(node));
-        }
-    }
-    else if (node.kindString == "Constructor") {
-        // Do Nothing Here, this is handled through the class name.
-    }
-    else {
-        this.errorCallback(parent ? parent.name : null,
-            node.name,
-            node.kindString,
-            "Naming",
-            "UnknownNamingConvention",
-            "Unknown naming convention for " + node.kindString + " at " + node.name + " (id: " + node.id + ")", Validate.position(node));
-    }
-}
-
-// ______________________________________________ PLUGIN ____________________________________________
-
-// consts
-const PLUGIN_NAME = 'gulp-validateTypedoc';
-
-// plugin level function (dealing with files)
-function gulpValidateTypedoc(validationBaselineFileName, namespaceName, validateNamingConvention, generateBaseLine) {
-
-    if (!validationBaselineFileName) {
-        throw new PluginError(PLUGIN_NAME, 'Missing validation filename!');
-    }
-    if (typeof validationBaselineFileName !== "string") {
-        throw new PluginError(PLUGIN_NAME, 'Validation filename must be a string!');
-    }
-
-    var validate;
-    var latestFile;
-
-    function bufferContents(file, enc, cb) {
-        // ignore empty files
-        if (file.isNull()) {
-            cb();
-            return;
-        }
-
-        // we don't do streams (yet)
-        if (file.isStream()) {
-            this.emit('error', new Error('gulp-validatTypedoc: Streaming not supported'));
-            cb();
-            return;
-        }
-
-        // set latest file if not already set,
-        // or if the current file was modified more recently.
-        latestFile = file;
-
-        // What will happen once all set.
-        var done = function () {
-            // add file to concat instance
-            validate.add(file.relative, file.contents);
-
-            cb();
-        }
-
-        // Do the validation.
-        if (!validate) {
-            validate = new Validate(validationBaselineFileName, namespaceName, validateNamingConvention, generateBaseLine);
-            validate.init(done);
-        }
-        else {
-            done();
-        }
-    }
-
-    function endStream(cb) {
-        // no files passed in, no file goes out
-        if (!latestFile) {
-            var error = new PluginError(PLUGIN_NAME, 'gulp-validatTypedoc: No Baseline found.');
-            this.emit('error', error);
-            cb();
-            return;
-        }
-
-        var results = validate.getResults();
-        var buffer = Buffer.from(JSON.stringify(results, null, 2))
-
-        if (generateBaseLine) {
-            fs.writeFileSync(validationBaselineFileName, buffer || '');
-        }
-
-        var jsFile = new Vinyl({
-            base: null,
-            path: validationBaselineFileName,
-            contents: buffer
-        });
-
-        this.push(jsFile);
-
-        var action = generateBaseLine ? "baseline generation" : "validation";
-        var self = this;
-        var error = function (message) {
-            generateBaseLine ? warn : err;
-            if (generateBaseLine) {
-                warn(message);
-            }
-            else {
-                err(message);
-                var error = new PluginError(PLUGIN_NAME, message);
-                self.emit('error', error);
-            }
-        }
-
-        if (results.errors > 1) {
-            var message = results.errors + " errors have been detected during the " + action + " !";
-            error(message);
-        }
-        else if (results.errors === 1) {
-            var message = "1 error has been detected during the " + action + " !";
-            error(message);
-        }
-        else {
-            var message = "All formatting check passed successfully during the " + action + " !";
-            success(message);
-        }
-
-        cb();
-    }
-
-    return through.obj(bufferContents, endStream);
-};
-
-// exporting the plugin main function
-module.exports = gulpValidateTypedoc;

文件差異過大導致無法顯示
+ 54 - 1481
Tools/Gulp/gulpfile.js


+ 113 - 0
Tools/Gulp/helpers/gulp-addModuleExports.js

@@ -0,0 +1,113 @@
+var through = require('through2');
+var PluginError = require('plugin-error');
+
+/**
+ * The parameters for this function has grown during development.
+ * Eventually, this function will need to be reorganized. 
+ */
+//  subModule, extendsRoot, externalUsingBabylon, noBabylonInit
+module.exports = function (varName, config) {
+    return through.obj(function (file, enc, cb) {
+        config = config || {};
+        if (typeof varName === 'string') {
+            varName = {
+                name: varName,
+                module: varName
+            }
+            if (varName.name === 'BABYLON') {
+                varName.module = 'babylonjs';
+            }
+        }
+        if (!config.dependencies) {
+            if (config.subModule || config.extendsRoot) {
+                config.dependencies = [
+                    {
+                        name: "BABYLON",
+                        module: "babylonjs",
+                        optional: false
+                    }
+                ]
+            }
+        }
+
+        function moduleExportAddition(varName) {
+
+            let dependenciesDefinition = `var amdDependencies = [];`;
+            let functionVariables = '';
+            let requireText = '';
+            let amdText = '';
+            let afterInitText = '';
+            if (config.dependencies) {
+                config.dependencies.forEach(dep => {
+                    if (functionVariables) functionVariables += ',';
+                    functionVariables += dep.name;
+                    requireText += `        ${dep.optional ? ' try { ' : ''} ${dep.name} = ${dep.name} || require("${dep.module}"); ${dep.optional ? ' } catch(e) {} ' : ''}
+`;
+                    amdText += `        ${dep.optional ? ' if(require.specified && require.specified("' + dep.module + '"))' : ''} amdDependencies.push("${dep.module}");
+`;
+                    dependenciesDefinition += `
+    var ${dep.name} = root.${dep.name} || this.${dep.name};`;
+                    afterInitText += `  ${dep.name} = ${dep.name} || this.${dep.name};
+`
+                });
+
+            }
+
+            let base = config.subModule ? 'BABYLON' : varName.name;
+
+            return `\n\n(function universalModuleDefinition(root, factory) {
+    ${dependenciesDefinition}
+    if(typeof exports === 'object' && typeof module === 'object') {
+${requireText}
+        module.exports = factory(${functionVariables});
+    } else if(typeof define === 'function' && define.amd) {
+${amdText}
+        define("${varName.module}", amdDependencies, factory);
+    } else if(typeof exports === 'object') {
+${requireText}
+        exports["${varName.module}"] = factory(${functionVariables});
+    } else {
+        root["${base}"]${(config.subModule && !config.extendsRoot) ? '["' + varName.name + '"]' : ''} = factory(${functionVariables});
+    }
+})(this, function(${functionVariables}) {
+${afterInitText}
+${String(file.contents)}
+    ${varName.name === 'BABYLON' || varName.name === 'INSPECTOR' ? `
+var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
+globalObject["${varName.name}"] = ${varName.name};
+//backwards compatibility
+if(typeof earcut !== 'undefined') {
+    globalObject["Earcut"] = {
+        earcut: earcut
+    };
+}` : ''}
+
+    return ${base}${(config.subModule && !config.extendsRoot) ? '.' + varName.name : ''};
+});
+`;
+        }
+
+        if (file.isNull()) {
+            cb(null, file);
+            return;
+        }
+
+        if (file.isStream()) {
+            //streams not supported, no need for now.
+            return;
+        }
+
+        try {
+            //if (config.externalUsingBabylon) {
+            file.contents = Buffer.from(String('').concat(moduleExportAddition(varName)));
+            /*} else {
+                let pretext = '';
+                file.contents = new Buffer(decorateAddition.concat(new Buffer(extendsAddition.concat(String('')).concat(moduleExportAddition(varName)))));
+            }*/
+            this.push(file);
+        } catch (err) {
+            this.emit('error', new PluginError('gulp-add-module-exports', err, { fileName: file.path }));
+        }
+        cb();
+    });
+};

+ 156 - 0
Tools/Gulp/helpers/gulp-processAmdDeclarationToModule.js

@@ -0,0 +1,156 @@
+// Gulp Tools
+var fs = require("fs");
+
+var processData = function(data, options) {
+    var moduleName = options.moduleName;
+    var entryPoint = options.entryPoint;
+
+    var str = "" + data;
+
+    // Start process by extracting all lines.
+    let lines = str.split('\n');
+
+    // Let's go line by line and check if we have special folder replacements
+    // Replaces declare module '...'; by declare module 'babylonjs/...'; for instance
+    for (let index = 0; index < lines.length; index++) {
+        let line = lines[index];
+
+        // Replace Type Imports
+        var regexTypeImport = /(.*)type ([A-Za-z0-9]*) = import\("(.*)"\)\.(.*);/g;
+        var match = regexTypeImport.exec(line);
+        if (match) {
+            var spaces = match[1]
+            var module = match[3];
+            var type = match[4];
+            line = `${spaces}import { ${type} } from "${module}";`;
+        }
+
+        // Checks if line is about external module
+        var externalModule = false;
+        if (options.externals) {
+            for (let ext in options.externals) {
+                externalModule = line.indexOf(ext) > -1;
+                if (externalModule) {
+                    break;
+                }
+            }
+        }
+        // If not Append Module Name
+        if (!externalModule) {
+            // Declaration
+            line = line.replace(/declare module "/g, `declare module "${moduleName}/`);
+            // From
+            line = line.replace(/ from "/g, ` from "${moduleName}/`);
+            // Module augmentation
+            line = line.replace(/    module "/g, `    module "${moduleName}/`);
+            // Inlined Import
+            line = line.replace(/import\("/g, `import("${moduleName}/`);
+            // Side Effect Import
+            line = line.replace(/import "/g, `import "${moduleName}/`);
+        }
+
+        // Replace Static Readonly declaration for UMD TS Version compat
+        var regexVar = /(.*)readonly (.*) = (.*);/g;
+        match = regexVar.exec(line);
+        if (match) {
+            let spaces = match[1];
+            let name = match[2];
+            let value = match[3];
+            if (value === "true" || value === "false") {
+                line = `${spaces}readonly ${name}: boolean;`;
+            }
+            else if (value.startsWith('"')) {
+                line = `${spaces}readonly ${name}: string;`;    
+            }
+            else {
+                line = `${spaces}readonly ${name}: number;`;
+            }
+        }
+
+        lines[index] = line;
+    }
+
+    // Recreate the file.
+    str = lines.join('\n');
+
+    // !!! Be carefull
+    // Could cause issues if this appears in several import scope
+    // with different aliases.
+    // !!! Be carefull multiline not managed.
+    // Remove unmanaged externals Appears as classMap false in the config.
+    if (options.externals) {
+        for (let ext in options.externals) {
+            // Need to remove the module and dependencies if false.
+            if (options.externals[ext] === false) {
+                // Replace import { foo, bar } from ...
+                const package = ext;
+                var babylonRegex = new RegExp(`import {(.*)} from ['"](${package})[\/'"](.*);`, "g");
+                var match = babylonRegex.exec(str);
+                let classes = new Set();
+                while (match != null) {
+                    if (match[1]) {
+                        match[1].split(",").forEach(element => {
+                            classes.add(element.trim());
+                        });
+                    }
+                    match = babylonRegex.exec(str);
+                }
+                str = str.replace(babylonRegex, '');
+
+                classes.forEach(cls => {
+                    let className = cls;
+                    let alias = cls;
+
+                    // Deal with import { foo as A, bar as B } from ...
+                    if (cls.indexOf(" as ") > -1) {
+                        const tokens = cls.split(" as ");
+                        className = tokens[0];
+                        alias = tokens[1];
+                    }
+
+                    // !!! Be carefull multiline not managed.
+                    const rg = new RegExp(`.*[ <]${alias}[^\\w].*`, "g")
+                    str = str.replace(rg, "");
+                });
+            }
+        }
+
+        // Remove Empty Lines
+        str = str.replace(/^\s*$/gm, "");
+    }
+
+    // Hide Exported Consts if necessary
+    if (options.hiddenConsts) {
+        for (let toHide of options.hiddenConsts) {
+            var constStart = str.indexOf(`export const ${toHide}`);
+            if (constStart > -1) {
+                for (let i = constStart; i < str.length; i++) {
+                    if (str[i] === "}") {
+                        // +1 to enroll the last }
+                        // +2 to enroll the trailing ;
+                        str = str.substr(0, constStart) + str.substr(i + 2);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    // Add Entry point.
+    str += `
+declare module "${moduleName}" {
+    export * from "${moduleName}/${entryPoint.replace(/\.\//g,"").replace(".ts", "")}";
+}`;
+
+    return str;
+}
+
+module.exports = function(fileLocation, options, cb) {
+    options = options || { };
+
+    var data = fs.readFileSync(fileLocation);
+
+    newData = processData(data, options);
+
+    fs.writeFileSync(options.output || fileLocation, newData);
+}

+ 42 - 0
Tools/Gulp/helpers/gulp-processImportsToEs6.js

@@ -0,0 +1,42 @@
+// Dependencies.
+var through = require('through2');
+var PluginError = require('plugin-error');
+let fs = require('fs');
+
+/**
+ * Replace all imports by their corresponding ES6 imports.
+ */
+function processImports(sourceCode, replacements) {
+
+    for (let replacement of replacements) {
+        var regex = new RegExp(`(["'])${replacement.packageName}([/"'])`, "g");
+        sourceCode = sourceCode.replace(regex, `$1${replacement.newPackageName}$2`);
+    }
+
+    return sourceCode;
+}
+
+/**
+ * Replaces all imports by their es6 peers.
+ */
+function main(replacements) {
+    return through.obj(function (file, enc, cb) {
+            if (file.isNull()) {
+                cb(null, file);
+                return;
+            }
+            if (file.isStream()) {
+                cb(new PluginError("Process Shader", "Streaming not supported."));
+            }
+
+            let data = file.contents.toString();
+            data = processImports(data, replacements);
+
+            // Go to disk.
+            fs.writeFileSync(file.path, data);
+
+            return cb();
+        });
+}
+
+module.exports = main;

+ 44 - 0
Tools/Gulp/helpers/gulp-processLooseDeclarationsEs6.js

@@ -0,0 +1,44 @@
+// Dependencies.
+var through = require('through2');
+var PluginError = require('plugin-error');
+let fs = require('fs');
+
+/**
+ * Encapsulates types in declare global { }
+ */
+function processLooseDeclarations(sourceCode) {
+    // To replace if that causes issue (defining start point of the concat
+    // as interface like the first code line of the first mixin)
+    sourceCode = sourceCode.replace(/declare /g, "");
+    sourceCode = sourceCode.replace(/interface /, `declare global {
+interface `);
+    sourceCode += `
+}`;
+
+    return sourceCode;
+}
+
+/**
+ * Prepare loose declarations to be added to the package.
+ */
+function main(replacements) {
+    return through.obj(function (file, enc, cb) {
+        if (file.isNull()) {
+            cb(null, file);
+            return;
+        }
+        if (file.isStream()) {
+            cb(new PluginError("Process Shader", "Streaming not supported."));
+        }
+
+        let data = file.contents.toString();
+        data = processLooseDeclarations(data, replacements);
+
+        file.contents = Buffer.from(data);
+        this.push(file);
+
+        return cb();
+    });
+}
+
+module.exports = main;

+ 0 - 0
Tools/Gulp/helpers/gulp-processModuleDeclarationToNamespace.js


部分文件因文件數量過多而無法顯示