@bis-toolkit/edds 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +49 -0
- package/dist/Edds.d.ts +17 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1509 -0
- package/dist/index.js.map +7 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
````markdown
|
|
2
|
+
# @bis-toolkit/edds
|
|
3
|
+
|
|
4
|
+
Library for reading EDDS (DayZ compressed DDS) files and obtaining RGBA pixel data for previews or further processing.
|
|
5
|
+
|
|
6
|
+
Part of the [BIS Toolkit TypeScript](../../README.md) monorepo.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Parse EDDS containers (DDS header + LZ4/COPY mip blocks)
|
|
11
|
+
- Validate headers and mip sizes
|
|
12
|
+
- Decode BC1/BC2/BC3 and RGBA/BGRA mipmaps to RGBA buffers
|
|
13
|
+
- Small, dependency-light build (custom LZ4 block decoder)
|
|
14
|
+
- Works in Node.js and browsers (ESM build bundled for the demo)
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @bis-toolkit/edds
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { Edds } from '@bis-toolkit/edds';
|
|
26
|
+
import * as fs from 'fs';
|
|
27
|
+
|
|
28
|
+
const buffer = fs.readFileSync('texture.edds');
|
|
29
|
+
const edds = new Edds();
|
|
30
|
+
edds.read(buffer);
|
|
31
|
+
|
|
32
|
+
console.log(`Format: ${edds.formatName}`);
|
|
33
|
+
console.log(`Mipmaps: ${edds.mipmaps.length}`);
|
|
34
|
+
|
|
35
|
+
// Get RGBA pixels for the top mip level
|
|
36
|
+
const rgba = edds.getRgbaPixelData(0);
|
|
37
|
+
console.log(`First pixel RGBA: ${Array.from(rgba.slice(0, 4))}`);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Supported output formats
|
|
41
|
+
|
|
42
|
+
- BC1 / DXT1 -> RGBA
|
|
43
|
+
- BC2 / DXT3/2 -> RGBA
|
|
44
|
+
- BC3 / DXT5/4 -> RGBA
|
|
45
|
+
- RGBA8 / BGRA8 -> RGBA
|
|
46
|
+
|
|
47
|
+
## LICENSE
|
|
48
|
+
|
|
49
|
+
GPLv3 © Alpine Labs - see [LICENSE](LICENSE).
|
package/dist/Edds.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type EddsFormat = 'BC1' | 'BC2' | 'BC3' | 'BC4' | 'BC5' | 'BC6' | 'BC7' | 'RGBA8' | 'BGRA8' | 'UNKNOWN';
|
|
2
|
+
export interface EddsMipMap {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
compression?: 'COPY' | 'LZ4';
|
|
7
|
+
}
|
|
8
|
+
export declare class Edds {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
format: EddsFormat;
|
|
12
|
+
formatDetails: string;
|
|
13
|
+
mipmaps: EddsMipMap[];
|
|
14
|
+
read(buffer: Buffer | Uint8Array): void;
|
|
15
|
+
getRgbaPixelData(mipLevel?: number): Uint8Array;
|
|
16
|
+
get formatName(): string;
|
|
17
|
+
}
|
package/dist/index.d.ts
ADDED