@luma.gl/test-utils 9.0.0-alpha.4 → 9.0.0-alpha.40
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 +3 -1
- package/dist/check-type.js +0 -1
- package/dist/check-type.js.map +1 -1
- package/dist/create-test-device.d.ts +11 -4
- package/dist/create-test-device.d.ts.map +1 -1
- package/dist/create-test-device.js +29 -18
- package/dist/create-test-device.js.map +1 -1
- package/dist/engine/classic-animation-loop.d.ts +135 -0
- package/dist/engine/classic-animation-loop.d.ts.map +1 -0
- package/dist/engine/classic-animation-loop.js +434 -0
- package/dist/engine/classic-animation-loop.js.map +1 -0
- package/dist/index.cjs +851 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/performance-test-runner.d.ts +7 -6
- package/dist/performance-test-runner.d.ts.map +1 -1
- package/dist/performance-test-runner.js +10 -22
- package/dist/performance-test-runner.js.map +1 -1
- package/dist/register-devices.d.ts +2 -0
- package/dist/register-devices.d.ts.map +1 -0
- package/dist/register-devices.js +7 -0
- package/dist/register-devices.js.map +1 -0
- package/dist/snapshot-test-runner.d.ts +11 -7
- package/dist/snapshot-test-runner.d.ts.map +1 -1
- package/dist/snapshot-test-runner.js +23 -29
- package/dist/snapshot-test-runner.js.map +1 -1
- package/dist/test-runner.d.ts +35 -23
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +62 -81
- package/dist/test-runner.js.map +1 -1
- package/dist/utils.d.ts +5 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +28 -7
- package/src/check-type.ts +1 -1
- package/src/create-test-device.ts +38 -21
- package/src/engine/classic-animation-loop.ts +714 -0
- package/src/index.ts +5 -5
- package/src/performance-test-runner.ts +17 -13
- package/src/register-devices.ts +11 -0
- package/src/snapshot-test-runner.ts +33 -31
- package/src/test-runner.ts +100 -75
- package/src/utils.ts +1 -1
- package/dist/create-headless-context.d.ts +0 -2
- package/dist/create-headless-context.d.ts.map +0 -1
- package/dist/create-headless-context.js +0 -37
- package/dist/create-headless-context.js.map +0 -1
- package/dist/create-test-context.d.ts +0 -2
- package/dist/create-test-context.d.ts.map +0 -1
- package/dist/create-test-context.js +0 -6
- package/dist/create-test-context.js.map +0 -1
- package/src/create-headless-context.ts +0 -36
- package/src/create-test-context.ts +0 -29
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { luma, log, requestAnimationFrame, cancelAnimationFrame } from '@luma.gl/core';
|
|
2
|
+
import { isBrowser } from '@probe.gl/env';
|
|
3
|
+
import { isWebGL, resetGLParameters } from '@luma.gl/webgl';
|
|
4
|
+
const isPage = isBrowser() && typeof document !== 'undefined';
|
|
5
|
+
function getHTMLCanvasElement(canvas) {
|
|
6
|
+
return typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement ? canvas : null;
|
|
7
|
+
}
|
|
8
|
+
let statIdCounter = 0;
|
|
9
|
+
const DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS = {
|
|
10
|
+
onCreateDevice: props => luma.createDevice(props),
|
|
11
|
+
onCreateContext: undefined,
|
|
12
|
+
onAddHTML: undefined,
|
|
13
|
+
onInitialize: () => ({}),
|
|
14
|
+
onRender: () => {},
|
|
15
|
+
onFinalize: () => {},
|
|
16
|
+
onError: error => console.error(error),
|
|
17
|
+
device: null,
|
|
18
|
+
useDevicePixels: true,
|
|
19
|
+
autoResizeViewport: true,
|
|
20
|
+
autoResizeDrawingBuffer: true,
|
|
21
|
+
stats: luma.stats.get(`animation-loop-${statIdCounter++}`),
|
|
22
|
+
gl: undefined,
|
|
23
|
+
glOptions: {},
|
|
24
|
+
createFramebuffer: false
|
|
25
|
+
};
|
|
26
|
+
export class ClassicAnimationLoop {
|
|
27
|
+
constructor() {
|
|
28
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
+
this.device = void 0;
|
|
30
|
+
this.canvas = void 0;
|
|
31
|
+
this.props = void 0;
|
|
32
|
+
this.animationProps = void 0;
|
|
33
|
+
this.timeline = null;
|
|
34
|
+
this.stats = void 0;
|
|
35
|
+
this.cpuTime = void 0;
|
|
36
|
+
this.gpuTime = void 0;
|
|
37
|
+
this.frameRate = void 0;
|
|
38
|
+
this.display = void 0;
|
|
39
|
+
this.needsRedraw = 'initialized';
|
|
40
|
+
this._initialized = false;
|
|
41
|
+
this._running = false;
|
|
42
|
+
this._animationFrameId = null;
|
|
43
|
+
this._pageLoadPromise = null;
|
|
44
|
+
this._nextFramePromise = null;
|
|
45
|
+
this._resolveNextFrame = null;
|
|
46
|
+
this._cpuStartTime = 0;
|
|
47
|
+
this.gl = void 0;
|
|
48
|
+
this.props = {
|
|
49
|
+
...DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS,
|
|
50
|
+
...props
|
|
51
|
+
};
|
|
52
|
+
props = this.props;
|
|
53
|
+
let {
|
|
54
|
+
useDevicePixels = true
|
|
55
|
+
} = this.props;
|
|
56
|
+
if ('useDevicePixelRatio' in props) {
|
|
57
|
+
log.deprecated('useDevicePixelRatio', 'useDevicePixels')();
|
|
58
|
+
useDevicePixels = props.useDevicePixelRatio;
|
|
59
|
+
}
|
|
60
|
+
this.device = props.device;
|
|
61
|
+
this.gl = this.device && this.device.gl || props.gl;
|
|
62
|
+
this.stats = props.stats;
|
|
63
|
+
this.cpuTime = this.stats.get('CPU Time');
|
|
64
|
+
this.gpuTime = this.stats.get('GPU Time');
|
|
65
|
+
this.frameRate = this.stats.get('Frame Rate');
|
|
66
|
+
this.setProps({
|
|
67
|
+
autoResizeViewport: props.autoResizeViewport,
|
|
68
|
+
autoResizeDrawingBuffer: props.autoResizeDrawingBuffer,
|
|
69
|
+
useDevicePixels
|
|
70
|
+
});
|
|
71
|
+
this.start = this.start.bind(this);
|
|
72
|
+
this.stop = this.stop.bind(this);
|
|
73
|
+
this._onMousemove = this._onMousemove.bind(this);
|
|
74
|
+
this._onMouseleave = this._onMouseleave.bind(this);
|
|
75
|
+
}
|
|
76
|
+
destroy() {
|
|
77
|
+
this.stop();
|
|
78
|
+
this._setDisplay(null);
|
|
79
|
+
}
|
|
80
|
+
delete() {
|
|
81
|
+
this.destroy();
|
|
82
|
+
}
|
|
83
|
+
setNeedsRedraw(reason) {
|
|
84
|
+
this.needsRedraw = this.needsRedraw || reason;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
setProps(props) {
|
|
88
|
+
if ('autoResizeViewport' in props) {
|
|
89
|
+
this.props.autoResizeViewport = props.autoResizeViewport;
|
|
90
|
+
}
|
|
91
|
+
if ('autoResizeDrawingBuffer' in props) {
|
|
92
|
+
this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;
|
|
93
|
+
}
|
|
94
|
+
if ('useDevicePixels' in props) {
|
|
95
|
+
this.props.useDevicePixels = props.useDevicePixels;
|
|
96
|
+
}
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
start() {
|
|
100
|
+
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
101
|
+
this._start(opts);
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
async _start(props) {
|
|
105
|
+
if (this._running) {
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
this._running = true;
|
|
109
|
+
try {
|
|
110
|
+
await this._getPageLoadPromise();
|
|
111
|
+
if (!this._running) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
let appContext;
|
|
115
|
+
if (!this._initialized) {
|
|
116
|
+
this._initialized = true;
|
|
117
|
+
await this._createDevice(props);
|
|
118
|
+
this._initialize(props);
|
|
119
|
+
appContext = await this.onInitialize(this.animationProps);
|
|
120
|
+
this._addCallbackData(appContext || {});
|
|
121
|
+
}
|
|
122
|
+
if (!this._running) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (appContext !== false) {
|
|
126
|
+
this._cancelAnimationFrame();
|
|
127
|
+
this._requestAnimationFrame();
|
|
128
|
+
}
|
|
129
|
+
return this;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
this.props.onError(error);
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
redraw() {
|
|
136
|
+
if (this.isContextLost()) {
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
this._beginTimers();
|
|
140
|
+
this._setupFrame();
|
|
141
|
+
this._updateCallbackData();
|
|
142
|
+
this._renderFrame(this.animationProps);
|
|
143
|
+
this._clearNeedsRedraw();
|
|
144
|
+
if (this._resolveNextFrame) {
|
|
145
|
+
this._resolveNextFrame(this);
|
|
146
|
+
this._nextFramePromise = null;
|
|
147
|
+
this._resolveNextFrame = null;
|
|
148
|
+
}
|
|
149
|
+
this._endTimers();
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
stop() {
|
|
153
|
+
if (this._running) {
|
|
154
|
+
this._finalizeCallbackData();
|
|
155
|
+
this._cancelAnimationFrame();
|
|
156
|
+
this._nextFramePromise = null;
|
|
157
|
+
this._resolveNextFrame = null;
|
|
158
|
+
this._running = false;
|
|
159
|
+
}
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
attachTimeline(timeline) {
|
|
163
|
+
this.timeline = timeline;
|
|
164
|
+
return this.timeline;
|
|
165
|
+
}
|
|
166
|
+
detachTimeline() {
|
|
167
|
+
this.timeline = null;
|
|
168
|
+
}
|
|
169
|
+
waitForRender() {
|
|
170
|
+
this.setNeedsRedraw('waitForRender');
|
|
171
|
+
if (!this._nextFramePromise) {
|
|
172
|
+
this._nextFramePromise = new Promise(resolve => {
|
|
173
|
+
this._resolveNextFrame = resolve;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return this._nextFramePromise;
|
|
177
|
+
}
|
|
178
|
+
async toDataURL() {
|
|
179
|
+
var _getHTMLCanvasElement;
|
|
180
|
+
this.setNeedsRedraw('toDataURL');
|
|
181
|
+
await this.waitForRender();
|
|
182
|
+
return (_getHTMLCanvasElement = getHTMLCanvasElement(this.gl.canvas)) === null || _getHTMLCanvasElement === void 0 ? void 0 : _getHTMLCanvasElement.toDataURL();
|
|
183
|
+
}
|
|
184
|
+
isContextLost() {
|
|
185
|
+
return this.gl.isContextLost();
|
|
186
|
+
}
|
|
187
|
+
onCreateDevice(deviceProps) {
|
|
188
|
+
const {
|
|
189
|
+
onCreateDevice
|
|
190
|
+
} = this.props;
|
|
191
|
+
return onCreateDevice(deviceProps);
|
|
192
|
+
}
|
|
193
|
+
onInitialize(animationProps) {
|
|
194
|
+
const {
|
|
195
|
+
onInitialize
|
|
196
|
+
} = this.props;
|
|
197
|
+
return onInitialize(animationProps);
|
|
198
|
+
}
|
|
199
|
+
onRender(animationProps) {
|
|
200
|
+
const {
|
|
201
|
+
onRender
|
|
202
|
+
} = this.props;
|
|
203
|
+
return onRender(animationProps);
|
|
204
|
+
}
|
|
205
|
+
onFinalize(animationProps) {
|
|
206
|
+
const {
|
|
207
|
+
onFinalize
|
|
208
|
+
} = this.props;
|
|
209
|
+
return onFinalize(animationProps);
|
|
210
|
+
}
|
|
211
|
+
onCreateContext(props) {
|
|
212
|
+
const {
|
|
213
|
+
onCreateContext
|
|
214
|
+
} = this.props;
|
|
215
|
+
return onCreateContext(props);
|
|
216
|
+
}
|
|
217
|
+
getHTMLControlValue(id) {
|
|
218
|
+
let defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
219
|
+
const element = document.getElementById(id);
|
|
220
|
+
return element ? Number(element.value) : defaultValue;
|
|
221
|
+
}
|
|
222
|
+
_initialize(props) {
|
|
223
|
+
this._createFramebuffer();
|
|
224
|
+
this._startEventHandling();
|
|
225
|
+
this._initializeCallbackData();
|
|
226
|
+
this._updateCallbackData();
|
|
227
|
+
this._resizeCanvasDrawingBuffer();
|
|
228
|
+
this._resizeViewport();
|
|
229
|
+
}
|
|
230
|
+
_getPageLoadPromise() {
|
|
231
|
+
if (!this._pageLoadPromise) {
|
|
232
|
+
this._pageLoadPromise = isPage ? new Promise((resolve, reject) => {
|
|
233
|
+
if (isPage && document.readyState === 'complete') {
|
|
234
|
+
resolve(document);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
window.addEventListener('load', () => {
|
|
238
|
+
resolve(document);
|
|
239
|
+
});
|
|
240
|
+
}) : Promise.resolve({});
|
|
241
|
+
}
|
|
242
|
+
return this._pageLoadPromise;
|
|
243
|
+
}
|
|
244
|
+
_setDisplay(display) {
|
|
245
|
+
if (this.display) {
|
|
246
|
+
this.display.destroy();
|
|
247
|
+
this.display.animationLoop = null;
|
|
248
|
+
}
|
|
249
|
+
if (display) {
|
|
250
|
+
display.animationLoop = this;
|
|
251
|
+
}
|
|
252
|
+
this.display = display;
|
|
253
|
+
}
|
|
254
|
+
_requestAnimationFrame() {
|
|
255
|
+
if (!this._running) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
this._animationFrameId = requestAnimationFrame(this._animationFrame.bind(this));
|
|
259
|
+
}
|
|
260
|
+
_cancelAnimationFrame() {
|
|
261
|
+
if (this._animationFrameId !== null) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
cancelAnimationFrame(this._animationFrameId);
|
|
265
|
+
this._animationFrameId = null;
|
|
266
|
+
}
|
|
267
|
+
_animationFrame() {
|
|
268
|
+
if (!this._running) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.redraw();
|
|
272
|
+
this._requestAnimationFrame();
|
|
273
|
+
}
|
|
274
|
+
_renderFrame(props) {
|
|
275
|
+
if (this.display) {
|
|
276
|
+
this.display._renderFrame(props);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this.onRender(props);
|
|
280
|
+
}
|
|
281
|
+
_clearNeedsRedraw() {
|
|
282
|
+
this.needsRedraw = null;
|
|
283
|
+
}
|
|
284
|
+
_setupFrame() {
|
|
285
|
+
this._resizeCanvasDrawingBuffer();
|
|
286
|
+
this._resizeViewport();
|
|
287
|
+
this._resizeFramebuffer();
|
|
288
|
+
}
|
|
289
|
+
_initializeCallbackData() {
|
|
290
|
+
this.animationProps = {
|
|
291
|
+
device: this.device,
|
|
292
|
+
gl: this.gl,
|
|
293
|
+
stop: this.stop,
|
|
294
|
+
canvas: this.gl.canvas,
|
|
295
|
+
useDevicePixels: this.props.useDevicePixels,
|
|
296
|
+
needsRedraw: null,
|
|
297
|
+
startTime: Date.now(),
|
|
298
|
+
engineTime: 0,
|
|
299
|
+
tick: 0,
|
|
300
|
+
tock: 0,
|
|
301
|
+
timeline: this.timeline,
|
|
302
|
+
animationLoop: this,
|
|
303
|
+
time: 0,
|
|
304
|
+
_mousePosition: null,
|
|
305
|
+
_timeline: this.timeline,
|
|
306
|
+
_loop: this,
|
|
307
|
+
_animationLoop: this
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
_updateCallbackData() {
|
|
311
|
+
const {
|
|
312
|
+
width,
|
|
313
|
+
height,
|
|
314
|
+
aspect
|
|
315
|
+
} = this._getSizeAndAspect();
|
|
316
|
+
if (width !== this.animationProps.width || height !== this.animationProps.height) {
|
|
317
|
+
this.setNeedsRedraw('drawing buffer resized');
|
|
318
|
+
}
|
|
319
|
+
if (aspect !== this.animationProps.aspect) {
|
|
320
|
+
this.setNeedsRedraw('drawing buffer aspect changed');
|
|
321
|
+
}
|
|
322
|
+
this.animationProps.width = width;
|
|
323
|
+
this.animationProps.height = height;
|
|
324
|
+
this.animationProps.aspect = aspect;
|
|
325
|
+
this.animationProps.needsRedraw = this.needsRedraw;
|
|
326
|
+
this.animationProps.engineTime = Date.now() - this.animationProps.startTime;
|
|
327
|
+
if (this.timeline) {
|
|
328
|
+
this.timeline.update(this.animationProps.engineTime);
|
|
329
|
+
}
|
|
330
|
+
this.animationProps.tick = Math.floor(this.animationProps.time / 1000 * 60);
|
|
331
|
+
this.animationProps.tock++;
|
|
332
|
+
this.animationProps.time = this.timeline ? this.timeline.getTime() : this.animationProps.engineTime;
|
|
333
|
+
}
|
|
334
|
+
_finalizeCallbackData() {
|
|
335
|
+
this.onFinalize(this.animationProps);
|
|
336
|
+
}
|
|
337
|
+
_addCallbackData(appContext) {
|
|
338
|
+
if (typeof appContext === 'object' && appContext !== null) {
|
|
339
|
+
this.animationProps = Object.assign({}, this.animationProps, appContext);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
async _createDevice(props) {
|
|
343
|
+
const deviceProps = {
|
|
344
|
+
...this.props,
|
|
345
|
+
...props,
|
|
346
|
+
...this.props.glOptions
|
|
347
|
+
};
|
|
348
|
+
this.device = await this.onCreateDevice(deviceProps);
|
|
349
|
+
this.gl = this.device.gl;
|
|
350
|
+
if (!isWebGL(this.gl)) {
|
|
351
|
+
throw new Error('ClassicAnimationLoop.onCreateContext - illegal context returned');
|
|
352
|
+
}
|
|
353
|
+
resetGLParameters(this.gl);
|
|
354
|
+
this._createInfoDiv();
|
|
355
|
+
}
|
|
356
|
+
_createInfoDiv() {
|
|
357
|
+
const canvas = getHTMLCanvasElement(this.gl.canvas);
|
|
358
|
+
if (canvas && this.props.onAddHTML) {
|
|
359
|
+
const wrapperDiv = document.createElement('div');
|
|
360
|
+
document.body.appendChild(wrapperDiv);
|
|
361
|
+
wrapperDiv.style.position = 'relative';
|
|
362
|
+
const div = document.createElement('div');
|
|
363
|
+
div.style.position = 'absolute';
|
|
364
|
+
div.style.left = '10px';
|
|
365
|
+
div.style.bottom = '10px';
|
|
366
|
+
div.style.width = '300px';
|
|
367
|
+
div.style.background = 'white';
|
|
368
|
+
if (canvas) {
|
|
369
|
+
wrapperDiv.appendChild(canvas);
|
|
370
|
+
}
|
|
371
|
+
wrapperDiv.appendChild(div);
|
|
372
|
+
const html = this.props.onAddHTML(div);
|
|
373
|
+
if (html) {
|
|
374
|
+
div.innerHTML = html;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
_getSizeAndAspect() {
|
|
379
|
+
const width = this.gl.drawingBufferWidth;
|
|
380
|
+
const height = this.gl.drawingBufferHeight;
|
|
381
|
+
let aspect = 1;
|
|
382
|
+
const canvas = getHTMLCanvasElement(this.gl.canvas);
|
|
383
|
+
if (canvas && canvas.clientHeight) {
|
|
384
|
+
aspect = canvas.clientWidth / canvas.clientHeight;
|
|
385
|
+
} else if (width > 0 && height > 0) {
|
|
386
|
+
aspect = width / height;
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
width,
|
|
390
|
+
height,
|
|
391
|
+
aspect
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
_resizeViewport() {
|
|
395
|
+
if (this.props.autoResizeViewport) {
|
|
396
|
+
this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
_resizeCanvasDrawingBuffer() {
|
|
400
|
+
if (this.props.autoResizeDrawingBuffer) {
|
|
401
|
+
this.device.canvasContext.resize({
|
|
402
|
+
useDevicePixels: this.props.useDevicePixels
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
_beginTimers() {
|
|
407
|
+
this.frameRate.timeEnd();
|
|
408
|
+
this.frameRate.timeStart();
|
|
409
|
+
this.cpuTime.timeStart();
|
|
410
|
+
}
|
|
411
|
+
_endTimers() {
|
|
412
|
+
this.cpuTime.timeEnd();
|
|
413
|
+
}
|
|
414
|
+
_startEventHandling() {
|
|
415
|
+
const {
|
|
416
|
+
canvas
|
|
417
|
+
} = this.gl;
|
|
418
|
+
if (canvas) {
|
|
419
|
+
canvas.addEventListener('mousemove', this._onMousemove);
|
|
420
|
+
canvas.addEventListener('mouseleave', this._onMouseleave);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
_onMousemove(e) {
|
|
424
|
+
this.animationProps._mousePosition = [e.offsetX, e.offsetY];
|
|
425
|
+
}
|
|
426
|
+
_onMouseleave(e) {
|
|
427
|
+
this.animationProps._mousePosition = null;
|
|
428
|
+
}
|
|
429
|
+
_createFramebuffer() {
|
|
430
|
+
if (this.props.createFramebuffer) {}
|
|
431
|
+
}
|
|
432
|
+
_resizeFramebuffer() {}
|
|
433
|
+
}
|
|
434
|
+
//# sourceMappingURL=classic-animation-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classic-animation-loop.js","names":["luma","log","requestAnimationFrame","cancelAnimationFrame","isBrowser","isWebGL","resetGLParameters","isPage","document","getHTMLCanvasElement","canvas","HTMLCanvasElement","statIdCounter","DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS","onCreateDevice","props","createDevice","onCreateContext","undefined","onAddHTML","onInitialize","onRender","onFinalize","onError","error","console","device","useDevicePixels","autoResizeViewport","autoResizeDrawingBuffer","stats","get","gl","glOptions","createFramebuffer","ClassicAnimationLoop","constructor","arguments","length","animationProps","timeline","cpuTime","gpuTime","frameRate","display","needsRedraw","_initialized","_running","_animationFrameId","_pageLoadPromise","_nextFramePromise","_resolveNextFrame","_cpuStartTime","deprecated","useDevicePixelRatio","setProps","start","bind","stop","_onMousemove","_onMouseleave","destroy","_setDisplay","delete","setNeedsRedraw","reason","opts","_start","_getPageLoadPromise","appContext","_createDevice","_initialize","_addCallbackData","_cancelAnimationFrame","_requestAnimationFrame","redraw","isContextLost","_beginTimers","_setupFrame","_updateCallbackData","_renderFrame","_clearNeedsRedraw","_endTimers","_finalizeCallbackData","attachTimeline","detachTimeline","waitForRender","Promise","resolve","toDataURL","_getHTMLCanvasElement","deviceProps","getHTMLControlValue","id","defaultValue","element","getElementById","Number","value","_createFramebuffer","_startEventHandling","_initializeCallbackData","_resizeCanvasDrawingBuffer","_resizeViewport","reject","readyState","window","addEventListener","animationLoop","_animationFrame","_resizeFramebuffer","startTime","Date","now","engineTime","tick","tock","time","_mousePosition","_timeline","_loop","_animationLoop","width","height","aspect","_getSizeAndAspect","update","Math","floor","getTime","Object","assign","Error","_createInfoDiv","wrapperDiv","createElement","body","appendChild","style","position","div","left","bottom","background","html","innerHTML","drawingBufferWidth","drawingBufferHeight","clientHeight","clientWidth","viewport","canvasContext","resize","timeEnd","timeStart","e","offsetX","offsetY"],"sources":["../../src/engine/classic-animation-loop.ts"],"sourcesContent":["// TODO - replace createGLContext, instrumentGLContext, resizeGLContext?\n// TODO - remove dependency on framebuffer (bundle size impact)\nimport {\n luma,\n Device,\n DeviceProps,\n log,\n requestAnimationFrame,\n cancelAnimationFrame\n} from '@luma.gl/core';\nimport {Timeline, AnimationProps} from '@luma.gl/engine';\nimport {Stats, Stat} from '@probe.gl/stats';\nimport {isBrowser} from '@probe.gl/env';\n\nimport {isWebGL, resetGLParameters} from '@luma.gl/webgl';\n// import {default as Query} from '../classic/query';\n// import {ClassicFramebuffer} from '../classic/framebuffer';\n\ntype ContextProps = DeviceProps;\n\nconst isPage = isBrowser() && typeof document !== 'undefined';\nfunction getHTMLCanvasElement(\n canvas: HTMLCanvasElement | OffscreenCanvas\n): HTMLCanvasElement | null {\n return typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement\n ? canvas\n : null;\n}\n\nlet statIdCounter = 0;\n\n/**\n * Classic Animation Props.\n * Contain a number of deprecated fields\n * @deprecated Use new AnimationLoop in `@luma.gl/engine`\n */\nexport type ClassicAnimationProps = AnimationProps & {\n animationLoop: ClassicAnimationLoop;\n\n /** @deprecated Use .device */\n stop: () => ClassicAnimationLoop;\n\n /** @deprecated Use .device */\n gl: WebGLRenderingContext;\n /** @deprecated Will be removed */\n framebuffer: unknown;\n\n /** @deprecated Use .timeline */\n _timeline: Timeline;\n /** @deprecated Use .animationLoop */\n _loop: ClassicAnimationLoop;\n /** @deprecated Use .animationLoop */\n _animationLoop: ClassicAnimationLoop;\n};\n\n/** ClassicAnimationLoop properties */\nexport type ClassicAnimationLoopProps = {\n onCreateDevice?: (props: DeviceProps) => Promise<Device>;\n onCreateContext?: (props: ContextProps) => WebGLRenderingContext; // TODO: signature from createGLContext\n onAddHTML?: (div: HTMLDivElement) => string; // innerHTML\n onInitialize?: (animationProps: ClassicAnimationProps) => {} | void | Promise<{} | void>;\n onRender?: (animationProps: ClassicAnimationProps) => void;\n onFinalize?: (animationProps: ClassicAnimationProps) => void;\n onError?: (reason: any) => void;\n\n stats?: Stats;\n\n device?: Device;\n glOptions?: ContextProps; // createGLContext options\n // debug?: boolean;\n\n // view parameters\n autoResizeViewport?: boolean;\n autoResizeDrawingBuffer?: boolean;\n useDevicePixels?: number | boolean;\n\n /** @deprecated Use .device */\n gl?: WebGLRenderingContext | null;\n /** @deprecated Will be removed */\n createFramebuffer?: boolean;\n};\n\nconst DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS: Required<ClassicAnimationLoopProps> = {\n onCreateDevice: (props: DeviceProps) => luma.createDevice(props),\n onCreateContext: undefined,\n onAddHTML: undefined,\n onInitialize: () => ({}),\n onRender: () => {},\n onFinalize: () => {},\n onError: (error) => console.error(error), // eslint-disable-line no-console\n\n device: null,\n // debug: true,\n\n // view parameters\n useDevicePixels: true,\n autoResizeViewport: true,\n autoResizeDrawingBuffer: true,\n stats: luma.stats.get(`animation-loop-${statIdCounter++}`),\n\n // deprecated\n // onCreateContext: (opts) => createGLContext(opts),\n gl: undefined,\n glOptions: {},\n createFramebuffer: false\n};\n\n/**\n * Convenient animation loop\n * @deprecated Use `@luma.gl/engine` AnimationLoop\n */\nexport class ClassicAnimationLoop {\n device: Device;\n canvas?: HTMLCanvasElement | OffscreenCanvas;\n\n props: Required<ClassicAnimationLoopProps>;\n animationProps: ClassicAnimationProps;\n // framebuffer: ClassicFramebuffer = null;\n timeline: Timeline = null;\n stats: Stats;\n cpuTime: Stat;\n gpuTime: Stat;\n frameRate: Stat;\n\n display: any;\n\n needsRedraw: string | null = 'initialized';\n\n _initialized: boolean = false;\n _running: boolean = false;\n _animationFrameId: any = null;\n _pageLoadPromise: Promise<{}> | null = null;\n _nextFramePromise: Promise<ClassicAnimationLoop> | null = null;\n _resolveNextFrame: ((loop: ClassicAnimationLoop) => void) | null = null;\n _cpuStartTime: number = 0;\n\n // _gpuTimeQuery: Query | null = null;\n\n /** @deprecated */\n gl: WebGLRenderingContext;\n\n /*\n */\n constructor(props: ClassicAnimationLoopProps = {}) {\n this.props = {...DEFAULT_CLASSIC_ANIMATION_LOOP_PROPS, ...props};\n props = this.props;\n\n let {useDevicePixels = true} = this.props;\n\n if ('useDevicePixelRatio' in props) {\n log.deprecated('useDevicePixelRatio', 'useDevicePixels')();\n // @ts-expect-error\n useDevicePixels = props.useDevicePixelRatio;\n }\n\n // state\n this.device = props.device;\n // @ts-expect-error\n this.gl = (this.device && this.device.gl) || props.gl;\n\n this.stats = props.stats;\n this.cpuTime = this.stats.get('CPU Time');\n this.gpuTime = this.stats.get('GPU Time');\n this.frameRate = this.stats.get('Frame Rate');\n\n this.setProps({\n autoResizeViewport: props.autoResizeViewport,\n autoResizeDrawingBuffer: props.autoResizeDrawingBuffer,\n useDevicePixels\n });\n\n // Bind methods\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n\n this._onMousemove = this._onMousemove.bind(this);\n this._onMouseleave = this._onMouseleave.bind(this);\n }\n\n destroy(): void {\n this.stop();\n this._setDisplay(null);\n }\n\n /** @deprecated Use .destroy() */\n delete(): void {\n this.destroy();\n }\n\n setNeedsRedraw(reason: string): this {\n this.needsRedraw = this.needsRedraw || reason;\n return this;\n }\n\n setProps(props: ClassicAnimationLoopProps): this {\n if ('autoResizeViewport' in props) {\n this.props.autoResizeViewport = props.autoResizeViewport;\n }\n if ('autoResizeDrawingBuffer' in props) {\n this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;\n }\n if ('useDevicePixels' in props) {\n this.props.useDevicePixels = props.useDevicePixels;\n }\n return this;\n }\n\n start(opts = {}) {\n this._start(opts);\n return this;\n }\n\n /** Starts a render loop if not already running */\n async _start(props) {\n if (this._running) {\n return this;\n }\n this._running = true;\n\n // console.debug(`Starting ${this.constructor.name}`);\n // Wait for start promise before rendering frame\n try {\n await this._getPageLoadPromise();\n\n // check that we haven't been stopped\n if (!this._running) {\n return null;\n }\n\n let appContext;\n if (!this._initialized) {\n this._initialized = true;\n // Create the WebGL context\n await this._createDevice(props);\n this._initialize(props);\n\n // Note: onIntialize can return a promise (in case app needs to load resources)\n // eslint-disable-next-line @typescript-eslint/await-thenable\n appContext = await this.onInitialize(this.animationProps);\n this._addCallbackData(appContext || {});\n }\n\n // check that we haven't been stopped\n if (!this._running) {\n return null;\n }\n\n // Start the loop\n if (appContext !== false) {\n // cancel any pending renders to ensure only one loop can ever run\n this._cancelAnimationFrame();\n this._requestAnimationFrame();\n }\n\n return this;\n } catch (error) {\n this.props.onError(error);\n // this._running = false; // TODO\n return null;\n }\n }\n\n /** Explicitly draw a frame */\n redraw(): this {\n if (this.isContextLost()) {\n return this;\n }\n\n this._beginTimers();\n\n this._setupFrame();\n this._updateCallbackData();\n\n this._renderFrame(this.animationProps);\n\n // clear needsRedraw flag\n this._clearNeedsRedraw();\n\n if (this._resolveNextFrame) {\n this._resolveNextFrame(this);\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n }\n\n this._endTimers();\n\n return this;\n }\n\n // Stops a render loop if already running, finalizing\n stop() {\n // console.debug(`Stopping ${this.constructor.name}`);\n if (this._running) {\n this._finalizeCallbackData();\n this._cancelAnimationFrame();\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n this._running = false;\n }\n return this;\n }\n\n attachTimeline(timeline: Timeline): Timeline {\n this.timeline = timeline;\n return this.timeline;\n }\n\n detachTimeline(): void {\n this.timeline = null;\n }\n\n waitForRender(): Promise<ClassicAnimationLoop> {\n this.setNeedsRedraw('waitForRender');\n\n if (!this._nextFramePromise) {\n this._nextFramePromise = new Promise((resolve) => {\n this._resolveNextFrame = resolve;\n });\n }\n return this._nextFramePromise;\n }\n\n async toDataURL() {\n this.setNeedsRedraw('toDataURL');\n\n await this.waitForRender();\n\n return getHTMLCanvasElement(this.gl.canvas)?.toDataURL();\n }\n\n isContextLost(): boolean {\n return this.gl.isContextLost();\n }\n\n onCreateDevice(deviceProps: DeviceProps): Promise<Device> {\n const {onCreateDevice} = this.props;\n return onCreateDevice(deviceProps);\n }\n\n onInitialize(animationProps: ClassicAnimationProps): {} | void {\n const {onInitialize} = this.props;\n return onInitialize(animationProps);\n }\n\n onRender(animationProps: ClassicAnimationProps) {\n const {onRender} = this.props;\n return onRender(animationProps);\n }\n\n onFinalize(animationProps: ClassicAnimationProps) {\n const {onFinalize} = this.props;\n return onFinalize(animationProps);\n }\n\n // DEPRECATED/REMOVED METHODS\n\n /** @deprecated Use .onCreateDevice() */\n onCreateContext(props: ContextProps) {\n const {onCreateContext} = this.props;\n return onCreateContext(props);\n }\n\n /** @deprecated */\n getHTMLControlValue(id, defaultValue = 1) {\n const element = document.getElementById(id);\n // @ts-expect-error Not all html elements have value\n return element ? Number(element.value) : defaultValue;\n }\n\n // PRIVATE METHODS\n\n _initialize(props: ClassicAnimationLoopProps) {\n this._createFramebuffer();\n this._startEventHandling();\n\n // Initialize the callback data\n this._initializeCallbackData();\n this._updateCallbackData();\n\n // Default viewport setup, in case onInitialize wants to render\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n\n // this._gpuTimeQuery = Query.isSupported(this.gl, ['timers']) ? new Query(this.gl) : null;\n }\n\n _getPageLoadPromise() {\n if (!this._pageLoadPromise) {\n this._pageLoadPromise = isPage\n ? new Promise((resolve, reject) => {\n if (isPage && document.readyState === 'complete') {\n resolve(document);\n return;\n }\n window.addEventListener('load', () => {\n resolve(document);\n });\n })\n : Promise.resolve({});\n }\n return this._pageLoadPromise;\n }\n\n _setDisplay(display: any) {\n if (this.display) {\n this.display.destroy();\n this.display.animationLoop = null;\n }\n\n // store animation loop on the display\n if (display) {\n display.animationLoop = this;\n }\n\n this.display = display;\n }\n\n _requestAnimationFrame() {\n if (!this._running) {\n return;\n }\n\n // VR display has a separate animation frame to sync with headset\n // TODO WebVR API discontinued, replaced by WebXR: https://immersive-web.github.io/webxr/\n // See https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestAnimationFrame\n // if (this.display && this.display.requestAnimationFrame) {\n // this._animationFrameId = this.display.requestAnimationFrame(this._animationFrame.bind(this));\n // }\n this._animationFrameId = requestAnimationFrame(this._animationFrame.bind(this));\n }\n\n _cancelAnimationFrame() {\n if (this._animationFrameId !== null) {\n return;\n }\n\n // VR display has a separate animation frame to sync with headset\n // TODO WebVR API discontinued, replaced by WebXR: https://immersive-web.github.io/webxr/\n // See https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/requestAnimationFrame\n // if (this.display && this.display.cancelAnimationFrame) {\n // this.display.cancelAnimationFrame(this._animationFrameId);\n // }\n cancelAnimationFrame(this._animationFrameId);\n this._animationFrameId = null;\n }\n\n _animationFrame() {\n if (!this._running) {\n return;\n }\n this.redraw();\n this._requestAnimationFrame();\n }\n\n // Called on each frame, can be overridden to call onRender multiple times\n // to support e.g. stereoscopic rendering\n _renderFrame(props: ClassicAnimationProps) {\n // Allow e.g. VR display to render multiple frames.\n if (this.display) {\n this.display._renderFrame(props);\n return;\n }\n\n // call callback\n this.onRender(props);\n // end callback\n }\n\n _clearNeedsRedraw() {\n this.needsRedraw = null;\n }\n\n _setupFrame() {\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n this._resizeFramebuffer();\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Initialize the object that will be passed to app callbacks\n _initializeCallbackData() {\n this.animationProps = {\n device: this.device,\n gl: this.gl,\n\n stop: this.stop,\n canvas: this.gl.canvas,\n\n // Initial values\n useDevicePixels: this.props.useDevicePixels,\n needsRedraw: null,\n\n // Animation props\n startTime: Date.now(),\n engineTime: 0,\n tick: 0,\n tock: 0,\n\n timeline: this.timeline,\n // @ts-ignore\n animationLoop: this,\n\n // Timeline time for back compatibility\n time: 0,\n\n // Experimental\n _mousePosition: null, // Event props\n\n /** @deprecated */\n // framebuffer: this.framebuffer,\n /** @deprecated */\n _timeline: this.timeline,\n /** @deprecated */\n _loop: this,\n /** @deprecated */\n _animationLoop: this\n };\n }\n\n // Update the context object that will be passed to app callbacks\n _updateCallbackData() {\n const {width, height, aspect} = this._getSizeAndAspect();\n if (width !== this.animationProps.width || height !== this.animationProps.height) {\n this.setNeedsRedraw('drawing buffer resized');\n }\n if (aspect !== this.animationProps.aspect) {\n this.setNeedsRedraw('drawing buffer aspect changed');\n }\n\n this.animationProps.width = width;\n this.animationProps.height = height;\n this.animationProps.aspect = aspect;\n\n this.animationProps.needsRedraw = this.needsRedraw;\n\n // Update time properties\n this.animationProps.engineTime = Date.now() - this.animationProps.startTime;\n\n if (this.timeline) {\n this.timeline.update(this.animationProps.engineTime);\n }\n\n this.animationProps.tick = Math.floor((this.animationProps.time / 1000) * 60);\n this.animationProps.tock++;\n\n // For back compatibility\n this.animationProps.time = this.timeline\n ? this.timeline.getTime()\n : this.animationProps.engineTime;\n }\n\n _finalizeCallbackData() {\n // call callback\n this.onFinalize(this.animationProps);\n // end callback\n }\n\n /** Add application's data to the app context object */\n _addCallbackData(appContext) {\n if (typeof appContext === 'object' && appContext !== null) {\n this.animationProps = Object.assign({}, this.animationProps, appContext);\n }\n }\n\n /** Either uses supplied or existing context, or calls provided callback to create one */\n async _createDevice(props: DeviceProps) {\n const deviceProps = {...this.props, ...props, ...this.props.glOptions};\n\n // TODO - support this.onCreateContext\n // Create the WebGL context if necessary\n // this.gl = this.props.gl ? instrumentGLContext(this.props.gl, deviceProps) : this.onCreateContext(deviceProps);\n\n this.device = await this.onCreateDevice(deviceProps);\n // @ts-expect-error\n this.gl = this.device.gl;\n\n if (!isWebGL(this.gl)) {\n throw new Error('ClassicAnimationLoop.onCreateContext - illegal context returned');\n }\n\n // Reset the WebGL context.\n resetGLParameters(this.gl);\n\n this._createInfoDiv();\n }\n\n _createInfoDiv() {\n const canvas = getHTMLCanvasElement(this.gl.canvas)\n if (canvas && this.props.onAddHTML) {\n const wrapperDiv = document.createElement('div');\n document.body.appendChild(wrapperDiv);\n wrapperDiv.style.position = 'relative';\n const div = document.createElement('div');\n div.style.position = 'absolute';\n div.style.left = '10px';\n div.style.bottom = '10px';\n div.style.width = '300px';\n div.style.background = 'white';\n if (canvas) {\n wrapperDiv.appendChild(canvas);\n }\n wrapperDiv.appendChild(div);\n const html = this.props.onAddHTML(div);\n if (html) {\n div.innerHTML = html;\n }\n }\n }\n\n _getSizeAndAspect() {\n // https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n const width = this.gl.drawingBufferWidth;\n const height = this.gl.drawingBufferHeight;\n\n // https://webglfundamentals.org/webgl/lessons/webgl-anti-patterns.html\n let aspect = 1;\n\n const canvas = getHTMLCanvasElement(this.gl.canvas);\n if (canvas && canvas.clientHeight) {\n aspect = canvas.clientWidth / canvas.clientHeight;\n } else if (width > 0 && height > 0) {\n aspect = width / height;\n }\n\n return {width, height, aspect};\n }\n\n /** Default viewport setup */\n _resizeViewport() {\n if (this.props.autoResizeViewport) {\n this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight);\n }\n }\n\n /**\n * Resize the render buffer of the canvas to match canvas client size\n * Optionally multiplying with devicePixel ratio\n */\n _resizeCanvasDrawingBuffer() {\n if (this.props.autoResizeDrawingBuffer) {\n this.device.canvasContext.resize({useDevicePixels: this.props.useDevicePixels});\n }\n }\n\n _beginTimers() {\n this.frameRate.timeEnd();\n this.frameRate.timeStart();\n\n // Check if timer for last frame has completed.\n // GPU timer results are never available in the same\n // frame they are captured.\n // if (\n // this._gpuTimeQuery &&\n // this._gpuTimeQuery.isResultAvailable() &&\n // !this._gpuTimeQuery.isTimerDisjoint()\n // ) {\n // this.stats.get('GPU Time').addTime(this._gpuTimeQuery.getTimerMilliseconds());\n // }\n\n // if (this._gpuTimeQuery) {\n // // GPU time query start\n // this._gpuTimeQuery.beginTimeElapsedQuery();\n // }\n\n this.cpuTime.timeStart();\n }\n\n _endTimers() {\n this.cpuTime.timeEnd();\n\n // if (this._gpuTimeQuery) {\n // // GPU time query end. Results will be available on next frame.\n // this._gpuTimeQuery.end();\n // }\n }\n\n // Event handling\n\n _startEventHandling() {\n const {canvas} = this.gl;\n if (canvas) {\n canvas.addEventListener('mousemove', this._onMousemove);\n canvas.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n _onMousemove(e) {\n this.animationProps._mousePosition = [e.offsetX, e.offsetY];\n }\n _onMouseleave(e) {\n this.animationProps._mousePosition = null;\n }\n\n // Deprecated\n\n /** @deprecated */\n _createFramebuffer() {\n // Setup default framebuffer\n if (this.props.createFramebuffer) {\n // this.framebuffer = new ClassicFramebuffer(this.gl);\n }\n }\n\n /** @deprecated */\n _resizeFramebuffer() {\n // if (this.framebuffer) {\n // this.framebuffer.resize({\n // width: this.gl.drawingBufferWidth,\n // height: this.gl.drawingBufferHeight\n // });\n // }\n }\n}\n"],"mappings":"AAEA,SACEA,IAAI,EAGJC,GAAG,EACHC,qBAAqB,EACrBC,oBAAoB,QACf,eAAe;AAGtB,SAAQC,SAAS,QAAO,eAAe;AAEvC,SAAQC,OAAO,EAAEC,iBAAiB,QAAO,gBAAgB;AAMzD,MAAMC,MAAM,GAAGH,SAAS,CAAC,CAAC,IAAI,OAAOI,QAAQ,KAAK,WAAW;AAC7D,SAASC,oBAAoBA,CAC3BC,MAA2C,EACjB;EAC1B,OAAO,OAAOC,iBAAiB,KAAK,WAAW,IAAID,MAAM,YAAYC,iBAAiB,GAClFD,MAAM,GACN,IAAI;AACV;AAEA,IAAIE,aAAa,GAAG,CAAC;AAqDrB,MAAMC,oCAAyE,GAAG;EAChFC,cAAc,EAAGC,KAAkB,IAAKf,IAAI,CAACgB,YAAY,CAACD,KAAK,CAAC;EAChEE,eAAe,EAAEC,SAAS;EAC1BC,SAAS,EAAED,SAAS;EACpBE,YAAY,EAAEA,CAAA,MAAO,CAAC,CAAC,CAAC;EACxBC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,UAAU,EAAEA,CAA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