浏览代码

Merge pull request #1543 from sebavan/Development

Development
David Catuhe 8 年之前
父节点
当前提交
7c9f7039d3
共有 100 个文件被更改,包括 2306 次插入9458 次删除
  1. 7 3
      .gitignore
  2. 9 0
      .vscode/launch.json
  3. 8 1
      .vscode/settings.json
  4. 1 1
      .vscode/tasks.json
  5. 6 201
      Playground/index-local.html
  6. 36 27
      Playground/scripts/pbr.js
  7. 169 0
      Tools/DevLoader/BabylonLoader.js
  8. 71 24
      Tools/Gulp/config.json
  9. 3 2
      Tools/Gulp/gulp-appendSrcToVariable.js
  10. 116 109
      Tools/Gulp/gulpfile.js
  11. 3 0
      Tools/Gulp/package.json
  12. 0 1
      dist/materialsLibrary/babylon.gradientMaterial.min.js
  13. 0 1
      dist/materialsLibrary/babylon.lavaMaterial.min.js
  14. 0 1
      dist/materialsLibrary/babylon.normalMaterial.min.js
  15. 1426 1426
      dist/preview release/babylon.d.ts
  16. 15 0
      loaders/glTF/babylon.glTFFileLoader.js
  17. 1 0
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  18. 3 1
      loaders/OBJ/babylon.objFileLoader.js
  19. 1 0
      dist/preview release/loaders/babylon.objFileLoader.min.js
  20. 3 0
      loaders/STL/babylon.stlFileLoader.js
  21. 1 0
      dist/preview release/loaders/babylon.stlFileLoader.min.js
  22. 7 3
      dist/materialsLibrary/babylon.fireMaterial.js
  23. 0 0
      dist/preview release/materialsLibrary/babylon.fireMaterial.min.js
  24. 7 3
      dist/materialsLibrary/babylon.furMaterial.js
  25. 0 0
      dist/preview release/materialsLibrary/babylon.furMaterial.min.js
  26. 8 4
      dist/materialsLibrary/babylon.gradientMaterial.js
  27. 1 0
      dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js
  28. 7 3
      dist/materialsLibrary/babylon.gridMaterial.js
  29. 0 0
      dist/preview release/materialsLibrary/babylon.gridMaterial.min.js
  30. 8 4
      dist/materialsLibrary/babylon.lavaMaterial.js
  31. 1 0
      dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js
  32. 8 4
      dist/materialsLibrary/babylon.normalMaterial.js
  33. 1 0
      dist/preview release/materialsLibrary/babylon.normalMaterial.min.js
  34. 7 3
      dist/materialsLibrary/babylon.simpleMaterial.js
  35. 0 0
      dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js
  36. 7 3
      dist/materialsLibrary/babylon.skyMaterial.js
  37. 0 0
      dist/preview release/materialsLibrary/babylon.skyMaterial.min.js
  38. 7 3
      dist/materialsLibrary/babylon.terrainMaterial.js
  39. 0 0
      dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js
  40. 7 3
      dist/materialsLibrary/babylon.triPlanarMaterial.js
  41. 0 0
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js
  42. 7 3
      dist/materialsLibrary/babylon.waterMaterial.js
  43. 0 0
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  44. 7 3
      dist/postProcessesLibrary/babylon.asciiArtPostProcess.js
  45. 0 0
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  46. 7 3
      dist/postProcessesLibrary/babylon.digitalRainPostProcess.js
  47. 0 0
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  48. 7 3
      dist/proceduralTexturesLibrary/babylon.brickProceduralTexture.js
  49. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.brickProceduralTexture.min.js
  50. 7 3
      dist/proceduralTexturesLibrary/babylon.cloudProceduralTexture.js
  51. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.cloudProceduralTexture.min.js
  52. 7 3
      dist/proceduralTexturesLibrary/babylon.fireProceduralTexture.js
  53. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.fireProceduralTexture.min.js
  54. 7 3
      dist/proceduralTexturesLibrary/babylon.grassProceduralTexture.js
  55. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.grassProceduralTexture.min.js
  56. 7 3
      dist/proceduralTexturesLibrary/babylon.marbleProceduralTexture.js
  57. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.marbleProceduralTexture.min.js
  58. 7 3
      dist/proceduralTexturesLibrary/babylon.roadProceduralTexture.js
  59. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.roadProceduralTexture.min.js
  60. 7 3
      dist/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.js
  61. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.min.js
  62. 7 3
      dist/proceduralTexturesLibrary/babylon.woodProceduralTexture.js
  63. 0 0
      dist/preview release/proceduralTexturesLibrary/babylon.woodProceduralTexture.min.js
  64. 4 2
      serializers/OBJ/babylon.objSerializer.js
  65. 1 0
      dist/preview release/serializers/babylon.objSerializer.min.js
  66. 0 74
      loaders/OBJ/README.md
  67. 0 872
      loaders/OBJ/babylon.objFileLoader.ts
  68. 0 31
      loaders/config.json
  69. 0 41
      loaders/gulpfile.js
  70. 0 14
      loaders/package.json
  71. 6 0
      loaders/readme.md
  72. 3 1
      loaders/STL/babylon.stlFileLoader.ts
  73. 0 0
      loaders/src/glTF/README.md
  74. 3 1
      loaders/glTF/babylon.glTFBinaryExtension.ts
  75. 3 1
      loaders/glTF/babylon.glTFFileLoader.ts
  76. 3 1
      loaders/glTF/babylon.glTFFileLoaderExtension.ts
  77. 3 1
      loaders/glTF/babylon.glTFFileLoaderInterfaces.ts
  78. 3 1
      loaders/glTF/babylon.glTFFileLoaderUtils.ts
  79. 7 0
      loaders/src/tsconfig.json
  80. 1 0
      localDev/.gitignore
  81. 85 0
      localDev/index.html
  82. 34 0
      localDev/template/index.js
  83. 4 14
      materialsLibrary/index.html
  84. 17 20
      materialsLibrary/readme.md
  85. 1 1
      materialsLibrary/src/gradient/babylon.gradientMaterial.ts
  86. 1 1
      materialsLibrary/src/lava/babylon.lavaMaterial.ts
  87. 1 1
      materialsLibrary/src/normal/babylon.normalMaterial.ts
  88. 5 5
      materialsLibrary/src/tsconfig.json
  89. 12 8
      postProcessLibrary/index.html
  90. 41 17
      postProcessLibrary/readme.md
  91. 0 0
      postProcessLibrary/src/tsconfig.json
  92. 20 23
      proceduralTexturesLibrary/index.html
  93. 16 19
      proceduralTexturesLibrary/readme.md
  94. 0 0
      proceduralTexturesLibrary/src/tsconfig.json
  95. 0 17
      serializers/.gitignore
  96. 0 102
      serializers/OBJ/babylon.objSerializer.ts
  97. 0 2
      serializers/OBJ/readme.md
  98. 0 6319
      serializers/babylon.d.ts
  99. 0 5
      serializers/config.json
  100. 0 0
      serializers/gulpfile.js

+ 7 - 3
.gitignore

@@ -16,6 +16,10 @@ TestResults
 
 # javascript files
 src/**/*.js
+loaders/src/**/*.js
+materialsLibrary/src/**/*.js
+proceduralTexturesLibrary/src/**/*.js
+postProcessLibrary/src/**/*.js
 
 # Build results
 [Dd]ebug/
@@ -130,8 +134,8 @@ node_modules
 .idea
 
 # for VSCode
-/.vs
-/Playground/project.lock.json
+.vs
 .tempChromeProfileForDebug
 .temp
-*.js.map
+*.js.map
+*.js.fx

+ 9 - 0
.vscode/launch.json

@@ -36,6 +36,15 @@
             "webRoot": "${workspaceRoot}/",
             "sourceMaps": true,
             "userDataDir": "${workspaceRoot}/.tempChromeProfileForDebug"
+        },
+        {
+            "name": "Launch Local Dev (Chrome)",
+            "type": "chrome",
+            "request": "launch",
+            "url": "http://localhost:1338/localDev/index.html",
+            "webRoot": "${workspaceRoot}/",
+            "sourceMaps": true,
+            "userDataDir": "${workspaceRoot}/.tempChromeProfileForDebug"
         }
     ]
 }

+ 8 - 1
.vscode/settings.json

@@ -10,7 +10,9 @@
         "**/.tempChromeProfileForDebug": true,
         "**/node_modules": true,
         "**/temp": true,
+        "**/.temp": true,
         "**/*.js.map": true,
+        "**/*.js.fx": true,
         "**/*.js": { 
             "when":"$(basename).ts"
         }
@@ -23,6 +25,11 @@
         "**/bower_components": true,
         "**/.vs": true,
         "**/.tempChromeProfileForDebug": true,
-        "**/.temp": true
+        "**/.temp": true,
+        "**/dist": true,
+        "**/*.map": true,
+        "**/*.js": { 
+             "when":"$(basename).ts"
+         }       
     }
 }

+ 1 - 1
.vscode/tasks.json

