Skip to content

Class: Textures ​

Defined in: packages/minerender/src/texture/Textures.ts:9

Creates and caches Three.js textures with nearest-neighbor sampling for Minecraft artwork.

Constructors ​

Constructor ​

ts
new Textures(): Textures;

Returns ​

Textures

Methods ​

createAsset() ​

ts
static createAsset(key): Texture;

Defined in: packages/minerender/src/texture/Textures.ts:45

Parameters ​

ParameterType
keyAssetKey

Returns ​

Texture


createCanvasTexture() ​

ts
static createCanvasTexture(canvas): CanvasTexture;

Defined in: packages/minerender/src/texture/Textures.ts:50

Creates an sRGB color texture from a canvas.

Parameters ​

ParameterType
canvasHTMLCanvasElement

Returns ​

CanvasTexture


createImage() ​

ts
static createImage(key): Texture;

Defined in: packages/minerender/src/texture/Textures.ts:41

Parameters ​

ParameterType
keyTextureKey

Returns ​

Texture


getImage() ​

ts
static getImage(key): Texture;

Defined in: packages/minerender/src/texture/Textures.ts:57

Returns a shared texture immediately and loads its image asynchronously. Failed cached loads are retried.

Parameters ​

ParameterType
keyTextureKey

Returns ​

Texture


getMissing() ​

ts
static getMissing(): DataTexture;

Defined in: packages/minerender/src/texture/Textures.ts:12

Creates the shared checkerboard from pixels without fetching or decoding an image.

Returns ​

DataTexture


initTextureProps() ​

ts
static initTextureProps<T>(texture): T;

Defined in: packages/minerender/src/texture/Textures.ts:33

Sets nearest-neighbor filters without changing the texture's color space. Returns the same texture.

Type Parameters ​

Type Parameter
T extends Texture<unknown, TextureEventMap>

Parameters ​

ParameterType
textureT

Returns ​

T