@luma.gl/engine 9.0.0-alpha.5 → 9.0.0-alpha.50

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 (171) hide show
  1. package/LICENSE +3 -1
  2. package/dist/animation/key-frames.d.ts +1 -1
  3. package/dist/animation/key-frames.d.ts.map +1 -1
  4. package/dist/animation/key-frames.js +6 -27
  5. package/dist/animation/key-frames.js.map +1 -1
  6. package/dist/animation/timeline.d.ts +9 -9
  7. package/dist/animation/timeline.d.ts.map +1 -1
  8. package/dist/animation/timeline.js +18 -49
  9. package/dist/animation/timeline.js.map +1 -1
  10. package/dist/{lib → animation-loop}/animation-loop.d.ts +30 -31
  11. package/dist/animation-loop/animation-loop.d.ts.map +1 -0
  12. package/dist/{lib → animation-loop}/animation-loop.js +115 -199
  13. package/dist/animation-loop/animation-loop.js.map +1 -0
  14. package/dist/{lib → animation-loop}/animation-props.d.ts +6 -7
  15. package/dist/animation-loop/animation-props.d.ts.map +1 -0
  16. package/dist/animation-loop/animation-props.js.map +1 -0
  17. package/dist/animation-loop/make-animation-loop.d.ts +6 -0
  18. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
  19. package/dist/animation-loop/make-animation-loop.js +28 -0
  20. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  21. package/dist/animation-loop/render-loop.d.ts +23 -0
  22. package/dist/animation-loop/render-loop.d.ts.map +1 -0
  23. package/dist/animation-loop/render-loop.js +7 -0
  24. package/dist/animation-loop/render-loop.js.map +1 -0
  25. package/dist/dist.dev.js +7064 -0
  26. package/dist/geometries/cone-geometry.d.ts +1 -1
  27. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  28. package/dist/geometries/cone-geometry.js +6 -5
  29. package/dist/geometries/cone-geometry.js.map +1 -1
  30. package/dist/geometries/cube-geometry.d.ts +2 -2
  31. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  32. package/dist/geometries/cube-geometry.js +15 -8
  33. package/dist/geometries/cube-geometry.js.map +1 -1
  34. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  35. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  36. package/dist/geometries/cylinder-geometry.js +6 -5
  37. package/dist/geometries/cylinder-geometry.js.map +1 -1
  38. package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
  39. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  40. package/dist/geometries/ico-sphere-geometry.js +10 -19
  41. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  42. package/dist/geometries/plane-geometry.d.ts +2 -2
  43. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  44. package/dist/geometries/plane-geometry.js +14 -23
  45. package/dist/geometries/plane-geometry.js.map +1 -1
  46. package/dist/geometries/sphere-geometry.d.ts +2 -2
  47. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  48. package/dist/geometries/sphere-geometry.js +9 -13
  49. package/dist/geometries/sphere-geometry.js.map +1 -1
  50. package/dist/geometries/truncated-cone-geometry.d.ts +2 -4
  51. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  52. package/dist/geometries/truncated-cone-geometry.js +9 -25
  53. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  54. package/dist/geometry/geometry-table.d.ts +2 -2
  55. package/dist/geometry/geometry-table.d.ts.map +1 -1
  56. package/dist/geometry/geometry-table.js.map +1 -1
  57. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  58. package/dist/geometry/geometry-utils.js +0 -9
  59. package/dist/geometry/geometry-utils.js.map +1 -1
  60. package/dist/geometry/geometry.d.ts +50 -59
  61. package/dist/geometry/geometry.d.ts.map +1 -1
  62. package/dist/geometry/geometry.js +32 -97
  63. package/dist/geometry/geometry.js.map +1 -1
  64. package/dist/geometry/gpu-geometry.d.ts +37 -0
  65. package/dist/geometry/gpu-geometry.d.ts.map +1 -0
  66. package/dist/geometry/gpu-geometry.js +107 -0
  67. package/dist/geometry/gpu-geometry.js.map +1 -0
  68. package/dist/geometry/gpu-table.d.ts +1 -0
  69. package/dist/geometry/gpu-table.d.ts.map +1 -0
  70. package/dist/geometry/gpu-table.js +2 -0
  71. package/dist/geometry/gpu-table.js.map +1 -0
  72. package/dist/index.cjs +2959 -0
  73. package/dist/index.d.ts +26 -9
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +23 -13
  76. package/dist/index.js.map +1 -1
  77. package/dist/lib/clip-space.d.ts +8 -0
  78. package/dist/lib/clip-space.d.ts.map +1 -1
  79. package/dist/lib/clip-space.js +47 -0
  80. package/dist/lib/clip-space.js.map +1 -1
  81. package/dist/lib/pipeline-factory.d.ts +12 -40
  82. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  83. package/dist/lib/pipeline-factory.js +50 -148
  84. package/dist/lib/pipeline-factory.js.map +1 -1
  85. package/dist/model/model.d.ts +192 -0
  86. package/dist/model/model.d.ts.map +1 -0
  87. package/dist/model/model.js +312 -0
  88. package/dist/model/model.js.map +1 -0
  89. package/dist/scenegraph/group-node.d.ts +21 -0
  90. package/dist/scenegraph/group-node.d.ts.map +1 -0
  91. package/dist/scenegraph/group-node.js +94 -0
  92. package/dist/scenegraph/group-node.js.map +1 -0
  93. package/dist/scenegraph/model-node.d.ts +18 -0
  94. package/dist/scenegraph/model-node.d.ts.map +1 -0
  95. package/dist/scenegraph/model-node.js +28 -0
  96. package/dist/scenegraph/model-node.js.map +1 -0
  97. package/dist/scenegraph/scenegraph-node.d.ts +56 -0
  98. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
  99. package/dist/scenegraph/scenegraph-node.js +141 -0
  100. package/dist/scenegraph/scenegraph-node.js.map +1 -0
  101. package/dist/shader-inputs.d.ts +62 -0
  102. package/dist/shader-inputs.d.ts.map +1 -0
  103. package/dist/shader-inputs.js +49 -0
  104. package/dist/shader-inputs.js.map +1 -0
  105. package/dist/transform/buffer-transform.d.ts +35 -0
  106. package/dist/transform/buffer-transform.d.ts.map +1 -0
  107. package/dist/transform/buffer-transform.js +62 -0
  108. package/dist/transform/buffer-transform.js.map +1 -0
  109. package/dist/transform/texture-transform.d.ts +57 -0
  110. package/dist/transform/texture-transform.d.ts.map +1 -0
  111. package/dist/transform/texture-transform.js +122 -0
  112. package/dist/transform/texture-transform.js.map +1 -0
  113. package/dist.min.js +286 -0
  114. package/package.json +21 -12
  115. package/src/animation/timeline.ts +16 -15
  116. package/src/{lib → animation-loop}/animation-loop.ts +120 -107
  117. package/src/{lib → animation-loop}/animation-props.ts +5 -5
  118. package/src/animation-loop/make-animation-loop.ts +44 -0
  119. package/src/animation-loop/render-loop.ts +23 -0
  120. package/src/geometries/cone-geometry.ts +1 -1
  121. package/src/geometries/cube-geometry.ts +6 -3
  122. package/src/geometries/cylinder-geometry.ts +2 -2
  123. package/src/geometries/ico-sphere-geometry.ts +7 -6
  124. package/src/geometries/plane-geometry.ts +5 -4
  125. package/src/geometries/sphere-geometry.ts +4 -3
  126. package/src/geometries/truncated-cone-geometry.ts +4 -13
  127. package/src/geometry/geometry-table.ts +1 -1
  128. package/src/geometry/geometry-utils.ts +3 -3
  129. package/src/geometry/geometry.ts +79 -119
  130. package/src/geometry/gpu-geometry.ts +124 -0
  131. package/src/geometry/gpu-table.ts +41 -0
  132. package/src/index.ts +38 -12
  133. package/src/lib/clip-space.ts +22 -21
  134. package/src/lib/pipeline-factory.ts +60 -168
  135. package/src/model/model.ts +549 -0
  136. package/src/scenegraph/group-node.ts +103 -0
  137. package/src/scenegraph/model-node.ts +50 -0
  138. package/src/scenegraph/scenegraph-node.ts +204 -0
  139. package/src/shader-inputs.ts +132 -0
  140. package/src/transform/buffer-transform.ts +94 -0
  141. package/src/transform/texture-transform.ts +169 -0
  142. package/dist/bundle.d.ts +0 -2
  143. package/dist/bundle.d.ts.map +0 -1
  144. package/dist/bundle.js +0 -5
  145. package/dist/bundle.js.map +0 -1
  146. package/dist/geometry/primitive-utils.d.ts +0 -1
  147. package/dist/geometry/primitive-utils.d.ts.map +0 -1
  148. package/dist/geometry/primitive-utils.js +0 -2
  149. package/dist/geometry/primitive-utils.js.map +0 -1
  150. package/dist/lib/animation-loop.d.ts.map +0 -1
  151. package/dist/lib/animation-loop.js.map +0 -1
  152. package/dist/lib/animation-props.d.ts.map +0 -1
  153. package/dist/lib/animation-props.js.map +0 -1
  154. package/dist/lib/model-utils.d.ts +0 -5
  155. package/dist/lib/model-utils.d.ts.map +0 -1
  156. package/dist/lib/model-utils.js +0 -45
  157. package/dist/lib/model-utils.js.map +0 -1
  158. package/dist/lib/model.d.ts +0 -41
  159. package/dist/lib/model.d.ts.map +0 -1
  160. package/dist/lib/model.js +0 -176
  161. package/dist/lib/model.js.map +0 -1
  162. package/dist/lib/render-loop.d.ts +0 -14
  163. package/dist/lib/render-loop.d.ts.map +0 -1
  164. package/dist/lib/render-loop.js +0 -49
  165. package/dist/lib/render-loop.js.map +0 -1
  166. package/src/bundle.ts +0 -4
  167. package/src/geometry/primitive-utils.ts +0 -30
  168. package/src/lib/model-utils.ts +0 -124
  169. package/src/lib/model.ts +0 -179
  170. package/src/lib/render-loop.ts +0 -58
  171. /package/dist/{lib → animation-loop}/animation-props.js +0 -0
