@asset-manager/three
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

@asset-manager/three

NPM version PR Welcome

This package provides loaders for preloading three.js type assets.

Introduction

Loading and retrieving assets.

import AssetManager from "@asset-manager/core";
import { GLTFLoader, TextureLoader } from "@asset-manager/three";

// Get an instance to the manager and set the loaders
const manager = AssetManager.getInstance();
manager.setLoaders({
  gltf: GLTFLoader,
  texture: TextureLoader,
});

// Set the assets to load
manager.setAssets([
  {
    id: "modelName",
    type: "gltf",
    url: "modelName.gltf",
    preload: true,
    params: {
      dracoCompressed: false,
    },
  },
  {
    id: "textureName",
    type: "texture",
    url: "texureName.png",
    preload: true,
    params: {},
  },
]);

// Elsewhere in your app you can grab assets from the manager
const gltf = AssetManager.getInstance().get<GLTFLoader>("modelName").gltf;
const texture =
  AssetManager.getInstance().get<TextureLoader>("textureName").texture;

Installation

Install this package with npm.

npm i @asset-manager/three

This package does not include the core loader. You will need to install that separately

npm i @asset-manager/core

Package Sidebar

Install

npm i @asset-manager/three

Weekly Downloads

4

Version

0.0.6

License

MIT

Unpacked Size

37.4 kB

Total Files

49

Last publish

Collaborators

  • digitaljohn