Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juunini/three-async-gltf-loader

Async GLTF Loader of ThreeJS
https://github.com/juunini/three-async-gltf-loader

async gltf loader threejs

Last synced: 27 days ago
JSON representation

Async GLTF Loader of ThreeJS

Awesome Lists containing this project

README

        

ThreeJS Async GLTF Loader


ThreeJS
TypeScript

---

## Install

```bash
# npm
npm install three-async-gltf-loader

# yarn
yarn add three-async-gltf-loader

# pnpm
pnpm add three-async-gltf-loader

# bun
bun add three-async-gltf-loader
```

## Usage

```ts
import { AsyncGLTFLoader } from 'three-async-gltf-loader';

// Instantiate a loader
const loader = new AsyncGLTFLoader();

// Optional: Provide a DRACOLoader instance to decode compressed mesh data
const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath('/examples/jsm/libs/draco/');
loader.setDRACOLoader(dracoLoader);

// Load a glTF resource
const gltf = await loader.loadAsync(
// resource URL
'models/gltf/duck/duck.gltf',
// called while loading is progressing. optional
function (xhr: XMLHttpRequest) {
console.log(`${xhr.loaded / xhr.total * 100} % loaded`)
},
);
```