1.6.0 • Published 14 days ago

node-three-gltf v1.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

node-three-gltf

This package offers a modified three.js GLTFLoader to load glTF files in a Node.js environment. Files can be loaded from local file system or from web resources. DRACO-compressed glTF files are also supported.

In order to work in a non-browser environment, following classes had to be adopted from three.js and modified:

All are exposed and can be used independently.

Usage

Install via NPM:

npm install node-three-gltf

Use with ES modules or TypeScript:

import { DRACOLoader, GLTFLoader, loadGltf, TextureLoader } from 'node-three-gltf';

// init GLTFLoader and pass a path to a local file or a url to a web resource
const loader = new GLTFLoader();
loader.setDRACOLoader(new DRACOLoader());

loader.load('path/to/file', gltf => {
  console.log(gltf.scene.children);
});

// there is also a small utility function that instantiates GLTFLoader and DRACOLoader
// and returns a Promise with the loaded content
const gltf = await loadGltf('path/to/file');
console.log(gltf.scene.children);

// use TextureLoader, ImageLoader, or FileLoader independently
new TextureLoader().load('path/to/file', texture => {
  console.log(texture);
});
1.6.0

14 days ago

1.5.0

5 months ago

1.4.0

12 months ago

1.3.1

1 year ago

1.2.0

2 years ago

1.3.0

2 years ago

1.2.0-node16

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago