@luma.gl/engine 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.
Files changed (166) 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 +114 -195
  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 +7149 -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 +102 -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 +2802 -0
  73. package/dist/index.d.ts +19 -9
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +21 -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 +175 -0
  86. package/dist/model/model.d.ts.map +1 -0
  87. package/dist/model/model.js +273 -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/shadertools/shader-module-uniforms.d.ts +36 -0
  102. package/dist/shadertools/shader-module-uniforms.d.ts.map +1 -0
  103. package/dist/shadertools/shader-module-uniforms.js +87 -0
  104. package/dist/shadertools/shader-module-uniforms.js.map +1 -0
  105. package/dist/transform/transform.d.ts +98 -0
  106. package/dist/transform/transform.d.ts.map +1 -0
  107. package/dist/transform/transform.js +48 -0
  108. package/dist/transform/transform.js.map +1 -0
  109. package/dist.min.js +264 -0
  110. package/package.json +21 -12
  111. package/src/animation/timeline.ts +16 -15
  112. package/src/{lib → animation-loop}/animation-loop.ts +119 -102
  113. package/src/{lib → animation-loop}/animation-props.ts +5 -5
  114. package/src/animation-loop/make-animation-loop.ts +44 -0
  115. package/src/animation-loop/render-loop.ts +23 -0
  116. package/src/geometries/cone-geometry.ts +1 -1
  117. package/src/geometries/cube-geometry.ts +6 -3
  118. package/src/geometries/cylinder-geometry.ts +2 -2
  119. package/src/geometries/ico-sphere-geometry.ts +7 -6
  120. package/src/geometries/plane-geometry.ts +5 -4
  121. package/src/geometries/sphere-geometry.ts +4 -3
  122. package/src/geometries/truncated-cone-geometry.ts +4 -13
  123. package/src/geometry/geometry-table.ts +1 -1
  124. package/src/geometry/geometry-utils.ts +3 -3
  125. package/src/geometry/geometry.ts +79 -119
  126. package/src/geometry/gpu-geometry.ts +124 -0
  127. package/src/geometry/gpu-table.ts +41 -0
  128. package/src/index.ts +31 -12
  129. package/src/lib/clip-space.ts +16 -15
  130. package/src/lib/pipeline-factory.ts +60 -168
  131. package/src/model/model.ts +489 -0
  132. package/src/scenegraph/group-node.ts +103 -0
  133. package/src/scenegraph/model-node.ts +50 -0
  134. package/src/scenegraph/scenegraph-node.ts +204 -0
  135. package/src/shadertools/shader-module-uniforms.ts +178 -0
  136. package/src/transform/transform.ts +249 -0
  137. package/dist/bundle.d.ts +0 -2
  138. package/dist/bundle.d.ts.map +0 -1
  139. package/dist/bundle.js +0 -5
  140. package/dist/bundle.js.map +0 -1
  141. package/dist/geometry/primitive-utils.d.ts +0 -1
  142. package/dist/geometry/primitive-utils.d.ts.map +0 -1
  143. package/dist/geometry/primitive-utils.js +0 -2
  144. package/dist/geometry/primitive-utils.js.map +0 -1
  145. package/dist/lib/animation-loop.d.ts.map +0 -1
  146. package/dist/lib/animation-loop.js.map +0 -1
  147. package/dist/lib/animation-props.d.ts.map +0 -1
  148. package/dist/lib/animation-props.js.map +0 -1
  149. package/dist/lib/model-utils.d.ts +0 -5
  150. package/dist/lib/model-utils.d.ts.map +0 -1
  151. package/dist/lib/model-utils.js +0 -45
  152. package/dist/lib/model-utils.js.map +0 -1
  153. package/dist/lib/model.d.ts +0 -41
  154. package/dist/lib/model.d.ts.map +0 -1
  155. package/dist/lib/model.js +0 -176
  156. package/dist/lib/model.js.map +0 -1
  157. package/dist/lib/render-loop.d.ts +0 -14
  158. package/dist/lib/render-loop.d.ts.map +0 -1
  159. package/dist/lib/render-loop.js +0 -49
  160. package/dist/lib/render-loop.js.map +0 -1
  161. package/src/bundle.ts +0 -4
  162. package/src/geometry/primitive-utils.ts +0 -30
  163. package/src/lib/model-utils.ts +0 -124
  164. package/src/lib/model.ts +0 -179
  165. package/src/lib/render-loop.ts +0 -58
  166. /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,52 @@ 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
