0.0.6 • Published 2 years ago

@asset-manager/three v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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
0.0.6

2 years ago

0.0.3

3 years ago

0.0.5

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago