Here is my code to load a .fbx object, which loads an object as BufferGeometry
by default:
var loader = new THREE.FBXLoader();
async function loadFiles(scene,props) {
const {files, path, childName, fn} = props;
if (index > files.length - 1) return;
loader.load(path+files[index], object => {
// apply functions / transformations to obj
let sceneObj = fn.call(null,object,props);
if (sceneObj) { scene.add(sceneObj) }
// add obj to scene and push to array
scene.add(object);
objects.push(object);
// if there is another object to load, load it
index++;
loadFiles(scene,props);
});
}
I wanted to use var geometry = new THREE.Geometry().fromBufferGeometry( bufferGeometry );
to fix this, but I don't seem to build a mesh
in my loader function so I don't see how I could implement this code.
I want to access the vertices of the object in a readable way, which is why I don't want it to load as BufferGeometry
.