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
new Textures(): Textures;Returns
Textures
Methods
createAsset()
static createAsset(key): Texture;Defined in: packages/minerender/src/texture/Textures.ts:45
Parameters
| Parameter | Type |
|---|---|
key | AssetKey |
Returns
Texture
createCanvasTexture()
static createCanvasTexture(canvas): CanvasTexture;Defined in: packages/minerender/src/texture/Textures.ts:50
Creates an sRGB color texture from a canvas.
Parameters
| Parameter | Type |
|---|---|
canvas | HTMLCanvasElement |
Returns
CanvasTexture
createImage()
static createImage(key): Texture;Defined in: packages/minerender/src/texture/Textures.ts:41
Parameters
| Parameter | Type |
|---|---|
key | TextureKey |
Returns
Texture
getImage()
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
| Parameter | Type |
|---|---|
key | TextureKey |
Returns
Texture
getMissing()
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()
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
| Parameter | Type |
|---|---|
texture | T |
Returns
T