@@ -19,7 +19,7 @@
             ]
         },
         { 
-            "taskName": "typescript",
+            "taskName": "typescript-all",
             "isBuildCommand": true,
             "problemMatcher": [
                 "$tsc"

+ 6 - 201
Playground/index-local.html

@@ -14,206 +14,8 @@
     <!-- Bootstrap -->
     <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
     <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
-    <!-- Babylon.js -->
-    <script src="../dist/preview release/cannon.js"></script>
-    <script src="../dist/preview release/Oimo.js"></script>
-    <!--<script src="../babylon.js"></script>-->
-    <script src="../src/Math/babylon.math.js"></script>
-    <script src="../src/Tools/babylon.observable.js"></script>
-    <script src="../src/Culling/babylon.ray.js"></script>
-    <script src="../src/States/babylon.alphaCullingState.js"></script>
-    <script src="../src/States/babylon.depthCullingState.js"></script>
-    <script src="../src/States/babylon.stencilState.js"></script>
-    <script src="../src/Tools/babylon.decorators.js"></script>
-    <script src="../src/Tools/babylon.database.js"></script>
-    <script src="../src/Tools/babylon.tools.tga.js"></script>
-    <script src="../src/Tools/babylon.tools.dds.js"></script>
-    <script src="../src/Tools/babylon.smartArray.js"></script>
-    <script src="../src/Tools/babylon.tools.js"></script>
-    <script src="../src/babylon.engine.js"></script>
-    <script src="../src/babylon.node.js"></script>
-    <script src="../src/Mesh/babylon.buffer.js"></script>
-    <script src="../src/Cameras/VR/babylon.vrCameraMetrics.js"></script>
-    <script src="../src/Cameras/babylon.cameraInputsManager.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.mouse.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.touch.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.keyboard.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js"></script>
-    <script src="../src/Cameras/Inputs/babylon.freecamera.input.gamepad.js"></script>
-    <script src="../src/Cameras/babylon.freeCameraInputsManager.js"></script>
-    <script src="../src/Cameras/babylon.arcRotateCameraInputsManager.js"></script>
-    <script src="../src/Tools/babylon.filesInput.js"></script>
-    <script src="../src/Collisions/babylon.pickingInfo.js"></script>
-    <script src="../src/Culling/babylon.boundingSphere.js"></script>
-    <script src="../src/Culling/babylon.boundingBox.js"></script>
-    <script src="../src/Culling/babylon.boundingInfo.js"></script>
-    <script src="../src/Mesh/babylon.abstractMesh.js"></script>
-    <script src="../src/Lights/babylon.light.js"></script>
-    <script src="../src/Lights/babylon.pointLight.js"></script>
-    <script src="../src/Lights/babylon.spotLight.js"></script>
-    <script src="../src/Lights/babylon.hemisphericLight.js"></script>
-    <script src="../src/Lights/babylon.directionalLight.js"></script>
-    <script src="../src/Lights/Shadows/babylon.shadowGenerator.js"></script>
-    <script src="../src/Collisions/babylon.collider.js"></script>
-    <script src="../src/Collisions/babylon.collisionCoordinator.js"></script>
-    <script src="../src/Collisions/babylon.collisionWorker.js"></script>
-    <script src="../src/Cameras/babylon.camera.js"></script>
-    <script src="../src/Cameras/babylon.targetCamera.js"></script>
-    <script src="../src/Cameras/babylon.followCamera.js"></script>
-    <script src="../src/Cameras/babylon.freeCamera.js"></script>
-    <script src="../src/Cameras/babylon.touchCamera.js"></script>
-    <script src="../src/Cameras/babylon.arcRotateCamera.js"></script>
-    <script src="../src/Cameras/babylon.deviceOrientationCamera.js"></script>
-    <script src="../src/Cameras/babylon.universalCamera.js"></script>
-    <script src="../src/Tools/babylon.gamepads.js"></script>
-    <script src="../src/Cameras/babylon.gamepadCamera.js"></script>
-    <script src="../src/Rendering/babylon.renderingManager.js"></script>
-    <script src="../src/Rendering/babylon.renderingGroup.js"></script>
-    <script src="../src/babylon.scene.js"></script>
-    <script src="../src/Mesh/babylon.vertexBuffer.js"></script>
-    <script src="../src/Mesh/babylon.InstancedMesh.js"></script>
-    <script src="../src/Mesh/babylon.mesh.js"></script>
-    <script src="../src/Mesh/babylon.groundMesh.js"></script>
-    <script src="../src/Mesh/babylon.subMesh.js"></script>
-    <script src="../src/Mesh/babylon.meshBuilder.js"></script>
-    <script src="../src/Materials/textures/babylon.baseTexture.js"></script>
-    <script src="../src/Materials/textures/babylon.texture.js"></script>
-    <script src="../src/Materials/textures/babylon.cubeTexture.js"></script>
-    <script src="../src/Materials/textures/babylon.renderTargetTexture.js"></script>
-    <script src="../src/Materials/textures/babylon.mirrorTexture.js"></script>
-    <script src="../src/Materials/textures/babylon.dynamicTexture.js"></script>
-    <script src="../src/Materials/textures/babylon.videoTexture.js"></script>
-    <script src="../src/Materials/babylon.effect.js"></script>
-    <script src="../src/Materials/babylon.materialHelper.js"></script>
-    <script src="../src/Materials/babylon.material.js"></script>
-    <script src="../src/Materials/babylon.standardMaterial.js"></script>
-    <script src="../src/Materials/babylon.multiMaterial.js"></script>
-    <script src="../src/Materials/textures/procedurals/babylon.proceduralTexture.js"></script>
-    <script src="../src/Materials/textures/procedurals/babylon.customProceduralTexture.js"></script>
-    <script src="../src/Loading/babylon.sceneLoader.js"></script>
-    <script src="../src/Loading/Plugins/babylon.babylonFileLoader.js"></script>
-    <script src="../src/Sprites/babylon.spriteManager.js"></script>
-    <script src="../src/Sprites/babylon.sprite.js"></script>
-    <script src="../src/Layer/babylon.layer.js"></script>
-    <script src="../src/Particles/babylon.particle.js"></script>
-    <script src="../src/Particles/babylon.particleSystem.js"></script>
-    <script src="../src/Animations/babylon.animation.js"></script>
-    <script src="../src/Animations/babylon.animatable.js"></script>
-    <script src="../src/Animations/babylon.easing.js"></script>
-    <script src="../src/Culling/Octrees/babylon.octree.js"></script>
-    <script src="../src/Culling/Octrees/babylon.octreeBlock.js"></script>
-    <script src="../src/Bones/babylon.bone.js"></script>
-    <script src="../src/Bones/babylon.skeleton.js"></script>
-    <script src="../src/Bones/babylon.skeleton.js"></script>
-    <script src="../src/PostProcess/babylon.postProcess.js"></script>
-    <script src="../src/PostProcess/babylon.postProcessManager.js"></script>
-    <script src="../src/PostProcess/babylon.passPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.blurPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.refractionPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.blackAndWhitePostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.convolutionPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.filterPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.fxaaPostProcess.js"></script>
-    <script src="../src/LensFlare/babylon.lensFlare.js"></script>
-    <script src="../src/LensFlare/babylon.lensFlareSystem.js"></script>
-    <script src="../src/Physics/babylon.physicsJoint.js"></script>
-    <script src="../src/Physics/babylon.physicsImpostor.js"></script>
-    <script src="../src/Physics/Plugins/babylon.cannonJSPlugin.js"></script>
-    <script src="../src/Physics/Plugins/babylon.oimoJSPlugin.js"></script>
-    <script src="../src/Physics/babylon.physicsEngine.js"></script>
-    <script src="../src/Tools/babylon.sceneSerializer.js"></script>
-    <script src="../src/Mesh/babylon.csg.js"></script>
-    <script src="../src/PostProcess/babylon.vrDistortionCorrectionPostProcess.js"></script>
-    <script src="../src/Tools/babylon.virtualJoystick.js"></script>
-    <script src="../src/Cameras/babylon.virtualJoysticksCamera.js"></script>
-    <script src="../src/Materials/babylon.shaderMaterial.js"></script>
-    <script src="../src/Mesh/babylon.mesh.vertexData.js"></script>
-    <script src="../src/PostProcess/babylon.anaglyphPostProcess.js"></script>
-    <script src="../src/Tools/babylon.tags.js"></script>
-    <script src="../src/Tools/babylon.andOrNotEvaluator.js"></script>
-    <script src="../src/PostProcess/RenderPipeline/babylon.postProcessRenderPass.js"></script>
-    <script src="../src/PostProcess/RenderPipeline/babylon.postProcessRenderEffect.js"></script>
-    <script src="../src/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js"></script>
-    <script src="../src/PostProcess/RenderPipeline/babylon.postProcessRenderPipelineManager.js"></script>
-    <script src="../src/PostProcess/babylon.displayPassPostProcess.js"></script>
-    <script src="../src/Rendering/babylon.boundingBoxRenderer.js"></script>
-    <script src="../src/Actions/babylon.condition.js"></script>
-    <script src="../src/Actions/babylon.action.js"></script>
-    <script src="../src/Actions/babylon.actionManager.js"></script>
-    <script src="../src/Actions/babylon.interpolateValueAction.js"></script>
-    <script src="../src/Actions/babylon.directActions.js"></script>
-    <script src="../src/Mesh/babylon.geometry.js"></script>
-    <script src="../src/Mesh/babylon.linesMesh.js"></script>
-    <script src="../src/Rendering/babylon.outlineRenderer.js"></script>
-    <script src="../src/Tools/babylon.assetsManager.js"></script>
-    <script src="../src/Cameras/VR/babylon.vrDeviceOrientationCamera.js"></script>
-    <script src="../src/Cameras/VR/babylon.webVRCamera.js"></script>
-    <script src="../src/Tools/babylon.sceneOptimizer.js"></script>
-    <script src="../src/Mesh/babylon.meshLODLevel.js"></script>
-    <script src="../src/Audio/babylon.audioengine.js"></script>
-    <script src="../src/Audio/babylon.sound.js"></script>
-    <script src="../src/Audio/babylon.analyser.js"></script>
-    <script src="../src/Debug/babylon.debugLayer.js"></script>
-    <script src="../src/Audio/babylon.soundtrack.js"></script>
-    <script src="../src/Materials/Textures/babylon.rawTexture.js"></script>
-    <script src="../src/Mesh/babylon.polygonMesh.js"></script>
-    <script src="../src/Mesh/babylon.meshSimplification.js"></script>
-    <script src="../src/Rendering/babylon.depthRenderer.js"></script>
-    <script src="../src/PostProcess/babylon.ssaoRenderingPipeline.js"></script>
-    <script src="../src/PostProcess/babylon.volumetricLightScatteringPostProcess.js"></script>
-    <script src="../src/PostProcess/babylon.lensRenderingPipeline.js"></script>
-    <script src="../src/PostProcess/babylon.colorCorrectionPostProcess.js"></script>
-    <script src="../src/Tools/babylon.stringDictionary.js"></script>
-    <script src="../src/PostProcess/babylon.stereoscopicInterlacePostProcess.js"></script>
-    <script src="../src/Cameras/babylon.stereoscopicCameras.js"></script>
-    <script src="../src/PostProcess/babylon.hdrRenderingPipeline.js"></script>
-    <script src="../src/Rendering/babylon.edgesRenderer.js"></script>
-    <script src="../src/PostProcess/babylon.tonemapPostProcess.js"></script>
-    <script src="../src/Tools/babylon.loadingScreen.js"></script>
-    <script src="../src/Materials/babylon.pbrMaterial.js"></script>
-    <script src="../src/Probes/babylon.reflectionProbe.js"></script>
-    <script src="../src/Particles/babylon.solidParticle.js"></script>
-    <script src="../src/Particles/babylon.solidParticleSystem.js"></script>
-    <script src="../src/Debug/babylon.skeletonViewer.js"></script>
-    <script src="../src/Materials/Textures/babylon.hdrCubeTexture.js"></script>
-    <script src="../src/Tools/HDR/babylon.tools.cubemapToSphericalPolynomial.js"></script>
-    <script src="../src/Tools/HDR/babylon.tools.hdr.js"></script>
-    <script src="../src/Tools/HDR/babylon.tools.pmremGenerator.js"></script>
-    <script src="../src/Tools/HDR/babylon.tools.panoramaToCubemap.js"></script>
-    <script src="../src/Materials/babylon.fresnelParameters.js"></script>
-    <script src="../dist/preview release/babylon.canvas2d.max.js"></script>
-    <script src="../src/Tools/babylon.dynamicFloatArray.js"></script>
-    <script src="../src/Materials/Textures/babylon.fontTexture.js"></script>
-    <script src="../src/Materials/Textures/babylon.mapTexture.js"></script>
-    <script src="../src/Tools/babylon.rectPackingMap.js"></script>
-    <script src="../src/Materials/babylon.colorCurves.js"></script>
-    <script src="../src/Materials/Textures/babylon.colorGradingTexture.js"></script>
-    <script src="../src/Layer/babylon.highlightlayer.js"></script>
-
-    <script src="../dist/materialsLibrary/babylon.fireMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.waterMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.lavaMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.normalMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.skyMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.triPlanarMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.terrainMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.gradientMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.furMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.gridMaterial.js"></script>
-
-    <script src="../dist/proceduralTexturesLibrary/babylon.brickProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.cloudProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.fireProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.grassProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.marbleProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.roadProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.js"></script>
-    <script src="../dist/proceduralTexturesLibrary/babylon.woodProceduralTexture.js"></script>
+    <!-- Babylon.js -->    
+	<script src="../tools/DevLoader/BabylonLoader.js"></script>
     <link href="index.css" rel="stylesheet" />
 </head>
 <body>
@@ -290,6 +92,9 @@
 
     <script src="http://code.jquery.com/jquery.js"></script>
     <script src="bootstrap/js/bootstrap.min.js"></script>
-    <script src="index.js"></script>
+    <script>
+        BABYLONDEVTOOLS.Loader.require('index.js')
+            .load();
+    </script>
 </body>
 </html>

+ 36 - 27
Playground/scripts/pbr.js

@@ -3,33 +3,37 @@
     var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 4, Math.PI / 2.5, 200, BABYLON.Vector3.Zero(), scene);
     camera.attachControl(canvas, true);
     camera.minZ = 0.1;
-
-    // Light
-    new BABYLON.PointLight("point", new BABYLON.Vector3(20, 20, 10), scene);
-
+    
     // Environment Texture
     var hdrTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512);
 
+    var exposure = 0.6;
+    var contrast = 1.6;
+
     // Skybox
     var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
-    var hdrSkyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
+    var hdrSkyboxMaterial = new BABYLON.PBRMaterial("skyBox", scene);
     hdrSkyboxMaterial.backFaceCulling = false;
     hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
     hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
-    hdrSkyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    hdrSkyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
+	hdrSkyboxMaterial.microSurface = 1.0;
+	hdrSkyboxMaterial.cameraExposure = exposure;
+	hdrSkyboxMaterial.cameraContrast = contrast;
     hdrSkyboxMaterial.disableLighting = true;
     hdrSkybox.material = hdrSkyboxMaterial;
     hdrSkybox.infiniteDistance = true;
 
     // Create meshes
-    var sphereGlass = BABYLON.Mesh.CreateSphere("sphere", 48, 30.0, scene);
-    sphereGlass.translate(new BABYLON.Vector3(1, 0, 0), -50);
+    var sphereGlass = BABYLON.Mesh.CreateSphere("sphereGlass", 48, 30.0, scene);
+    sphereGlass.translate(new BABYLON.Vector3(1, 0, 0), -60);
+
+    var sphereMetal = BABYLON.Mesh.CreateSphere("sphereMetal", 48, 30.0, scene);
+    sphereMetal.translate(new BABYLON.Vector3(1, 0, 0), 60);
 
-    var sphereMetal = BABYLON.Mesh.CreateSphere("sphere", 48, 30.0, scene);
-    sphereMetal.translate(new BABYLON.Vector3(1, 0, 0), 50);
+	var spherePlastic = BABYLON.Mesh.CreateSphere("spherePlastic", 48, 30.0, scene);
+    spherePlastic.translate(new BABYLON.Vector3(0, 0, 1), -60);
 
-    var woodPlank = BABYLON.MeshBuilder.CreateBox("plane", { width: 45, height: 1, depth: 90 }, scene);
+    var woodPlank = BABYLON.MeshBuilder.CreateBox("plane", { width: 65, height: 1, depth: 65 }, scene);
 
     // Create materials
     var glass = new BABYLON.PBRMaterial("glass", scene);
@@ -38,33 +42,37 @@
     glass.linkRefractionWithTransparency = true;
     glass.indexOfRefraction = 0.52;
     glass.alpha = 0;
-    glass.directIntensity = 0.0;
-    glass.environmentIntensity = 0.5;
-    glass.cameraExposure = 0.5;
-    glass.cameraContrast = 1.7;
+    glass.cameraExposure = exposure;
+    glass.cameraContrast = contrast;
     glass.microSurface = 1;
-    glass.reflectivityColor = new BABYLON.Color3(0.1, 0.1, 0.1);
-    glass.albedoColor = new BABYLON.Color3(0.3, 0.3, 0.3);
+    glass.reflectivityColor = new BABYLON.Color3(0.2, 0.2, 0.2);
+    glass.albedoColor = new BABYLON.Color3(0.85, 0.85, 0.85);
     sphereGlass.material = glass;
 
     var metal = new BABYLON.PBRMaterial("metal", scene);
     metal.reflectionTexture = hdrTexture;
-    metal.directIntensity = 0.3;
-    metal.environmentIntensity = 0.7;
-    metal.cameraExposure = 0.6;
+    metal.cameraExposure = exposure;
     metal.cameraContrast = 1.6;
     metal.microSurface = 0.96;
-    metal.reflectivityColor = new BABYLON.Color3(0.9, 0.9, 0.9);
-    metal.albedoColor = new BABYLON.Color3(1, 1, 1);
+    metal.reflectivityColor = new BABYLON.Color3(0.85, 0.85, 0.85);
+    metal.albedoColor = new BABYLON.Color3(0.01, 0.01, 0.01);
     sphereMetal.material = metal;
+	
+	var plastic = new BABYLON.PBRMaterial("plastic", scene);
+    plastic.reflectionTexture = hdrTexture;
+    plastic.cameraExposure = exposure;
+    plastic.cameraContrast = contrast;
+    plastic.microSurface = 0.96;
+	plastic.albedoColor = new BABYLON.Color3(0.206, 0.94, 1);
+	plastic.reflectivityColor = new BABYLON.Color3(0.07, 0.07, 0.07);
+    spherePlastic.material = plastic;
 
     var wood = new BABYLON.PBRMaterial("wood", scene);
     wood.reflectionTexture = hdrTexture;
-    wood.directIntensity = 1.5;
-    wood.environmentIntensity = 0.5;
+    wood.environmentIntensity = 1;
     wood.specularIntensity = 0.3;
-    wood.cameraExposure = 0.9;
-    wood.cameraContrast = 1.6;
+    wood.cameraExposure = exposure;
+    wood.cameraContrast = contrast;
 
     wood.reflectivityTexture = new BABYLON.Texture("textures/reflectivity.png", scene);
     wood.useMicroSurfaceFromReflectivityMapAlpha = true;
@@ -72,5 +80,6 @@
     wood.albedoColor = BABYLON.Color3.White();
     wood.albedoTexture = new BABYLON.Texture("textures/albedo.png", scene);
     woodPlank.material = wood;
+		
     return scene;
 };

+ 169 - 0
Tools/DevLoader/BabylonLoader.js

