rw-parser-ng 2.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.
Files changed (72) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +88 -0
  3. package/lib/index.d.ts +6 -0
  4. package/lib/index.js +26 -0
  5. package/lib/renderware/RwFile.d.ts +10 -0
  6. package/lib/renderware/RwFile.js +33 -0
  7. package/lib/renderware/RwSections.d.ts +20 -0
  8. package/lib/renderware/RwSections.js +29 -0
  9. package/lib/renderware/dff/DffModelType.d.ts +5 -0
  10. package/lib/renderware/dff/DffModelType.js +9 -0
  11. package/lib/renderware/dff/DffParser.d.ts +155 -0
  12. package/lib/renderware/dff/DffParser.js +418 -0
  13. package/lib/renderware/errors/RwParseError.d.ts +6 -0
  14. package/lib/renderware/errors/RwParseError.js +34 -0
  15. package/lib/renderware/txd/TxdParser.d.ts +38 -0
  16. package/lib/renderware/txd/TxdParser.js +185 -0
  17. package/lib/renderware/utils/ImageDecoder.d.ts +23 -0
  18. package/lib/renderware/utils/ImageDecoder.js +512 -0
  19. package/lib/renderware/utils/ImageFormatEnums.d.ts +25 -0
  20. package/lib/renderware/utils/ImageFormatEnums.js +32 -0
  21. package/lib/renderware/utils/RwVersion.d.ts +7 -0
  22. package/lib/renderware/utils/RwVersion.js +30 -0
  23. package/lib/scripts/sort_models.d.ts +1 -0
  24. package/lib/scripts/sort_models.js +185 -0
  25. package/lib/scripts/sort_worker.d.ts +1 -0
  26. package/lib/scripts/sort_worker.js +140 -0
  27. package/lib/src/index.d.ts +8 -0
  28. package/lib/src/index.js +28 -0
  29. package/lib/src/renderware/RwFile.d.ts +10 -0
  30. package/lib/src/renderware/RwFile.js +33 -0
  31. package/lib/src/renderware/RwSections.d.ts +20 -0
  32. package/lib/src/renderware/RwSections.js +29 -0
  33. package/lib/src/renderware/common/types.d.ts +50 -0
  34. package/lib/src/renderware/common/types.js +2 -0
  35. package/lib/src/renderware/dff/DffModelType.d.ts +5 -0
  36. package/lib/src/renderware/dff/DffModelType.js +9 -0
  37. package/lib/src/renderware/dff/DffParser.d.ts +112 -0
  38. package/lib/src/renderware/dff/DffParser.js +418 -0
  39. package/lib/src/renderware/errors/RwParseError.d.ts +6 -0
  40. package/lib/src/renderware/errors/RwParseError.js +34 -0
  41. package/lib/src/renderware/ifp/IfpData.d.ts +28 -0
  42. package/lib/src/renderware/ifp/IfpData.js +9 -0
  43. package/lib/src/renderware/ifp/IfpParser.d.ts +12 -0
  44. package/lib/src/renderware/ifp/IfpParser.js +196 -0
  45. package/lib/src/renderware/txd/TxdParser.d.ts +38 -0
  46. package/lib/src/renderware/txd/TxdParser.js +185 -0
  47. package/lib/src/renderware/utils/ImageDecoder.d.ts +23 -0
  48. package/lib/src/renderware/utils/ImageDecoder.js +512 -0
  49. package/lib/src/renderware/utils/ImageFormatEnums.d.ts +25 -0
  50. package/lib/src/renderware/utils/ImageFormatEnums.js +32 -0
  51. package/lib/src/renderware/utils/RwVersion.d.ts +7 -0
  52. package/lib/src/renderware/utils/RwVersion.js +30 -0
  53. package/lib/src/utils/ByteStream.d.ts +17 -0
  54. package/lib/src/utils/ByteStream.js +65 -0
  55. package/lib/utils/ByteStream.d.ts +16 -0
  56. package/lib/utils/ByteStream.js +60 -0
  57. package/package.json +64 -0
  58. package/src/index.ts +10 -0
  59. package/src/renderware/RwFile.ts +22 -0
  60. package/src/renderware/RwSections.ts +27 -0
  61. package/src/renderware/common/types.ts +59 -0
  62. package/src/renderware/dff/DffModelType.ts +5 -0
  63. package/src/renderware/dff/DffParser.ts +596 -0
  64. package/src/renderware/errors/RwParseError.ts +11 -0
  65. package/src/renderware/ifp/IfpData.ts +33 -0
  66. package/src/renderware/ifp/IfpParser.ts +203 -0
  67. package/src/renderware/txd/TxdParser.ts +234 -0
  68. package/src/renderware/utils/ImageDecoder.ts +571 -0
  69. package/src/renderware/utils/ImageFormatEnums.ts +28 -0
  70. package/src/renderware/utils/RwVersion.ts +28 -0
  71. package/src/utils/ByteStream.ts +75 -0
  72. package/tsconfig.json +68 -0
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.IfpParser = void 0;
19
+ var RwFile_1 = require("../RwFile");
20
+ var IfpData_1 = require("./IfpData");
21
+ var IfpParser = /** @class */ (function (_super) {
22
+ __extends(IfpParser, _super);
23
+ function IfpParser(buffer) {
24
+ return _super.call(this, buffer) || this;
25
+ }
26
+ IfpParser.prototype.parse = function () {
27
+ var fileSignature = this.readString(4);
28
+ this.setPosition(0);
29
+ var version;
30
+ if (fileSignature === 'ANP3') {
31
+ version = IfpData_1.IfpVersion.ANP3;
32
+ return this.readAnp3();
33
+ }
34
+ else if (fileSignature === 'ANPK') {
35
+ version = IfpData_1.IfpVersion.ANPK;
36
+ return this.readAnpk();
37
+ }
38
+ else {
39
+ version = IfpData_1.IfpVersion.UNSUPPORTED;
40
+ throw new Error('Unsupported IFP version');
41
+ }
42
+ };
43
+ IfpParser.prototype.readAnp3 = function () {
44
+ this.skip(4); // ANP3
45
+ var size = this.readUint32();
46
+ var name = this.readString(24);
47
+ var animationsCount = this.readUint32();
48
+ var animations = [];
49
+ for (var i = 0; i < animationsCount; i++) {
50
+ animations.push(this.readAnp3Animation());
51
+ }
52
+ return {
53
+ version: IfpData_1.IfpVersion.ANP3,
54
+ name: name,
55
+ animations: animations
56
+ };
57
+ };
58
+ IfpParser.prototype.readAnp3Animation = function () {
59
+ var name = this.readString(24);
60
+ var bonesCount = this.readUint32();
61
+ this.skip(4); // keyframes_size
62
+ this.skip(4); // unk
63
+ var bones = [];
64
+ for (var i = 0; i < bonesCount; i++) {
65
+ bones.push(this.readAnp3Bone());
66
+ }
67
+ return { name: name, bones: bones };
68
+ };
69
+ IfpParser.prototype.readAnp3Bone = function () {
70
+ var name = this.readString(24);
71
+ var keyframeTypeNum = this.readUint32();
72
+ var keyframesCount = this.readUint32();
73
+ var keyframeType = keyframeTypeNum === 4 ? 'KRT0' : 'KR00';
74
+ var boneId = this.readInt32();
75
+ var keyframes = [];
76
+ for (var i = 0; i < keyframesCount; i++) {
77
+ var qx = this.readInt16() / 4096.0;
78
+ var qy = this.readInt16() / 4096.0;
79
+ var qz = this.readInt16() / 4096.0;
80
+ var qw = this.readInt16() / 4096.0;
81
+ var time = this.readInt16();
82
+ var px = 0, py = 0, pz = 0;
83
+ if (keyframeType[2] === 'T') {
84
+ px = this.readInt16() / 1024.0;
85
+ py = this.readInt16() / 1024.0;
86
+ pz = this.readInt16() / 1024.0;
87
+ }
88
+ keyframes.push({
89
+ time: time,
90
+ position: { x: px, y: py, z: pz },
91
+ rotation: { w: qw, x: qx, y: qy, z: qz },
92
+ scale: { x: 1, y: 1, z: 1 }
93
+ });
94
+ }
95
+ return {
96
+ name: name,
97
+ keyframeType: keyframeType,
98
+ useBoneId: true,
99
+ boneId: boneId,
100
+ keyframes: keyframes
101
+ };
102
+ };
103
+ IfpParser.prototype.readAnpk = function () {
104
+ this.skip(4); // ANPK
105
+ var size = this.readUint32();
106
+ this.skip(4); // INFO
107
+ var infoLen = this.readUint32();
108
+ var animationsCount = this.readUint32();
109
+ var name = this.readString(infoLen - 4);
110
+ var nameAlignLen = (4 - infoLen % 4) % 4;
111
+ this.skip(nameAlignLen);
112
+ var animations = [];
113
+ for (var i = 0; i < animationsCount; i++) {
114
+ animations.push(this.readAnpkAnimation());
115
+ }
116
+ return {
117
+ version: IfpData_1.IfpVersion.ANPK,
118
+ name: name,
119
+ animations: animations
120
+ };
121
+ };
122
+ IfpParser.prototype.readAnpkAnimation = function () {
123
+ this.skip(4); // NAME
124
+ var nameLen = this.readUint32();
125
+ var name = this.readString(nameLen);
126
+ this.skip((4 - nameLen % 4) % 4);
127
+ this.skip(4); // DGAN
128
+ this.skip(4); // animation_size
129
+ this.skip(4); // INFO
130
+ this.skip(4); // unk_size
131
+ var bonesCount = this.readUint32();
132
+ this.skip(4); // unk
133
+ var bones = [];
134
+ for (var i = 0; i < bonesCount; i++) {
135
+ bones.push(this.readAnpkBone());
136
+ }
137
+ return { name: name, bones: bones };
138
+ };
139
+ IfpParser.prototype.readAnpkBone = function () {
140
+ this.skip(4); // CPAN
141
+ this.skip(4); // bone_len
142
+ this.skip(4); // ANIM
143
+ var animLen = this.readUint32();
144
+ var name = this.readString(28);
145
+ var keyframesCount = this.readUint32();
146
+ this.skip(8); // unk
147
+ var boneId = 0;
148
+ var useBoneId = animLen === 44;
149
+ if (useBoneId) {
150
+ boneId = this.readInt32();
151
+ }
152
+ else {
153
+ this.skip(8); // sibling_x, sibling_y
154
+ }
155
+ var keyframeType = 'K000';
156
+ var keyframes = [];
157
+ if (keyframesCount > 0) {
158
+ keyframeType = this.readString(4);
159
+ this.skip(4); // keyframes_len
160
+ for (var i = 0; i < keyframesCount; i++) {
161
+ var qx = this.readFloat();
162
+ var qy = this.readFloat();
163
+ var qz = this.readFloat();
164
+ var qw = this.readFloat();
165
+ var px = 0, py = 0, pz = 0;
166
+ if (keyframeType[2] === 'T') {
167
+ px = this.readFloat();
168
+ py = this.readFloat();
169
+ pz = this.readFloat();
170
+ }
171
+ var sx = 1, sy = 1, sz = 1;
172
+ if (keyframeType[3] === 'S') {
173
+ sx = this.readFloat();
174
+ sy = this.readFloat();
175
+ sz = this.readFloat();
176
+ }
177
+ var time = this.readFloat();
178
+ keyframes.push({
179
+ time: time,
180
+ position: { x: px, y: py, z: pz },
181
+ rotation: { w: qw, x: qx, y: qy, z: qz },
182
+ scale: { x: sx, y: sy, z: sz }
183
+ });
184
+ }
185
+ }
186
+ return {
187
+ name: name,
188
+ keyframeType: keyframeType,
189
+ useBoneId: useBoneId,
190
+ boneId: boneId,
191
+ keyframes: keyframes
192
+ };
193
+ };
194
+ return IfpParser;
195
+ }(RwFile_1.RwFile));
196
+ exports.IfpParser = IfpParser;
@@ -0,0 +1,38 @@
1
+ import { RwFile } from '../RwFile';
2
+ export interface RwTxd {
3
+ textureDictionary: RwTextureDictionary;
4
+ }
5
+ export interface RwTextureDictionary {
6
+ textureCount: number;
7
+ textureNatives: RwTextureNative[];
8
+ }
9
+ export interface RwTextureNative {
10
+ platformId: number;
11
+ filterMode: number;
12
+ uAddressing: number;
13
+ vAddressing: number;
14
+ textureName: string;
15
+ maskName: string;
16
+ rasterFormat: number;
17
+ d3dFormat: string;
18
+ width: number;
19
+ height: number;
20
+ depth: number;
21
+ mipmapCount: number;
22
+ rasterType: number;
23
+ alpha: boolean;
24
+ cubeTexture: boolean;
25
+ autoMipMaps: boolean;
26
+ compressed: boolean;
27
+ mipmaps: number[][];
28
+ }
29
+ export declare class TxdParser extends RwFile {
30
+ constructor(stream: Buffer);
31
+ parse(): RwTxd;
32
+ readTextureDictionary(): RwTextureDictionary;
33
+ readTextureNative(): RwTextureNative;
34
+ readPalette(paletteType: number, depth: number): Uint8Array;
35
+ getBitmapWithPalette(paletteType: number, depth: number, hasAlpha: boolean, raster: Uint8Array, palette: Uint8Array, width: number, height: number): Uint8Array;
36
+ getBitmapWithDXT(dxtType: string, raster: Uint8Array, width: number, height: number): Uint8Array;
37
+ getBitmapWithRasterFormat(rasterFormat: number, raster: Uint8Array, width: number, height: number): Uint8Array;
38
+ }
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TxdParser = void 0;
19
+ var RwFile_1 = require("../RwFile");
20
+ var ImageDecoder_1 = require("../utils/ImageDecoder");
21
+ var ImageFormatEnums_1 = require("../utils/ImageFormatEnums");
22
+ var TxdParser = /** @class */ (function (_super) {
23
+ __extends(TxdParser, _super);
24
+ function TxdParser(stream) {
25
+ return _super.call(this, stream) || this;
26
+ }
27
+ TxdParser.prototype.parse = function () {
28
+ return {
29
+ textureDictionary: this.readTextureDictionary(),
30
+ };
31
+ };
32
+ TxdParser.prototype.readTextureDictionary = function () {
33
+ this.readSectionHeader();
34
+ this.readSectionHeader();
35
+ var textureCount = this.readUint16();
36
+ this.skip(2);
37
+ var textureNatives = [];
38
+ for (var i = 0; i < textureCount; i++) {
39
+ var textureNative = this.readTextureNative();
40
+ textureNatives.push(textureNative);
41
+ }
42
+ // Skip unused extension
43
+ this.skip(this.readSectionHeader().sectionSize);
44
+ return { textureCount: textureCount, textureNatives: textureNatives };
45
+ };
46
+ TxdParser.prototype.readTextureNative = function () {
47
+ this.readSectionHeader();
48
+ this.readSectionHeader();
49
+ // TODO: Structure this part better
50
+ // Texture format
51
+ var platformId = this.readUint32();
52
+ var flags = this.readUint32();
53
+ var filterMode = (flags & 0xFF);
54
+ var uAddressing = (flags & 0xF00) >> 8;
55
+ var vAddressing = (flags & 0xF000) >> 12;
56
+ var textureName = this.readString(32);
57
+ var maskName = this.readString(32);
58
+ // Raster format
59
+ var rasterFormat = this.readUint32();
60
+ var d3dFormat = this.readString(4);
61
+ var width = this.readUint16();
62
+ var height = this.readUint16();
63
+ var depth = this.readUint8();
64
+ var mipmapCount = this.readUint8();
65
+ var rasterType = this.readUint8();
66
+ var compressionFlags = this.readUint8(); // Is "dxtType" for III/VC
67
+ // SA
68
+ var alpha = (compressionFlags & (1 << 0)) !== 0;
69
+ var cubeTexture = (compressionFlags & (1 << 1)) !== 0;
70
+ var autoMipMaps = (compressionFlags & (1 << 2)) !== 0;
71
+ var compressed = (compressionFlags & (1 << 3)) !== 0;
72
+ var paletteType = (rasterFormat >> 13) & 3;
73
+ var mipWidth = width;
74
+ var mipHeight = height;
75
+ var mipmaps = [];
76
+ var palette = (paletteType !== ImageFormatEnums_1.PaletteType.PALETTE_NONE ? this.readPalette(paletteType, depth) : new Uint8Array(0));
77
+ for (var i = 0; i < mipmapCount; i++) {
78
+ var rasterSize = this.readUint32();
79
+ var raster = this.read(rasterSize);
80
+ if (i == 0) {
81
+ // Raw RGBA presentation
82
+ var bitmap = void 0;
83
+ if (palette.length !== 0) {
84
+ var rasterFormatsWithoutAlpha = [
85
+ ImageFormatEnums_1.RasterFormat.RASTER_565,
86
+ ImageFormatEnums_1.RasterFormat.RASTER_LUM,
87
+ ImageFormatEnums_1.RasterFormat.RASTER_888,
88
+ ImageFormatEnums_1.RasterFormat.RASTER_555
89
+ ];
90
+ var hasAlpha = ((platformId === ImageFormatEnums_1.PlatformType.D3D9 && alpha) || (platformId == ImageFormatEnums_1.PlatformType.D3D8 && !rasterFormatsWithoutAlpha.includes(rasterFormat)));
91
+ bitmap = Array.from(this.getBitmapWithPalette(paletteType, depth, hasAlpha, raster, palette, width, height));
92
+ }
93
+ else if (platformId === ImageFormatEnums_1.PlatformType.D3D8 && compressionFlags !== 0) {
94
+ bitmap = Array.from(this.getBitmapWithDXT('DXT' + compressionFlags, raster, width, height));
95
+ }
96
+ else if (platformId === ImageFormatEnums_1.PlatformType.D3D9 && compressed) {
97
+ bitmap = Array.from(this.getBitmapWithDXT(d3dFormat, raster, width, height));
98
+ }
99
+ else {
100
+ bitmap = Array.from(this.getBitmapWithRasterFormat(rasterFormat, raster, width, height));
101
+ }
102
+ mipmaps.push(bitmap);
103
+ }
104
+ mipWidth /= 2;
105
+ mipHeight /= 2;
106
+ }
107
+ // Skip extension
108
+ this.skip(this.readSectionHeader().sectionSize);
109
+ return {
110
+ platformId: platformId,
111
+ filterMode: filterMode,
112
+ uAddressing: uAddressing,
113
+ vAddressing: vAddressing,
114
+ textureName: textureName,
115
+ maskName: maskName,
116
+ rasterFormat: rasterFormat,
117
+ d3dFormat: d3dFormat,
118
+ width: width,
119
+ height: height,
120
+ depth: depth,
121
+ mipmapCount: mipmapCount,
122
+ rasterType: rasterType,
123
+ alpha: alpha,
124
+ cubeTexture: cubeTexture,
125
+ autoMipMaps: autoMipMaps,
126
+ compressed: compressed,
127
+ mipmaps: mipmaps,
128
+ };
129
+ };
130
+ TxdParser.prototype.readPalette = function (paletteType, depth) {
131
+ var size = (paletteType === ImageFormatEnums_1.PaletteType.PALETTE_8 ? 1024 : (depth === 4 ? 64 : 128));
132
+ return this.read(size);
133
+ };
134
+ TxdParser.prototype.getBitmapWithPalette = function (paletteType, depth, hasAlpha, raster, palette, width, height) {
135
+ if (paletteType !== ImageFormatEnums_1.PaletteType.PALETTE_8 && depth == 4) {
136
+ return (hasAlpha
137
+ ? ImageDecoder_1.ImageDecoder.pal4(raster, palette, width, height)
138
+ : ImageDecoder_1.ImageDecoder.pal4NoAlpha(raster, palette, width, height));
139
+ }
140
+ return (hasAlpha
141
+ ? ImageDecoder_1.ImageDecoder.pal8(raster, palette, width, height)
142
+ : ImageDecoder_1.ImageDecoder.pal8NoAlpha(raster, palette, width, height));
143
+ };
144
+ TxdParser.prototype.getBitmapWithDXT = function (dxtType, raster, width, height) {
145
+ switch (dxtType) {
146
+ case ImageFormatEnums_1.D3DFormat.D3D_DXT1:
147
+ return ImageDecoder_1.ImageDecoder.bc1(raster, width, height);
148
+ case ImageFormatEnums_1.D3DFormat.D3D_DXT2:
149
+ return ImageDecoder_1.ImageDecoder.bc2(raster, width, height, true);
150
+ case ImageFormatEnums_1.D3DFormat.D3D_DXT3:
151
+ return ImageDecoder_1.ImageDecoder.bc2(raster, width, height, false);
152
+ case ImageFormatEnums_1.D3DFormat.D3D_DXT4:
153
+ return ImageDecoder_1.ImageDecoder.bc3(raster, width, height, true);
154
+ case ImageFormatEnums_1.D3DFormat.D3D_DXT5:
155
+ return ImageDecoder_1.ImageDecoder.bc3(raster, width, height, false);
156
+ // LUM8_A8 has compressed flag
157
+ case ImageFormatEnums_1.D3DFormat.D3DFMT_A8L8:
158
+ return ImageDecoder_1.ImageDecoder.lum8a8(raster, width, height);
159
+ default:
160
+ return new Uint8Array(0);
161
+ }
162
+ };
163
+ TxdParser.prototype.getBitmapWithRasterFormat = function (rasterFormat, raster, width, height) {
164
+ switch (rasterFormat) {
165
+ case ImageFormatEnums_1.RasterFormat.RASTER_1555:
166
+ return ImageDecoder_1.ImageDecoder.bgra1555(raster, width, height);
167
+ case ImageFormatEnums_1.RasterFormat.RASTER_565:
168
+ return ImageDecoder_1.ImageDecoder.bgra565(raster, width, height);
169
+ case ImageFormatEnums_1.RasterFormat.RASTER_4444:
170
+ return ImageDecoder_1.ImageDecoder.bgra4444(raster, width, height);
171
+ case ImageFormatEnums_1.RasterFormat.RASTER_LUM:
172
+ return ImageDecoder_1.ImageDecoder.lum8(raster, width, height);
173
+ case ImageFormatEnums_1.RasterFormat.RASTER_8888:
174
+ return ImageDecoder_1.ImageDecoder.bgra8888(raster, width, height);
175
+ case ImageFormatEnums_1.RasterFormat.RASTER_888:
176
+ return ImageDecoder_1.ImageDecoder.bgra888(raster, width, height);
177
+ case ImageFormatEnums_1.RasterFormat.RASTER_555:
178
+ return ImageDecoder_1.ImageDecoder.bgra555(raster, width, height);
179
+ default:
180
+ return new Uint8Array(0);
181
+ }
182
+ };
183
+ return TxdParser;
184
+ }(RwFile_1.RwFile));
185
+ exports.TxdParser = TxdParser;
@@ -0,0 +1,23 @@
1
+ export declare class ImageDecoder {
2
+ static readUInt16LE(buf: Uint8Array, offset: number): number;
3
+ static readUInt32LE(buf: Uint8Array, offset: number): number;
4
+ static decode565(bits: number): [number, number, number];
5
+ static decode555(bits: number): [number, number, number];
6
+ static decode1555(bits: number): [number, number, number, number];
7
+ static decode4444(bits: number): [number, number, number, number];
8
+ static bc1(data: Uint8Array, width: number, height: number): Uint8Array;
9
+ static bc2(data: Uint8Array, width: number, height: number, premultiplied: boolean): Uint8Array;
10
+ static bc3(data: Uint8Array, width: number, height: number, premultiplied: boolean): Uint8Array;
11
+ static bgra1555(data: Uint8Array, width: number, height: number): Uint8Array;
12
+ static bgra4444(data: Uint8Array, width: number, height: number): Uint8Array;
13
+ static bgra555(data: Uint8Array, width: number, height: number): Uint8Array;
14
+ static bgra565(data: Uint8Array, width: number, height: number): Uint8Array;
15
+ static bgra888(data: Uint8Array, width: number, height: number): Uint8Array;
16
+ static bgra8888(data: Uint8Array, width: number, height: number): Uint8Array;
17
+ static lum8(data: Uint8Array, width: number, height: number): Uint8Array;
18
+ static lum8a8(data: Uint8Array, width: number, height: number): Uint8Array;
19
+ static pal4(data: Uint8Array, palette: Uint8Array, width: number, height: number): Uint8Array;
20
+ static pal4NoAlpha(data: Uint8Array, palette: Uint8Array, width: number, height: number): Uint8Array;
21
+ static pal8(data: Uint8Array, palette: Uint8Array, width: number, height: number): Uint8Array;
22
+ static pal8NoAlpha(data: Uint8Array, palette: Uint8Array, width: number, height: number): Uint8Array;
23
+ }