Three.js: OBJLoader2 loadMtl Does Not Accept Array Buffer

Created on 7 May 2018  路  5Comments  路  Source: mrdoob/three.js

Description of the problem

OBJLoader2 .loadMtl docs state content is text or array buffer, however array buffer is not supported. _loadMtl function in OBJLoader2 calls the following:

processMaterials(Validator.isValid(resource.content) ? mtlLoader.parse(resource.content) : null);

mtlLoader.parse doesn't take an array buffer, just text.

Three.js version

r92

Bug Loaders

All 5 comments

/ping @kaisalmen

@pizza-r0b thanks for spotting this.
It seems to a good idea to use THREE.LoaderUtils.decodeText inside OBJLoader2.loadMtl to transform an ArrayBuffer to a String and make this work instead of adjusting the docs.

@Mugen87 I will take care. I have some other smaller bug fixes available for OBJLoader2 and will open a combined PR later.

@kaisalmen Thanks I wasn't aware of THREE.LoaderUtils.decodeText I was using TextDecoder

PR is now available!

Was this page helpful?
0 / 5 - 0 ratings