@@ -0,0 +1,169 @@
+// Old Fashion Way for IE 11 Devs. Yes, that still exists ;-)
+
+var BABYLONDEVTOOLS;
+(function (BABYLONDEVTOOLS) {
+    
+    var getJson = function(url, callback, errorCallback) {
+        var xhr = new XMLHttpRequest();
+        xhr.open('GET', url);
+        xhr.onload = function () {
+            if (this.status >= 200 && this.status < 300) {
+                var data = JSON.parse(xhr.response);
+                callback(data)
+            } else {
+                errorCallback({
+                status: this.status,
+                statusText: xhr.statusText
+                });
+            }
+        };
+        xhr.onerror = function () {
+            errorCallback({
+                status: this.status,
+                statusText: xhr.statusText
+            });
+        };
+        xhr.send();
+    }
+
+    var Loader = (function () {
+        var queue;
+        var callback;
+        var dependencies;
+        var useDist;
+        var min;
+
+        function Loader() {
+            queue = [];
+            dependencies = [];
+            callback = null;
+            min = (document.location.href.toLowerCase().indexOf('dist=min') > 0);
+            useDist = (min || document.location.href.toLowerCase().indexOf('dist=true') > 0);
+        }
+
+        Loader.prototype.onReady = function (callback) {
+            this.callback = callback;
+        }
+
+        Loader.prototype.require = function (dependencies) {
+            this.dependencies = dependencies;
+            return this;
+        }
+
+        Loader.prototype.dequeue = function () {
+            if (queue.length == 0) {
+                console.log('Scripts loaded');
+                BABYLON.Engine.ShadersRepository = "/src/Shaders/"; 
+                if (this.callback) {                    
+                    this.callback();
+                }
+                return;                
+            }
+
+            var url = queue.shift();
+            
+            var head = document.getElementsByTagName('head')[0];
+            var script = document.createElement('script');
+            script.type = 'text/javascript';
+            script.src = url;
+
+            var self = this;
+            script.onload = function() {
+                self.dequeue();
+            };
+            head.appendChild(script);
+        }
+
+        Loader.prototype.loadScript = function (url) {
+            queue.push(url);
+        }
+
+        Loader.prototype.loadScripts = function (urls) {
+            for (var i = 0; i< urls.length; i++) {
+                this.loadScript(urls[i]);
+            }
+        }
+
+        Loader.prototype.loadLibrary = function (library, module) {
+            if (!useDist) {
+                var i = 0;
+                for (; i < library.files.length; i++) {
+                    var file = library.files[i];
+                    file = file.replace('.ts', '.js');
+                    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);
+                }
+            }
+            else if (min) {
+                this.loadScript('/dist/preview release' + module.build.distOutputDirectory + library.output.replace('.js', '.min.js'));
+            }
+            else {
+                this.loadScript('/dist/preview release' + module.build.distOutputDirectory + library.output);
+            }
+        }
+
+        Loader.prototype.loadModule = function (module) {
+            for (var i = 0; i< module.libraries.length; i++) {
+                this.loadLibrary(module.libraries[i], module);
+            }
+        }
+
+        Loader.prototype.loadBJSScripts = function (settings) {
+
+            if (!useDist) {
+                this.loadScripts(settings.core.files);
+                this.loadScripts(settings.extras.files);                
+                this.loadScript('/dist/preview release/babylon.canvas2d.max.js');
+            }
+            else if (min) {
+                this.loadScript('/dist/preview release/babylon.js');
+                this.loadScript('/dist/preview release/babylon.canvas2d.js');
+            }
+            else {
+                this.loadScript('/dist/preview release/babylon.max.js');
+                this.loadScript('/dist/preview release/babylon.canvas2d.max.js');
+            }
+
+            for (var i = 0; i< settings.modules.length; i++) {
+                this.loadModule(settings[settings.modules[i]]);
+            }
+        }
+
+        Loader.prototype.load = function (callback) {
+            var self = this;
+            if (callback) {
+                self.callback = callback;
+            }
+            getJson('/Tools/Gulp/config.json',
+                function(data) {
+                    self.loadBJSScripts(data);
+                    
+                    if (typeof self.dependencies === 'string') {
+                        self.loadScript(self.dependencies);
+                    }
+                    else if (self.dependencies) {
+                        self.loadScripts(self.dependencies);
+                    }
+
+                    self.dequeue();
+                },
+                function(reason) { 
+                    console.error(reason);
+                }
+            );
+        };
+
+        return Loader;
+    }());    
+
+    var loader = new Loader();
+    BABYLONDEVTOOLS.Loader = loader;
+
+})(BABYLONDEVTOOLS || (BABYLONDEVTOOLS = {}))

+ 71 - 24
Tools/Gulp/config.json

@@ -228,10 +228,12 @@
     ]
   },
 