@@ -1,70 +1,54 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { luma } from '@luma.gl/api';
3
- import { requestAnimationFrame, cancelAnimationFrame } from '@luma.gl/api';
4
- import { isBrowser } from '@probe.gl/env';
5
- const isPage = isBrowser() && typeof document !== 'undefined';
1
+ import { luma } from '@luma.gl/core';
2
+ import { requestAnimationFrame, cancelAnimationFrame } from '@luma.gl/core';
3
+ import { Stats } from '@probe.gl/stats';
6
4
  let statIdCounter = 0;
7
5
  const DEFAULT_ANIMATION_LOOP_PROPS = {
8
- onCreateDevice: props => luma.createDevice(props),
9
- onAddHTML: undefined,
10
- onInitialize: () => ({}),
6
+ device: null,
7
+ onAddHTML: () => '',
8
+ onInitialize: async () => {
9
+ return null;
10
+ },
11
11
  onRender: () => {},
12
12
  onFinalize: () => {},
13
13
  onError: error => console.error(error),
14
- device: undefined,
15
- deviceProps: {},
16
- debug: false,
17
- stats: luma.stats.get("animation-loop-".concat(statIdCounter++)),
14
+ stats: luma.stats.get(`animation-loop-${statIdCounter++}`),
18
15
  useDevicePixels: true,
19
- autoResizeViewport: true,
20
- autoResizeDrawingBuffer: true
16
+ autoResizeViewport: false,
17
+ autoResizeDrawingBuffer: false
21
18
  };
