@aguacerowx/mapsgl 0.0.58 → 0.0.59

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.
@@ -1,37 +1,37 @@
1
- /**
2
- * Default GOES brightness-temperature colormaps for WebGL satellite, aligned with
3
- * aguacero-frontend `src/lib/defaultColormaps.ts` (`SatelliteLongwaveIR` and `SatelliteWV`, K/°C units).
4
- *
5
- * Format: flat array `[norm0, '#hex', norm1, '#hex', ...]` where each **norm** is 0–100
6
- * (cold → hot in texture space; see `SatelliteShaderManager._generateTextureFromColormapData` and
7
- * frontend `normToKelvin` / `kelvinToNorm` in `utilityFunctions.ts`).
8
- */
9
-
10
- /** Longwave IR (C13–C16-style) — matches `SatelliteLongwaveIR.units.K.colormap` in the frontend. */
11
- export const DEFAULT_SATELLITE_LONGWAVE_IR_COLORMAP = [
12
- 5, '#000000',
13
- 51, '#ffffff',
14
- 52, '#00ffff',
15
- 58, '#0033cc',
16
- 64, '#33ff00',
17
- 73, '#ffee00',
18
- 78, '#ff0000',
19
- 82, '#660000',
20
- 88, '#808080',
21
- 90, '#cc66ff',
22
- 96, '#9933cc',
23
- 100, '#9933cc',
24
- ];
25
-
26
- /** Upper / mid / lower water vapor (C08–C10) — matches `SatelliteWV.units.K.colormap` in the frontend. */
27
- export const DEFAULT_SATELLITE_WATER_VAPOR_COLORMAP = [
28
- 10, '#cece55',
29
- 20, '#ce5555',
30
- 30, '#262626',
31
- 45, '#ffffff',
32
- 55, '#55cece',
33
- 70, '#5555ce',
34
- 80, '#4d3366',
35
- 90, '#e673e6',
36
- 100, '#efe6eb',
37
- ];
1
+ /**
2
+ * Default GOES brightness-temperature colormaps for WebGL satellite, aligned with
3
+ * aguacero-frontend `src/lib/defaultColormaps.ts` (`SatelliteLongwaveIR` and `SatelliteWV`, K/°C units).
4
+ *
5
+ * Format: flat array `[norm0, '#hex', norm1, '#hex', ...]` where each **norm** is 0–100
6
+ * (cold → hot in texture space; see `SatelliteShaderManager._generateTextureFromColormapData` and
7
+ * frontend `normToKelvin` / `kelvinToNorm` in `utilityFunctions.ts`).
8
+ */
9
+
10
+ /** Longwave IR (C13–C16-style) — matches `SatelliteLongwaveIR.units.K.colormap` in the frontend. */
11
+ export const DEFAULT_SATELLITE_LONGWAVE_IR_COLORMAP = [
12
+ 5, '#000000',
13
+ 51, '#ffffff',
14
+ 52, '#00ffff',
15
+ 58, '#0033cc',
16
+ 64, '#33ff00',
17
+ 73, '#ffee00',
18
+ 78, '#ff0000',
19
+ 82, '#660000',
20
+ 88, '#808080',
21
+ 90, '#cc66ff',
22
+ 96, '#9933cc',
23
+ 100, '#9933cc',
24
+ ];
25
+
26
+ /** Upper / mid / lower water vapor (C08–C10) — matches `SatelliteWV.units.K.colormap` in the frontend. */
27
+ export const DEFAULT_SATELLITE_WATER_VAPOR_COLORMAP = [
28
+ 10, '#cece55',
29
+ 20, '#ce5555',
30
+ 30, '#262626',
31
+ 45, '#ffffff',
32
+ 55, '#55cece',
33
+ 70, '#5555ce',
34
+ 80, '#4d3366',
35
+ 90, '#e673e6',
36
+ 100, '#efe6eb',
37
+ ];
@@ -1,232 +1,232 @@
1
- /**
2
- * KTX2 → GPU bytes for GOES satellite tiles. INITIAL_LOAD matches aguacero-frontend gridWorker.js.
3
- * Serve matching basis_transcoder.js + basis_transcoder.wasm at basisBaseUrl (e.g. /basis/).
4
- */
5
-
6
- let basisModule = null;
7
- let basisInitPromise = null;
8
- let supportedFormats = {};
9
-
10
- /** Emscripten expects u32; Basis enum bindings may be numbers, { value: n }, or missing in some builds. */
11
- function toU32(v) {
12
- if (v == null) return 0;
13
- if (typeof v === 'number' && Number.isFinite(v)) return v >>> 0;
14
- if (typeof v === 'object' && 'value' in v) {
15
- const n = v.value;
16
- return typeof n === 'number' && Number.isFinite(n) ? n >>> 0 : 0;
17
- }
18
- return 0;
19
- }
20
-
21
- /** Decode flags (e.g. flip Y). Newer basis_transcoder builds may omit top-level cDecodeFlagsFlipY; THREE.KTX2Loader uses 0. */
22
- function getDecodeFlags(module) {
23
- const raw = module?.cDecodeFlagsFlipY ?? module?.DecodeFlags?.cDecodeFlagsFlipY;
24
- return toU32(raw);
25
- }
26
-
27
- function findBestFormatForWorker(module, isUASTC, hasAlpha) {
28
- const T = module?.transcoder_texture_format;
29
- if (!T) {
30
- return { transcoderFormat: 0, webglFormatName: 'RGBA', isCompressed: false };
31
- }
32
- if (supportedFormats.astc) {
33
- const formatEnum = T.cTFASTC_4x4_RGBA;
34
- if (formatEnum) {
35
- const formatValue = toU32(formatEnum.value ?? formatEnum);
36
- if (formatValue !== 0) {
37
- return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_ASTC_4x4_KHR', isCompressed: true };
38
- }
39
- }
40
- }
41
- if (isUASTC && supportedFormats.bc7) {
42
- const formatEnum = T.cTFBC7_RGBA;
43
- if (formatEnum) {
44
- const formatValue = toU32(formatEnum.value ?? formatEnum);
45
- if (formatValue !== 0) {
46
- return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_BPTC_UNORM_EXT', isCompressed: true };
47
- }
48
- }
49
- }
50
- if (supportedFormats.s3tc) {
51
- if (hasAlpha) {
52
- const formatEnum = T.cTFBC3_RGBA;
53
- if (formatEnum) {
54
- const formatValue = toU32(formatEnum.value ?? formatEnum);
55
- if (formatValue !== 0) {
56
- return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_S3TC_DXT5_EXT', isCompressed: true };
57
- }
58
- }
59
- } else {
60
- const formatEnum = T.cTFBC1_RGB;
61
- if (formatEnum) {
62
- const formatValue = toU32(formatEnum.value ?? formatEnum);
63
- if (formatValue !== 0) {
64
- return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGB_S3TC_DXT1_EXT', isCompressed: true };
65
- }
66
- }
67
- }
68
- }
69
- if (supportedFormats.etc1 && !hasAlpha) {
70
- const formatEnum = T.cTFETC1_RGB;
71
- if (formatEnum) {
72
- const formatValue = toU32(formatEnum.value ?? formatEnum);
73
- if (formatValue !== 0) {
74
- return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGB_ETC1_WEBGL', isCompressed: true };
75
- }
76
- }
77
- }
78
- const formatEnum = T.cTFRGBA32;
79
- const formatValue = formatEnum ? toU32(formatEnum.value ?? formatEnum) : 0;
80
- return { transcoderFormat: formatValue, webglFormatName: 'RGBA', isCompressed: false };
81
- }
82
-
83
- const loadBasisModule = async (basisBaseUrl) => {
84
- const base = (basisBaseUrl || '/basis/').replace(/\/?$/, '/');
85
- const jsUrl = `${base}basis_transcoder.js`;
86
- const wasmUrl = `${base}basis_transcoder.wasm`;
87
-
88
- if (typeof self.BASIS === 'undefined') {
89
- const scriptText = await (await fetch(jsUrl)).text();
90
- const trimmed = scriptText.trimStart();
91
- if (trimmed.startsWith('<')) {
92
- throw new Error(
93
- `Expected JavaScript at ${jsUrl} but got HTML (often a 404 or SPA index). ` +
94
- 'Copy basis_transcoder.js and basis_transcoder.wasm to your static host, or set WeatherLayerManager basisBaseUrl.',
95
- );
96
- }
97
- self.eval(scriptText);
98
- if (self.Module) {
99
- self.Module = undefined;
100
- }
101
- }
102
-
103
- const BASIS = self.BASIS || self.module?.exports?.default;
104
- const ctor = typeof BASIS === 'function' ? BASIS : BASIS?.default;
105
- const module = await ctor({
106
- locateFile: (filename) => (filename === 'basis_transcoder.wasm' ? wasmUrl : `${base}${filename}`),
107
- });
108
- module.initializeBasis();
109
- return module;
110
- };
111
-
112
- self.onmessage = async function (e) {
113
- const { type } = e.data;
114
- const taskId = e.data.__taskId || Math.random().toString(36).substr(2, 9);
115
-
116
- try {
117
- if (type === 'INIT_WORKER') {
118
- supportedFormats = e.data.supportedFormats || {};
119
- if (e.data.basisBaseUrl) {
120
- self.__BASIS_BASE__ = e.data.basisBaseUrl;
121
- }
122
- self.postMessage({ __taskId: taskId, type: 'INIT_SUCCESS' });
123
- return;
124
- }
125
-
126
- if (type === 'INITIAL_LOAD') {
127
- const basisBaseUrl = e.data.basisBaseUrl || self.__BASIS_BASE__ || '/basis/';
128
-
129
- if (!basisModule) {
130
- try {
131
- if (!basisInitPromise) {
132
- basisInitPromise = loadBasisModule(basisBaseUrl);
133
- }
134
- basisModule = await basisInitPromise;
135
- } catch (error) {
136
- self.postMessage({
137
- __taskId: taskId,
138
- type: 'WORKER_ERROR',
139
- frameKey: e.data.frameKey,
140
- error: `Worker not initialized: ${error.message}`,
141
- });
142
- return;
143
- }
144
- }
145
-
146
- const downsampleRate = e.data.downsampleRate || 1;
147
- const { KTX2File } = basisModule;
148
- const ktx2File = new KTX2File(new Uint8Array(e.data.ktx2Buffer));
149
-
150
- if (!ktx2File.isValid()) throw new Error('Invalid KTX2 file');
151
-
152
- const width = ktx2File.getWidth();
153
- const height = ktx2File.getHeight();
154
- const hasAlpha = ktx2File.getHasAlpha();
155
- const isUASTC = ktx2File.isUASTC();
156
-
157
- const formatInfo = findBestFormatForWorker(basisModule, isUASTC, hasAlpha);
158
-
159
- let blockWidth = 1;
160
- let blockHeight = 1;
161
- let bytesPerBlock = 4;
162
- if (formatInfo.isCompressed) {
163
- switch (formatInfo.webglFormatName) {
164
- case 'COMPRESSED_RGBA_ASTC_4x4_KHR':
165
- case 'COMPRESSED_RGBA_BPTC_UNORM_EXT':
166
- case 'COMPRESSED_RGBA_S3TC_DXT5_EXT':
167
- blockWidth = 4;
168
- blockHeight = 4;
169
- bytesPerBlock = 16;
170
- break;
171
- case 'COMPRESSED_RGB_S3TC_DXT1_EXT':
172
- case 'COMPRESSED_RGB_ETC1_WEBGL':
173
- blockWidth = 4;
174
- blockHeight = 4;
175
- bytesPerBlock = 8;
176
- break;
177
- }
178
- }
179
-
180
- if (!ktx2File.startTranscoding()) throw new Error('Failed to start transcoding');
181
-
182
- const fullTranscodedData = new Uint8Array(
183
- ktx2File.getImageTranscodedSizeInBytes(0, 0, 0, formatInfo.transcoderFormat)
184
- );
185
-
186
- if (
187
- !ktx2File.transcodeImage(
188
- fullTranscodedData,
189
- 0,
190
- 0,
191
- 0,
192
- formatInfo.transcoderFormat,
193
- getDecodeFlags(basisModule),
194
- -1,
195
- -1
196
- )
197
- ) {
198
- throw new Error('Transcoding failed');
199
- }
200
-
201
- ktx2File.close();
202
- ktx2File.delete();
203
-
204
- const ktx2Metadata = { fullWidth: width, fullHeight: height, blockWidth, blockHeight, formatInfo, bytesPerBlock, downsampleRate };
205
- const sampleRate = downsampleRate;
206
- const totalBlocksX = Math.ceil(width / blockWidth);
207
- const totalBlocksY = Math.ceil(height / blockHeight);
208
- const newBlocksX = Math.floor(totalBlocksX / sampleRate);
209
- const newBlocksY = Math.floor(totalBlocksY / sampleRate);
210
-
211
- const lowResData = new Uint8Array(newBlocksX * newBlocksY * bytesPerBlock);
212
-
213
- for (let y = 0; y < newBlocksY; y++) {
214
- for (let x = 0; x < newBlocksX; x++) {
215
- const sourceBlockIndex = y * sampleRate * totalBlocksX + x * sampleRate;
216
- const sourceOffset = sourceBlockIndex * bytesPerBlock;
217
- const destOffset = (y * newBlocksX + x) * bytesPerBlock;
218
- lowResData.set(fullTranscodedData.subarray(sourceOffset, sourceOffset + bytesPerBlock), destOffset);
219
- }
220
- }
221
-
222
- const frameKey = e.data.frameKey;
223
- self.postMessage(
224
- { __taskId: taskId, type: 'INITIAL_LOAD_RESULT', frameKey, lowResData, ktx2Metadata, fullTranscodedData },
225
- [lowResData.buffer, fullTranscodedData.buffer]
226
- );
227
- return;
228
- }
229
- } catch (error) {
230
- self.postMessage({ __taskId: taskId, type: 'WORKER_ERROR', frameKey: e.data?.frameKey, error: error.message });
231
- }
232
- };
1
+ /**
2
+ * KTX2 → GPU bytes for GOES satellite tiles. INITIAL_LOAD matches aguacero-frontend gridWorker.js.
3
+ * Serve matching basis_transcoder.js + basis_transcoder.wasm at basisBaseUrl (e.g. /basis/).
4
+ */
5
+
6
+ let basisModule = null;
7
+ let basisInitPromise = null;
8
+ let supportedFormats = {};
9
+
10
+ /** Emscripten expects u32; Basis enum bindings may be numbers, { value: n }, or missing in some builds. */
11
+ function toU32(v) {
12
+ if (v == null) return 0;
13
+ if (typeof v === 'number' && Number.isFinite(v)) return v >>> 0;
14
+ if (typeof v === 'object' && 'value' in v) {
15
+ const n = v.value;
16
+ return typeof n === 'number' && Number.isFinite(n) ? n >>> 0 : 0;
17
+ }
18
+ return 0;
19
+ }
20
+
21
+ /** Decode flags (e.g. flip Y). Newer basis_transcoder builds may omit top-level cDecodeFlagsFlipY; THREE.KTX2Loader uses 0. */
22
+ function getDecodeFlags(module) {
23
+ const raw = module?.cDecodeFlagsFlipY ?? module?.DecodeFlags?.cDecodeFlagsFlipY;
24
+ return toU32(raw);
25
+ }
26
+
27
+ function findBestFormatForWorker(module, isUASTC, hasAlpha) {
28
+ const T = module?.transcoder_texture_format;
29
+ if (!T) {
30
+ return { transcoderFormat: 0, webglFormatName: 'RGBA', isCompressed: false };
31
+ }
32
+ if (supportedFormats.astc) {
33
+ const formatEnum = T.cTFASTC_4x4_RGBA;
34
+ if (formatEnum) {
35
+ const formatValue = toU32(formatEnum.value ?? formatEnum);
36
+ if (formatValue !== 0) {
37
+ return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_ASTC_4x4_KHR', isCompressed: true };
38
+ }
39
+ }
40
+ }
41
+ if (isUASTC && supportedFormats.bc7) {
42
+ const formatEnum = T.cTFBC7_RGBA;
43
+ if (formatEnum) {
44
+ const formatValue = toU32(formatEnum.value ?? formatEnum);
45
+ if (formatValue !== 0) {
46
+ return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_BPTC_UNORM_EXT', isCompressed: true };
47
+ }
48
+ }
49
+ }
50
+ if (supportedFormats.s3tc) {
51
+ if (hasAlpha) {
52
+ const formatEnum = T.cTFBC3_RGBA;
53
+ if (formatEnum) {
54
+ const formatValue = toU32(formatEnum.value ?? formatEnum);
55
+ if (formatValue !== 0) {
56
+ return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGBA_S3TC_DXT5_EXT', isCompressed: true };
57
+ }
58
+ }
59
+ } else {
60
+ const formatEnum = T.cTFBC1_RGB;
61
+ if (formatEnum) {
62
+ const formatValue = toU32(formatEnum.value ?? formatEnum);
63
+ if (formatValue !== 0) {
64
+ return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGB_S3TC_DXT1_EXT', isCompressed: true };
65
+ }
66
+ }
67
+ }
68
+ }
69
+ if (supportedFormats.etc1 && !hasAlpha) {
70
+ const formatEnum = T.cTFETC1_RGB;
71
+ if (formatEnum) {
72
+ const formatValue = toU32(formatEnum.value ?? formatEnum);
73
+ if (formatValue !== 0) {
74
+ return { transcoderFormat: formatValue, webglFormatName: 'COMPRESSED_RGB_ETC1_WEBGL', isCompressed: true };
75
+ }
76
+ }
77
+ }
78
+ const formatEnum = T.cTFRGBA32;
79
+ const formatValue = formatEnum ? toU32(formatEnum.value ?? formatEnum) : 0;
80
+ return { transcoderFormat: formatValue, webglFormatName: 'RGBA', isCompressed: false };
81
+ }
82
+
83
+ const loadBasisModule = async (basisBaseUrl) => {
84
+ const base = (basisBaseUrl || '/basis/').replace(/\/?$/, '/');
85
+ const jsUrl = `${base}basis_transcoder.js`;
86
+ const wasmUrl = `${base}basis_transcoder.wasm`;
87
+
88
+ if (typeof self.BASIS === 'undefined') {
89
+ const scriptText = await (await fetch(jsUrl)).text();
90
+ const trimmed = scriptText.trimStart();
91
+ if (trimmed.startsWith('<')) {
92
+ throw new Error(
93
+ `Expected JavaScript at ${jsUrl} but got HTML (often a 404 or SPA index). ` +
94
+ 'Copy basis_transcoder.js and basis_transcoder.wasm to your static host, or set WeatherLayerManager basisBaseUrl.',
95
+ );
96
+ }
97
+ self.eval(scriptText);
98
+ if (self.Module) {
99
+ self.Module = undefined;
100
+ }
101
+ }
102
+
103
+ const BASIS = self.BASIS || self.module?.exports?.default;
104
+ const ctor = typeof BASIS === 'function' ? BASIS : BASIS?.default;
105
+ const module = await ctor({
106
+ locateFile: (filename) => (filename === 'basis_transcoder.wasm' ? wasmUrl : `${base}${filename}`),
107
+ });
108
+ module.initializeBasis();
109
+ return module;
110
+ };
111
+
112
+ self.onmessage = async function (e) {
113
+ const { type } = e.data;
114
+ const taskId = e.data.__taskId || Math.random().toString(36).substr(2, 9);
115
+
116
+ try {
117
+ if (type === 'INIT_WORKER') {
118
+ supportedFormats = e.data.supportedFormats || {};
119
+ if (e.data.basisBaseUrl) {
120
+ self.__BASIS_BASE__ = e.data.basisBaseUrl;
121
+ }
122
+ self.postMessage({ __taskId: taskId, type: 'INIT_SUCCESS' });
123
+ return;
124
+ }
125
+
126
+ if (type === 'INITIAL_LOAD') {
127
+ const basisBaseUrl = e.data.basisBaseUrl || self.__BASIS_BASE__ || '/basis/';
128
+
129
+ if (!basisModule) {
130
+ try {
131
+ if (!basisInitPromise) {
132
+ basisInitPromise = loadBasisModule(basisBaseUrl);
133
+ }
134
+ basisModule = await basisInitPromise;
135
+ } catch (error) {
136
+ self.postMessage({
137
+ __taskId: taskId,
138
+ type: 'WORKER_ERROR',
139
+ frameKey: e.data.frameKey,
140
+ error: `Worker not initialized: ${error.message}`,
141
+ });
142
+ return;
143
+ }
144
+ }
145
+
146
+ const downsampleRate = e.data.downsampleRate || 1;
147
+ const { KTX2File } = basisModule;
148
+ const ktx2File = new KTX2File(new Uint8Array(e.data.ktx2Buffer));
149
+
150
+ if (!ktx2File.isValid()) throw new Error('Invalid KTX2 file');
151
+
152
+ const width = ktx2File.getWidth();
153
+ const height = ktx2File.getHeight();
154
+ const hasAlpha = ktx2File.getHasAlpha();
155
+ const isUASTC = ktx2File.isUASTC();
156
+
157
+ const formatInfo = findBestFormatForWorker(basisModule, isUASTC, hasAlpha);
158
+
159
+ let blockWidth = 1;
160
+ let blockHeight = 1;
161
+ let bytesPerBlock = 4;
162
+ if (formatInfo.isCompressed) {
163
+ switch (formatInfo.webglFormatName) {
164
+ case 'COMPRESSED_RGBA_ASTC_4x4_KHR':
165
+ case 'COMPRESSED_RGBA_BPTC_UNORM_EXT':
166
+ case 'COMPRESSED_RGBA_S3TC_DXT5_EXT':
167
+ blockWidth = 4;
168
+ blockHeight = 4;
169
+ bytesPerBlock = 16;
170
+ break;
171
+ case 'COMPRESSED_RGB_S3TC_DXT1_EXT':
172
+ case 'COMPRESSED_RGB_ETC1_WEBGL':
173
+ blockWidth = 4;
174
+ blockHeight = 4;
175
+ bytesPerBlock = 8;
176
+ break;
177
+ }
178
+ }
179
+
180
+ if (!ktx2File.startTranscoding()) throw new Error('Failed to start transcoding');
181
+
182
+ const fullTranscodedData = new Uint8Array(
183
+ ktx2File.getImageTranscodedSizeInBytes(0, 0, 0, formatInfo.transcoderFormat)
184
+ );
185
+
186
+ if (
187
+ !ktx2File.transcodeImage(
188
+ fullTranscodedData,
189
+ 0,
190
+ 0,
191
+ 0,
192
+ formatInfo.transcoderFormat,
193
+ getDecodeFlags(basisModule),
194
+ -1,
195
+ -1
196
+ )
197
+ ) {
198
+ throw new Error('Transcoding failed');
199
+ }
200
+
201
+ ktx2File.close();
202
+ ktx2File.delete();
203
+
204
+ const ktx2Metadata = { fullWidth: width, fullHeight: height, blockWidth, blockHeight, formatInfo, bytesPerBlock, downsampleRate };
205
+ const sampleRate = downsampleRate;
206
+ const totalBlocksX = Math.ceil(width / blockWidth);
207
+ const totalBlocksY = Math.ceil(height / blockHeight);
208
+ const newBlocksX = Math.floor(totalBlocksX / sampleRate);
209
+ const newBlocksY = Math.floor(totalBlocksY / sampleRate);
210
+
211
+ const lowResData = new Uint8Array(newBlocksX * newBlocksY * bytesPerBlock);
212
+
213
+ for (let y = 0; y < newBlocksY; y++) {
214
+ for (let x = 0; x < newBlocksX; x++) {
215
+ const sourceBlockIndex = y * sampleRate * totalBlocksX + x * sampleRate;
216
+ const sourceOffset = sourceBlockIndex * bytesPerBlock;
217
+ const destOffset = (y * newBlocksX + x) * bytesPerBlock;
218
+ lowResData.set(fullTranscodedData.subarray(sourceOffset, sourceOffset + bytesPerBlock), destOffset);
219
+ }
220
+ }
221
+
222
+ const frameKey = e.data.frameKey;
223
+ self.postMessage(
224
+ { __taskId: taskId, type: 'INITIAL_LOAD_RESULT', frameKey, lowResData, ktx2Metadata, fullTranscodedData },
225
+ [lowResData.buffer, fullTranscodedData.buffer]
226
+ );
227
+ return;
228
+ }
229
+ } catch (error) {
230
+ self.postMessage({ __taskId: taskId, type: 'WORKER_ERROR', frameKey: e.data?.frameKey, error: error.message });
231
+ }
232
+ };
@@ -1,17 +1,17 @@
1
- /** Minimal shader compile helper (same as aguacero-frontend satelliteShader.js). */
2
- export function createProgram(gl, vertexSource, fragmentSource) {
3
- const vertexShader = gl.createShader(gl.VERTEX_SHADER);
4
- gl.shaderSource(vertexShader, vertexSource);
5
- gl.compileShader(vertexShader);
6
-
7
- const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
8
- gl.shaderSource(fragmentShader, fragmentSource);
9
- gl.compileShader(fragmentShader);
10
-
11
- const program = gl.createProgram();
12
- gl.attachShader(program, vertexShader);
13
- gl.attachShader(program, fragmentShader);
14
- gl.linkProgram(program);
15
-
16
- return program;
17
- }
1
+ /** Minimal shader compile helper (same as aguacero-frontend satelliteShader.js). */
2
+ export function createProgram(gl, vertexSource, fragmentSource) {
3
+ const vertexShader = gl.createShader(gl.VERTEX_SHADER);
4
+ gl.shaderSource(vertexShader, vertexSource);
5
+ gl.compileShader(vertexShader);
6
+
7
+ const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
8
+ gl.shaderSource(fragmentShader, fragmentSource);
9
+ gl.compileShader(fragmentShader);
10
+
11
+ const program = gl.createProgram();
12
+ gl.attachShader(program, vertexShader);
13
+ gl.attachShader(program, fragmentShader);
14
+ gl.linkProgram(program);
15
+
16
+ return program;
17
+ }