94
  if (!this._running) {
122
95
  return null;
123
96
  }
124
-
125
97
  let appContext;
126
-
127
98
  if (!this._initialized) {
128
99
  this._initialized = true;
129
- await this._createDevice();
130
-
100
+ await this._initDevice();
131
101
  this._initialize();
132
-
133
- await this.onInitialize(this.animationProps);
102
+ await this.props.onInitialize(this._getAnimationProps());
134
103
  }
135
-
136
104
  if (!this._running) {
137
105
  return null;
138
106
  }
139
-
140
107
  if (appContext !== false) {
141
108
  this._cancelAnimationFrame();
142
-
143
109
  this._requestAnimationFrame();
144
110
  }
145
-
146
111
  return this;
147
112
  } catch (err) {
148
113
  const error = err instanceof Error ? err : new Error('Unknown error');
@@ -150,171 +115,123 @@ export default class AnimationLoop {
150
115
  throw error;
151
116
  }
152
117
  }
153
-
154
118
  redraw() {
155
- if (this.device.isLost) {
119
+ var _this$device;
120
+ if ((_this$device = this.device) !== null && _this$device !== void 0 && _this$device.isLost) {
156
121
  return this;
157
122
  }
158
-
159
- this._beginTimers();
160
-
123
+ this._beginFrameTimers();
161
124
  this._setupFrame();
162
-
163
- this._updateCallbackData();
164
-
165
- this._renderFrame(this.animationProps);
166
-
125
+ this._updateAnimationProps();
126
+ this._renderFrame(this._getAnimationProps());
167
127
  this._clearNeedsRedraw();
168
-
169
128
  if (this._resolveNextFrame) {
170
129
  this._resolveNextFrame(this);
171
-
172
130
  this._nextFramePromise = null;
173
131
  this._resolveNextFrame = null;
174
132
  }
175
-
176
- this._endTimers();
177
-
133
+ this._endFrameTimers();
178
134
  return this;
179
135
  }
180
-
181
136
  stop() {
182
137
  if (this._running) {
183
- this.onFinalize(this.animationProps);
184
-
138
+ if (this.animationProps) {
139
+ this.props.onFinalize(this.animationProps);
140
+ }
185
141
  this._cancelAnimationFrame();
186
-
187
142
  this._nextFramePromise = null;
188
143
  this._resolveNextFrame = null;
189
144
  this._running = false;
190
145
  }
191
-
192
146
  return this;
193
147
  }
194
-
195
148
  attachTimeline(timeline) {
196
149
  this.timeline = timeline;
197
150
  return this.timeline;
198
151
  }
199
-
200
152
  detachTimeline() {
201
153
  this.timeline = null;
202
154
  }
203
-
204
155
  waitForRender() {
205
156
  this.setNeedsRedraw('waitForRender');
206
-
207
157
  if (!this._nextFramePromise) {
208
158
  this._nextFramePromise = new Promise(resolve => {
209
159
  this._resolveNextFrame = resolve;
210
160
  });
211
161
  }
212
-
213
162
  return this._nextFramePromise;
214
163
  }
215
-
216
164
  async toDataURL() {
217
165
  this.setNeedsRedraw('toDataURL');
218
166
  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);
167
+ if (this.canvas instanceof HTMLCanvasElement) {
168
+ return this.canvas.toDataURL();
169
+ }
170
+ throw new Error('OffscreenCanvas');
236
171
  }
237
-
238
172
  _initialize() {
239
173
  this._startEventHandling();
240
-
241
- this._initializeCallbackData();
242
-
243
- this._updateCallbackData();
244
-
174
+ this._initializeAnimationProps();
175
+ this._updateAnimationProps();
245
176
  this._resizeCanvasDrawingBuffer();
246
-
247
177
  this._resizeViewport();
248
178
  }
