@asset-manager/three
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";
const manager = AssetManager.getInstance();
manager.setLoaders({
gltf: GLTFLoader,
texture: TextureLoader,
});
manager.setAssets([
{
id: "modelName",
type: "gltf",
url: "modelName.gltf",
preload: true,
params: {
dracoCompressed: false,
},
},
{
id: "textureName",
type: "texture",
url: "texureName.png",
preload: true,
params: {},
},
]);
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