UNPKG

mdx-m3-viewer

Version:

A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.

25 lines (20 loc) 556 B
/** * war3map.shd - the shadow file. */ export default class War3MapShd { shadows: Uint8Array = new Uint8Array(0); constructor(buffer?: ArrayBuffer, width?: number, height?: number) { if (buffer && width && height) { this.load(buffer, width, height); } } load(buffer: ArrayBuffer, width: number, height: number) { this.shadows = new Uint8Array(buffer.slice(0, width * height * 16)); } save() { return this.shadows.slice().buffer; } getByteLength() { return this.shadows.length; } }