UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

46 lines (38 loc) 973 B
import { Asset } from "../../Asset.js"; import { Sampler2D } from "../../../graphics/texture/sampler/Sampler2D.js"; export class ImageRGBADataAsset extends Asset { /** * * @param {number[]|Uint8Array} data * @param {number} width * @param {number} height * @param {number} [itemSize] */ constructor(data, width, height, itemSize = 4) { super(); /** * * @type {number[]} */ this.data = data; /** * * @type {number} */ this.width = width; /** * * @type {number} */ this.height = height; /** * Number of channels * @type {number} */ this.itemSize = itemSize; this.byteSize = data.length; } create() { return new Sampler2D(this.data, this.itemSize, this.width, this.height); } }