UNPKG

@loaders.gl/obj

Version:

Framework-independent loader for the OBJ format

33 lines 1 kB
// loaders.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { parseMTL } from "./lib/parse-mtl.js"; import { MTLFormat } from "./mtl-format.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.4.5" !== 'undefined' ? "4.4.5" : 'latest'; /** * Loader for the MTL material format * Parses a Wavefront .mtl file specifying materials */ export const MTLWorkerLoader = { ...MTLFormat, dataType: null, batchType: null, version: VERSION, worker: true, testText: (text) => text.includes('newmtl'), options: { mtl: {} } }; // MTLLoader /** * Loader for the MTL material format */ export const MTLLoader = { ...MTLWorkerLoader, parse: async (arrayBuffer, options) => parseMTL(new TextDecoder().decode(arrayBuffer), options?.mtl), parseTextSync: (text, options) => parseMTL(text, options?.mtl) }; //# sourceMappingURL=mtl-loader.js.map