Members
(constant) MODEL_CUBE :ModelType
Simple cube / Minecraft block.
Type:
(constant) MODEL_ITEM :ModelType
Simple 2D plane / Minecraft item.
Type:
(constant) MODEL_SKULL_COMPACT :ModelType
Skeleton / Player skull, using a compact texture layout.
Type:
(constant) MODEL_SKULL_SKIN :ModelType
Skeleton / Player skull, using the Minecraft skin texture layout.
Type:
Methods
createAtlas(texture) → {Promise.<TextureAtlas>}
Parameters:
| Name | Type | Description |
|---|---|---|
texture |
string | TexImageSource | A URL to the model texture or an arbitrary image. |
- Source:
Returns:
- Type
- Promise.<TextureAtlas>
createRenderer(canvas, models, contextAttributesopt) → {Renderer}
Creates a new renderer.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
canvas |
HTMLCanvasElement | The canvas to render on. | ||
models |
ModelData | Array.<ModelData> | What to render. | ||
contextAttributes |
WebGLContextAttributes |
<optional> |
{antialias: false} | Arbitrary WebGL context attributes. |
Returns:
- Type
- Renderer
createTexture(texture) → {Promise.<TexImageSource>}
Resolves a texture.
Parameters:
| Name | Type | Description |
|---|---|---|
texture |
string | TexImageSource | A URL to the model texture or an arbitrary image. |
- Source:
Returns:
- Type
- Promise.<TexImageSource>
Type Definitions
ModelData
Type:
- Object
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
modelType |
ModelType | One of MODEL_CUBE, MODEL_ITEM, MODEL_SKULL_COMPACT, MODEL_SKULL_SKIN. | ||
texture |
string | TexImageSource | A URL to the model texture, a TextureAtlas cutout or an arbitrary image. | ||
enchanted |
boolean |
<optional> |
false | Applies Minecraft's enchantment glint. |
inInventory |
boolean |
<optional> |
false | Applies padding to match rendering of Minecraft items in inventory. |
translation |
[number, number, number] |
<optional> |
[0, 0, 0] | Applies a translation to the model. |
scale |
number |
<optional> |
1 | Scales the model. |