Skip to content

Commit

Permalink
Certain models do not load due to console error xeokit#985
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Jan 13, 2023
1 parent 66c991c commit e608b51
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/plugins/GLTFLoaderPlugin/GLTFVBOSceneModelLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class GLTFVBOSceneModelLoader {
});
}

parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
options = options || {};
parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
sceneModel.fire("loaded", true, false);
if (ok) {
Expand Down Expand Up @@ -101,14 +101,14 @@ function getMetaModelCorrections(metaModelJSON) {
};
}

function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
const spinner = plugin.viewer.scene.canvas.spinner;
spinner.processes++;
const isGLB = (src.split('.').pop() === "glb");
if (isGLB) {
plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK
options.basePath = getBasePath(src);
parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok, error);
parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok, error);
spinner.processes--;
},
(err) => {
Expand All @@ -118,7 +118,7 @@ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
} else {
plugin.dataSource.getGLTF(src, (gltf) => { // OK
options.basePath = getBasePath(src);
parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, error);
parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, error);
spinner.processes--;
},
(err) => {
Expand All @@ -133,7 +133,7 @@ function getBasePath(src) {
return (i !== 0) ? src.substring(0, i + 1) : "";
}

function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
const spinner = plugin.viewer.scene.canvas.spinner;
spinner.processes++;
parse(gltf, GLTFLoader, {
Expand All @@ -152,7 +152,10 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
//geometryCreated: {},
numObjects: 0,
nodes: [],
nextId: 0
nextId: 0,
log: (msg) => {
plugin.log(msg);
}
};
loadTextures(ctx);
loadMaterials(ctx);
Expand Down

0 comments on commit e608b51

Please sign in to comment.