249
-
250
179
  _setDisplay(display) {
251
180
  if (this.display) {
252
- this.display.delete();
181
+ this.display.destroy();
253
182
  this.display.animationLoop = null;
254
183
  }
255
-
256
184
  if (display) {
257
185
  display.animationLoop = this;
258
186
  }
259
-
260
187
  this.display = display;
261
188
  }
262
-
263
189
  _requestAnimationFrame() {
264
190
  if (!this._running) {
265
191
  return;
266
192
  }
267
-
268
193
  this._animationFrameId = requestAnimationFrame(this._animationFrame.bind(this));
269
194
  }
270
-
271
195
  _cancelAnimationFrame() {
272
196
  if (this._animationFrameId !== null) {
273
197
  return;
274
198
  }
275
-
276
199
  cancelAnimationFrame(this._animationFrameId);
277
200
  this._animationFrameId = null;
278
201
  }
279
-
280
202
  _animationFrame() {
281
203
  if (!this._running) {
282
204
  return;
283
205
  }
284
-
285
206
  this.redraw();
286
-
287
207
  this._requestAnimationFrame();
288
208
  }
289
-
290
- _renderFrame(props) {
209
+ _renderFrame(animationProps) {
291
210
  if (this.display) {
292
- this.display._renderFrame(props);
293
-
211
+ this.display._renderFrame(animationProps);
294
212
  return;
295
213
  }
296
-
297
- this.onRender(props);
214
+ this.props.onRender(this._getAnimationProps());
298
215
  }
299
-
300
216
  _clearNeedsRedraw() {
301
- this.needsRedraw = null;
217
+ this.needsRedraw = false;
302
218
  }
303
-
304
219
  _setupFrame() {
305
220
  this._resizeCanvasDrawingBuffer();
306
-
307
221
  this._resizeViewport();
308
222
  }
309
-
310
- _initializeCallbackData() {
223
+ _initializeAnimationProps() {
224
+ var _this$device2;
225
+ if (!this.device) {
226
+ throw new Error('loop');
227
+ }
311
228
  this.animationProps = {
312
229
  animationLoop: this,
313
230
  device: this.device,
314
- canvas: this.device.canvasContext.canvas,
231
+ 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
232
  timeline: this.timeline,
316
233
  useDevicePixels: this.props.useDevicePixels,
317
- needsRedraw: null,
234
+ needsRedraw: false,
318
235
  width: 1,
319
236
  height: 1,
320
237
  aspect: 1,
@@ -326,47 +243,47 @@ export default class AnimationLoop {
326
243
  _mousePosition: null
327
244
  };
328
245
  }
329
-
330
- _updateCallbackData() {
246
+ _getAnimationProps() {
247
+ if (!this.animationProps) {
248
+ throw new Error('animationProps');
249
+ }
250
+ return this.animationProps;
251
+ }
252
+ _updateAnimationProps() {
253
+ if (!this.animationProps) {
254
+ return;
255
+ }
331
256
  const {
332
257
  width,
333
258
  height,
334
259
  aspect
335
260
  } = this._getSizeAndAspect();
336
-
337
261
  if (width !== this.animationProps.width || height !== this.animationProps.height) {
338
262
  this.setNeedsRedraw('drawing buffer resized');
339
263
  }
340
-
341
264
  if (aspect !== this.animationProps.aspect) {
342
265
  this.setNeedsRedraw('drawing buffer aspect changed');
343
266
  }
344
-
345
267
  this.animationProps.width = width;
346
268
  this.animationProps.height = height;
347
269
  this.animationProps.aspect = aspect;
348
270
  this.animationProps.needsRedraw = this.needsRedraw;
349
271
  this.animationProps.engineTime = Date.now() - this.animationProps.startTime;
350
-
351
272
  if (this.timeline) {
352
273
  this.timeline.update(this.animationProps.engineTime);
353
274
  }
354
-
355
275
  this.animationProps.tick = Math.floor(this.animationProps.time / 1000 * 60);
356
276
  this.animationProps.tock++;
357
277
  this.animationProps.time = this.timeline ? this.timeline.getTime() : this.animationProps.engineTime;
358
278
  }
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();
279
+ async _initDevice() {
280
+ var _this$device$canvasCo;
281
+ this.device = await this.props.device;
282
+ if (!this.device) {
283
+ throw new Error('No device provided');
284
+ }
285
+ this.canvas = ((_this$device$canvasCo = this.device.canvasContext) === null || _this$device$canvasCo === void 0 ? void 0 : _this$device$canvasCo.canvas) || null;
368
286
  }
369
-
370
287
  _createInfoDiv() {
371
288
  if (this.canvas && this.props.onAddHTML) {
372
289
  const wrapperDiv = document.createElement('div');
@@ -378,71 +295,73 @@ export default class AnimationLoop {
378
295
  div.style.bottom = '10px';
379
296
  div.style.width = '300px';
380
297
  div.style.background = 'white';
381
- wrapperDiv.appendChild(this.canvas);
298
+ if (this.canvas instanceof HTMLCanvasElement) {
299
+ wrapperDiv.appendChild(this.canvas);
300
+ }
382
301
  wrapperDiv.appendChild(div);
383
302
  const html = this.props.onAddHTML(div);
384
-
385
303
  if (html) {
386
304
  div.innerHTML = html;
387
305
  }
388
306
  }
389
307
  }
390
-
391
308
  _getSizeAndAspect() {
392
- const [width, height] = this.device.canvasContext.getPixelSize();
309
+ var _this$device3, _this$device4;
310
+ if (!this.device) {
311
+ return {
312
+ width: 1,
313
+ height: 1,
314
+ aspect: 1
315
+ };
316
+ }
317
+ 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
318
  let aspect = 1;
394
- const canvas = this.device.canvasContext.canvas;
395
-
319
+ 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
320
  if (canvas && canvas.clientHeight) {
397
321
  aspect = canvas.clientWidth / canvas.clientHeight;
398
322
  } else if (width > 0 && height > 0) {
399
323
  aspect = width / height;
400
324
  }
401
-
402
325
  return {
403
326
  width,
404
327
  height,
405
328
  aspect
406
329
  };
407
330
  }
408
-
409
331
  _resizeViewport() {
410
332
  if (this.props.autoResizeViewport && this.device.gl) {
411
333
  this.device.gl.viewport(0, 0, this.device.gl.drawingBufferWidth, this.device.gl.drawingBufferHeight);
412
334
  }
413
335
  }
414
-
415
336
  _resizeCanvasDrawingBuffer() {
416
337
  if (this.props.autoResizeDrawingBuffer) {
417
- this.device.canvasContext.resize({
338
+ var _this$device5;
339
+ (_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
340
  useDevicePixels: this.props.useDevicePixels
419
341
  });
420
342
  }
421
343
  }
422
-
423
- _beginTimers() {
344
+ _beginFrameTimers() {
424
345
  this.frameRate.timeEnd();
425
346
  this.frameRate.timeStart();
347
+ this.cpuTime.timeStart();
426
348
  }
427
-
428
- _endTimers() {
349
+ _endFrameTimers() {
429
350
  this.cpuTime.timeEnd();
430
351
  }
431
-
432
352
  _startEventHandling() {
433
353
  if (this.canvas) {
434
- this.canvas.addEventListener('mousemove', this._onMousemove);
435
- this.canvas.addEventListener('mouseleave', this._onMouseleave);
354
+ this.canvas.addEventListener('mousemove', this._onMousemove.bind(this));
355
+ this.canvas.addEventListener('mouseleave', this._onMouseleave.bind(this));
436
356
  }
437
357
  }
438
-
439
- _onMousemove(e) {
440
- this.animationProps._mousePosition = [e.offsetX, e.offsetY];
358
+ _onMousemove(event) {
359
+ if (event instanceof MouseEvent) {
360
+ this._getAnimationProps()._mousePosition = [event.offsetX, event.offsetY];
361
+ }
441
362
  }
442
-
443
- _onMouseleave(e) {
444
- this.animationProps._mousePosition = null;
363
+ _onMouseleave(event) {
364
+ this._getAnimationProps()._mousePosition = null;
445
365
  }
446
-
447
366
  }
448
367
  //# 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 // 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._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+C,IAAI;IAAA,KAEzDD,KAAK;IAAA,KACLE,cAAc,GAA0B,IAAI;IAAA,KAC5CC,QAAQ,GAAoB,IAAI;IAAA,KAChCV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/>
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"}