22
- export default class AnimationLoop {
23
- constructor(props = {}) {
24
- _defineProperty(this, "device", void 0);
25
-
26
- _defineProperty(this, "canvas", void 0);
27
-
28
- _defineProperty(this, "props", void 0);
29
-
30
- _defineProperty(this, "animationProps", void 0);
31
-
32
- _defineProperty(this, "timeline", null);
33
-
34
- _defineProperty(this, "stats", void 0);
35
-
36
- _defineProperty(this, "cpuTime", void 0);
37
-
38
- _defineProperty(this, "gpuTime", void 0);
39
-
40
- _defineProperty(this, "frameRate", void 0);
41
-
42
- _defineProperty(this, "display", void 0);
43
-
44
- _defineProperty(this, "needsRedraw", 'initialized');
45
-
46
- _defineProperty(this, "_initialized", false);
47
-
48
- _defineProperty(this, "_running", false);
49
-
50
- _defineProperty(this, "_animationFrameId", null);
51
-
52
- _defineProperty(this, "_nextFramePromise", null);
53
-
54
- _defineProperty(this, "_resolveNextFrame", null);
55
-
56
- _defineProperty(this, "_cpuStartTime", 0);
57
-
58
- this.props = { ...DEFAULT_ANIMATION_LOOP_PROPS,
19
+ export class AnimationLoop {
20
+ constructor(props) {
21
+ this.device = null;
22
+ this.canvas = null;
23
+ this.props = void 0;
24
+ this.animationProps = null;
25
+ this.timeline = null;
26
+ this.stats = void 0;
27
+ this.cpuTime = void 0;
28
+ this.gpuTime = void 0;
29
+ this.frameRate = void 0;
30
+ this.display = void 0;
31
+ this.needsRedraw = 'initialized';
32
+ this._initialized = false;
33
+ this._running = false;
34
+ this._animationFrameId = null;
35
+ this._nextFramePromise = null;
36
+ this._resolveNextFrame = null;
37
+ this._cpuStartTime = 0;
38
+ this.props = {
39
+ ...DEFAULT_ANIMATION_LOOP_PROPS,
59
40
  ...props
60
41
  };
61
42
  props = this.props;
62
- let {
43
+ if (!props.device) {
44
+ throw new Error('No device provided');
45
+ }
46
+ const {
63
47
  useDevicePixels = true
64
48
  } = this.props;
65
- this.device = props.device;
66
- this.gl = this.device && this.device.gl || props.gl;
67
- this.stats = props.stats;
49
+ this.stats = props.stats || new Stats({
50
+ id: 'animation-loop-stats'
51
+ });
68
52
  this.cpuTime = this.stats.get('CPU Time');
69
53
  this.gpuTime = this.stats.get('GPU Time');
70
54
  this.frameRate = this.stats.get('Frame Rate');
@@ -78,71 +62,49 @@ export default class AnimationLoop {
78
62
  this._onMousemove = this._onMousemove.bind(this);
79
63
  this._onMouseleave = this._onMouseleave.bind(this);
80
64
  }
81
-
82
65
  destroy() {
83
66
  this.stop();
84
-
85
67
  this._setDisplay(null);
86
68
  }
87
-
88
69
  delete() {
89
70
  this.destroy();
90
71
  }
91
-
92
72
  setNeedsRedraw(reason) {
93
73
  this.needsRedraw = this.needsRedraw || reason;
94
74
  return this;
95
75
  }
96
-
97
76
  setProps(props) {
98
77
  if ('autoResizeViewport' in props) {
99
- this.props.autoResizeViewport = props.autoResizeViewport;
78
+ this.props.autoResizeViewport = props.autoResizeViewport || false;
100
79
  }
101
-
102
80
  if ('autoResizeDrawingBuffer' in props) {
103
- this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;
81
+ this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer || false;
104
82
  }
105
-
106
83
  if ('useDevicePixels' in props) {
107
- this.props.useDevicePixels = props.useDevicePixels;
84
+ this.props.useDevicePixels = props.useDevicePixels || false;
108
85
  }
109
-
110
86
  return this;
111
87
  }
112
-
113
88
  async start() {
114
89
  if (this._running) {
115
90
  return this;
116
91
  }
117
-
118
92
  this._running = true;
119
-
120
93
  try {
121
- if (!this._running) {
122
- return null;
123
- }
124
-
125
94
  let appContext;
126
-
127
95
  if (!this._initialized) {
128
96
  this._initialized = true;
129
- await this._createDevice();
130
-
97
+ await this._initDevice();
131
98
  this._initialize();
132
-
133
- await this.onInitialize(this.animationProps);
99
+ await this.props.onInitialize(this._getAnimationProps());
134
100
  }
135
-
136
101
  if (!this._running) {
137
102
  return null;
138
103
  }
139
-
140
104
  if (appContext !== false) {
141
105
  this._cancelAnimationFrame();
142
-
143
106
  this._requestAnimationFrame();
144
107
  }
145
-
146
108
  return this;
147
109
  } catch (err) {
148
110
  const error = err instanceof Error ? err : new Error('Unknown error');
@@ -150,171 +112,123 @@ export default class AnimationLoop {
150
112
  throw error;
151
113
  }
152
114
  }
153
-
154
115
  redraw() {
155
- if (this.device.isLost) {
116
+ var _this$device;
117
+ if ((_this$device = this.device) !== null && _this$device !== void 0 && _this$device.isLost) {
156
118
  return this;
157
119
  }
158
-
159
- this._beginTimers();
160
-
120
+ this._beginFrameTimers();
161
121
  this._setupFrame();
162
-
163
- this._updateCallbackData();
164
-
165
- this._renderFrame(this.animationProps);
166
-
122
+ this._updateAnimationProps();
123
+ this._renderFrame(this._getAnimationProps());
167
124
  this._clearNeedsRedraw();
168
-
169
125
  if (this._resolveNextFrame) {
170
126
  this._resolveNextFrame(this);
171
-
172
127
  this._nextFramePromise = null;
173
128
  this._resolveNextFrame = null;
174
129
  }
175
-
176
- this._endTimers();
177
-
130
+ this._endFrameTimers();
178
131
  return this;
179
132
  }
180
-
181
133
  stop() {
182
134
  if (this._running) {
183
- this.onFinalize(this.animationProps);
184
-
135
+ if (this.animationProps) {
136
+ this.props.onFinalize(this.animationProps);
137
+ }
185
138
  this._cancelAnimationFrame();
186
-
187
139
  this._nextFramePromise = null;
188
140
  this._resolveNextFrame = null;
189
141
  this._running = false;
190
142
  }
191
-
192
143
  return this;
193
144
  }
194
-
195
145
  attachTimeline(timeline) {
196
146
  this.timeline = timeline;
197
147
  return this.timeline;
198
148
  }
199
-
200
149
  detachTimeline() {
201
150
  this.timeline = null;
202
151
  }
203
-
204
152
  waitForRender() {
205
153
  this.setNeedsRedraw('waitForRender');
206
-
207
154
  if (!this._nextFramePromise) {
208
155
  this._nextFramePromise = new Promise(resolve => {
209
156
  this._resolveNextFrame = resolve;
210
157
  });
211
158
  }
212
-
213
159
  return this._nextFramePromise;
214
160
  }
215
-
216
161
  async toDataURL() {
217
162
  this.setNeedsRedraw('toDataURL');
218
163
  await this.waitForRender();
219
- return this.canvas.toDataURL();
220
- }
221
-
222
- onCreateDevice(deviceProps) {
223
- return this.props.onCreateDevice(deviceProps);
224
- }
225
-
226
- onInitialize(animationProps) {
227
- return this.props.onInitialize(animationProps);
228
- }
229
-
230
- onRender(animationProps) {
231
- return this.props.onRender(animationProps);
232
- }
233
-
234
- onFinalize(animationProps) {
235
- return this.props.onFinalize(animationProps);
164
+ if (this.canvas instanceof HTMLCanvasElement) {
165
+ return this.canvas.toDataURL();
166
+ }
167
+ throw new Error('OffscreenCanvas');
236
168
  }
237
-
238
169
  _initialize() {
239
170
  this._startEventHandling();
240
-
241
- this._initializeCallbackData();
242
-
243
- this._updateCallbackData();
244
-
171
+ this._initializeAnimationProps();
172
+ this._updateAnimationProps();
245
173
  this._resizeCanvasDrawingBuffer();
246
-
247
174
  this._resizeViewport();
248
175
  }
249
-
250
176
  _setDisplay(display) {
251
177
  if (this.display) {
252
- this.display.delete();
178
+ this.display.destroy();
253
179
  this.display.animationLoop = null;
254
180
  }
255
-
256
181
  if (display) {
257
182
  display.animationLoop = this;
258
183
  }
259
-
260
184
  this.display = display;
261
185
  }
262
-
263
186
  _requestAnimationFrame() {
264
187
  if (!this._running) {
265
188
  return;
266
189
  }
267
-
268
190
  this._animationFrameId = requestAnimationFrame(this._animationFrame.bind(this));
269
191
  }
270
-
271
192
  _cancelAnimationFrame() {
272
- if (this._animationFrameId !== null) {
193
+ if (this._animationFrameId === null) {
273
194
  return;
274
195
  }
275
-
276
196
  cancelAnimationFrame(this._animationFrameId);
277
197
  this._animationFrameId = null;
278
198
  }
279
-
280
199
  _animationFrame() {
281
200
  if (!this._running) {
282
201
  return;
283
202
  }
284
-
285
203
  this.redraw();
286
-
287
204
  this._requestAnimationFrame();
288
205
  }
289
-
290
- _renderFrame(props) {
206
+ _renderFrame(animationProps) {
291
207
  if (this.display) {
292
- this.display._renderFrame(props);
293
-
208
+ this.display._renderFrame(animationProps);
294
209
  return;
295
210
  }
296
-
297
- this.onRender(props);
211
+ this.props.onRender(this._getAnimationProps());
298
212
  }
299
-
300
213
  _clearNeedsRedraw() {
301
- this.needsRedraw = null;
214
+ this.needsRedraw = false;
302
215
  }
303
-
304
216
  _setupFrame() {
305
217
  this._resizeCanvasDrawingBuffer();
306
-
307
218
  this._resizeViewport();
308
219
  }
309
-
310
- _initializeCallbackData() {
220
+ _initializeAnimationProps() {
221
+ var _this$device2;
222
+ if (!this.device) {
223
+ throw new Error('loop');
224
+ }
311
225
  this.animationProps = {
312
226
  animationLoop: this,
313
227
  device: this.device,
314
- canvas: this.device.canvasContext.canvas,
228
+ canvas: (_this$device2 = this.device) === null || _this$device2 === void 0 || (_this$device2 = _this$device2.canvasContext) === null || _this$device2 === void 0 ? void 0 : _this$device2.canvas,
315
229
  timeline: this.timeline,
316
230
  useDevicePixels: this.props.useDevicePixels,
317
- needsRedraw: null,
231
+ needsRedraw: false,
318
232
  width: 1,
319
233
  height: 1,
320
234
  aspect: 1,
@@ -326,47 +240,47 @@ export default class AnimationLoop {
326
240
  _mousePosition: null
327
241
  };
328
242
  }
329
-
330
- _updateCallbackData() {
243
+ _getAnimationProps() {
244
+ if (!this.animationProps) {
245
+ throw new Error('animationProps');
246
+ }
247
+ return this.animationProps;
248
+ }
249
+ _updateAnimationProps() {
250
+ if (!this.animationProps) {
251
+ return;
252
+ }
331
253
  const {
332
254
  width,
333
255
  height,
334
256
  aspect
335
257
  } = this._getSizeAndAspect();
336
-
337
258
  if (width !== this.animationProps.width || height !== this.animationProps.height) {
338
259
  this.setNeedsRedraw('drawing buffer resized');
339
260
  }
340
-
341
261
  if (aspect !== this.animationProps.aspect) {
342
262
  this.setNeedsRedraw('drawing buffer aspect changed');
343
263
  }
344
-
345
264
  this.animationProps.width = width;
346
265
  this.animationProps.height = height;
347
266
  this.animationProps.aspect = aspect;
348
267
  this.animationProps.needsRedraw = this.needsRedraw;
349
268
  this.animationProps.engineTime = Date.now() - this.animationProps.startTime;
350
-
351
269
  if (this.timeline) {
352
270
  this.timeline.update(this.animationProps.engineTime);
353
271
  }
354
-
355
272
  this.animationProps.tick = Math.floor(this.animationProps.time / 1000 * 60);
356
273
  this.animationProps.tock++;
357
274
  this.animationProps.time = this.timeline ? this.timeline.getTime() : this.animationProps.engineTime;
358
275
  }
359
-
360
- async _createDevice() {
361
- const deviceProps = { ...this.props,
362
- ...this.props.deviceProps
363
- };
364
- this.device = await this.onCreateDevice(deviceProps);
365
- this.canvas = this.device.canvasContext.canvas;
366
-
367
- this._createInfoDiv();
276
+ async _initDevice() {
277
+ var _this$device$canvasCo;
278
+ this.device = await this.props.device;
279
+ if (!this.device) {
280
+ throw new Error('No device provided');
281
+ }
282
+ this.canvas = ((_this$device$canvasCo = this.device.canvasContext) === null || _this$device$canvasCo === void 0 ? void 0 : _this$device$canvasCo.canvas) || null;
368
283
  }
369
-
370
284
  _createInfoDiv() {
371
285
  if (this.canvas && this.props.onAddHTML) {
372
286
  const wrapperDiv = document.createElement('div');
@@ -378,71 +292,73 @@ export default class AnimationLoop {
378
292
  div.style.bottom = '10px';
379
293
  div.style.width = '300px';
380
294
  div.style.background = 'white';
381
- wrapperDiv.appendChild(this.canvas);
295
+ if (this.canvas instanceof HTMLCanvasElement) {
296
+ wrapperDiv.appendChild(this.canvas);
297
+ }
382
298
  wrapperDiv.appendChild(div);
383
299
  const html = this.props.onAddHTML(div);
384
-
385
300
  if (html) {
386
301
  div.innerHTML = html;
387
302
  }
388
303
  }
389
304
  }
390
-
391
305
  _getSizeAndAspect() {
392
- const [width, height] = this.device.canvasContext.getPixelSize();
306
+ var _this$device3, _this$device4;
307
+ if (!this.device) {
308
+ return {
309
+ width: 1,
310
+ height: 1,
311
+ aspect: 1
312
+ };
313
+ }
314
+ const [width, height] = ((_this$device3 = this.device) === null || _this$device3 === void 0 || (_this$device3 = _this$device3.canvasContext) === null || _this$device3 === void 0 ? void 0 : _this$device3.getPixelSize()) || [1, 1];
393
315
  let aspect = 1;
394
- const canvas = this.device.canvasContext.canvas;
395
-
316
+ const canvas = (_this$device4 = this.device) === null || _this$device4 === void 0 || (_this$device4 = _this$device4.canvasContext) === null || _this$device4 === void 0 ? void 0 : _this$device4.canvas;
396
317
  if (canvas && canvas.clientHeight) {
397
318
  aspect = canvas.clientWidth / canvas.clientHeight;
398
319
  } else if (width > 0 && height > 0) {
399
320
  aspect = width / height;
400
321
  }
401
-
402
322
  return {
403
323
  width,
404
324
  height,
405
325
  aspect
406
326
  };
407
327
  }
408
-
409
328
  _resizeViewport() {
410
329
  if (this.props.autoResizeViewport && this.device.gl) {
411
330
  this.device.gl.viewport(0, 0, this.device.gl.drawingBufferWidth, this.device.gl.drawingBufferHeight);
412
331
  }
413
332
  }
414
-
415
333
  _resizeCanvasDrawingBuffer() {
416
334
  if (this.props.autoResizeDrawingBuffer) {
417
- this.device.canvasContext.resize({
335
+ var _this$device5;
336
+ (_this$device5 = this.device) === null || _this$device5 === void 0 || (_this$device5 = _this$device5.canvasContext) === null || _this$device5 === void 0 ? void 0 : _this$device5.resize({
418
337
  useDevicePixels: this.props.useDevicePixels
419
338
  });
420
339
  }
421
340
  }
422
-
423
- _beginTimers() {
341
+ _beginFrameTimers() {
424
342
  this.frameRate.timeEnd();
425
343
  this.frameRate.timeStart();
344
+ this.cpuTime.timeStart();
426
345
  }
427
-
428
- _endTimers() {
346
+ _endFrameTimers() {
429
347
  this.cpuTime.timeEnd();
430
348
  }
431
-
432
349
  _startEventHandling() {
433
350
  if (this.canvas) {
434
- this.canvas.addEventListener('mousemove', this._onMousemove);
435
- this.canvas.addEventListener('mouseleave', this._onMouseleave);
351
+ this.canvas.addEventListener('mousemove', this._onMousemove.bind(this));
352
+ this.canvas.addEventListener('mouseleave', this._onMouseleave.bind(this));
436
353
  }
437
354
  }
438
-
439
- _onMousemove(e) {
440
- this.animationProps._mousePosition = [e.offsetX, e.offsetY];
355
+ _onMousemove(event) {
356
+ if (event instanceof MouseEvent) {
357
+ this._getAnimationProps()._mousePosition = [event.offsetX, event.offsetY];
358
+ }
441
359
  }
442
-
443
- _onMouseleave(e) {
444
- this.animationProps._mousePosition = null;
360
+ _onMouseleave(event) {
361
+ this._getAnimationProps()._mousePosition = null;
445
362
  }
446
-
447
363
  }
448
364
  //# sourceMappingURL=animation-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation-loop.js","names":["luma","requestAnimationFrame","cancelAnimationFrame","Stats","statIdCounter","DEFAULT_ANIMATION_LOOP_PROPS","device","onAddHTML","onInitialize","onRender","onFinalize","onError","error","console","stats","get","useDevicePixels","autoResizeViewport","autoResizeDrawingBuffer","AnimationLoop","constructor","props","canvas","animationProps","timeline","cpuTime","gpuTime","frameRate","display","needsRedraw","_initialized","_running","_animationFrameId","_nextFramePromise","_resolveNextFrame","_cpuStartTime","Error","id","setProps","start","bind","stop","_onMousemove","_onMouseleave","destroy","_setDisplay","delete","setNeedsRedraw","reason","appContext","_initDevice","_initialize","_getAnimationProps","_cancelAnimationFrame","_requestAnimationFrame","err","redraw","_this$device","isLost","_beginFrameTimers","_setupFrame","_updateAnimationProps","_renderFrame","_clearNeedsRedraw","_endFrameTimers","attachTimeline","detachTimeline","waitForRender","Promise","resolve","toDataURL","HTMLCanvasElement","_startEventHandling","_initializeAnimationProps","_resizeCanvasDrawingBuffer","_resizeViewport","animationLoop","_animationFrame","_this$device2","canvasContext","width","height","aspect","time","startTime","Date","now","engineTime","tick","tock","_mousePosition","_getSizeAndAspect","update","Math","floor","getTime","_this$device$canvasCo","_createInfoDiv","wrapperDiv","document","createElement","body","appendChild","style","position","div","left","bottom","background","html","innerHTML","_this$device3","_this$device4","getPixelSize","clientHeight","clientWidth","gl","viewport","drawingBufferWidth","drawingBufferHeight","_this$device5","resize","timeEnd","timeStart","addEventListener","event","MouseEvent","offsetX","offsetY"],"sources":["../../src/animation-loop/animation-loop.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {luma, Device} from '@luma.gl/core';\nimport {requestAnimationFrame, cancelAnimationFrame} from '@luma.gl/core';\nimport {Timeline} from '../animation/timeline';\nimport {AnimationProps} from './animation-props';\nimport {Stats, Stat} from '@probe.gl/stats';\n\nlet statIdCounter = 0;\n\n/** AnimationLoop properties */\nexport type AnimationLoopProps = {\n device: Device | Promise<Device>;\n\n onAddHTML?: (div: HTMLDivElement) => string; // innerHTML\n onInitialize?: (animationProps: AnimationProps) => Promise<unknown>;\n onRender?: (animationProps: AnimationProps) => unknown;\n onFinalize?: (animationProps: AnimationProps) => void;\n onError?: (reason: Error) => void;\n\n stats?: Stats;\n\n // view parameters - TODO move to CanvasContext?\n autoResizeViewport?: boolean;\n autoResizeDrawingBuffer?: boolean;\n useDevicePixels?: number | boolean;\n};\n\nexport type MutableAnimationLoopProps = {\n // view parameters\n autoResizeViewport?: boolean;\n autoResizeDrawingBuffer?: boolean;\n useDevicePixels?: number | boolean;\n}\n\n\nconst DEFAULT_ANIMATION_LOOP_PROPS: Required<AnimationLoopProps> = {\n device: null!,\n\n onAddHTML: () => '',\n onInitialize: async () => { return null; },\n onRender: () => {},\n onFinalize: () => {},\n onError: (error) => console.error(error), // eslint-disable-line no-console\n\n stats: luma.stats.get(`animation-loop-${statIdCounter++}`),\n\n // view parameters\n useDevicePixels: true,\n autoResizeViewport: false,\n autoResizeDrawingBuffer: false,\n};\n\n/** Convenient animation loop */\nexport class AnimationLoop {\n device: Device | null = null;\n canvas: HTMLCanvasElement | OffscreenCanvas | null = null;\n\n props: Required<AnimationLoopProps>;\n animationProps: AnimationProps | null = null;\n timeline: Timeline | null = null;\n stats: Stats;\n cpuTime: Stat;\n gpuTime: Stat;\n frameRate: Stat;\n\n display: any;\n\n needsRedraw: string | false = 'initialized';\n\n _initialized: boolean = false;\n _running: boolean = false;\n _animationFrameId: any = null;\n _nextFramePromise: Promise<AnimationLoop> | null = null;\n _resolveNextFrame: ((animationLoop: AnimationLoop) => void) | null = null;\n _cpuStartTime: number = 0;\n\n // _gpuTimeQuery: Query | null = null;\n\n /*\n * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context\n */\n constructor(props: AnimationLoopProps) {\n this.props = {...DEFAULT_ANIMATION_LOOP_PROPS, ...props};\n props = this.props;\n\n if (!props.device) {\n throw new Error('No device provided');\n }\n\n const {useDevicePixels = true} = this.props;\n\n // state\n this.stats = props.stats || new Stats({id: 'animation-loop-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 // TODO - move to CanvasContext\n setProps(props: MutableAnimationLoopProps): this {\n if ('autoResizeViewport' in props) {\n this.props.autoResizeViewport = props.autoResizeViewport || false;\n }\n if ('autoResizeDrawingBuffer' in props) {\n this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer || false;\n }\n if ('useDevicePixels' in props) {\n this.props.useDevicePixels = props.useDevicePixels || false;\n }\n return this;\n }\n\n /** Starts a render loop if not already running */\n async start() {\n if (this._running) {\n return this;\n }\n this._running = true;\n\n try {\n\n let appContext;\n if (!this._initialized) {\n this._initialized = true;\n // Create the WebGL context\n await this._initDevice();\n this._initialize();\n\n // Note: onIntialize can return a promise (e.g. in case app needs to load resources)\n await this.props.onInitialize(this._getAnimationProps());\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 (err: unknown) {\n const error = err instanceof Error ? err : new Error('Unknown error')\n this.props.onError(error);\n // this._running = false; // TODO\n throw error;\n }\n }\n\n /** Explicitly draw a frame */\n redraw(): this {\n if (this.device?.isLost) {\n return this;\n }\n\n this._beginFrameTimers();\n\n this._setupFrame();\n this._updateAnimationProps();\n\n this._renderFrame(this._getAnimationProps());\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._endFrameTimers();\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 // call callback\n // If stop is called immediately, we can end up in a state where props haven't been initialized...\n if (this.animationProps) {\n this.props.onFinalize(this.animationProps);\n }\n\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<AnimationLoop> {\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(): Promise<string> {\n this.setNeedsRedraw('toDataURL');\n await this.waitForRender();\n if (this.canvas instanceof HTMLCanvasElement) {\n return this.canvas.toDataURL();\n }\n throw new Error('OffscreenCanvas');\n }\n\n // PRIVATE METHODS\n\n _initialize() {\n this._startEventHandling();\n\n // Initialize the callback data\n this._initializeAnimationProps();\n this._updateAnimationProps();\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 _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(animationProps: AnimationProps) {\n // Allow e.g. VR display to render multiple frames.\n if (this.display) {\n this.display._renderFrame(animationProps);\n return;\n }\n\n // call callback\n this.props.onRender(this._getAnimationProps());\n // end callback\n }\n\n _clearNeedsRedraw() {\n this.needsRedraw = false;\n }\n\n _setupFrame() {\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n }\n\n // Initialize the object that will be passed to app callbacks\n _initializeAnimationProps() {\n if (!this.device) {\n throw new Error('loop');\n }\n this.animationProps = {\n animationLoop: this,\n\n device: this.device,\n canvas: this.device?.canvasContext?.canvas,\n timeline: this.timeline,\n\n // Initial values\n useDevicePixels: this.props.useDevicePixels,\n needsRedraw: false,\n\n // Placeholders\n width: 1,\n height: 1,\n aspect: 1,\n\n // Animation props\n time: 0,\n startTime: Date.now(),\n engineTime: 0,\n tick: 0,\n tock: 0,\n\n // Experimental\n _mousePosition: null // Event props\n };\n }\n\n _getAnimationProps(): AnimationProps {\n if (!this.animationProps) {\n throw new Error('animationProps');\n }\n return this.animationProps;\n }\n\n // Update the context object that will be passed to app callbacks\n _updateAnimationProps(): void {\n if (!this.animationProps) {\n return;\n }\n\n // Can this be replaced with canvas context?\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 /** Wait for supplied device */\n async _initDevice() {\n this.device = await this.props.device;\n if (!this.device) {\n throw new Error('No device provided');\n }\n this.canvas = this.device.canvasContext?.canvas || null;\n // this._createInfoDiv();\n }\n\n _createInfoDiv() {\n if (this.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 (this.canvas instanceof HTMLCanvasElement) {\n wrapperDiv.appendChild(this.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(): {width: number; height: number; aspect: number} {\n if (!this.device) {\n return {width: 1, height: 1, aspect: 1};\n }\n // https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n const [width, height] = this.device?.canvasContext?.getPixelSize() || [1, 1];\n\n // https://webglfundamentals.org/webgl/lessons/webgl-anti-patterns.html\n let aspect = 1;\n const canvas = this.device?.canvasContext?.canvas;\n\n // @ts-expect-error\n if (canvas && canvas.clientHeight) {\n // @ts-expect-error\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 // @ts-expect-error Expose on canvasContext\n if (this.props.autoResizeViewport && this.device.gl) {\n // @ts-expect-error Expose canvasContext\n this.device.gl.viewport(0, 0, this.device.gl.drawingBufferWidth, this.device.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 _beginFrameTimers() {\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 _endFrameTimers() {\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 if (this.canvas) {\n this.canvas.addEventListener('mousemove', this._onMousemove.bind(this));\n this.canvas.addEventListener('mouseleave', this._onMouseleave.bind(this));\n }\n }\n\n _onMousemove(event: Event) {\n if (event instanceof MouseEvent) {\n this._getAnimationProps()._mousePosition = [event.offsetX, event.offsetY];\n }\n }\n\n _onMouseleave(event: Event) {\n this._getAnimationProps()._mousePosition = null;\n }\n}\n"],"mappings":"AAGA,SAAQA,IAAI,QAAe,eAAe;AAC1C,SAAQC,qBAAqB,EAAEC,oBAAoB,QAAO,eAAe;AAGzE,SAAQC,KAAK,QAAa,iBAAiB;AAE3C,IAAIC,aAAa,GAAG,CAAC;AA4BrB,MAAMC,4BAA0D,GAAG;EACjEC,MAAM,EAAE,IAAK;EAEbC,SAAS,EAAEA,CAAA,KAAM,EAAE;EACnBC,YAAY,EAAE,MAAAA,CAAA,KAAY;IAAE,OAAO,IAAI;EAAE,CAAC;EAC1CC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,OAAO,EAAGC,KAAK,IAAKC,OAAO,CAACD,KAAK,CAACA,KAAK,CAAC;EAExCE,KAAK,EAAEd,IAAI,CAACc,KAAK,CAACC,GAAG,CAAE,kBAAiBX,aAAa,EAAG,EAAC,CAAC;EAG1DY,eAAe,EAAE,IAAI;EACrBC,kBAAkB,EAAE,KAAK;EACzBC,uBAAuB,EAAE;AAC3B,CAAC;AAGD,OAAO,MAAMC,aAAa,CAAC;EA4BzBC,WAAWA,CAACC,KAAyB,EAAE;IAAA,KA3BvCf,MAAM,GAAkB,IAAI;IAAA,KAC5BgB,MAAM,GAA+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@@ -1,9 +1,8 @@
1
- /// <reference types="offscreencanvas" />
2
- import { Device } from '@luma.gl/api';
1
+ import { Device } from '@luma.gl/core';
3
2
  import { Timeline } from '../animation/timeline';
4
- import type AnimationLoop from './animation-loop';
3
+ import type { AnimationLoop } from './animation-loop';
5
4
  /** Properties passed to every render frame */
6
- export declare type AnimationProps = {
5
+ export type AnimationProps = {
7
6
  device: Device;
8
7
  animationLoop: AnimationLoop;
9
8
  /** @todo Should be canvasContext */
@@ -17,8 +16,8 @@ export declare type AnimationProps = {
17
16
  engineTime: number;
18
17
  tick: number;
19
18
  tock: number;
20
- needsRedraw?: string;
21
- timeline: Timeline;
22
- _mousePosition?: [number, number];
19
+ needsRedraw?: string | false;
20
+ timeline: Timeline | null;
21
+ _mousePosition?: [number, number] | null;
23
22
  };
24
23
  //# sourceMappingURL=animation-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation-props.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAEpD,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,aAAa,CAAC;IAE7B,oCAAoC;IACpC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC5C,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IAGf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAGb,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE7B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAG1B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation-props.js","names":[],"sources":["../../src/animation-loop/animation-props.ts"],"sourcesContent":["import {Device} from '@luma.gl/core';\nimport {Timeline} from '../animation/timeline'\nimport type {AnimationLoop} from './animation-loop';\n\n/** Properties passed to every render frame */\nexport type AnimationProps = {\n device: Device;\n animationLoop: AnimationLoop;\n\n /** @todo Should be canvasContext */\n canvas: HTMLCanvasElement | OffscreenCanvas;\n useDevicePixels: number | boolean;\n width: number;\n height: number;\n aspect: number;\n\n // Animation props\n time: number;\n startTime: number;\n engineTime: number;\n tick: number;\n tock: number;\n\n // Initial values\n needsRedraw?: string | false;\n\n timeline: Timeline | null;\n\n // Experimental\n _mousePosition?: [number, number] | null; // [offsetX, offsetY],\n};\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { AnimationLoopTemplate } from './render-loop';
2
+ import { AnimationLoop, AnimationLoopProps } from './animation-loop';
3
+ export type MakeAnimationLoopProps = Omit<AnimationLoopProps, 'onCreateDevice' | 'onInitialize' | 'onRedraw' | 'onFinalize'>;
4
+ /** Instantiates and runs the render loop */
5
+ export declare function makeAnimationLoop(AnimationLoopTemplateCtor: typeof AnimationLoopTemplate, props?: MakeAnimationLoopProps): AnimationLoop;
6
+ //# sourceMappingURL=make-animation-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/make-animation-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAA;AACnD,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAA;AAGlE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,CAAC,CAAC;AAE7H,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,yBAAyB,EAAE,OAAO,qBAAqB,EAAE,KAAK,CAAC,EAAE,sBAAsB,GAAG,aAAa,CAkCxI"}