UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

21 lines (17 loc) 572 B
import { DataTexture, UnsignedByteType } from "three"; /** * * @param {ArrayLike<number>|number[]|Uint8Array} contents * @param {Signal} [cleanup_signal] can be called to dispose of the texture * @returns {DataTexture} */ export function makeOnePixelTexture(contents, cleanup_signal) { const t = new DataTexture(new Uint8Array(contents), 1, 1); t.generateMipmaps = false; t.needsUpdate = true; t.type = UnsignedByteType; if (cleanup_signal !== undefined) { cleanup_signal.addOne(t.dispose, t); } return t; }