@luma.gl/test-utils 9.0.0-alpha.9 → 9.0.0-beta.2

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 (43) hide show
  1. package/LICENSE +3 -1
  2. package/dist/check-type.js +0 -1
  3. package/dist/check-type.js.map +1 -1
  4. package/dist/create-test-device.d.ts +8 -4
  5. package/dist/create-test-device.d.ts.map +1 -1
  6. package/dist/create-test-device.js +26 -13
  7. package/dist/create-test-device.js.map +1 -1
  8. package/dist/engine/classic-animation-loop.d.ts +135 -0
  9. package/dist/engine/classic-animation-loop.d.ts.map +1 -0
  10. package/dist/engine/classic-animation-loop.js +434 -0
  11. package/dist/engine/classic-animation-loop.js.map +1 -0
  12. package/dist/index.cjs +828 -0
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +6 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/performance-test-runner.d.ts +7 -6
  18. package/dist/performance-test-runner.d.ts.map +1 -1
  19. package/dist/performance-test-runner.js +10 -22
  20. package/dist/performance-test-runner.js.map +1 -1
  21. package/dist/register-devices.js +1 -1
  22. package/dist/register-devices.js.map +1 -1
  23. package/dist/snapshot-test-runner.d.ts +11 -7
  24. package/dist/snapshot-test-runner.d.ts.map +1 -1
  25. package/dist/snapshot-test-runner.js +23 -29
  26. package/dist/snapshot-test-runner.js.map +1 -1
  27. package/dist/test-runner.d.ts +35 -23
  28. package/dist/test-runner.d.ts.map +1 -1
  29. package/dist/test-runner.js +62 -81
  30. package/dist/test-runner.js.map +1 -1
  31. package/dist/utils.d.ts +5 -5
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js.map +1 -1
  34. package/package.json +28 -8
  35. package/src/check-type.ts +1 -1
  36. package/src/create-test-device.ts +28 -9
  37. package/src/engine/classic-animation-loop.ts +714 -0
  38. package/src/index.ts +3 -3
  39. package/src/performance-test-runner.ts +17 -13
  40. package/src/register-devices.ts +2 -1
  41. package/src/snapshot-test-runner.ts +33 -31
  42. package/src/test-runner.ts +100 -75
  43. package/src/utils.ts +1 -1
package/LICENSE CHANGED
@@ -1,4 +1,6 @@
1
- Copyright (c) 2020 Urban Computing Foundation
1
+ luma.gl is provided under the MIT license
2
+
3
+ Copyright (c) 2020 vis.gl contributors
2
4
 
3
5
  This software includes parts initially developed by Uber and open sourced under MIT license.
4
6
  Copyright (c) 2015 Uber Technologies, Inc.
@@ -1,3 +1,2 @@
1
1
  export function checkType(value) {}
2
- ;
3
2
  //# sourceMappingURL=check-type.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/check-type.ts"],"names":["checkType","value"],"mappings":"AAKA,OAAO,SAASA,SAAT,CAAsBC,KAAtB,EAAsC,CAAE;AAAA","sourcesContent":["\n/**\n * Tests that an argument matches the type.\n * @note fails during typescript type check, not during runtime.\n */\nexport function checkType<T>(value: T): void {};\n"],"file":"check-type.js"}
1
+ {"version":3,"file":"check-type.js","names":["checkType","value"],"sources":["../src/check-type.ts"],"sourcesContent":["\n/**\n * Tests that an argument matches the type.\n * @note fails during typescript type check, not during runtime.\n */\nexport function checkType<T>(value: T): void {}\n"],"mappings":"AAKA,OAAO,SAASA,SAASA,CAAIC,KAAQ,EAAQ,CAAC"}
@@ -1,14 +1,18 @@
1
- import type { Device, DeviceProps } from '@luma.gl/api';
1
+ import type { Device, DeviceProps } from '@luma.gl/core';
2
2
  import { WebGLDevice } from '@luma.gl/webgl';
3
3
  import { WebGPUDevice } from '@luma.gl/webgpu';
4
4
  /** Create a test WebGL context */
