I built an application a few years back, it would basically put a collection of building blocks together and if there was a gltf model for one of those building blocks it would replace the default three.js mesh with the gltf scene clone.
The application is still used however new models being exported from blender no longer are visible. Ive had a look and i believe its with either my version of three or my loader implementation is no longer working with the newer gltf specifications.
Ive loaded the gltf into https://gltf-viewer.donmccurdy.com/ ( Great btw ) and is completely visible without fault.
Here is the function I use which allows me to use the GLTFLoader with promises.
model_loader_gltf = ( keysUsed ) => {
const loadModel = (modelInfo) => {
return new Promise((resolve, reject) => {
new GLTFLoader().load(
this.config.staticBaseUrl + this.modelListJson.modelPath + modelInfo + ".gltf",
(OBJdata) => {
console.log(OBJdata)
resolve(OBJdata);
},
(xhr) => {},
(error) => {}
);
});
};
const models = Promise.all(
keysUsed.map((modelInfo) =>
loadModel(modelInfo)
)
);
models.then((results) => {
this.avaliableModels = {};
keysUsed.map((modelInfo, index) => {
this.avaliableModels[modelInfo] = results[index];
});
this.avaliableModelKeys = Object.keys(this.avaliableModels);
this.load_font();
});
};
im importing
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
from THREE r107
My question(s) are the following:
- Why are the old gltfs loading and the new ones are not?
- Is there a way to convert the new gltfs into the old format?
Thanks in advanced!