Bläddra i källkod

Simplify glTFFileLoader packaging

Gary Hsu 8 år sedan
förälder
incheckning
65b7893ddd

+ 21 - 8
Tools/Gulp/config.json

@@ -509,12 +509,7 @@
             },
             },
             {
             {
                 "files": [
                 "files": [
-                    "../../loaders/src/glTF/babylon.glTFFileLoader.ts"
-                ],
-                "output": "babylon.glTFFileLoader.js"
-            },
-            {
-                "files": [
+                    "../../loaders/src/glTF/babylon.glTFFileLoader.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoaderInterfaces.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoaderInterfaces.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoader.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoader.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoaderUtils.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFLoaderUtils.ts",
@@ -522,17 +517,35 @@
                     "../../loaders/src/glTF/1.0/babylon.glTFBinaryExtension.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFBinaryExtension.ts",
                     "../../loaders/src/glTF/1.0/babylon.glTFMaterialsCommonExtension.ts"
                     "../../loaders/src/glTF/1.0/babylon.glTFMaterialsCommonExtension.ts"
                 ],
                 ],
-                "output": "babylon.glTF1Loader.js"
+                "output": "babylon.glTF1FileLoader.js"
+            },
+            {
+                "files": [
+                    "../../loaders/src/glTF/babylon.glTFFileLoader.ts",
+                    "../../loaders/src/glTF/2.0/babylon.glTFLoaderInterfaces.ts",
+                    "../../loaders/src/glTF/2.0/babylon.glTFLoader.ts",
+                    "../../loaders/src/glTF/2.0/babylon.glTFLoaderUtils.ts",
+                    "../../loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts",
+                    "../../loaders/src/glTF/2.0/babylon.glTFMaterialsPbrSpecularGlossinessExtension.ts"
+                ],
+                "output": "babylon.glTF2FileLoader.js"
             },
             },
             {
             {
                 "files": [
                 "files": [
+                    "../../loaders/src/glTF/babylon.glTFFileLoader.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFLoaderInterfaces.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFLoader.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFLoaderUtils.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFLoaderExtension.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFBinaryExtension.ts",
+                    "../../loaders/src/glTF/1.0/babylon.glTFMaterialsCommonExtension.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderInterfaces.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderInterfaces.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoader.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoader.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderUtils.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderUtils.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts",
                     "../../loaders/src/glTF/2.0/babylon.glTFMaterialsPbrSpecularGlossinessExtension.ts"
                     "../../loaders/src/glTF/2.0/babylon.glTFMaterialsPbrSpecularGlossinessExtension.ts"
                 ],
                 ],
-                "output": "babylon.glTF2Loader.js"
+                "output": "babylon.glTFFileLoader.js"
             }
             }
         ],
         ],
         "build": {
         "build": {

+ 0 - 1
loaders/src/glTF/1.0/babylon.glTFLoader.ts

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

+ 0 - 1
loaders/src/glTF/2.0/babylon.glTFLoader.ts

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

+ 24 - 14
loaders/src/glTF/README.md

@@ -1,31 +1,38 @@
 # Babylon.js glTF File Loader
 # Babylon.js glTF File Loader
 
 
 # Usage
 # Usage
-The glTF file loader is a SceneLoader plugin. The loader supports glTF version 1.0 and 2.0 and will use the correct loader based on the glTF version string. Include the version support that you want in any combination.
+The glTF file loader is a SceneLoader plugin.
+
+## Step 1 - Include the glTF File Loader
+
+**Full Version**
+
+This loader supports both glTF 1.0 and 2.0 and will use the correct loader based on the glTF version string.
 
 
-Both versions:
 ```
 ```
 <script src="babylon.js"></script>
 <script src="babylon.js"></script>
 <script src="babylon.glTFFileLoader.js"></script>
 <script src="babylon.glTFFileLoader.js"></script>
-<script src="babylon.glTF1Loader.js"></script>
-<script src="babylon.glTF2Loader.js"></script>
 ```
 ```
 
 
-Version 1 only:
+**Version 1 Only**
+
+This loader supports only glTF 1.0 and will fail to load glTF 2.0.
+
 ```
 ```
 <script src="babylon.js"></script>
 <script src="babylon.js"></script>
-<script src="babylon.glTFFileLoader.js"></script>
-<script src="babylon.glTF1Loader.js"></script>
+<script src="babylon.glTF1FileLoader.js"></script>
 ```
 ```
 
 
-Version 2 only:
+**Version 2 Only**
+
+This loader supports only glTF 2.0 and will fail to load glTF 1.0.
+
 ```
 ```
 <script src="babylon.js"></script>
 <script src="babylon.js"></script>
-<script src="babylon.glTFFileLoader.js"></script>
-<script src="babylon.glTF2Loader.js"></script>
+<script src="babylon.glTF2FileLoader.js"></script>
 ```
 ```
 
 
-And then, call the scene loader:
+## Step 2 - Call the Scene Loader
 ```
 ```
 BABYLON.SceneLoader.Load("./", "duck.gltf", engine, function (scene) { 
 BABYLON.SceneLoader.Load("./", "duck.gltf", engine, function (scene) { 
    // do somethings with the scene
    // do somethings with the scene
@@ -40,6 +47,8 @@ BABYLON.SceneLoader.ImportMesh(["myMesh1", "myMesh2", "..."], "./", "duck.gltf",
 });
 });
 ```
 ```
 
 
+## Step 3 (Optional) - Specify Flags
+
 If you want to disable incremental loading, you can set the property `IncrementalLoading` to false.
 If you want to disable incremental loading, you can set the property `IncrementalLoading` to false.
 Then, you'll be able to be called back with all geometries, shaders (V1), PBR materials (V2) loaded. Textures are always loaded asynchronously. For example, you can retrieve the real bounding infos of a mesh loaded when incremental loading is disabled.
 Then, you'll be able to be called back with all geometries, shaders (V1), PBR materials (V2) loaded. Textures are always loaded asynchronously. For example, you can retrieve the real bounding infos of a mesh loaded when incremental loading is disabled.
 ```
 ```
@@ -51,7 +60,7 @@ BABYLON.GLTFFileLoader.IncrementalLoading = false; // true by default
 BABYLON.GLTFFileLoader.HomogeneousCoordinates = true; // false by default
 BABYLON.GLTFFileLoader.HomogeneousCoordinates = true; // false by default
 ```
 ```
 
 
-## Supported features
+# Supported Features
 * Load scenes (SceneLoader.Load and SceneLoader.Append)
 * Load scenes (SceneLoader.Load and SceneLoader.Append)
 * Support of ImportMesh function
 * Support of ImportMesh function
 * Import geometries
 * Import geometries
@@ -71,8 +80,9 @@ BABYLON.GLTFFileLoader.HomogeneousCoordinates = true; // false by default
 * Handle dummy nodes (empty nodes)
 * Handle dummy nodes (empty nodes)
 * PBR materials (V2 only)
 * PBR materials (V2 only)
 
 
-## To improve
+# Future Improvements
 * Test on more geometries
 * Test on more geometries
 * Test on more animated models
 * Test on more animated models
 * Test on more skinned models
 * Test on more skinned models
-* Improve shaders support (glitches with samplers can appear in particular configurations)
+* Improve shaders support (V1 only) (glitches with samplers can appear in particular configurations)
+* Add support for morph targets (V2 only)