+  "modules": ["materialsLibrary", "postProcessesLibrary", "proceduralTexturesLibrary", "loaders", "serializers"],
+
   "materialsLibrary": {
     "libraries": [
       {
-        "file": "../../materialsLibrary/src/gradient/babylon.gradientMaterial.ts",
+        "files": ["../../materialsLibrary/src/gradient/babylon.gradientMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/gradient/gradient.vertex.fx",
           "../../materialsLibrary/src/gradient/gradient.fragment.fx"
@@ -239,7 +241,7 @@
         "output": "babylon.gradientMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/normal/babylon.normalMaterial.ts",
+        "files": ["../../materialsLibrary/src/normal/babylon.normalMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/normal/normal.vertex.fx",
           "../../materialsLibrary/src/normal/normal.fragment.fx"
@@ -247,7 +249,7 @@
         "output": "babylon.normalMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/lava/babylon.lavaMaterial.ts",
+        "files": ["../../materialsLibrary/src/lava/babylon.lavaMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/lava/lava.vertex.fx",
           "../../materialsLibrary/src/lava/lava.fragment.fx"
@@ -255,7 +257,7 @@
         "output": "babylon.lavaMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/simple/babylon.simpleMaterial.ts",
+        "files": ["../../materialsLibrary/src/simple/babylon.simpleMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/simple/simple.vertex.fx",
           "../../materialsLibrary/src/simple/simple.fragment.fx"
@@ -263,7 +265,7 @@
         "output": "babylon.simpleMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/water/babylon.waterMaterial.ts",
+        "files": ["../../materialsLibrary/src/water/babylon.waterMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/water/water.vertex.fx",
           "../../materialsLibrary/src/water/water.fragment.fx"
@@ -271,7 +273,7 @@
         "output": "babylon.waterMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/fire/babylon.fireMaterial.ts",
+        "files": ["../../materialsLibrary/src/fire/babylon.fireMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/fire/fire.vertex.fx",
           "../../materialsLibrary/src/fire/fire.fragment.fx"
@@ -279,7 +281,7 @@
         "output": "babylon.fireMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/fur/babylon.furMaterial.ts",
+        "files": ["../../materialsLibrary/src/fur/babylon.furMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/fur/fur.vertex.fx",
           "../../materialsLibrary/src/fur/fur.fragment.fx"
@@ -287,7 +289,7 @@
         "output": "babylon.furMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/terrain/babylon.terrainMaterial.ts",
+        "files": ["../../materialsLibrary/src/terrain/babylon.terrainMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/terrain/terrain.vertex.fx",
           "../../materialsLibrary/src/terrain/terrain.fragment.fx"
@@ -295,7 +297,7 @@
         "output": "babylon.terrainMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts",
+        "files": ["../../materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/triPlanar/triplanar.vertex.fx",
           "../../materialsLibrary/src/triPlanar/triplanar.fragment.fx"
@@ -303,7 +305,7 @@
         "output": "babylon.triPlanarMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/sky/babylon.skyMaterial.ts",
+        "files": ["../../materialsLibrary/src/sky/babylon.skyMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/sky/sky.vertex.fx",
           "../../materialsLibrary/src/sky/sky.fragment.fx"
@@ -311,7 +313,7 @@
         "output": "babylon.skyMaterial.js"
       },
       {
-        "file": "../../materialsLibrary/src/grid/babylon.gridMaterial.ts",
+        "files": ["../../materialsLibrary/src/grid/babylon.gridMaterial.ts"],
         "shaderFiles": [
           "../../materialsLibrary/src/grid/grid.vertex.fx",
           "../../materialsLibrary/src/grid/grid.fragment.fx",
@@ -322,21 +324,22 @@
       }
     ],
     "build": {
-      "distOutputDirectory": "../../dist/materialsLibrary/"
+      "srcOutputDirectory": "../../materialsLibrary/",
+      "distOutputDirectory": "/materialsLibrary/"
     }
   },
 
   "postProcessesLibrary": {
       "libraries": [    
       {
-        "file": "../../postProcessLibrary/src/asciiArt/babylon.asciiArtPostProcess.ts",
+        "files": ["../../postProcessLibrary/src/asciiArt/babylon.asciiArtPostProcess.ts"],
         "shaderFiles": [
           "../../postProcessLibrary/src/asciiArt/asciiart.fragment.fx"
         ],
         "output": "babylon.asciiArtPostProcess.js"
       },
       {
-        "file": "../../postProcessLibrary/src/digitalRain/babylon.digitalRainPostProcess.ts",
+        "files": ["../../postProcessLibrary/src/digitalRain/babylon.digitalRainPostProcess.ts"],
         "shaderFiles": [
           "../../postProcessLibrary/src/digitalRain/digitalrain.fragment.fx"
         ],
@@ -344,63 +347,64 @@
       }
     ],
     "build": {
-      "distOutputDirectory": "../../dist/postProcessesLibrary/"
+      "srcOutputDirectory": "../../postProcessLibrary/",
+      "distOutputDirectory": "/postProcessesLibrary/"
     }
   },
 
   "proceduralTexturesLibrary": {
     "libraries": [
       {
-        "file": "../../proceduralTexturesLibrary/src/wood/babylon.woodProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/wood/babylon.woodProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/wood/woodProceduralTexture.fragment.fx"
         ],
         "output": "babylon.woodProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/fire/babylon.fireProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/fire/babylon.fireProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/fire/fireProceduralTexture.fragment.fx"
         ],
         "output": "babylon.fireProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/cloud/babylon.cloudProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/cloud/babylon.cloudProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/cloud/cloudProceduralTexture.fragment.fx"
         ],
         "output": "babylon.cloudProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/grass/babylon.grassProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/grass/babylon.grassProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/grass/grassProceduralTexture.fragment.fx"
         ],
         "output": "babylon.grassProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/road/babylon.roadProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/road/babylon.roadProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/road/roadProceduralTexture.fragment.fx"
         ],
         "output": "babylon.roadProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/brick/babylon.brickProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/brick/babylon.brickProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/brick/brickProceduralTexture.fragment.fx"
         ],
         "output": "babylon.brickProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/marble/babylon.marbleProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/marble/babylon.marbleProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/marble/marbleProceduralTexture.fragment.fx"
         ],
         "output": "babylon.marbleProceduralTexture.js"
       },
       {
-        "file": "../../proceduralTexturesLibrary/src/starfield/babylon.starfieldProceduralTexture.ts",
+        "files": ["../../proceduralTexturesLibrary/src/starfield/babylon.starfieldProceduralTexture.ts"],
         "shaderFiles": [
           "../../proceduralTexturesLibrary/src/starfield/starfieldProceduralTexture.fragment.fx"
         ],
@@ -408,7 +412,50 @@
       }
     ],
     "build": {
-      "distOutputDirectory": "../../dist/proceduralTexturesLibrary/"
+      "srcOutputDirectory": "../../proceduralTexturesLibrary/",      
+      "distOutputDirectory": "/proceduralTexturesLibrary/"
+    }
+  },
+
+  "loaders": {
+    "libraries": [
+     {
+      "files": ["../../loaders/src/STL/babylon.stlFileLoader.ts"],
+      "output": "babylon.stlFileLoader.js"
+    },
+
+    {
+      "files": ["../../loaders/src/OBJ/babylon.objFileLoader.ts"],
+      "output": "babylon.objFileLoader.js"
+    },
+
+    {
+      "files": [
+        "../../loaders/src/glTF/babylon.glTFFileLoaderInterfaces.ts",
+        "../../loaders/src/glTF/babylon.glTFFileLoader.ts",
+        "../../loaders/src/glTF/babylon.glTFFileLoaderUtils.ts",
+        "../../loaders/src/glTF/babylon.glTFFileLoaderExtension.ts",
+        "../../loaders/src/glTF/babylon.glTFBinaryExtension.ts"
+      ],
+      "output": "babylon.glTFFileLoader.js"
+    }],
+
+    "build": {
+      "srcOutputDirectory": "../../loaders/",
+      "distOutputDirectory": "/loaders/"
+    }
+  },
+
+  "serializers": {
+      "libraries": [    
+      {
+        "files": ["../../serializers/src/OBJ/babylon.objSerializer.ts"],
+        "output": "babylon.objSerializer.js"
+      }
+    ],
+    "build": {
+      "srcOutputDirectory": "../../serializers/",
+      "distOutputDirectory": "/serializers/"
     }
   }
 }

+ 3 - 2
Tools/Gulp/gulp-appendSrcToVariable.js

@@ -7,7 +7,7 @@ var File = gutil.File;
 // Consts
 const PLUGIN_NAME = 'gulp-appendSrcToVariable';
 
-var appendSrcToVariable = function appendSrcToVariable(varName, asMap, namingCallback) {
+var appendSrcToVariable = function appendSrcToVariable(varName, namingCallback, output) {
 
     var content;
     var firstFile;
@@ -48,7 +48,8 @@ var appendSrcToVariable = function appendSrcToVariable(varName, asMap, namingCal
             return;
         }
 
-        var joinedPath = path.join(firstFile.base, varName);
+        var pathObject = path.parse(firstFile.path);
+        var joinedPath = path.join(pathObject.dir, output);
 
         var joinedFile = new File({
             cwd: firstFile.cwd,

+ 116 - 109
Tools/Gulp/gulpfile.js

@@ -55,7 +55,8 @@ var externalTsConfig = {
  * Shader Management.
  */
 function shadersName(filename) {
-    return filename.replace('.fragment', 'Pixel')
+    return path.basename(filename)
+        .replace('.fragment', 'Pixel')
         .replace('.vertex', 'Vertex')
         .replace('.fx', 'Shader');
 }
@@ -103,6 +104,67 @@ gulp.task("workers", function (cb) {
     cb();
 });
 
+/**
+ * Build tasks to concat minify uflify optimise the BJS js in different flavor (workers...).
+ */
+gulp.task("buildCore", ["shaders"], function () {
+    return merge2(
+        gulp.src(config.core.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
+        shadersStream,
+        includeShadersStream
+        )
+        .pipe(concat(config.build.minCoreFilename))
+        .pipe(cleants())
+        .pipe(replace(extendsSearchRegex, ""))
+        .pipe(replace(decorateSearchRegex, ""))
+        .pipe(addModuleExports("BABYLON"))
+        .pipe(uglify())
+        .pipe(optimisejs())
+        .pipe(gulp.dest(config.build.outputDirectory));
+});
+
+gulp.task("buildNoWorker", ["shaders"], function () {
+    return merge2(
+        gulp.src(config.core.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
+        gulp.src(config.extras.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.extras.files)),
+        shadersStream,
+        includeShadersStream
+        )
+        .pipe(concat(config.build.minNoWorkerFilename))
+        .pipe(cleants())
+        .pipe(replace(extendsSearchRegex, ""))
+        .pipe(replace(decorateSearchRegex, ""))
+        .pipe(addModuleExports("BABYLON"))
+        .pipe(uglify())
+        .pipe(optimisejs())
+        .pipe(gulp.dest(config.build.outputDirectory));
+});
+
+gulp.task("build", ["workers", "shaders"], function () {
+    return merge2(
+        gulp.src(config.core.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
+        gulp.src(config.extras.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.extras.files)),   
+        shadersStream,
+        includeShadersStream,
+        workersStream
+        )
+        .pipe(concat(config.build.filename))
+        .pipe(cleants())
+        .pipe(replace(extendsSearchRegex, ""))
+        .pipe(replace(decorateSearchRegex, ""))
+        .pipe(addModuleExports("BABYLON"))
+        .pipe(gulp.dest(config.build.outputDirectory))
+        .pipe(rename(config.build.minFilename))
+        .pipe(uglify())
+        .pipe(optimisejs())
+        .pipe(gulp.dest(config.build.outputDirectory));
+});
+
 /*
 * Compiles all typescript files and creating a js and a declaration file.
 */
@@ -142,21 +204,6 @@ gulp.task('typescript-compile', function () {
 });
 
 /**
- * External library Build (mat, post processes, ...).
- */
-gulp.task('materialsLibrary', function () {
-    return buildExternalLibraries(config.materialsLibrary);
-});
-
-gulp.task('postProcessesLibrary', function () {
-    return buildExternalLibraries(config.postProcessesLibrary);
-});
-
-gulp.task('proceduralTexturesLibrary', function () {
-    return buildExternalLibraries(config.proceduralTexturesLibrary);
-});
-
-/**
  * Helper methods to build external library (mat, post processes, ...).
  */
 var buildExternalLibraries = function(settings) {
@@ -168,100 +215,39 @@ var buildExternalLibraries = function(settings) {
 }
 
 var buildExternalLibrary= function(library, settings) {
-    var compilOutput = gulp.src(library.file, { base: '../../' })
+    var tsProcess = gulp.src(library.files, {base: settings.build.srcOutputDirectory})
         .pipe(sourcemaps.init())
         .pipe(typescript(externalTsConfig));
 
-    var js = compilOutput.js;        
-    var shader = gulp.src(library.shaderFiles)
-            .pipe(uncommentShader())
-            .pipe(appendSrcToVariable("BABYLON.Effect.ShadersStore", true, shadersName));
+    var shader = gulp.src(library.shaderFiles || [], {base: settings.build.srcOutputDirectory} )
+            .pipe(uncommentShader())            
+            .pipe(appendSrcToVariable("BABYLON.Effect.ShadersStore", shadersName, library.output + '.fx'))
+            .pipe(gulp.dest(settings.build.srcOutputDirectory));
 
-    var fulljs = merge2(js, shader)
-        .pipe(concat(library.output));
-
-    var unminifiedAndMaps = fulljs.pipe(sourcemaps.write('.temp', {
-                includeContent:false,
-                sourceRoot: function (file) {
-                    return '../';
+    var dev = tsProcess.js.pipe(sourcemaps.write("./", {
+                includeContent:false, 
+                sourceRoot: (filePath) => {
+                    return ''; 
                 }
             }))
-        .pipe(gulp.dest(settings.build.distOutputDirectory));
+            .pipe(gulp.dest(settings.build.srcOutputDirectory));
 
-    var minified = fulljs
+    var outputDirectory = config.build.outputDirectory + settings.build.distOutputDirectory;
+    var dist = merge2(tsProcess.js, shader)
+        .pipe(concat(library.output))
+        .pipe(gulp.dest(outputDirectory))
         .pipe(cleants())
         .pipe(replace(extendsSearchRegex, ""))
         .pipe(replace(decorateSearchRegex, ""))
         .pipe(rename({extname: ".min.js"}))
         .pipe(uglify())
         .pipe(optimisejs())
-        .pipe(gulp.dest(settings.build.distOutputDirectory));
+        .pipe(gulp.dest(outputDirectory));
 
-    return merge2(unminifiedAndMaps, minified);
+    return merge2(dev, dist);
 }
 
 /**
- * Build tasks to concat minify uflify optimise the BJS js in different flavor (workers...).
- */
-gulp.task("buildCore", ["shaders"], function () {
-    return merge2(
-        gulp.src(config.core.files).        
-            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
-        shadersStream,
-        includeShadersStream
-        )
-        .pipe(concat(config.build.minCoreFilename))
-        .pipe(cleants())
-        .pipe(replace(extendsSearchRegex, ""))
-        .pipe(replace(decorateSearchRegex, ""))
-        .pipe(addModuleExports("BABYLON"))
-        .pipe(uglify())
-        .pipe(optimisejs())
-        .pipe(gulp.dest(config.build.outputDirectory));
-});
-
-gulp.task("buildNoWorker", ["shaders"], function () {
-    return merge2(
-        gulp.src(config.core.files).        
-            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
-        gulp.src(config.extras.files).        
-            pipe(expect.real({ errorOnFailure: true }, config.extras.files)),
-        shadersStream,
-        includeShadersStream
-        )
-        .pipe(concat(config.build.minNoWorkerFilename))
-        .pipe(cleants())
-        .pipe(replace(extendsSearchRegex, ""))
-        .pipe(replace(decorateSearchRegex, ""))
-        .pipe(addModuleExports("BABYLON"))
-        .pipe(uglify())
-        .pipe(optimisejs())
-        .pipe(gulp.dest(config.build.outputDirectory));
-});
-
-gulp.task("build", ["workers", "shaders"], function () {
-    return merge2(
-        gulp.src(config.core.files).        
-            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
-        gulp.src(config.extras.files).        
-            pipe(expect.real({ errorOnFailure: true }, config.extras.files)),   
-        shadersStream,
-        includeShadersStream,
-        workersStream
-        )
-        .pipe(concat(config.build.filename))
-        .pipe(cleants())
-        .pipe(replace(extendsSearchRegex, ""))
-        .pipe(replace(decorateSearchRegex, ""))
-        .pipe(addModuleExports("BABYLON"))
-        .pipe(gulp.dest(config.build.outputDirectory))
-        .pipe(rename(config.build.minFilename))
-        .pipe(uglify())
-        .pipe(optimisejs())
-        .pipe(gulp.dest(config.build.outputDirectory));
-});
-
-/**
  * The default task, concat and min the main BJS files.
  */
 gulp.task('default', function (cb) {
@@ -275,9 +261,21 @@ gulp.task("typescript", function (cb) {
     runSequence("typescript-compile", "default", cb);
 });
 
-gulp.task("typescript-libraries", ["materialsLibrary", "postProcessesLibrary", "proceduralTexturesLibrary"], function () {
+/**
+ * Dynamic module creation.
+ */
+config.modules.map(function (module) {
+    gulp.task(module, function () {
+        return buildExternalLibraries(config[module]);
+    });
+});
+
+gulp.task("typescript-libraries", config.modules, function () {
 });
 
+/**
+ * Do it all.
+ */
 gulp.task("typescript-all", function (cb) {
     runSequence("typescript", "typescript-libraries", cb);
 });
@@ -285,28 +283,37 @@ gulp.task("typescript-all", function (cb) {
 /**
  * Watch ts files and fire repective tasks.
  */
-gulp.task('watch', ['typescript-compile'], function () {
+gulp.task('watch', [], function () {
     var tasks = [gulp.watch(config.core.typescript, ['typescript-compile'])];
 
-    config.materialsLibrary.libraries.map(function (material) {
-        tasks.push(gulp.watch(material.file, () => buildExternalLibrary(material, config.materialsLibrary)));
-        tasks.push(gulp.watch(material.shaderFiles, () => buildExternalLibrary(material, config.materialsLibrary)));
-    });
-
-    config.postProcessesLibrary.libraries.map(function (postProcess) {
-        tasks.push(gulp.watch(postProcess.file, buildExternalLibrary(postProcess, config.postProcessesLibrary)));
-        tasks.push(gulp.watch(postProcess.shaderFiles, buildExternalLibrary(postProcess, config.postProcessesLibrary)));
-    });
-
-    config.proceduralTexturesLibrary.libraries.map(function (proceduralTexture) {
-        tasks.push(gulp.watch(proceduralTexture.file, buildExternalLibrary(proceduralTexture, config.proceduralTexturesLibrary)));
-        tasks.push(gulp.watch(proceduralTexture.shaderFiles, buildExternalLibrary(proceduralTexture, config.proceduralTexturesLibrary)));
+    config.modules.map(function (module) { 
+        config[module].libraries.map(function (library) {
+            
+            tasks.push(gulp.watch(library.files, function() { 
+                console.log(library.output);
+                return buildExternalLibrary(library, config[module])
+                .pipe(debug()); 
+            }));
+            tasks.push(gulp.watch(library.shaderFiles, function() { 
+                console.log(library.output);
+                return buildExternalLibrary(library, config[module])
+                .pipe(debug()) 
+            }));
+        }); 
     });
-
+    
     return tasks;
 });
 
 /**
+ * Embedded local dev env management.
+ */
+gulp.task('deployLocalDev', function () {
+    gulp.src('../../localDev/template/**.*')
+        .pipe(gulp.dest('../../localDev/src/'));
+});
+
+/**
  * Embedded webserver for test convenience.
  */
 gulp.task('webserver', function () {

+ 3 - 0
Tools/Gulp/package.json

@@ -26,5 +26,8 @@
     "gulp-optimize-js": "^1.0.2",
     "gulp-webserver": "^0.9.1",
     "gulp-debug": "^3.0.0"
+  },
+  "scripts": {
+    "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"
   }
 }

文件差异内容过多而无法显示
+ 0 - 1
dist/materialsLibrary/babylon.gradientMaterial.min.js


文件差异内容过多而无法显示
+ 0 - 1
dist/materialsLibrary/babylon.lavaMaterial.min.js


文件差异内容过多而无法显示
+ 0 - 1
dist/materialsLibrary/babylon.normalMaterial.min.js


文件差异内容过多而无法显示
+ 1426 - 1426
dist/preview release/babylon.d.ts


+ 15 - 0
loaders/glTF/babylon.glTFFileLoader.js

@@ -1,3 +1,4 @@
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     /**
@@ -89,6 +90,9 @@ var BABYLON;
     var EBlendingFunction = BABYLON.EBlendingFunction;
 })(BABYLON || (BABYLON = {}));
 
+//# sourceMappingURL=babylon.glTFFileLoaderInterfaces.js.map
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     /**
@@ -1496,6 +1500,9 @@ var BABYLON;
     BABYLON.SceneLoader.RegisterPlugin(new GLTFFileLoader());
 })(BABYLON || (BABYLON = {}));
 
+//# sourceMappingURL=babylon.glTFFileLoader.js.map
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     /**
@@ -1696,6 +1703,9 @@ var BABYLON;
     BABYLON.GLTFUtils = GLTFUtils;
 })(BABYLON || (BABYLON = {}));
 
+//# sourceMappingURL=babylon.glTFFileLoaderUtils.js.map
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     var GLTFFileLoaderExtension = (function () {
@@ -1815,6 +1825,9 @@ var BABYLON;
     BABYLON.GLTFFileLoaderExtension = GLTFFileLoaderExtension;
 })(BABYLON || (BABYLON = {}));
 
+//# sourceMappingURL=babylon.glTFFileLoaderExtension.js.map
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var __extends = (this && this.__extends) || function (d, b) {
     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
     function __() { this.constructor = d; }
@@ -1955,3 +1968,5 @@ var BABYLON;
     }());
     BABYLON.GLTFFileLoader.RegisterExtension(new GLTFBinaryExtension());
 })(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.glTFBinaryExtension.js.map

文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 3 - 1
loaders/OBJ/babylon.objFileLoader.js

@@ -1,4 +1,4 @@
-/// <reference path="../../dist/preview release/babylon.d.ts"/>
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     /**
@@ -739,3 +739,5 @@ var BABYLON;
     //Add this loader into the register plugin
     BABYLON.SceneLoader.RegisterPlugin(new OBJFileLoader());
 })(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.objFileLoader.js.map

文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 3 - 0
loaders/STL/babylon.stlFileLoader.js

@@ -1,3 +1,4 @@
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     var STLFileLoader = (function () {
@@ -78,3 +79,5 @@ var BABYLON;
     BABYLON.STLFileLoader = STLFileLoader;
     BABYLON.SceneLoader.RegisterPlugin(new STLFileLoader());
 })(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.stlFileLoader.js.map

文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/loaders/babylon.stlFileLoader.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.fireMaterial.js


dist/materialsLibrary/babylon.fireMaterial.min.js → dist/preview release/materialsLibrary/babylon.fireMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.furMaterial.js


dist/materialsLibrary/babylon.furMaterial.min.js → dist/preview release/materialsLibrary/babylon.furMaterial.min.js


文件差异内容过多而无法显示
+ 8 - 4
dist/materialsLibrary/babylon.gradientMaterial.js


文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.gridMaterial.js


dist/materialsLibrary/babylon.gridMaterial.min.js → dist/preview release/materialsLibrary/babylon.gridMaterial.min.js


文件差异内容过多而无法显示
+ 8 - 4
dist/materialsLibrary/babylon.lavaMaterial.js


文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js


文件差异内容过多而无法显示
+ 8 - 4
dist/materialsLibrary/babylon.normalMaterial.js


文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/materialsLibrary/babylon.normalMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.simpleMaterial.js


dist/materialsLibrary/babylon.simpleMaterial.min.js → dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.skyMaterial.js


dist/materialsLibrary/babylon.skyMaterial.min.js → dist/preview release/materialsLibrary/babylon.skyMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.terrainMaterial.js


dist/materialsLibrary/babylon.terrainMaterial.min.js → dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.triPlanarMaterial.js


dist/materialsLibrary/babylon.triPlanarMaterial.min.js → dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/materialsLibrary/babylon.waterMaterial.js


dist/materialsLibrary/babylon.waterMaterial.min.js → dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/postProcessesLibrary/babylon.asciiArtPostProcess.js


dist/postProcessesLibrary/babylon.asciiArtPostProcess.min.js → dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/postProcessesLibrary/babylon.digitalRainPostProcess.js


dist/postProcessesLibrary/babylon.digitalRainPostProcess.min.js → dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.brickProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.brickProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.brickProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.cloudProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.cloudProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.cloudProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.fireProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.fireProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.fireProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.grassProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.grassProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.grassProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.marbleProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.marbleProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.marbleProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.roadProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.roadProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.roadProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.min.js


文件差异内容过多而无法显示
+ 7 - 3
dist/proceduralTexturesLibrary/babylon.woodProceduralTexture.js


dist/proceduralTexturesLibrary/babylon.woodProceduralTexture.min.js → dist/preview release/proceduralTexturesLibrary/babylon.woodProceduralTexture.min.js


+ 4 - 2
serializers/OBJ/babylon.objSerializer.js

@@ -1,4 +1,4 @@
-/// <reference path="../babylon.d.ts"/>
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
 var BABYLON;
 (function (BABYLON) {
     var OBJExport = (function () {
@@ -83,6 +83,8 @@ var BABYLON;
             return (text);
         };
         return OBJExport;
-    })();
+    }());
     BABYLON.OBJExport = OBJExport;
 })(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.objSerializer.js.map

文件差异内容过多而无法显示
+ 1 - 0
dist/preview release/serializers/babylon.objSerializer.min.js


+ 0 - 74
loaders/OBJ/README.md

@@ -1,74 +0,0 @@
-# Babylon.js .obj File Loader
-
-#[Demo](http://www.babylonjs-playground.com/#28YUR5)
-To use it, you just have to reference the loader file:
-
-```
-<script src="babylon.2.1.js"></script>
-<script src="babylon.objFileLoader.js"></script>
-```
-
-Babylon.js will know how to load the obj file and its mtl file automatically: 
-```
-BABYLON.SceneLoader.Load("/assets/", "batman.obj", engine, function (newScene) { 
-   // ...
-});
-```
-```
-var loader = new BABYLON.AssetsManager(scene);
-var batman = loader.addMeshTask("batman", "", "assets/", "batman.obj");
-```
-```
-BABYLON.SceneLoader.ImportMesh("batmanface", "", "batman.obj", scene, function (meshes) { 
-   // ...
-});
-```
-
-## Good things to know
-* Your model doesn't have to be triangulated, as this loader will do it automatically.
-* A Babylon.Mesh will be created for each object/group
-* The obj model should be exported with -Z axis forward, and Y axis upward to be compatible with Babylon.js
-
-![Axis](http://geomorph.sourceforge.net/preview/axes.jpg)
-
-* By default, due to optimization in the code for loading time, UVs problems can appear, like this :
-
-![Batman UVs problem](http://i.imgur.com/vjWKNRK.png)
-
-If you meet this problem, set the variable 
-```
-BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true;
-```
-Then, you'll have a better texture, but with a longer loading.
-
-![Batman UVs ok](http://i.imgur.com/Dajwlvq.png)
-
-## Supported
-* Object/group
-* Faces
-    * triangles
-    * quads
-    * polygons
-* Colors
-    * diffuseColor
-    * ambientColor
-    * specularColor
-    * specularPower
-    * alpha
-* Textures
-    * ambientTexture
-    * diffuseTexture
-    * specularTexture
-    * bumpTexture
-    * opacityTexture
-* Multimaterial
-	* For each material defined in the same mesh, it creates a new BABYLON.Mesh.
-	* The name of the created BABYLON.Mesh follows this syntax: meshName_mmX 
-	* X is the nth BABYLON.Mesh created with this method
-
-    
-## Not supported currently
-* Smoothing groups (s parameter in OBJ file)
-* Illumination (illum parameter in MTL file)
-* The differents options for loading textures in MTL file.
-* A good description about MTL file and his options could be found here: http://paulbourke.net/dataformats/mtl/

+ 0 - 872
loaders/OBJ/babylon.objFileLoader.ts

@@ -1,872 +0,0 @@
-/// <reference path="../../dist/preview release/babylon.d.ts"/>
-
-module BABYLON {
-
-    /**
-     * Class reading and parsing the MTL file bundled with the obj file.
-     */
-    export class MTLFileLoader {
-
-        // All material loaded from the mtl will be set here
-        public materials: BABYLON.StandardMaterial[] = [];
-
-        /**
-         * This function will read the mtl file and create each material described inside
-         * This function could be improve by adding :
-         * -some component missing (Ni, Tf...)
-         * -including the specific options available
-         *
-         * @param scene
-         * @param data
-         * @param rootUrl
-         */
-        public parseMTL = function (scene: BABYLON.Scene, data: string, rootUrl: string) {
-            //Split the lines from the file
-            var lines = data.split('\n');
-            //Space char
-            var delimiter_pattern = /\s+/;
-            //Array with RGB colors
-            var color: number[];
-            //New material
-            var material: BABYLON.StandardMaterial;
-
-            //Look at each line
-            for (var i = 0; i < lines.length; i++) {
-                var line = lines[i].trim();
-
-                // Blank line or comment
-                if (line.length === 0 || line.charAt(0) === '#') {
-                    continue;
-                }
-
-                //Get the first parameter (keyword)
-                var pos = line.indexOf(' ');
-                var key = (pos >= 0) ? line.substring(0, pos) : line;
-                key = key.toLowerCase();
-
-                //Get the data following the key
-                var value: any = (pos >= 0) ? line.substring(pos + 1).trim() : "";
-
-                //This mtl keyword will create the new material
-                if (key === "newmtl") {
-                    //Check if it is the first material.
-                    // Materials specifications are described after this keyword.
-                    if (material) {
-                        //Add the previous material in the material array.
-                        this.materials.push(material);
-                    }
-                    //Create a new material.
-                    // value is the name of the material read in the mtl file
-                    material = new BABYLON.StandardMaterial(value, scene);
-                } else if (key === "kd") {
-                    // Diffuse color (color under white light) using RGB values
-
-                    //value  = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
-                    //color = [r,g,b]
-                    //Set tghe color into the material
-                    material.diffuseColor = BABYLON.Color3.FromArray(color);
-                } else if (key === "ka") {
-                    // Ambient color (color under shadow) using RGB values
-
-                    //value = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
-                    //color = [r,g,b]
-                    //Set tghe color into the material
-                    material.ambientColor = BABYLON.Color3.FromArray(color);
-                } else if (key === "ks") {
-                    // Specular color (color when light is reflected from shiny surface) using RGB values
-
-                    //value = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
-                    //color = [r,g,b]
-                    //Set the color into the material
-                    material.specularColor = BABYLON.Color3.FromArray(color);
-                } else if (key === "ns") {
-
-                    //value = "Integer"
-                    material.specularPower = value;
-                } else if (key === "d") {
-                    //d is dissolve for current material. It mean alpha for BABYLON
-                    material.alpha = value;
-
-                    //Texture
-                    //This part can be improved by adding the possible options of texture
-                } else if (key === "map_ka") {
-                    // ambient texture map with a loaded image
-                    //We must first get the folder of the image
-                    material.ambientTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
-                } else if (key === "map_kd") {
-                    // Diffuse texture map with a loaded image
-                    material.diffuseTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
-                } else if (key === "map_ks") {
-                    // Specular texture map with a loaded image
-                    //We must first get the folder of the image
-                    material.specularTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
-                } else if (key === "map_ns") {
-                    //Specular
-                    //Specular highlight component
-                    //We must first get the folder of the image
-                    //
-                    //Not supported by BABYLON
-                    //
-                    //    continue;
-                } else if (key === "map_bump") {
-                    //The bump texture
-                    material.bumpTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
-                } else if (key === "map_d") {
-                    // The dissolve of the material
-                    material.opacityTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
-
-
-                    //Options for illumination
-                } else if (key === "illum") {
-                    //Illumination
-                    if (value === "0") {
-                        //That mean Kd == Kd
-                    } else if (value === "1") {
-                        //Color on and Ambient on
-                    } else if (value === "2") {
-                        //Highlight on
-                    } else if (value === "3") {
-                        //Reflection on and Ray trace on
-                    } else if (value === "4") {
-                        //Transparency: Glass on, Reflection: Ray trace on
-                    } else if (value === "5") {
-                        //Reflection: Fresnel on and Ray trace on
-                    } else if (value === "6") {
-                        //Transparency: Refraction on, Reflection: Fresnel off and Ray trace on
-                    } else if (value === "7") {
-                        //Transparency: Refraction on, Reflection: Fresnel on and Ray trace on
-                    } else if (value === "8") {
-                        //Reflection on and Ray trace off
-                    } else if (value === "9") {
-                        //Transparency: Glass on, Reflection: Ray trace off
-                    } else if (value === "10") {
-                        //Casts shadows onto invisible surfaces
-                    }
-                } else {
-                    // console.log("Unhandled expression at line : " + i +'\n' + "with value : " + line);
-                }
-            }
-            //At the end of the file, add the last material
-            this.materials.push(material);
-        }
-
-        /**
-         * Gets the texture for the material.
-         * 
-         * If the material is imported from input file,
-         * We sanitize the url to ensure it takes the textre from aside the material.
-         * 
-         * @param rootUrl The root url to load from
-         * @param value The value stored in the mtl
-         * @return The Texture
-         */
-        private static _getTexture(rootUrl: string, value: string, scene: Scene): Texture {
-            var url = rootUrl;
-            // Load from input file.
-            if (rootUrl === "file:") {
-                var lastDelimiter = value.lastIndexOf("\\");
-                if (lastDelimiter === -1) {
-                    lastDelimiter = value.lastIndexOf("/");
-                }
-
-                if (lastDelimiter > -1) {
-                    url += value.substr(lastDelimiter + 1);
-                }
-                else {
-                    url += value;
-                }
-            }
-            // Not from input file.
-            else {
-                url += value;
-            }
-
-            return new BABYLON.Texture(url, scene);
-        }
-    }
-
-    export class OBJFileLoader implements ISceneLoaderPlugin {
-
-        public static OPTIMIZE_WITH_UV = false;
-
-        public extensions = ".obj";
-        public obj = /^o/;
-        public group = /^g/;
-        public mtllib = /^mtllib /;
-        public usemtl = /^usemtl /;
-        public smooth = /^s /;
-        public vertexPattern = /v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
-        // vn float float float
-        public normalPattern = /vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
-        // vt float float
-        public uvPattern = /vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
-        // f vertex vertex vertex ...
-        public facePattern1 = /f\s+(([\d]{1,}[\s]?){3,})+/;
-        // f vertex/uvs vertex/uvs vertex/uvs ...
-        public facePattern2 = /f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
-        // f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal ...
-        public facePattern3 = /f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
-        // f vertex//normal vertex//normal vertex//normal ...
-        public facePattern4 = /f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/;
-
-
-        /**
-         * Calls synchronously the MTL file attached to this obj.
-         * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
-         * Without this function materials are not displayed in the first frame (but displayed after).
-         * In consequence it is impossible to get material information in your HTML file
-         *
-         * @param url The URL of the MTL file
-         * @param rootUrl
-         * @param onSuccess Callback function to be called when the MTL file is loaded
-         * @private
-         */
-        private _loadMTL(url: string, rootUrl: string, onSuccess: (response: string) => any) {
-            //The complete path to the mtl file
-            var pathOfFile = BABYLON.Tools.BaseUrl + rootUrl + url;
-
-            // Loads through the babylon tools to allow fileInput search.
-            BABYLON.Tools.LoadFile(pathOfFile, 
-                onSuccess, 
-                null, 
-                null, 
-                false, 
-                () => { console.warn("Error - Unable to load " + pathOfFile); });
-        }
-
-        public importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]): boolean {
-            //get the meshes from OBJ file
-            var loadedMeshes = this._parseSolid(meshesNames, scene, data, rootUrl);
-            //Push meshes from OBJ file into the variable mesh of this function
-            if (meshes) {
-                loadedMeshes.forEach(function (mesh) {
-                    meshes.push(mesh);
-                });
-            }
-            return true;
-        }
-
-        public load(scene: Scene, data: string, rootUrl: string): boolean {
-            //Get the 3D model
-            return this.importMesh(null, scene, data, rootUrl, null, null, null);
-        }
-
-        /**
-         * Read the OBJ file and create an Array of meshes.
-         * Each mesh contains all information given by the OBJ and the MTL file.
-         * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
-         *
-         * @param meshesNames
-         * @param scene BABYLON.Scene The scene where are displayed the data
-         * @param data String The content of the obj file
-         * @param rootUrl String The path to the folder
-         * @returns Array<AbstractMesh>
-         * @private
-         */
-        private _parseSolid(meshesNames: any, scene: BABYLON.Scene, data: string, rootUrl: string): Array<AbstractMesh> {
-
-            var positions: Array<BABYLON.Vector3> = [];      //values for the positions of vertices
-            var normals: Array<BABYLON.Vector3> = [];      //Values for the normals
-            var uvs: Array<BABYLON.Vector2> = [];      //Values for the textures
-            var meshesFromObj: Array<any> = [];      //[mesh] Contains all the obj meshes
-            var handledMesh: any;      //The current mesh of meshes array
-            var indicesForBabylon: Array<number> = [];      //The list of indices for VertexData
-            var wrappedPositionForBabylon: Array<BABYLON.Vector3> = [];      //The list of position in vectors
-            var wrappedUvsForBabylon: Array<BABYLON.Vector2> = [];      //Array with all value of uvs to match with the indices
-            var wrappedNormalsForBabylon: Array<BABYLON.Vector3> = [];      //Array with all value of normals to match with the indices
-            var tuplePosNorm: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }> = [];      //Create a tuple with indice of Position, Normal, UV  [pos, norm, uvs]
-            var curPositionInIndices = 0;
-            var hasMeshes: Boolean = false;   //Meshes are defined in the file
-            var unwrappedPositionsForBabylon: Array<number> = [];      //Value of positionForBabylon w/o Vector3() [x,y,z]
-            var unwrappedNormalsForBabylon: Array<number> = [];      //Value of normalsForBabylon w/o Vector3()  [x,y,z]
-            var unwrappedUVForBabylon: Array<number> = [];      //Value of uvsForBabylon w/o Vector3()      [x,y,z]
-            var triangles: Array<string> = [];      //Indices from new triangles coming from polygons
-            var materialNameFromObj: string = "";      //The name of the current material
-            var fileToLoad: string = "";      //The name of the mtlFile to load
-            var materialsFromMTLFile: MTLFileLoader = new MTLFileLoader();
-            var objMeshName: string = "";      //The name of the current obj mesh
-            var increment: number = 1;      //Id for meshes created by the multimaterial
-            var isFirstMaterial: boolean = true;
-
-            /**
-             * Search for obj in the given array.
-             * This function is called to check if a couple of data already exists in an array.
-             *
-             * If found, returns the index of the founded tuple index. Returns -1 if not found
-             * @param arr Array<{ normals: Array<number>, idx: Array<number> }>
-             * @param obj Array<number>
-             * @returns {boolean}
-             */
-            var isInArray = (arr: Array<{ normals: Array<number>; idx: Array<number> }>, obj: Array<number>) => {
-                if (!arr[obj[0]]) arr[obj[0]] = { normals: [], idx: [] };
-                var idx = arr[obj[0]].normals.indexOf(obj[1]);
-
-                return idx === -1 ? -1 : arr[obj[0]].idx[idx];
-            };
-            var isInArrayUV = (arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) => {
-                if (!arr[obj[0]]) arr[obj[0]] = { normals: [], idx: [], uv: [] };
-                var idx = arr[obj[0]].normals.indexOf(obj[1]);
-
-                if (idx != 1 && (obj[2] == arr[obj[0]].uv[idx])) {
-                    return arr[obj[0]].idx[idx];
-                }
-                return -1;
-            };
-
-            /**
-             * This function set the data for each triangle.
-             * Data are position, normals and uvs
-             * If a tuple of (position, normal) is not set, add the data into the corresponding array
-             * If the tuple already exist, add only their indice
-             *
-             * @param indicePositionFromObj Integer The index in positions array
-             * @param indiceUvsFromObj Integer The index in uvs array
-             * @param indiceNormalFromObj Integer The index in normals array
-             * @param positionVectorFromOBJ Vector3 The value of position at index objIndice
-             * @param textureVectorFromOBJ Vector3 The value of uvs
-             * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
-             */
-            var setData = (indicePositionFromObj: number, indiceUvsFromObj: number, indiceNormalFromObj: number, positionVectorFromOBJ: BABYLON.Vector3, textureVectorFromOBJ: BABYLON.Vector2, normalsVectorFromOBJ: BABYLON.Vector3) => {
-                //Check if this tuple already exists in the list of tuples
-                var _index: number;
-                if (OBJFileLoader.OPTIMIZE_WITH_UV) {
-                    _index = isInArrayUV(
-                        tuplePosNorm,
-                        [
-                            indicePositionFromObj,
-                            indiceNormalFromObj,
-                            indiceUvsFromObj
-                        ]
-                    );
-                }
-                else {
-                    _index = isInArray(
-                        tuplePosNorm,
-                        [
-                            indicePositionFromObj,
-                            indiceNormalFromObj
-                        ]
-                    );
-                }
-
-                //If it not exists
-                if (_index == -1) {
-                    //Add an new indice.
-                    //The array of indices is only an array with his length equal to the number of triangles - 1.
-                    //We add vertices data in this order
-                    indicesForBabylon.push(wrappedPositionForBabylon.length);
-                    //Push the position of vertice for Babylon
-                    //Each element is a BABYLON.Vector3(x,y,z)
-                    wrappedPositionForBabylon.push(positionVectorFromOBJ);
-                    //Push the uvs for Babylon
-                    //Each element is a BABYLON.Vector3(u,v)
-                    wrappedUvsForBabylon.push(textureVectorFromOBJ);
-                    //Push the normals for Babylon
-                    //Each element is a BABYLON.Vector3(x,y,z)
-                    wrappedNormalsForBabylon.push(normalsVectorFromOBJ);
-                    //Add the tuple in the comparison list
-                    tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);
-                    tuplePosNorm[indicePositionFromObj].idx.push(curPositionInIndices++);
-                    if (OBJFileLoader.OPTIMIZE_WITH_UV) tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);
-                } else {
-                    //The tuple already exists
-                    //Add the index of the already existing tuple
-                    //At this index we can get the value of position, normal and uvs of vertex
-                    indicesForBabylon.push(_index);
-                }
-            };
-
-            /**
-             * Transform BABYLON.Vector() object onto 3 digits in an array
-             */
-            var unwrapData = () => {
-                //Every array has the same length
-                for (var l = 0; l < wrappedPositionForBabylon.length; l++) {
-                    //Push the x, y, z values of each element in the unwrapped array
-                    unwrappedPositionsForBabylon.push(wrappedPositionForBabylon[l].x, wrappedPositionForBabylon[l].y, wrappedPositionForBabylon[l].z);
-                    unwrappedNormalsForBabylon.push(wrappedNormalsForBabylon[l].x, wrappedNormalsForBabylon[l].y, wrappedNormalsForBabylon[l].z);
-                    unwrappedUVForBabylon.push(wrappedUvsForBabylon[l].x, wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON
-                }
-                // Reset arrays for the next new meshes
-                wrappedPositionForBabylon = [];
-                wrappedNormalsForBabylon = [];
-                wrappedUvsForBabylon = [];
-                tuplePosNorm = [];
-                curPositionInIndices = 0;
-            };
-
-            /**
-             * Create triangles from polygons by recursion
-             * The best to understand how it works is to draw it in the same time you get the recursion.
-             * It is important to notice that a triangle is a polygon
-             * We get 4 patterns of face defined in OBJ File :
-             * facePattern1 = ["1","2","3","4","5","6"]
-             * facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
-             * facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
-             * facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
-             * Each pattern is divided by the same method
-             * @param face Array[String] The indices of elements
-             * @param v Integer The variable to increment
-             */
-            var getTriangles = (face: Array<string>, v: number) => {
-                //Work for each element of the array
-                if (v + 1 < face.length) {
-                    //Add on the triangle variable the indexes to obtain triangles
-                    triangles.push(face[0], face[v], face[v + 1]);
-                    //Incrementation for recursion
-                    v += 1;
-                    //Recursion
-                    getTriangles(face, v);
-                }
-
-                //Result obtained after 2 iterations:
-                //Pattern1 => triangle = ["1","2","3","1","3","4"];
-                //Pattern2 => triangle = ["1/1","2/2","3/3","1/1","3/3","4/4"];
-                //Pattern3 => triangle = ["1/1/1","2/2/2","3/3/3","1/1/1","3/3/3","4/4/4"];
-                //Pattern4 => triangle = ["1//1","2//2","3//3","1//1","3//3","4//4"];
-            };
-
-            /**
-             * Create triangles and push the data for each polygon for the pattern 1
-             * In this pattern we get vertice positions
-             * @param face
-             * @param v
-             */
-            var setDataForCurrentFaceWithPattern1 = (face: Array<string>, v: number) => {
-                //Get the indices of triangles for each polygon
-                getTriangles(face, v);
-                //For each element in the triangles array.
-                //This var could contains 1 to an infinity of triangles
-                for (var k = 0; k < triangles.length; k++) {
-                    // Set position indice
-                    var indicePositionFromObj = parseInt(triangles[k]) - 1;
-
-                    setData(
-                        indicePositionFromObj,
-                        0, 0,                                           //In the pattern 1, normals and uvs are not defined
-                        positions[indicePositionFromObj],               //Get the vectors data
-                        BABYLON.Vector2.Zero(), BABYLON.Vector3.Up()    //Create default vectors
-                    );
-                }
-                //Reset variable for the next line
-                triangles = [];
-            };
-
-
-            /**
-             * Create triangles and push the data for each polygon for the pattern 2
-             * In this pattern we get vertice positions and uvsu
-             * @param face
-             * @param v
-             */
-            var setDataForCurrentFaceWithPattern2 = (face: Array<string>, v: number) => {
-                //Get the indices of triangles for each polygon
-                getTriangles(face, v);
-                for (var k = 0; k < triangles.length; k++) {
-                    //triangle[k] = "1/1"
-                    //Split the data for getting position and uv
-                    var point = triangles[k].split("/"); // ["1", "1"]
-                    //Set position indice
-                    var indicePositionFromObj = parseInt(point[0]) - 1;
-                    //Set uv indice
-                    var indiceUvsFromObj = parseInt(point[1]) - 1;
-
-                    setData(
-                        indicePositionFromObj,
-                        indiceUvsFromObj,
-                        0,                                  //Default value for normals
-                        positions[indicePositionFromObj],   //Get the values for each element
-                        uvs[indiceUvsFromObj],
-                        BABYLON.Vector3.Up()                //Default value for normals
-                    );
-                }
-
-                //Reset variable for the next line
-                triangles = [];
-            };
-
-            /**
-             * Create triangles and push the data for each polygon for the pattern 3
-             * In this pattern we get vertice positions, uvs and normals
-             * @param face
-             * @param v
-             */
-            var setDataForCurrentFaceWithPattern3 = (face: Array<string>, v: number) => {
-                //Get the indices of triangles for each polygon
-                getTriangles(face, v);
-
-                for (var k = 0; k < triangles.length; k++) {
-                    //triangle[k] = "1/1/1"
-                    //Split the data for getting position, uv, and normals
-                    var point = triangles[k].split("/"); // ["1", "1", "1"]
-                    // Set position indice
-                    var indicePositionFromObj = parseInt(point[0]) - 1;
-                    // Set uv indice
-                    var indiceUvsFromObj = parseInt(point[1]) - 1;
-                    // Set normal indice
-                    var indiceNormalFromObj = parseInt(point[2]) - 1;
-
-                    setData(
-                        indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj,
-                        positions[indicePositionFromObj], uvs[indiceUvsFromObj], normals[indiceNormalFromObj] //Set the vector for each component
-                    );
-
-                }
-                //Reset variable for the next line
-                triangles = [];
-            };
-
-
-            /**
-             * Create triangles and push the data for each polygon for the pattern 4
-             * In this pattern we get vertice positions and normals
-             * @param face
-             * @param v
-             */
-            var setDataForCurrentFaceWithPattern4 = (face: Array<string>, v: number) => {
-                getTriangles(face, v);
-
-                for (var k = 0; k < triangles.length; k++) {
-                    //triangle[k] = "1//1"
-                    //Split the data for getting position and normals
-                    var point = triangles[k].split("//"); // ["1", "1"]
-                    // We check indices, and normals
-                    var indicePositionFromObj = parseInt(point[0]) - 1;
-                    var indiceNormalFromObj = parseInt(point[1]) - 1;
-
-                    setData(
-                        indicePositionFromObj,
-                        1, //Default value for uv
-                        indiceNormalFromObj,
-                        positions[indicePositionFromObj], //Get each vector of data
-                        BABYLON.Vector2.Zero(),
-                        normals[indiceNormalFromObj]
-                    );
-                }
-                //Reset variable for the next line
-                triangles = [];
-            };
-
-            var addPreviousObjMesh = () => {
-
-                //Check if it is not the first mesh. Otherwise we don't have data.
-                if (meshesFromObj.length > 0) {
-                    //Get the previous mesh for applying the data about the faces
-                    //=> in obj file, faces definition append after the name of the mesh
-                    handledMesh = meshesFromObj[meshesFromObj.length - 1];
-
-                    //Set the data into Array for the mesh
-                    unwrapData();
-
-                    // Reverse tab. Otherwise face are displayed in the wrong sens
-                    indicesForBabylon.reverse();
-                    //Set the information for the mesh
-                    //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited
-                    handledMesh.indices = indicesForBabylon.slice();
-                    handledMesh.positions = unwrappedPositionsForBabylon.slice();
-                    handledMesh.normals = unwrappedNormalsForBabylon.slice();
-                    handledMesh.uvs = unwrappedUVForBabylon.slice();
-
-                    //Reset the array for the next mesh
-                    indicesForBabylon = [];
-                    unwrappedPositionsForBabylon = [];
-                    unwrappedNormalsForBabylon = [];
-                    unwrappedUVForBabylon = [];
-                }
-            };
-            //Main function
-
-            //Split the file into lines
-            var lines = data.split('\n');
-            //Look at each line
-            for (var i = 0; i < lines.length; i++) {
-                var line = lines[i].trim();
-                var result;
-
-                //Comment or newLine
-                if (line.length === 0 || line.charAt(0) === '#') {
-                    continue;
-
-                    //Get information about one position possible for the vertices
-                } else if ((result = this.vertexPattern.exec(line)) !== null) {
-                    //Create a Vector3 with the position x, y, z
-                    //Value of result:
-                    // ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
-                    //Add the Vector in the list of positions
-                    positions.push(new BABYLON.Vector3(
-                        parseFloat(result[1]),
-                        parseFloat(result[2]),
-                        parseFloat(result[3])
-                    ));
-
-                } else if ((result = this.normalPattern.exec(line)) !== null) {
-                    //Create a Vector3 with the normals x, y, z
-                    //Value of result
-                    // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
-                    //Add the Vector in the list of normals
-                    normals.push(new BABYLON.Vector3(
-                        parseFloat(result[1]),
-                        parseFloat(result[2]),
-                        parseFloat(result[3])
-                    ));
-
-                } else if ((result = this.uvPattern.exec(line)) !== null) {
-                    //Create a Vector2 with the normals u, v
-                    //Value of result
-                    // ["vt 0.1 0.2 0.3", "0.1", "0.2"]
-                    //Add the Vector in the list of uvs
-                    uvs.push(new BABYLON.Vector2(
-                        parseFloat(result[1]),
-                        parseFloat(result[2])
-                    ));
-
-
-                    //Identify patterns of faces
-                    //Face could be defined in different type of pattern
-                } else if ((result = this.facePattern3.exec(line)) !== null) {
-                    //Value of result:
-                    //["f 1/1/1 2/2/2 3/3/3", "1/1/1 2/2/2 3/3/3"...]
-
-                    //Set the data for this face
-                    setDataForCurrentFaceWithPattern3(
-                        result[1].trim().split(" "), // ["1/1/1", "2/2/2", "3/3/3"]
-                        1
-                    );
-
-
-                } else if ((result = this.facePattern4.exec(line)) !== null) {
-                    //Value of result:
-                    //["f 1//1 2//2 3//3", "1//1 2//2 3//3"...]
-
-                    //Set the data for this face
-                    setDataForCurrentFaceWithPattern4(
-                        result[1].trim().split(" "), // ["1//1", "2//2", "3//3"]
-                        1
-                    );
-
-                } else if ((result = this.facePattern2.exec(line)) !== null) {
-                    //Value of result:
-                    //["f 1/1 2/2 3/3", "1/1 2/2 3/3"...]
-
-                    //Set the data for this face
-                    setDataForCurrentFaceWithPattern2(
-                        result[1].trim().split(" "), // ["1/1", "2/2", "3/3"]
-                        1
-                    );
-
-                } else if ((result = this.facePattern1.exec(line)) !== null) {
-                    //Value of result
-                    //["f 1 2 3", "1 2 3"...]
-
-                    //Set the data for this face
-                    setDataForCurrentFaceWithPattern1(
-                        result[1].trim().split(" "), // ["1", "2", "3"]
-                        1
-                    );
-
-                    //Define a mesh or an object
-                    //Each time this keyword is analysed, create a new Object with all data for creating a babylonMesh
-                } else if (this.group.test(line) || this.obj.test(line)) {
-                    //Create a new mesh corresponding to the name of the group.
-                    //Definition of the mesh
-                    var objMesh: {
-                        name: string;
-                        indices: Array<number>;
-                        positions: Array<number>;
-                        normals: Array<number>;
-                        uvs: Array<number>;
-                        materialName: string;
-                    } =
-                        //Set the name of the current obj mesh
-                        {
-                            name: line.substring(2).trim(),
-                            indices: undefined,
-                            positions: undefined,
-                            normals: undefined,
-                            uvs: undefined,
-                            materialName: ""
-                        };
-                    addPreviousObjMesh();
-
-                    //Push the last mesh created with only the name
-                    meshesFromObj.push(objMesh);
-
-                    //Set this variable to indicate that now meshesFromObj has objects defined inside
-                    hasMeshes = true;
-                    isFirstMaterial = true;
-                    increment = 1;
-                    //Keyword for applying a material
-                } else if (this.usemtl.test(line)) {
-                    //Get the name of the material
-                    materialNameFromObj = line.substring(7).trim();
-
-                    //If this new material is in the same mesh
-
-                    if (!isFirstMaterial) {
-                        //Set the data for the previous mesh
-                        addPreviousObjMesh();
-                        //Create a new mesh
-                        var objMesh: {
-                            name: string;
-                            indices: Array<number>;
-                            positions: Array<number>;
-                            normals: Array<number>;
-                            uvs: Array<number>;
-                            materialName: string;
-                        } =
-                            //Set the name of the current obj mesh
-                            {
-                                name: objMeshName + "_mm" + increment.toString(),
-                                indices: undefined,
-                                positions: undefined,
-                                normals: undefined,
-                                uvs: undefined,
-                                materialName: materialNameFromObj
-                            };
-                        increment++;
-                        //If meshes are already defined
-                        meshesFromObj.push(objMesh);
-                    }
-                    //Set the material name if the previous line define a mesh
-
-                    if (hasMeshes && isFirstMaterial) {
-                        //Set the material name to the previous mesh (1 material per mesh)
-                        meshesFromObj[meshesFromObj.length - 1].materialName = materialNameFromObj;
-                        isFirstMaterial = false;
-                    }
-                    //Keyword for loading the mtl file
-                } else if (this.mtllib.test(line)) {
-                    //Get the name of mtl file
-                    fileToLoad = line.substring(7).trim();
-
-                    //Apply smoothing
-                } else if (this.smooth.test(line)) {
-                    // smooth shading => apply smoothing
-                    //Toda  y I don't know it work with babylon and with obj.
-                    //With the obj file  an integer is set
-                } else {
-                    //If there is another possibility
-                    console.log("Unhandled expression at line : " + line);
-                }
-            }
-
-            //At the end of the file, add the last mesh into the meshesFromObj array
-            if (hasMeshes) {
-                //Set the data for the last mesh
-                handledMesh = meshesFromObj[meshesFromObj.length - 1];
-
-                //Reverse indices for displaying faces in the good sens
-                indicesForBabylon.reverse();
-                //Get the good array
-                unwrapData();
-                //Set array
-                handledMesh.indices = indicesForBabylon;
-                handledMesh.positions = unwrappedPositionsForBabylon;
-                handledMesh.normals = unwrappedNormalsForBabylon;
-                handledMesh.uvs = unwrappedUVForBabylon;
-            }
-
-            //If any o or g keyword found, create a mesj with a random id
-            if (!hasMeshes) {
-                // reverse tab of indices
-                indicesForBabylon.reverse();
-                //Get positions normals uvs
-                unwrapData();
-                //Set data for one mesh
-                meshesFromObj.push({
-                    name: BABYLON.Geometry.RandomId(),
-                    indices: indicesForBabylon,
-                    positions: unwrappedPositionsForBabylon,
-                    normals: unwrappedNormalsForBabylon,
-                    uvs: unwrappedUVForBabylon,
-                    materialName: materialNameFromObj
-                });
-            }
-
-            //Create a BABYLON.Mesh list
-            var babylonMeshesArray: Array<BABYLON.Mesh> = []; //The mesh for babylon
-            var materialToUse = [];
-
-            //Set data for each mesh
-            for (var j = 0; j < meshesFromObj.length; j++) {
-
-                //check meshesNames (stlFileLoader)
-                if (meshesNames && meshesFromObj[j].name) {
-                    if (meshesNames instanceof Array) {
-                        if (meshesNames.indexOf(meshesFromObj[j].name) == -1) {
-                            continue;
-                        }
-                    }
-                    else {
-                        if (meshesFromObj[j].name !== meshesNames) {
-                            continue;
-                        }
-                    }
-                }
-
-                //Get the current mesh
-                //Set the data with VertexBuffer for each mesh
-                handledMesh = meshesFromObj[j];
-                //Create a BABYLON.Mesh with the name of the obj mesh
-                var babylonMesh = new BABYLON.Mesh(meshesFromObj[j].name, scene);
-                //Push the name of the material to an array
-                //This is indispensable for the importMesh function
-                materialToUse.push(meshesFromObj[j].materialName);
-
-                var vertexData: VertexData = new BABYLON.VertexData(); //The container for the values
-                //Set the data for the babylonMesh
-                vertexData.positions = handledMesh.positions;
-                vertexData.normals = handledMesh.normals;
-                vertexData.uvs = handledMesh.uvs;
-                vertexData.indices = handledMesh.indices;
-                //Set the data from the VertexBuffer to the current BABYLON.Mesh
-                vertexData.applyToMesh(babylonMesh);
-                //Push the mesh into an array
-                babylonMeshesArray.push(babylonMesh);
-            }
-            //load the materials
-            //Check if we have a file to load
-            if (fileToLoad !== "") {
-                //Load the file synchronously
-                this._loadMTL(fileToLoad, rootUrl, function (dataLoaded) {
-                    //Create materials thanks MTLLoader function
-                    materialsFromMTLFile.parseMTL(scene, dataLoaded, rootUrl);
-                    //Look at each material loaded in the mtl file
-                    for (var n = 0; n < materialsFromMTLFile.materials.length; n++) {
-                        //Three variables to get all meshes with the same material
-                        var startIndex = 0;
-                        var _indices = [];
-                        var _index;
-
-                        //The material from MTL file is used in the meshes loaded
-                        //Push the indice in an array
-                        //Check if the material is not used for another mesh
-                        while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {
-                            _indices.push(_index);
-                            startIndex = _index + 1;
-                        }
-                        //If the material is not used dispose it
-                        if (_index == -1 && _indices.length == 0) {
-                            //If the material is not needed, remove it
-                            materialsFromMTLFile.materials[n].dispose();
-                        } else {
-                            for (var o = 0; o < _indices.length; o++) {
-                                //Apply the material to the BABYLON.Mesh for each mesh with the material
-                                babylonMeshesArray[_indices[o]].material = materialsFromMTLFile.materials[n];
-                            }
-                        }
-                    }
-
-                });
-            }
-            //Return an array with all BABYLON.Mesh
-            return babylonMeshesArray;
-        }
-
-    }
-    //Add this loader into the register plugin
-    BABYLON.SceneLoader.RegisterPlugin(new OBJFileLoader());
-}

+ 0 - 31
loaders/config.json

@@ -1,31 +0,0 @@
-{
-  "loaders": {
-    "stl": {
-      "files": ["STL/babylon.stlFileLoader.ts"],
-      "output": "./STL",
-      "filename": "babylon.stlFileLoader.js"
-    },
-
-    "obj": {
-      "files": ["OBJ/babylon.objFileLoader.ts"],
-      "output": "./OBJ",
-      "filename": "babylon.objFileLoader.js"
-    },
-
-    "gltf": {
-      "files": [
-        "glTF/babylon.glTFFileLoaderInterfaces.ts",
-        "glTF/babylon.glTFFileLoader.ts",
-        "glTF/babylon.glTFFileLoaderUtils.ts",
-        "glTF/babylon.glTFFileLoaderExtension.ts",
-        "glTF/babylon.glTFBinaryExtension.ts"
-      ],
-      "output": "./glTF",
-      "filename": "babylon.glTFFileLoader.js"
-    }
-  },
-
-  "defines": [
-    "../dist/preview release/*.d.ts"
-  ]
-}

+ 0 - 41
loaders/gulpfile.js

@@ -1,41 +0,0 @@
-var gulp = require("gulp");
-var typescript = require("gulp-typescript");
-var concat = require("gulp-concat");
-var config = require("./config.json");
-var packageConfig = require("./package.json");
-
-/*
-* Compiles all typescript files and merges in single loader files
-*/
-gulp.task("build", function () {
-    for (var loaderName in config.loaders) {
-        var loader = config.loaders[loaderName];
-
-        var result = gulp.src(loader.files.concat(config.defines))
-            .pipe(typescript({
-                target: "ES5",
-                declarationFiles: true,
-                experimentalDecorators: false
-            }));
-        
-        result.js
-            .pipe(concat(loader.filename))
-            .pipe(gulp.dest(loader.output));
-    }
-});
-
-/*
-* Automatically call the "default" task when a TS file changes
-*/
-gulp.task("watch", function() {
-    var files = [];
-    for (var loaderName in config.loaders) {
-        files = files.concat(config.loaders[loaderName].files);
-    }
-
-	gulp.watch(files, ["build"]);
-});
-
-gulp.task("default", ["build"], function() {
-    // Nothing...
-});

+ 0 - 14
loaders/package.json

@@ -1,14 +0,0 @@
-{
-  "name": "BabylonJSLoaders",
-  "version": "0.8.0",
-  "description": "Babylon.js file loaders",
-  "repository": { "url": "https://github.com/BabylonJS/BabylonJS/" },
-  "readme": "https://github.com/BabylonJS/BabylonJS/blob/master/README.md",
-  "license": "(Apache-2.0)",
-  "devDependencies": {
-    "gulp": "^3.8.11",
-    "typescript": "^1.8.10",
-    "gulp-typescript": "~2.13.0",
-    "gulp-concat": "~2.6.0"
-  }
-}

+ 6 - 0
loaders/readme.md

@@ -17,4 +17,10 @@ BABYLON.SceneLoader.Load("/Files/", "ch9.stl", engine, function (newScene) {
        newScene.render(); 
    }); 
 });
+```
+
+To compile, from the tools/gulp folder:
+
+```
+gulp loaders
 ```

+ 3 - 1
loaders/STL/babylon.stlFileLoader.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
 
     export class STLFileLoader implements ISceneLoaderPlugin {
 

loaders/glTF/README.md → loaders/src/glTF/README.md


+ 3 - 1
loaders/glTF/babylon.glTFBinaryExtension.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
     const BinaryExtensionBufferName = "binary_glTF";
 
     enum EContentFormat {

+ 3 - 1
loaders/glTF/babylon.glTFFileLoader.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
     /**
     * Tokenizer. Used for shaders compatibility
     * Automatically map world, view, projection, worldViewProjection, attributes and so on

+ 3 - 1
loaders/glTF/babylon.glTFFileLoaderExtension.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
     export abstract class GLTFFileLoaderExtension {
         private _name: string;
 

+ 3 - 1
loaders/glTF/babylon.glTFFileLoaderInterfaces.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
     /**
     * Enums
     */

+ 3 - 1
loaders/glTF/babylon.glTFFileLoaderUtils.ts

@@ -1,4 +1,6 @@
-module BABYLON {
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON {
     /**
     * Utils functions for GLTF
     */

+ 7 - 0
loaders/src/tsconfig.json

@@ -0,0 +1,7 @@
+{
+    "compilerOptions": {
+        "experimentalDecorators": true,
+        "module": "commonjs", 
+        "target": "es5"
+    }
+}

+ 1 - 0
localDev/.gitignore

@@ -0,0 +1 @@
+src/**/*

+ 85 - 0
localDev/index.html

@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>Local Development</title>
+	<script src="../assets/refs/dat.gui.min.js"></script>
+	<script src="../tools/DevLoader/BabylonLoader.js"></script>
+
+	<style>
+		html, body {
+			width: 100%;
+			height: 100%;
+			padding: 0;
+			margin: 0;
+			overflow: hidden;
+		}
+
+		#renderCanvas {
+			width: 100%;
+			height: 100%;
+		}
+
+		#fps {
+			position: absolute;
+			background-color: black;
+			border: 2px solid red;
+			text-align: center;
+			font-size: 16px;
+			color: white;
+			top: 15px;
+			left: 10px;
+			width: 60px;
+			height: 20px;
+		}
+	</style>
+</head>
+<body>
+	<div id="fps">0</div>
+	<canvas id="renderCanvas"></canvas>
+	
+	<script>
+		var canvas = document.getElementById("renderCanvas");
+		var divFps = document.getElementById("fps");
+
+		// Global to simulate PG.
+		var engine = null;
+
+		// Allow querystring to navigate easily in debug in local samples.
+		var indexjs = 'src/index';
+		var sampleSearch = /sample=([0-9]+)/i;
+		var matches = null;
+		if ((matches = sampleSearch.exec(window.location)) !== null) {			
+			indexjs += '.';
+			indexjs += matches[1];
+		}
+		indexjs += '.js';
+
+		// Load the scripts + map file to allow vscode debug.
+		BABYLONDEVTOOLS.Loader
+			.require(indexjs)
+			.load(function() {
+				if (BABYLON.Engine.isSupported()) {
+					engine = new BABYLON.Engine(canvas, true);				
+
+					// call the scene creation from the js.
+					var scene = createScene();
+
+					// Register a render loop to repeatedly render the scene
+					engine.runRenderLoop(function () {
+						scene.render();
+						divFps.innerHTML = engine.getFps().toFixed() + " fps";
+					});
+
+					// Resize
+					window.addEventListener("resize", function () {
+						engine.resize();
+					});
+					
+				}
+				else {
+					alert('BabylonJS is not supported.')
+				}
+			});
+	</script>
+</body>
+</html>

+ 34 - 0
localDev/template/index.js

@@ -0,0 +1,34 @@
+/// <reference path="../../dist/preview release/babylon.d.ts"/>
+
+// Playground like creation of the scene
+var createScene = function () {
+
+    // This creates a basic Babylon Scene object (non-mesh)
+    var scene = new BABYLON.Scene(engine);
+
+    // This creates and positions a free camera (non-mesh)
+    var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
+
+    // This targets the camera to scene origin
+    camera.setTarget(BABYLON.Vector3.Zero());
+
+    // This attaches the camera to the canvas
+    camera.attachControl(canvas, true);
+
+    // This creates a light, aiming 0,1,0 - to the sky (non-mesh)
+    var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
+
+    // Default intensity is 1. Let's dim the light a small amount
+    light.intensity = 0.7;
+
+    // Our built-in 'sphere' shape. Params: name, subdivs, size, scene
+    var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene);
+
+    // Move the sphere upward 1/2 its height
+    sphere.position.y = 1;
+
+    // Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene
+    var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene);
+
+    return scene;
+};

+ 4 - 14
materialsLibrary/index.html

@@ -3,18 +3,7 @@
 <head>
 	<title>Shaders Library</title>
 	<script src="../assets/refs/dat.gui.min.js"></script>
-	<script src="../dist/preview release/babylon.max.js"></script>
-	<script src="../dist/materialsLibrary/babylon.simpleMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.normalMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.waterMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.fireMaterial.js"></script>
-    <script src="../dist/materialsLibrary/babylon.lavaMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.terrainMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.furMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.triPlanarMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.gradientMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.skyMaterial.js"></script>
-	<script src="../dist/materialsLibrary/babylon.gridMaterial.js"></script>
+	<script src="../tools/DevLoader/BabylonLoader.js"></script>
 
 	<style>
 		html, body {
@@ -62,12 +51,13 @@
     <script src="test/addpbr.js"></script>
 	
 	<script>
+	BABYLONDEVTOOLS.Loader.load(function() {
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
 			var engine = new BABYLON.Engine(canvas, true);
 			var divFps = document.getElementById("fps");
 
-			var scene = new BABYLON.Scene(engine);
+			scene = new BABYLON.Scene(engine);
 
 			var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 6, 50, BABYLON.Vector3.Zero(), scene);
 			camera.attachControl(canvas, true);
@@ -361,7 +351,7 @@
 				});
 			});
 		}
-
+	});
 	</script>
 </body>
 </html>

+ 17 - 20
materialsLibrary/readme.md

@@ -33,35 +33,32 @@ But you can also start from scratch as you are not forced to support all these f
 
 ## Integrating the material in the build process
 
-To build all materials and generate the *dist* folder, just run:
+To build all materials and generate the *dist* folder, just run from the tools/gulp folder:
 
 ```
-gulp
+gulp materialsLibrary
 ```
 
-To integrate your new material to the build process, you have to edit the config.sjon file and add an entry in the "materials" section of the file:
+To integrate your new material to the build process, you have to edit the config.json file in the tools/gulp and add an entry in the "materialsLibrary/libraries" section of the file:
 
 ```
-{
-  "materials": [
-    {
-      "file": "shaders/simple/babylon.simpleMaterial.ts",
-      "shaderFiles": [
-        "shaders/simple/simple.vertex.fx",
-        "shaders/simple/simple.fragment.fx"
-      ],
-      "output": "babylon.simpleMaterial.js"
-    }
-  ],
-  "build": {
-    "distOutputDirectory": "dist/"
-  }
-}
+  "libraries": [
+    ...
+      {
+        "files": ["../../materialsLibrary/src/gradient/babylon.gradientMaterial.ts"],
+        "shaderFiles": [
+          "../../materialsLibrary/src/gradient/gradient.vertex.fx",
+          "../../materialsLibrary/src/gradient/gradient.fragment.fx"
+        ],
+        "output": "babylon.gradientMaterial.js"
+      }
+      ...
+  ]
 ```
 
 ## Testing your material
 
-To test your material, you can use the /test/index.html file by adding a reference to your .js file. Then you will need to update the code to create an instance of your material and reference it in the UI system:
+To test your material, you can use the /materialsLibrary/index.html page. References are added automatically. You only need to update the code to create an instance of your material and reference it in the UI system:
 
 ```
 gui.add(options, 'material', ['standard', 'simple']).onFinishChange(function () {
@@ -80,7 +77,7 @@ gui.add(options, 'material', ['standard', 'simple']).onFinishChange(function ()
 
 This page allows you to test your code with animated meshes, shadows, various kinds of lights and fog. Just use the UI on the right to turn features on and off.
 
-To serve this page, you can start:
+To serve this page, you can start from the tools/gulp folder the task:
 
 ```
 gulp webserver

+ 1 - 1
materialsLibrary/src/gradient/babylon.gradientMaterial.ts

@@ -265,7 +265,7 @@ module BABYLON {
                     ["diffuseSampler",
                         "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3"
                     ],
-                    join, fallbacks, this.onCompiled, this.onError);
+                    join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: 4 });
             }
             if (!this._effect.isReady()) {
                 return false;

+ 1 - 1
materialsLibrary/src/lava/babylon.lavaMaterial.ts

@@ -279,7 +279,7 @@ module BABYLON {
                     ["diffuseSampler",
                         "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3", "noiseTexture"
                     ],
-                    join, fallbacks, this.onCompiled, this.onError);
+                    join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: this.maxSimultaneousLights - 1 });
             }
             if (!this._effect.isReady()) {
                 return false;

+ 1 - 1
materialsLibrary/src/normal/babylon.normalMaterial.ts

@@ -255,7 +255,7 @@ module BABYLON {
                     ["diffuseSampler",
                         "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3"
                     ],
-                    join, fallbacks, this.onCompiled, this.onError);
+                    join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: 4 });
             }
             if (!this._effect.isReady()) {
                 return false;

+ 5 - 5
materialsLibrary/src/tsconfig.json

@@ -1,7 +1,7 @@
 {
-    "compilerOptions": {
-        "experimentalDecorators": true,
-        "module": "commonjs", 
-        "target": "es5"
-    }
+  "compilerOptions": {
+    "experimentalDecorators": true,
+    "module": "commonjs",
+    "target": "es5"
+  }
 }

+ 12 - 8
postProcessLibrary/index.html

@@ -1,26 +1,26 @@
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
+
 <head>
 	<title>Shaders Library</title>
 	<script src="../assets/refs/dat.gui.min.js"></script>
-	<script src="../dist/preview release/babylon.max.js"></script>
-	<script src="../dist/postProcessesLibrary/babylon.asciiArtPostProcess.js"></script>
-	<script src="../dist/postProcessesLibrary/babylon.digitalRainPostProcess.js"></script>
+	<script src="../tools/DevLoader/BabylonLoader.js"></script>
 
 	<style>
-		html, body {
+		html,
+		body {
 			width: 100%;
 			height: 100%;
 			padding: 0;
 			margin: 0;
 			overflow: hidden;
 		}
-
+		
 		#renderCanvas {
 			width: 100%;
 			height: 100%;
 		}
-
+		
 		#fps {
 			position: absolute;
 			background-color: black;
@@ -35,11 +35,13 @@
 		}
 	</style>
 </head>
+
 <body>
 	<div id="fps">0</div>
 	<canvas id="renderCanvas"></canvas>
-	
+
 	<script>
+	BABYLONDEVTOOLS.Loader.load(function() {
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
 			var engine = new BABYLON.Engine(canvas, true);
@@ -95,7 +97,9 @@
 				}
 			});
 		}
+	});
 
 	</script>
 </body>
-</html>
+
+</html>

+ 41 - 17
postProcessLibrary/readme.md

@@ -9,33 +9,57 @@ sphere.material.diffuseTexture = fire;
 
 ## Adding a new post process to the library
 
-To add a new post process, you have to create your own folder in *postProcesses* folder. Then you need to add a .ts file and one .fragment.fx files:
+To add a new post process, you have to create your own folder in *postProcesses/src* folder. Then you need to add a .ts file and one .fragment.fx files:
 * The .ts is the TypeScript code of your post process
 * .fx file: GLSL code for fragment shaders
 
 ## Integrating the post process in the build process
 
-To build all post processes and generate the *dist* folder, just run:
+To build all post processes and generate the *dist* folder, just run from the tools/gulp folder:
 
 ```
-gulp
+gulp postProcesLibrary
 ```
 
-To integrate your new post process to the build process, you have to edit the config.sjon file and add an entry in the "postProcesses" section of the file:
+To integrate your new post process to the build process, you have to edit the config.json file in the tools/gulp folder and add an entry in the "postProcessLibray/libraries" section of the file:
 
 ```
-{
-  "postProcesses": [
-    {
-      "file": "postProcesses/asciiArt/babylon.asciiArtPostProcess.ts",
-      "shaderFiles": [
-        "postProcesses/asciiArt/asciiart.fragment.fx"
-      ],
-      "output": "babylon.asciiArtPostProcess.js"
-    }
-  ],
-  "build": {
-    "distOutputDirectory": "dist/"
+  "libraries": [   
+    ... 
+      {
+        "files": ["../../postProcessLibrary/src/asciiArt/babylon.asciiArtPostProcess.ts"],
+        "shaderFiles": [
+          "../../postProcessLibrary/src/asciiArt/asciiart.fragment.fx"
+        ],
+        "output": "babylon.asciiArtPostProcess.js"
+      }
+    '''
+  ]
+```
+
+## Testing your post process
+
+To test your post process, you can use the /postProcessLibrary/index.html  page. References are added automatically. You only need to update the code to create an instance of your material and reference it in the UI system:
+
+```
+switch (options.postProcess) {
+    case "asciiArt":
+      camera.detachPostProcess(aaPostProcess);
+      camera.detachPostProcess(drPostProcess);
+      camera.attachPostProcess(aaPostProcess);
+      break;
+    case "digitalRain":
+      camera.detachPostProcess(aaPostProcess);
+      camera.detachPostProcess(drPostProcess);
+      camera.attachPostProcess(drPostProcess);
+      break;
   }
-}
+```
+
+This page allows you to test your code on a simple sphere.
+
+To serve this page, you can start from the tools/gulp folder the task:
+
+```
+gulp webserver
 ```

proceduralTexturesLibrary/tsconfig.json → postProcessLibrary/src/tsconfig.json


+ 20 - 23
proceduralTexturesLibrary/index.html

@@ -1,32 +1,26 @@
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
+
 <head>
 	<title>Procedural textures Library</title>
 	<script src="../assets/refs/dat.gui.min.js"></script>
-	<script src="../dist/preview release/babylon.max.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.fireProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.woodProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.cloudProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.grassProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.roadProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.brickProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.marbleProceduralTexture.js"></script>
-	<script src="../dist/proceduralTexturesLibrary/babylon.starfieldProceduralTexture.js"></script>
+	<script src="../tools/DevLoader/BabylonLoader.js"></script>
 
 	<style>
-		html, body {
+		html,
+		body {
 			width: 100%;
 			height: 100%;
 			padding: 0;
 			margin: 0;
 			overflow: hidden;
 		}
-
+		
 		#renderCanvas {
 			width: 100%;
 			height: 100%;
 		}
-
+		
 		#fps {
 			position: absolute;
 			background-color: black;
@@ -41,26 +35,28 @@
 		}
 	</style>
 </head>
+
 <body>
 	<div id="fps">0</div>
 	<canvas id="renderCanvas"></canvas>
 
 	<script src="test/index.js"></script>
-    <script src="test/addCloudPT.js"></script>
-    <script src="test/addFirePT.js"></script>
-    <script src="test/addWoodPT.js"></script>
-    <script src="test/addGrassPT.js"></script>
-    <script src="test/addRoadPT.js"></script>
-    <script src="test/addBrickPT.js"></script>
-    <script src="test/addMarblePT.js"></script>
-    <script src="test/addStarfieldPT.js"></script>
+	<script src="test/addCloudPT.js"></script>
+	<script src="test/addFirePT.js"></script>
+	<script src="test/addWoodPT.js"></script>
+	<script src="test/addGrassPT.js"></script>
+	<script src="test/addRoadPT.js"></script>
+	<script src="test/addBrickPT.js"></script>
+	<script src="test/addMarblePT.js"></script>
+	<script src="test/addStarfieldPT.js"></script>
 	<script>
+		BABYLONDEVTOOLS.Loader.load(function() {
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
 			var engine = new BABYLON.Engine(canvas, true);
 			var divFps = document.getElementById("fps");
 
-			var scene = new BABYLON.Scene(engine);
+			scene = new BABYLON.Scene(engine);
 
 			var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 6, 50, BABYLON.Vector3.Zero(), scene);
 			camera.attachControl(canvas, true);
@@ -409,7 +405,8 @@
 				});
 			});
 		}
-
+		});
 	</script>
 </body>
-</html>
+
+</html>

+ 16 - 19
proceduralTexturesLibrary/readme.md

@@ -15,34 +15,31 @@ To add a new procedural texture, you have to create your own folder in *procedur
 
 ## Integrating the procedural texture in the build process
 
-To build all procedural textures and generate the *dist* folder, just run:
+To build all procedural textures and generate the *dist* folder, just run from the tools/gulp folder:
 
 ```
-gulp
+gulp proceduralTextureLibrary
 ```
 
-To integrate your new procedural texture to the build process, you have to edit the config.sjon file and add an entry in the "proceduralTextures" section of the file:
+To integrate your new procedural texture to the build process, you have to edit the config.sjonfile in the tools/gulp folder and add an entry in the "proceduralTextureLibrary/libraries" section of the file:
 
 ```
-{
-  "proceduralTextures": [
-    {
-      "file": "proceduralTextures/fire/babylon.fireProceduralTexture.ts",
-      "shaderFiles": [
-        "proceduralTextures/fire/fireProceduralTexture.fragment.fx"
-      ],
-      "output": "babylon.fireProceduralTexture.js"
-    }
-  ],
-  "build": {
-    "distOutputDirectory": "dist/"
-  }
-}
+  "libraries": [
+    ...
+      {
+        "files": ["../../proceduralTexturesLibrary/src/wood/babylon.woodProceduralTexture.ts"],
+        "shaderFiles": [
+          "../../proceduralTexturesLibrary/src/wood/woodProceduralTexture.fragment.fx"
+        ],
+        "output": "babylon.woodProceduralTexture.js"
+      }
+    ...
+  ]
 ```
 
 ## Testing your procedural texture
 
-To test your procedural texture, you can use the /test/index.html file by adding a reference to your .js file. Then you will need to update the code to create an instance of your procedural texture and reference it in the UI system:
+To test your procedural texture, you can use the /proceduralTextureLibrary/index.html  page. References are added automatically. You only need to update the code to create an instance of your procedural texture and reference it in the UI system:
 
 ```
 gui.add(options, 'texture', ['default', 'fire', 'wood', 'cloud', 'grass', 'road', 'brick', 'marble', '[YOURTEXTURE]', 'starfield']).onFinishChange(function () {
@@ -70,7 +67,7 @@ gui.add(options, 'texture', ['default', 'fire', 'wood', 'cloud', 'grass', 'road'
 
 This page allows you to test your code with animated meshes, shadows, various kinds of lights and fog. Just use the UI on the right to turn features on and off.
 
-To serve this page, you can start:
+To serve this page, you can start from the tools/gulp folder the task:
 
 ```
 gulp webserver

postProcessLibrary/tsconfig.json → proceduralTexturesLibrary/src/tsconfig.json


+ 0 - 17
serializers/.gitignore

@@ -1,17 +0,0 @@
-#NodeJS
-node_modules
-
-
-# OS or Editor folders
-*.DS_Store
-._*
-Thumbs.db
-.cache
-.project
-.settings
-.tmproj
-nbproject
-*.sublime-project
-*.sublime-workspace
-.directory
-build

+ 0 - 102
serializers/OBJ/babylon.objSerializer.ts

@@ -1,102 +0,0 @@
-/// <reference path="../babylon.d.ts"/>
-module BABYLON {
- export class OBJExport {
-        //Exports the geometry of a Mesh in .OBJ file format (text)
-        public static OBJ(mesh: Mesh, materials?: boolean, matlibname?: string): string {
-            var output = [];
-            var g = mesh.geometry;
-            var trunkVerts = g.getVerticesData('position');
-            var trunkNormals = g.getVerticesData('normal');
-            var trunkUV = g.getVerticesData('uv');
-            var trunkFaces = g.getIndices();
-            if (materials) {
-                if (!matlibname) {
-                    matlibname = 'mat';
-                }
-                output.push("mtllib " + matlibname + ".mtl");
-            }
-            for (var i = 0; i < trunkVerts.length; i += 3) {
-                output.push("v " + trunkVerts[i] + " " + trunkVerts[i + 1] + " " + trunkVerts[i + 2]);
-            }
-            for (i = 0; i < trunkNormals.length; i += 3) {
-                output.push("vn " + trunkNormals[i] + " " + trunkNormals[i + 1] + " " + trunkNormals[i + 2]);
-            }
-            for (i = 0; i < trunkUV.length; i += 2) {
-                output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
-            }
-
-            //TODO: submeshes (groups)
-            //TODO: smoothing groups (s 1, s off)
-
-            output.push("g gr1");
-            if (materials) {
-                output.push("usemtl mat1");
-            }
-            for (i = 0; i < trunkFaces.length; i += 3) {
-                output.push(
-                    "f " + (trunkFaces[i + 2] + 1) + "/" + (trunkFaces[i + 2] + 1) + "/" + (trunkFaces[i + 2] + 1) +
-                    " " + (trunkFaces[i + 1] + 1) + "/" + (trunkFaces[i + 1] + 1) + "/" + (trunkFaces[i + 1] + 1) +
-                    " " + (trunkFaces[i] + 1) + "/" + (trunkFaces[i] + 1) + "/" + (trunkFaces[i] + 1)
-                );
-            }
-            var text = output.join("\n");
-            return (text);
-        }
-
-        //Exports the material(s) of a mesh in .MTL file format (text)
-        public static MTL(mesh: Mesh): string {
-            var output = [];
-            var m = <StandardMaterial>mesh.material;
-            output.push("newmtl mat1");
-            output.push("  Ns " + m.specularPower.toFixed(4));
-            output.push("  Ni 1.5000");
-            output.push("  d " + m.alpha.toFixed(4));
-            output.push("  Tr 0.0000");
-            output.push("  Tf 1.0000 1.0000 1.0000");
-            output.push("  illum 2");
-            output.push("  Ka " + m.ambientColor.r.toFixed(4) + " " + m.ambientColor.g.toFixed(4) + " " + m.ambientColor.b.toFixed(4));
-            output.push("  Kd " + m.diffuseColor.r.toFixed(4) + " " + m.diffuseColor.g.toFixed(4) + " " + m.diffuseColor.b.toFixed(4));
-            output.push("  Ks " + m.specularColor.r.toFixed(4) + " " + m.specularColor.g.toFixed(4) + " " + m.specularColor.b.toFixed(4));
-            output.push("  Ke " + m.emissiveColor.r.toFixed(4) + " " + m.emissiveColor.g.toFixed(4) + " " + m.emissiveColor.b.toFixed(4));
-
-            //TODO: uv scale, offset, wrap
-            //TODO: UV mirrored in Blender? second UV channel? lightMap? reflection textures?
-            var uvscale = "";
-
-            if (m.ambientTexture) {
-                output.push("  map_Ka " + uvscale + m.ambientTexture.name);
-            }
-
-            if (m.diffuseTexture) {
-                output.push("  map_Kd " + uvscale + m.diffuseTexture.name);
-                //TODO: alpha testing, opacity in diffuse texture alpha channel (diffuseTexture.hasAlpha -> map_d)
-            }
-
-            if (m.specularTexture) {
-                output.push("  map_Ks " + uvscale + m.specularTexture.name);
-                /* TODO: glossiness = specular highlight component is in alpha channel of specularTexture. (???)
-                if (m.useGlossinessFromSpecularMapAlpha)  {
-                    output.push("  map_Ns "+uvscale + m.specularTexture.name);
-                }
-                */
-            }
-
-            /* TODO: emissive texture not in .MAT format (???)
-            if (m.emissiveTexture) {
-                output.push("  map_d "+uvscale+m.emissiveTexture.name);
-            }
-            */
-
-            if (m.bumpTexture) {
-                output.push("  map_bump -imfchan z " + uvscale + m.bumpTexture.name);
-            }
-
-            if (m.opacityTexture) {
-                output.push("  map_d " + uvscale + m.opacityTexture.name);
-            }
-
-            var text = output.join("\n");
-            return (text);
-        }
-    }
-}

+ 0 - 2
serializers/OBJ/readme.md

@@ -1,2 +0,0 @@
-## Babylon.js OBJ serializer
-

文件差异内容过多而无法显示
+ 0 - 6319
serializers/babylon.d.ts


+ 0 - 5
serializers/config.json

@@ -1,5 +0,0 @@
-{
-  "typescript": [
-    "OBJ/babylon.objSerializer.ts"
-  ]
-}

+ 0 - 0
serializers/gulpfile.js


部分文件因为文件数量过多而无法显示