• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 25070233425

28 Apr 2026 06:20PM UTC coverage: 59.434% (+0.01%) from 59.423%
25070233425

push

github

web-flow
website: Add tabs for navigating between format docs (#3407)

11310 of 20887 branches covered (54.15%)

Branch coverage included in aggregate %.

89 of 136 new or added lines in 13 files covered. (65.44%)

1742 existing lines in 132 files now uncovered.

23500 of 37682 relevant lines covered (62.36%)

16296.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/modules/obj/src/obj-loader-with-parser.ts
1
// loaders.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import type {Loader, LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
6
import type {Mesh, MeshArrowTable} from '@loaders.gl/schema';
7
import {convertMeshToTable} from '@loaders.gl/schema-utils';
8
import {parseOBJ} from './lib/parse-obj';
9
import {OBJWorkerLoader as OBJWorkerLoaderMetadata} from './obj-loader';
10
import {OBJLoader as OBJLoaderMetadata} from './obj-loader';
11

12
const {preload: _OBJWorkerLoaderPreload, ...OBJWorkerLoaderMetadataWithoutPreload} =
13
  OBJWorkerLoaderMetadata;
5✔
14
const {preload: _OBJLoaderPreload, ...OBJLoaderMetadataWithoutPreload} = OBJLoaderMetadata;
5✔
15

16
export type OBJLoaderOptions = LoaderOptions & {
17
  obj?: {
18
    /** Output shape. Defaults to a legacy Mesh object. */
19
    shape?: 'mesh' | 'arrow-table';
20
    /** Override the URL to the worker bundle (by default loads from unpkg.com) */
21
    workerUrl?: string;
22
  };
23
};
24

25
function convertOBJMesh(mesh: Mesh, options?: OBJLoaderOptions): Mesh | MeshArrowTable {
26
  return options?.obj?.shape === 'arrow-table' ? convertMeshToTable(mesh, 'arrow-table') : mesh;
19✔
27
}
28

29
/**
30
 * Worker loader for the OBJ geometry format
31
 */
32
export const OBJWorkerLoaderWithParser = {
5✔
33
  ...OBJWorkerLoaderMetadataWithoutPreload
34
} as const satisfies Loader<Mesh | MeshArrowTable, never, OBJLoaderOptions>;
35

36
// OBJLoaderWithParser
37

38
/**
39
 * Loader for the OBJ geometry format
40
 */
41
export const OBJLoaderWithParser = {
5✔
42
  ...OBJLoaderMetadataWithoutPreload,
43
  parse: async (arrayBuffer: ArrayBuffer, options?: OBJLoaderOptions) =>
NEW
44
    convertOBJMesh(parseOBJ(new TextDecoder().decode(arrayBuffer), options), options),
×
45
  parseTextSync: (text: string, options?: OBJLoaderOptions) =>
46
    convertOBJMesh(parseOBJ(text, options), options)
19✔
47
} as const satisfies LoaderWithParser<Mesh | MeshArrowTable, never, OBJLoaderOptions>;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc