Model Module
This module can only used for browser environment
Usage
Build THREE.js model for block and player
Please read how to use resourcepacks before this
Create THREE.js block model:
ts
import { BlockModelFactory } from "@xmcl/model";
const textureRegistry: TextureRegistry;
const factory = new BlockModelFactory(textureRegistry);
const model: BlockModel.Resolved;
const o3d: THREE.Object3D = factory.getObject(model);
// add o3d to your three scene
Create THREE.js player model:
ts
import { PlayerModel } from "@xmcl/model";
const player: PlayerModel = new PlayerModel();
const isSlimSkin: boolean; // if this skin use alex model
player.setSkin("http://your-skin-url", isSlimSkin);
const o3d: THREE.Object3D = player.playerObject3d;
// add o3d to your three scene
🧾 Classes
🤝 Interfaces
🏷️ Variables
BUILTIN_GENERATED const
ts
BUILTIN_GENERATED: Resolved = ...
Defined in: packages/model/block.ts:59
DEFAULT_DISPLAY const
ts
DEFAULT_DISPLAY: Display = ...
Defined in: packages/model/block.ts:49
DEFAULT_TRANSFORM const
ts
DEFAULT_TRANSFORM: Transform = ...
Defined in: packages/model/block.ts:44