A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
// Types for encoder.mjs so TS consumers (the asset cook) import it with full typing.
export type ImageTypeValue = 'png' | 'jpg' | 'rgba';
export const ImageType: { readonly PNG: 'png'; readonly JPG: 'jpg'; readonly RGBA: 'rgba' };
export interface EncodeSource {
type: ImageTypeValue;
data: Uint8Array;
/** Required for RGBA sources; read from the header for PNG. */
width?: number;
height?: number;
}
export interface EncodeOptions {
/** 'uastc' = high quality / universal (default); 'etc1s' = smaller. */
mode?: 'uastc' | 'etc1s';
mipmaps?: boolean;
srgb?: boolean;
perceptual?: boolean;
/** ETC1S quality 1..255. */
quality?: number;
normalMap?: boolean;
/** Flip rows before encoding (default true — the engine samples bottom-up
* memory, and compressed blocks cannot be flipped at upload). */
yFlip?: boolean;
/** zstd over UASTC levels (default false; the runtime reads either). */
supercompress?: boolean;
/** UASTC effort, 0 (fastest) … 4 (slowest); the encoder's default when absent. */
uastcLevel?: number;
}
export const ENCODER_WASM: string;
/** How many calls the encoder runs at once (its worker pool's width). */
export const ENCODER_PARALLELISM: number;
export interface RgbaResult {
width: number;
height: number;
pixels: Uint8Array;
}
export function encodeToKtx2(source: EncodeSource, opts?: EncodeOptions): Promise<Uint8Array>;
export function encodePngToKtx2(png: Uint8Array, opts?: EncodeOptions): Promise<Uint8Array>;
export function transcodeKtx2ToRgba(ktx2: Uint8Array): Promise<RgbaResult>;