5
5
  export declare function createTestContext(opts?: Record<string, any>): WebGLRenderingContext | null;
6
6
  /** Create a test WebGLDevice */
7
7
  export declare function createTestDevice(props?: DeviceProps): WebGLDevice | null;
8
- export declare const webgl1TestDevice: WebGLDevice;
9
- export declare const webgl2TestDevice: WebGLDevice;
8
+ /** A WebGL 1 Device intended for testing */
9
+ export declare const webgl1Device: WebGLDevice;
10
+ /** A WebGL 2 Device intended for testing. Can be null */
11
+ export declare const webgl2Device: WebGLDevice;
12
+ /** A WebGL 2 or WebGL 1 Device intended for testing. Best available. */
13
+ export declare const webglDevice: WebGLDevice;
10
14
  /** Only available after getTestDevices() has completed */
11
- export declare let webgpuTestDevice: WebGPUDevice;
15
+ export declare let webgpuDevice: WebGPUDevice;
12
16
  /** Synchronously get test devices (only WebGLDevices) */
13
17
  export declare function getWebGLTestDevices(): WebGLDevice[];
14
18
  /** Includes WebGPU device if available */
@@ -1 +1 @@
1
- {"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAQ7C,kCAAkC;AAClC,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,qBAAqB,GAAG,IAAI,CAG9F;AAED,gCAAgC;AAChC,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,WAAgB,GAAG,WAAW,GAAG,IAAI,CAS5E;AAED,eAAO,MAAM,gBAAgB,EAAE,WAAuF,CAAC;AACvH,eAAO,MAAM,gBAAgB,EAAE,WAAuF,CAAC;AACvH,0DAA0D;AAC1D,eAAO,IAAI,gBAAgB,EAAE,YAAY,CAAC;AAI1C,yDAAyD;AACzD,wBAAgB,mBAAmB,IAAI,WAAW,EAAE,CAEnD;AAED,0CAA0C;AAC1C,wBAAsB,cAAc,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAUzD"}
1
+ {"version":3,"file":"create-test-device.d.ts","sourceRoot":"","sources":["../src/create-test-device.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAQ7C,kCAAkC;AAClC,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,qBAAqB,GAAG,IAAI,CAG9F;AAED,gCAAgC;AAChC,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,WAAgB,GAAG,WAAW,GAAG,IAAI,CAU5E;AAED,4CAA4C;AAC5C,eAAO,MAAM,YAAY,EAAE,WAAuF,CAAE;AACpH,yDAAyD;AACzD,eAAO,MAAM,YAAY,EAAE,WAAuF,CAAE;AACpH,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,WAA0C,CAAC;AAErE,0DAA0D;AAC1D,eAAO,IAAI,YAAY,EAAE,YAAY,CAAC;AAItC,yDAAyD;AACzD,wBAAgB,mBAAmB,IAAI,WAAW,EAAE,CASnD;AAED,0CAA0C;AAC1C,wBAAsB,cAAc,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAezD"}
@@ -1,53 +1,66 @@
1
- import { luma } from '@luma.gl/api';
1
+ import { luma } from '@luma.gl/core';
2
2
  import { WebGLDevice } from '@luma.gl/webgl';
3
3
  const CONTEXT_DEFAULTS = {
4
4
  width: 1,
5
5
  height: 1,
6
6
  debug: true
7
7
  };
8
- export function createTestContext(opts = {}) {
8
+ export function createTestContext() {
9
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
10
  const device = createTestDevice(opts);
10
11
  return device && device.gl;
11
12
  }
12
- export function createTestDevice(props = {}) {
13
+ export function createTestDevice() {
14
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
15
  try {
14
- props = { ...CONTEXT_DEFAULTS,
16
+ props = {
17
+ ...CONTEXT_DEFAULTS,
15
18
  ...props,
16
19
  debug: true
17
20
  };
18
21
  return new WebGLDevice(props);
19
22
  } catch (error) {
20
- console.error("Failed to created device '".concat(props.id, "': ").concat(error.message));
23
+ console.error(`Failed to created device '${props.id}': ${error.message}`);
21
24
  return null;
22
25
  }
23
26
  }
24
- export const webgl1TestDevice = createTestDevice({
27
+ export const webgl1Device = createTestDevice({
25
28
  id: 'webgl1-test-device',
26
29
  webgl1: true,
27
30
  webgl2: false
28
31
  });
29
- export const webgl2TestDevice = createTestDevice({
32
+ export const webgl2Device = createTestDevice({
30
33
  id: 'webgl2-test-device',
31
34
  webgl1: false,
32
35
  webgl2: true
33
36
  });
34
- export let webgpuTestDevice;
37
+ export const webglDevice = webgl2Device || webgl1Device;
38
+ export let webgpuDevice;
35
39
  let webgpuCreated = false;
36
40
  export function getWebGLTestDevices() {
37
- return [webgl2TestDevice, webgl1TestDevice].filter(Boolean);
41
+ const devices = [];
42
+ if (webgl2Device) {
43
+ devices.push(webgl2Device);
44
+ }
45
+ if (webgl1Device) {
46
+ devices.push(webgl1Device);
47
+ }
48
+ return devices;
38
49
  }
39
50
  export async function getTestDevices() {
40
51
  if (!webgpuCreated) {
41
52
  webgpuCreated = true;
42
-
43
53
  try {
44
- webgpuTestDevice = await luma.createDevice({
54
+ webgpuDevice = await luma.createDevice({
45
55
  id: 'webgpu-test-device',
46
56
  type: 'webgpu'
47
57
  });
48
58
  } catch {}
49
59
  }
50
-
51
- return [webgpuTestDevice, webgl2TestDevice, webgl1TestDevice].filter(Boolean);
60
+ const devices = getWebGLTestDevices();
61
+ if (webgpuDevice) {
62
+ devices.unshift(webgpuDevice);
63
+ }
64
+ return devices;
52
65
  }
53
66
  //# sourceMappingURL=create-test-device.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/create-test-device.ts"],"names":["luma","WebGLDevice","CONTEXT_DEFAULTS","width","height","debug","createTestContext","opts","device","createTestDevice","gl","props","error","console","id","message","webgl1TestDevice","webgl1","webgl2","webgl2TestDevice","webgpuTestDevice","webgpuCreated","getWebGLTestDevices","filter","Boolean","getTestDevices","createDevice","type"],"mappings":"AAGA,SA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OAA5C,CAAP;AACD;AAGD,OAAO,eAAeC,cAAf,GAAoD;AACzD,MAAI,CAACJ,aAAL,EAAoB;AAClBA,IAAAA,aAAa,GAAG,IAAhB;;AACA,QAAI;AACFD,MAAAA,gBAAgB,GAAG,MAAMpB,IAAI,CAAC0B,YAAL,CAAkB;AAACZ,QAAAA,EAAE,EAAE,oBAAL;AAA2Ba,QAAAA,IAAI,EAAE;AAAjC,OAAlB,CAAzB;AACD,KAFD,CAEE,MAAM,CAEP;AACF;;AACD,SAAO,CAACP,gBAAD,EAAmBD,gBAAnB,EAAqCH,gBAArC,EAAuDO,MAAvD,CAA8DC,OAA9D,CAAP;AACD","sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, DeviceProps} from '@luma.gl/api';\nimport {luma} from '@luma.gl/api';\nimport {WebGLDevice} from '@luma.gl/webgl';\nimport {WebGPUDevice} from '@luma.gl/webgpu';\n\nconst CONTEXT_DEFAULTS: Partial<DeviceProps> = {\n width: 1,\n height: 1,\n debug: true\n};\n\n/** Create a test WebGL context */\nexport function createTestContext(opts: Record<string, any> = {}): WebGLRenderingContext | null {\n const device = createTestDevice(opts);\n return device && device.gl;\n}\n\n/** Create a test WebGLDevice */\nexport function createTestDevice(props: DeviceProps = {}): WebGLDevice | null {\n try {\n props = {...CONTEXT_DEFAULTS, ...props, debug: true};\n // We dont use luma.createDevice since this tests current expect this context to be created synchronously\n return new WebGLDevice(props);\n } catch (error) {\n console.error(`Failed to created device '${props.id}': ${error.message}`);\n return null;\n }\n}\n\nexport const webgl1TestDevice: WebGLDevice = createTestDevice({id: 'webgl1-test-device', webgl1: true, webgl2: false});\nexport const webgl2TestDevice: WebGLDevice = createTestDevice({id: 'webgl2-test-device', webgl1: false, webgl2: true});\n/** Only available after getTestDevices() has completed */\nexport let webgpuTestDevice: WebGPUDevice;\n\nlet webgpuCreated = false;\n\n/** Synchronously get test devices (only WebGLDevices) */\nexport function getWebGLTestDevices(): WebGLDevice[] {\n return [webgl2TestDevice, webgl1TestDevice].filter(Boolean);\n}\n\n/** Includes WebGPU device if available */\nexport async function getTestDevices() : Promise<Device[]> {\n if (!webgpuCreated) {\n webgpuCreated = true;\n try {\n webgpuTestDevice = await luma.createDevice({id: 'webgpu-test-device', type: 'webgpu'}) as WebGPUDevice;\n } catch {\n // ignore (assume WebGPU was not available)\n }\n }\n return [webgpuTestDevice, webgl2TestDevice, webgl1TestDevice].filter(Boolean);\n}\n"],"file":"create-test-device.js"}
1
+ {"version":3,"file":"create-test-device.js","names":["luma","WebGLDevice","CONTEXT_DEFAULTS","width","height","debug","createTestContext","opts","arguments","length","undefined","device","createTestDevice","gl","props","error","console","id","message","webgl1Device","webgl1","webgl2","webgl2Device","webglDevice","webgpuDevice","webgpuCreated","getWebGLTestDevices","devices","push","getTestDevices","createDevice","type","unshift"],"sources":["../src/create-test-device.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, DeviceProps} from '@luma.gl/core';\nimport {luma} from '@luma.gl/core';\nimport {WebGLDevice} from '@luma.gl/webgl';\nimport {WebGPUDevice} from '@luma.gl/webgpu';\n\nconst CONTEXT_DEFAULTS: Partial<DeviceProps> = {\n width: 1,\n height: 1,\n debug: true\n};\n\n/** Create a test WebGL context */\nexport function createTestContext(opts: Record<string, any> = {}): WebGLRenderingContext | null {\n const device = createTestDevice(opts);\n return device && device.gl;\n}\n\n/** Create a test WebGLDevice */\nexport function createTestDevice(props: DeviceProps = {}): WebGLDevice | null {\n try {\n props = {...CONTEXT_DEFAULTS, ...props, debug: true};\n // We dont use luma.createDevice since this tests current expect this context to be created synchronously\n return new WebGLDevice(props);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Failed to created device '${props.id}': ${(error as Error).message}`);\n return null;\n }\n}\n\n/** A WebGL 1 Device intended for testing */\nexport const webgl1Device: WebGLDevice = createTestDevice({id: 'webgl1-test-device', webgl1: true, webgl2: false}) ;\n/** A WebGL 2 Device intended for testing. Can be null */\nexport const webgl2Device: WebGLDevice = createTestDevice({id: 'webgl2-test-device', webgl1: false, webgl2: true}) ;\n/** A WebGL 2 or WebGL 1 Device intended for testing. Best available. */\nexport const webglDevice: WebGLDevice = webgl2Device || webgl1Device;\n\n/** Only available after getTestDevices() has completed */\nexport let webgpuDevice: WebGPUDevice;\n\nlet webgpuCreated = false;\n\n/** Synchronously get test devices (only WebGLDevices) */\nexport function getWebGLTestDevices(): WebGLDevice[] {\n const devices: WebGLDevice[] = [];\n if (webgl2Device) {\n devices.push(webgl2Device);\n }\n if (webgl1Device) {\n devices.push(webgl1Device);\n }\n return devices;\n}\n\n/** Includes WebGPU device if available */\nexport async function getTestDevices() : Promise<Device[]> {\n if (!webgpuCreated) {\n webgpuCreated = true;\n try {\n webgpuDevice = await luma.createDevice({id: 'webgpu-test-device', type: 'webgpu'}) as WebGPUDevice;\n } catch {\n // ignore (assume WebGPU was not available)\n }\n }\n\n const devices: Device[] = getWebGLTestDevices();\n if (webgpuDevice) {\n devices.unshift(webgpuDevice);\n }\n return devices;\n}\n"],"mappings":"AAIA,SAAQA,IAAI,QAAO,eAAe;AAClC,SAAQC,WAAW,QAAO,gBAAgB;AAG1C,MAAMC,gBAAsC,GAAG;EAC7CC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE;AACT,CAAC;AAGD,OAAO,SAASC,iBAAiBA,CAAA,EAA+D;EAAA,IAA9DC,IAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC9D,MAAMG,MAAM,GAAGC,gBAAgB,CAACL,IAAI,CAAC;EACrC,OAAOI,MAAM,IAAIA,MAAM,CAACE,EAAE;AAC5B;AAGA,OAAO,SAASD,gBAAgBA,CAAA,EAA8C;EAAA,IAA7CE,KAAkB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACtD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D,mBAAmB,CAAC,CAAC;EAC/C,IAAIF,YAAY,EAAE;IAChBG,OAAO,CAACK,OAAO,CAACR,YAAY,CAAC;EAC/B;EACA,OAAOG,OAAO;AAChB"}
@@ -0,0 +1,135 @@
1
+ import { Device, DeviceProps } from '@luma.gl/core';
2
+ import { Timeline, AnimationProps } from '@luma.gl/engine';
3
+ import { Stats, Stat } from '@probe.gl/stats';
4
+ type ContextProps = DeviceProps;
5
+ /**
6
+ * Classic Animation Props.
7
+ * Contain a number of deprecated fields
8
+ * @deprecated Use new AnimationLoop in `@luma.gl/engine`
9
+ */
10
+ export type ClassicAnimationProps = AnimationProps & {
11
+ animationLoop: ClassicAnimationLoop;
12
+ /** @deprecated Use .device */
13
+ stop: () => ClassicAnimationLoop;
14
+ /** @deprecated Use .device */
15
+ gl: WebGLRenderingContext;
16
+ /** @deprecated Will be removed */
17
+ framebuffer: unknown;
18
+ /** @deprecated Use .timeline */
19
+ _timeline: Timeline;
20
+ /** @deprecated Use .animationLoop */
21
+ _loop: ClassicAnimationLoop;
22
+ /** @deprecated Use .animationLoop */
23
+ _animationLoop: ClassicAnimationLoop;
24
+ };
25
+ /** ClassicAnimationLoop properties */
26
+ export type ClassicAnimationLoopProps = {
27
+ onCreateDevice?: (props: DeviceProps) => Promise<Device>;
28
+ onCreateContext?: (props: ContextProps) => WebGLRenderingContext;
29
+ onAddHTML?: (div: HTMLDivElement) => string;
30
+ onInitialize?: (animationProps: ClassicAnimationProps) => {} | void | Promise<{} | void>;
31
+ onRender?: (animationProps: ClassicAnimationProps) => void;
32
+ onFinalize?: (animationProps: ClassicAnimationProps) => void;
33
+ onError?: (reason: any) => void;
34
+ stats?: Stats;
35
+ device?: Device;
36
+ glOptions?: ContextProps;
37
+ autoResizeViewport?: boolean;
38
+ autoResizeDrawingBuffer?: boolean;
39
+ useDevicePixels?: number | boolean;
40
+ /** @deprecated Use .device */
41
+ gl?: WebGLRenderingContext | null;
42
+ /** @deprecated Will be removed */
43
+ createFramebuffer?: boolean;
44
+ };
45
+ /**
46
+ * Convenient animation loop
47
+ * @deprecated Use `@luma.gl/engine` AnimationLoop
48
+ */
49
+ export declare class ClassicAnimationLoop {
50
+ device: Device;
51
+ canvas?: HTMLCanvasElement | OffscreenCanvas;
52
+ props: Required<ClassicAnimationLoopProps>;
53
+ animationProps: ClassicAnimationProps;
54
+ timeline: Timeline;
55
+ stats: Stats;
56
+ cpuTime: Stat;
57
+ gpuTime: Stat;
58
+ frameRate: Stat;
59
+ display: any;
60
+ needsRedraw: string | null;
61
+ _initialized: boolean;
62
+ _running: boolean;
63
+ _animationFrameId: any;
64
+ _pageLoadPromise: Promise<{}> | null;
65
+ _nextFramePromise: Promise<ClassicAnimationLoop> | null;
66
+ _resolveNextFrame: ((loop: ClassicAnimationLoop) => void) | null;
67
+ _cpuStartTime: number;
68
+ /** @deprecated */
69
+ gl: WebGLRenderingContext;
70
+ constructor(props?: ClassicAnimationLoopProps);
71
+ destroy(): void;
72
+ /** @deprecated Use .destroy() */
73
+ delete(): void;
74
+ setNeedsRedraw(reason: string): this;
75
+ setProps(props: ClassicAnimationLoopProps): this;
76
+ start(opts?: {}): this;
77
+ /** Starts a render loop if not already running */
78
+ _start(props: any): Promise<this>;
79
+ /** Explicitly draw a frame */
80
+ redraw(): this;
81
+ stop(): this;
82
+ attachTimeline(timeline: Timeline): Timeline;
83
+ detachTimeline(): void;
84
+ waitForRender(): Promise<ClassicAnimationLoop>;
85
+ toDataURL(): Promise<string>;
86
+ isContextLost(): boolean;
87
+ onCreateDevice(deviceProps: DeviceProps): Promise<Device>;
88
+ onInitialize(animationProps: ClassicAnimationProps): {} | void;
89
+ onRender(animationProps: ClassicAnimationProps): void;
90
+ onFinalize(animationProps: ClassicAnimationProps): void;
91
+ /** @deprecated Use .onCreateDevice() */
92
+ onCreateContext(props: ContextProps): WebGLRenderingContext;
93
+ /** @deprecated */
94
+ getHTMLControlValue(id: any, defaultValue?: number): number;
95
+ _initialize(props: ClassicAnimationLoopProps): void;
96
+ _getPageLoadPromise(): Promise<{}>;
97
+ _setDisplay(display: any): void;
98
+ _requestAnimationFrame(): void;
99
+ _cancelAnimationFrame(): void;
100
+ _animationFrame(): void;
101
+ _renderFrame(props: ClassicAnimationProps): void;
102
+ _clearNeedsRedraw(): void;
103
+ _setupFrame(): void;
104
+ _initializeCallbackData(): void;
105
+ _updateCallbackData(): void;
106
+ _finalizeCallbackData(): void;
107
+ /** Add application's data to the app context object */
108
+ _addCallbackData(appContext: any): void;
109
+ /** Either uses supplied or existing context, or calls provided callback to create one */
110
+ _createDevice(props: DeviceProps): Promise<void>;
111
+ _createInfoDiv(): void;
112
+ _getSizeAndAspect(): {
113
+ width: number;
114
+ height: number;
115
+ aspect: number;
116
+ };
117
+ /** Default viewport setup */
118
+ _resizeViewport(): void;
119
+ /**
120
+ * Resize the render buffer of the canvas to match canvas client size
121
+ * Optionally multiplying with devicePixel ratio
122
+ */
123
+ _resizeCanvasDrawingBuffer(): void;
124
+ _beginTimers(): void;
125
+ _endTimers(): void;
126
+ _startEventHandling(): void;
127
+ _onMousemove(e: any): void;
128
+ _onMouseleave(e: any): void;
129
+ /** @deprecated */
130
+ _createFramebuffer(): void;
131
+ /** @deprecated */
132
+ _resizeFramebuffer(): void;
133
+ }
134
+ export {};
135
+ //# sourceMappingURL=classic-animation-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classic-animation-loop.d.ts","sourceRoot":"","sources":["../../src/engine/classic-animation-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,MAAM,EACN,WAAW,EAIZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAO5C,KAAK,YAAY,GAAG,WAAW,CAAC;AAahC;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,aAAa,EAAE,o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