@loaders.gl/obj
Version:
Framework-independent loader for the OBJ format
36 lines • 1.03 kB
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { OBJFormat } from "./obj-format.js";
import { parseOBJ } from "./lib/parse-obj.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';
/**
* Worker loader for the OBJ geometry format
*/
export const OBJWorkerLoader = {
...OBJFormat,
dataType: null,
batchType: null,
version: VERSION,
worker: true,
testText: testOBJFile,
options: {
obj: {}
}
};
function testOBJFile(text) {
// TODO - There could be comment line first
return text[0] === 'v';
}
// OBJLoader
/**
* Loader for the OBJ geometry format
*/
export const OBJLoader = {
...OBJWorkerLoader,
parse: async (arrayBuffer, options) => parseOBJ(new TextDecoder().decode(arrayBuffer), options),
parseTextSync: (text, options) => parseOBJ(text, options)
};
//# sourceMappingURL=obj-loader.js.map