瀏覽代碼

Use GetAbsoluteUrl in the extension and unify configuration for local htmls

Arseny Kapoulkine 4 年之前
父節點
當前提交
eac1cf72de

+ 10 - 1
Playground/index-local.html

@@ -59,7 +59,16 @@
             BABYLONDEVTOOLS.Loader       
                 .require("index.js")
                 .load(() => {
-                    BABYLON.GLTF2.Loader.Extensions.EXT_meshopt_compression.DecoderPath = "../dist/preview%20release/meshopt_decoder.module.js";
+                    BABYLON.DracoCompression.Configuration.decoder = {
+                        wasmUrl: "../dist/preview%20release/draco_wasm_wrapper_gltf.js",
+                        wasmBinaryUrl: "../dist/preview%20release/draco_decoder_gltf.wasm",
+                        fallbackUrl: "../dist/preview%20release/draco_decoder_gltf.js"
+                    };
+                    BABYLON.GLTFValidation.Configuration = {
+                        url: "../dist/preview%20release/gltf_validator.js"
+                    };
+                    BABYLON.GLTF2.Loader.Extensions.EXT_meshopt_compression.DecoderPath =
+                        "../dist/preview%20release/meshopt_decoder.module.js";
                 });
         </script>
     </body>

+ 2 - 1
loaders/src/glTF/2.0/Extensions/EXT_meshopt_compression.ts

@@ -1,4 +1,5 @@
 import { Nullable } from "babylonjs/types";
+import { Tools } from "babylonjs/Misc/tools";
 import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
 import { GLTFLoader } from "../glTFLoader";
 import { IBufferView } from "../glTFLoaderInterfaces";
@@ -35,7 +36,7 @@ export class EXT_meshopt_compression implements IGLTFLoaderExtension {
         this._loader = loader;
 
         if (this.enabled) {
-            var url = EXT_meshopt_compression.DecoderPath;
+            var url = Tools.GetAbsoluteUrl(EXT_meshopt_compression.DecoderPath);
 
             this._decoder = import(/* webpackIgnore: true */ url).then(function (result) {
                 // Wait for WebAssembly compilation before resolving promise

+ 3 - 1
localDev/index-views.html

@@ -118,6 +118,8 @@
                 BABYLON.GLTFValidation.Configuration = {
                     url: "../dist/preview%20release/gltf_validator.js"
                 };
+                BABYLON.GLTF2.Loader.Extensions.EXT_meshopt_compression.DecoderPath =
+                    "../dist/preview%20release/meshopt_decoder.module.js";
 
                 if (BABYLON.Engine.isSupported()) {
                     if (typeof createEngine !== "undefined") {
@@ -179,4 +181,4 @@
     </script>
 </body>
 
-</html>
+</html>

+ 3 - 1
localDev/index.html

@@ -87,6 +87,8 @@
                 BABYLON.GLTFValidation.Configuration = {
                     url: "../dist/preview%20release/gltf_validator.js"
                 };
+                BABYLON.GLTF2.Loader.Extensions.EXT_meshopt_compression.DecoderPath =
+                    "../dist/preview%20release/meshopt_decoder.module.js";
 
                 if (BABYLON.Engine.isSupported()) {
                     if (typeof createEngine !== "undefined") {
@@ -151,4 +153,4 @@
     </script>
 </body>
 
-</html>
+</html>

+ 3 - 1
sandbox/public/index-local.html

@@ -43,8 +43,10 @@
                 BABYLON.GLTFValidation.Configuration = {
                     url: "../../dist/preview%20release/gltf_validator.js"
                 };
+                BABYLON.GLTF2.Loader.Extensions.EXT_meshopt_compression.DecoderPath =
+                    "../../dist/preview%20release/meshopt_decoder.module.js";
             });
     </script>
 </body>
 
-</html>
+</html>