UNPKG

loaders.gl

Version:

Framework-independent loaders for 3D graphics formats

31 lines (28 loc) 706 B
import OBJ from 'webgl-obj-loader'; function testOBJFile(text) { // There could be comment line first return text[0] === 'v'; } function parseOBJMesh(text) { var mesh = new OBJ.Mesh(text); var indices = new Uint16Array(mesh.indices); var positions = new Float32Array(mesh.vertices); var normals = new Float32Array(mesh.vertexNormals); var texCoords = new Float32Array(mesh.textures); return { header: {}, attributes: { indices: indices, positions: positions, normals: normals, texCoords: texCoords } }; } export default { name: 'OBJ', extension: 'obj', testText: testOBJFile, parseText: parseOBJMesh }; //# sourceMappingURL=obj-loader.js.map