I Already read this , and it did not work out ,
The case is I Have the model with draco compression ( AND ITS VALID )
https://github.khronos.org/glTF-Validator/
my code
import "babylonjs";
import "babylonjs-serializers"
import "babylonjs-loaders";
global.XMLHttpRequest = require("xhr2").XMLHttpRequest;
BABYLON.Tools.GetAbsoluteUrl =
(url): string => {
return url;
}
BABYLON.DracoCompression.Configuration = {
decoder: {
wasmUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_decoder.js",
wasmBinaryUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_decoder.wasm",
fallbackUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_wasm_wrapper.js",
}
};
async testLocal() {
try {
const result = await BABYLON.SceneLoader.ImportMeshAsync(null, 'http://localhost:4000/', 'uploads/models/0294_600_draco.glb', this.scene_);
} catch (e) {
throw e;
}
}
the output .
Importing with ImportMeshAsync
importing using the folowing code
async testLocal() {
BABYLON.Tools.LoadFile('http://localhost:4000/uploads/models/0294_600_draco.glb',
async (data: any) => {
BABYLON.DracoCompression.Configuration = {
decoder: {
wasmUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_decoder.js",
wasmBinaryUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_decoder.wasm",
fallbackUrl: "https://cdn.jsdelivr.net/gh/google/draco/javascript/draco_wasm_wrapper.js",
}
};
var dracoCompression = new BABYLON.DracoCompression();
var attributes = {
// [BABYLON.VertexBuffer.UVKind]: 0,
// [BABYLON.VertexBuffer.NormalKind]: 1,
// [BABYLON.VertexBuffer.TangentKind]: 2,
[BABYLON.VertexBuffer.PositionKind]: 3
};
var vertexData = await dracoCompression.decodeMeshAsync(data, attributes);
var mesh = new BABYLON.Mesh("dracoMesh", this.scene_);
var geometry = new BABYLON.Geometry("dracoGeometry", this.scene_, vertexData, undefined, mesh);
mesh.material = new BABYLON.PBRMaterial("material", this.scene_);
mesh.material.sideOrientation = BABYLON.Material.CounterClockWiseSideOrientation;
}, undefined, undefined, true);
}