@luma.gl/engine 9.0.0-alpha.14 → 9.0.0-alpha.16

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 (172) hide show
  1. package/dist/animation/key-frames.d.ts +1 -1
  2. package/dist/animation/key-frames.d.ts.map +1 -1
  3. package/dist/animation/key-frames.js +51 -72
  4. package/dist/animation/timeline.d.ts +4 -4
  5. package/dist/animation/timeline.d.ts.map +1 -1
  6. package/dist/animation/timeline.js +94 -131
  7. package/dist/animation-loop/animation-loop.d.ts +2 -3
  8. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  9. package/dist/animation-loop/animation-loop.js +414 -473
  10. package/dist/animation-loop/animation-props.d.ts +1 -2
  11. package/dist/animation-loop/animation-props.d.ts.map +1 -1
  12. package/dist/animation-loop/animation-props.js +0 -1
  13. package/dist/animation-loop/make-animation-loop.d.ts +1 -1
  14. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  15. package/dist/animation-loop/make-animation-loop.js +26 -31
  16. package/dist/animation-loop/render-loop.js +17 -7
  17. package/dist/bundle.js +2 -2
  18. package/dist/dist.min.js +31 -0
  19. package/dist/es5/animation/key-frames.js +84 -0
  20. package/dist/es5/animation/key-frames.js.map +1 -0
  21. package/dist/es5/animation/timeline.js +183 -0
  22. package/dist/es5/animation/timeline.js.map +1 -0
  23. package/dist/es5/animation-loop/animation-loop.js +534 -0
  24. package/dist/es5/animation-loop/animation-loop.js.map +1 -0
  25. package/dist/es5/animation-loop/animation-props.js +2 -0
  26. package/dist/es5/animation-loop/animation-props.js.map +1 -0
  27. package/dist/es5/animation-loop/make-animation-loop.js +53 -0
  28. package/dist/es5/animation-loop/make-animation-loop.js.map +1 -0
  29. package/dist/es5/animation-loop/render-loop.js +39 -0
  30. package/dist/es5/animation-loop/render-loop.js.map +1 -0
  31. package/dist/es5/bundle.js +6 -0
  32. package/dist/es5/bundle.js.map +1 -0
  33. package/dist/es5/geometries/cone-geometry.js +43 -0
  34. package/dist/es5/geometries/cone-geometry.js.map +1 -0
  35. package/dist/es5/geometries/cube-geometry.js +84 -0
  36. package/dist/es5/geometries/cube-geometry.js.map +1 -0
  37. package/dist/es5/geometries/cylinder-geometry.js +39 -0
  38. package/dist/es5/geometries/cylinder-geometry.js.map +1 -0
  39. package/dist/es5/geometries/ico-sphere-geometry.js +185 -0
  40. package/dist/es5/geometries/ico-sphere-geometry.js.map +1 -0
  41. package/dist/es5/geometries/plane-geometry.js +137 -0
  42. package/dist/es5/geometries/plane-geometry.js.map +1 -0
  43. package/dist/es5/geometries/sphere-geometry.js +120 -0
  44. package/dist/es5/geometries/sphere-geometry.js.map +1 -0
  45. package/dist/es5/geometries/truncated-cone-geometry.js +160 -0
  46. package/dist/es5/geometries/truncated-cone-geometry.js.map +1 -0
  47. package/dist/es5/geometry/geometry-table.js +2 -0
  48. package/dist/es5/geometry/geometry-table.js.map +1 -0
  49. package/dist/es5/geometry/geometry-utils.js +39 -0
  50. package/dist/es5/geometry/geometry-utils.js.map +1 -0
  51. package/dist/es5/geometry/geometry.js +150 -0
  52. package/dist/es5/geometry/geometry.js.map +1 -0
  53. package/dist/es5/geometry/primitive-utils.js +2 -0
  54. package/dist/es5/geometry/primitive-utils.js.map +1 -0
  55. package/dist/es5/index.js +112 -0
  56. package/dist/es5/index.js.map +1 -0
  57. package/dist/es5/lib/clip-space.js +2 -0
  58. package/dist/es5/lib/clip-space.js.map +1 -0
  59. package/dist/es5/lib/model-utils.js +52 -0
  60. package/dist/es5/lib/model-utils.js.map +1 -0
  61. package/dist/es5/lib/model.js +173 -0
  62. package/dist/es5/lib/model.js.map +1 -0
  63. package/dist/es5/lib/pipeline-factory.js +244 -0
  64. package/dist/es5/lib/pipeline-factory.js.map +1 -0
  65. package/dist/esm/animation/key-frames.js +57 -0
  66. package/dist/esm/animation/key-frames.js.map +1 -0
  67. package/dist/esm/animation/timeline.js +113 -0
  68. package/dist/esm/animation/timeline.js.map +1 -0
  69. package/dist/esm/animation-loop/animation-loop.js +367 -0
  70. package/dist/esm/animation-loop/animation-loop.js.map +1 -0
  71. package/dist/esm/animation-loop/animation-props.js +2 -0
  72. package/dist/esm/animation-loop/animation-props.js.map +1 -0
  73. package/dist/esm/animation-loop/make-animation-loop.js +28 -0
  74. package/dist/esm/animation-loop/make-animation-loop.js.map +1 -0
  75. package/dist/esm/animation-loop/render-loop.js +7 -0
  76. package/dist/esm/animation-loop/render-loop.js.map +1 -0
  77. package/dist/esm/bundle.js +4 -0
  78. package/dist/esm/bundle.js.map +1 -0
  79. package/dist/esm/geometries/cone-geometry.js +21 -0
  80. package/dist/esm/geometries/cone-geometry.js.map +1 -0
  81. package/dist/esm/geometries/cube-geometry.js +67 -0
  82. package/dist/esm/geometries/cube-geometry.js.map +1 -0
  83. package/dist/esm/geometries/cylinder-geometry.js +18 -0
  84. package/dist/esm/geometries/cylinder-geometry.js.map +1 -0
  85. package/dist/esm/geometries/ico-sphere-geometry.js +170 -0
  86. package/dist/esm/geometries/ico-sphere-geometry.js.map +1 -0
  87. package/dist/esm/geometries/plane-geometry.js +119 -0
  88. package/dist/esm/geometries/plane-geometry.js.map +1 -0
  89. package/dist/esm/geometries/sphere-geometry.js +102 -0
  90. package/dist/esm/geometries/sphere-geometry.js.map +1 -0
  91. package/dist/esm/geometries/truncated-cone-geometry.js +136 -0
  92. package/dist/esm/geometries/truncated-cone-geometry.js.map +1 -0
  93. package/dist/esm/geometry/geometry-table.js +2 -0
  94. package/dist/esm/geometry/geometry-table.js.map +1 -0
  95. package/dist/esm/geometry/geometry-utils.js +37 -0
  96. package/dist/esm/geometry/geometry-utils.js.map +1 -0
  97. package/dist/esm/geometry/geometry.js +119 -0
  98. package/dist/esm/geometry/geometry.js.map +1 -0
  99. package/dist/esm/geometry/primitive-utils.js +2 -0
  100. package/dist/esm/geometry/primitive-utils.js.map +1 -0
  101. package/dist/esm/index.js +16 -0
  102. package/dist/esm/index.js.map +1 -0
  103. package/dist/esm/lib/clip-space.js +2 -0
  104. package/dist/esm/lib/clip-space.js.map +1 -0
  105. package/dist/esm/lib/model-utils.js +40 -0
  106. package/dist/esm/lib/model-utils.js.map +1 -0
  107. package/dist/esm/lib/model.js +146 -0
  108. package/dist/esm/lib/model.js.map +1 -0
  109. package/dist/esm/lib/pipeline-factory.js +180 -0
  110. package/dist/esm/lib/pipeline-factory.js.map +1 -0
  111. package/dist/geometries/cone-geometry.d.ts +1 -1
  112. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  113. package/dist/geometries/cone-geometry.js +12 -17
  114. package/dist/geometries/cube-geometry.d.ts +1 -1
  115. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  116. package/dist/geometries/cube-geometry.js +187 -56
  117. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  118. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  119. package/dist/geometries/cylinder-geometry.js +10 -14
  120. package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
  121. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  122. package/dist/geometries/ico-sphere-geometry.js +141 -170
  123. package/dist/geometries/plane-geometry.d.ts +1 -1
  124. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  125. package/dist/geometries/plane-geometry.js +93 -121
  126. package/dist/geometries/sphere-geometry.d.ts +1 -1
  127. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  128. package/dist/geometries/sphere-geometry.js +76 -100
  129. package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
  130. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  131. package/dist/geometries/truncated-cone-geometry.js +104 -131
  132. package/dist/geometry/geometry-table.d.ts +1 -1
  133. package/dist/geometry/geometry-table.d.ts.map +1 -1
  134. package/dist/geometry/geometry-table.js +0 -1
  135. package/dist/geometry/geometry-utils.js +22 -41
  136. package/dist/geometry/geometry.d.ts +4 -4
  137. package/dist/geometry/geometry.d.ts.map +1 -1
  138. package/dist/geometry/geometry.js +96 -142
  139. package/dist/geometry/primitive-utils.js +30 -1
  140. package/dist/index.js +20 -16
  141. package/dist/lib/clip-space.js +50 -1
  142. package/dist/lib/model-utils.js +97 -29
  143. package/dist/lib/model.d.ts +1 -1
  144. package/dist/lib/model.d.ts.map +1 -1
  145. package/dist/lib/model.js +122 -166
  146. package/dist/lib/pipeline-factory.d.ts +3 -3
  147. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  148. package/dist/lib/pipeline-factory.js +136 -204
  149. package/package.json +12 -11
  150. package/dist/animation/key-frames.js.map +0 -1
  151. package/dist/animation/timeline.js.map +0 -1
  152. package/dist/animation-loop/animation-loop.js.map +0 -1
  153. package/dist/animation-loop/animation-props.js.map +0 -1
  154. package/dist/animation-loop/make-animation-loop.js.map +0 -1
  155. package/dist/animation-loop/render-loop.js.map +0 -1
  156. package/dist/bundle.js.map +0 -1
  157. package/dist/geometries/cone-geometry.js.map +0 -1
  158. package/dist/geometries/cube-geometry.js.map +0 -1
  159. package/dist/geometries/cylinder-geometry.js.map +0 -1
  160. package/dist/geometries/ico-sphere-geometry.js.map +0 -1
  161. package/dist/geometries/plane-geometry.js.map +0 -1
  162. package/dist/geometries/sphere-geometry.js.map +0 -1
  163. package/dist/geometries/truncated-cone-geometry.js.map +0 -1
  164. package/dist/geometry/geometry-table.js.map +0 -1
  165. package/dist/geometry/geometry-utils.js.map +0 -1
  166. package/dist/geometry/geometry.js.map +0 -1
  167. package/dist/geometry/primitive-utils.js.map +0 -1
  168. package/dist/index.js.map +0 -1
  169. package/dist/lib/clip-space.js.map +0 -1
  170. package/dist/lib/model-utils.js.map +0 -1
  171. package/dist/lib/model.js.map +0 -1
  172. package/dist/lib/pipeline-factory.js.map +0 -1
@@ -0,0 +1,367 @@
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 { Stats } from '@probe.gl/stats';
5
+ let statIdCounter = 0;
6
+ const DEFAULT_ANIMATION_LOOP_PROPS = {
7
+ device: null,
8
+ onAddHTML: () => '',
9
+ onInitialize: async () => {
10
+ return null;
11
+ },
12
+ onRender: () => {},
13
+ onFinalize: () => {},
14
+ onError: error => console.error(error),
15
+ stats: luma.stats.get("animation-loop-".concat(statIdCounter++)),
16
+ useDevicePixels: true,
17
+ autoResizeViewport: false,
18
+ autoResizeDrawingBuffer: false
19
+ };
20
+ export class AnimationLoop {
21
+ constructor(props) {
22
+ _defineProperty(this, "device", null);
23
+ _defineProperty(this, "canvas", null);
24
+ _defineProperty(this, "props", void 0);
25
+ _defineProperty(this, "animationProps", null);
26
+ _defineProperty(this, "timeline", null);
27
+ _defineProperty(this, "stats", void 0);
28
+ _defineProperty(this, "cpuTime", void 0);
29
+ _defineProperty(this, "gpuTime", void 0);
30
+ _defineProperty(this, "frameRate", void 0);
31
+ _defineProperty(this, "display", void 0);
32
+ _defineProperty(this, "needsRedraw", 'initialized');
33
+ _defineProperty(this, "_initialized", false);
34
+ _defineProperty(this, "_running", false);
35
+ _defineProperty(this, "_animationFrameId", null);
36
+ _defineProperty(this, "_nextFramePromise", null);
37
+ _defineProperty(this, "_resolveNextFrame", null);
38
+ _defineProperty(this, "_cpuStartTime", 0);
39
+ this.props = {
40
+ ...DEFAULT_ANIMATION_LOOP_PROPS,
41
+ ...props
42
+ };
43
+ props = this.props;
44
+ if (!props.device) {
45
+ throw new Error('No device provided');
46
+ }
47
+ let {
48
+ useDevicePixels = true
49
+ } = this.props;
50
+ this.stats = props.stats || new Stats({
51
+ id: 'animation-loop-stats'
52
+ });
53
+ this.cpuTime = this.stats.get('CPU Time');
54
+ this.gpuTime = this.stats.get('GPU Time');
55
+ this.frameRate = this.stats.get('Frame Rate');
56
+ this.setProps({
57
+ autoResizeViewport: props.autoResizeViewport,
58
+ autoResizeDrawingBuffer: props.autoResizeDrawingBuffer,
59
+ useDevicePixels
60
+ });
61
+ this.start = this.start.bind(this);
62
+ this.stop = this.stop.bind(this);
63
+ this._onMousemove = this._onMousemove.bind(this);
64
+ this._onMouseleave = this._onMouseleave.bind(this);
65
+ }
66
+ destroy() {
67
+ this.stop();
68
+ this._setDisplay(null);
69
+ }
70
+ delete() {
71
+ this.destroy();
72
+ }
73
+ setNeedsRedraw(reason) {
74
+ this.needsRedraw = this.needsRedraw || reason;
75
+ return this;
76
+ }
77
+ setProps(props) {
78
+ if ('autoResizeViewport' in props) {
79
+ this.props.autoResizeViewport = props.autoResizeViewport || false;
80
+ }
81
+ if ('autoResizeDrawingBuffer' in props) {
82
+ this.props.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer || false;
83
+ }
84
+ if ('useDevicePixels' in props) {
85
+ this.props.useDevicePixels = props.useDevicePixels || false;
86
+ }
87
+ return this;
88
+ }
89
+ async start() {
90
+ if (this._running) {
91
+ return this;
92
+ }
93
+ this._running = true;
94
+ try {
95
+ if (!this._running) {
96
+ return null;
97
+ }
98
+ let appContext;
99
+ if (!this._initialized) {
100
+ this._initialized = true;
101
+ await this._initDevice();
102
+ this._initialize();
103
+ await this.props.onInitialize(this._getAnimationProps());
104
+ }
105
+ if (!this._running) {
106
+ return null;
107
+ }
108
+ if (appContext !== false) {
109
+ this._cancelAnimationFrame();
110
+ this._requestAnimationFrame();
111
+ }
112
+ return this;
113
+ } catch (err) {
114
+ const error = err instanceof Error ? err : new Error('Unknown error');
115
+ this.props.onError(error);
116
+ throw error;
117
+ }
118
+ }
119
+ redraw() {
120
+ var _this$device;
121
+ if ((_this$device = this.device) !== null && _this$device !== void 0 && _this$device.isLost) {
122
+ return this;
123
+ }
124
+ this._beginTimers();
125
+ this._setupFrame();
126
+ this._updateAnimationProps();
127
+ this._renderFrame(this._getAnimationProps());
128
+ this._clearNeedsRedraw();
129
+ if (this._resolveNextFrame) {
130
+ this._resolveNextFrame(this);
131
+ this._nextFramePromise = null;
132
+ this._resolveNextFrame = null;
133
+ }
134
+ this._endTimers();
135
+ return this;
136
+ }
137
+ stop() {
138
+ if (this._running) {
139
+ if (this.animationProps) {
140
+ this.props.onFinalize(this.animationProps);
141
+ }
142
+ this._cancelAnimationFrame();
143
+ this._nextFramePromise = null;
144
+ this._resolveNextFrame = null;
145
+ this._running = false;
146
+ }
147
+ return this;
148
+ }
149
+ attachTimeline(timeline) {
150
+ this.timeline = timeline;
151
+ return this.timeline;
152
+ }
153
+ detachTimeline() {
154
+ this.timeline = null;
155
+ }
156
+ waitForRender() {
157
+ this.setNeedsRedraw('waitForRender');
158
+ if (!this._nextFramePromise) {
159
+ this._nextFramePromise = new Promise(resolve => {
160
+ this._resolveNextFrame = resolve;
161
+ });
162
+ }
163
+ return this._nextFramePromise;
164
+ }
165
+ async toDataURL() {
166
+ this.setNeedsRedraw('toDataURL');
167
+ await this.waitForRender();
168
+ if (this.canvas instanceof HTMLCanvasElement) {
169
+ return this.canvas.toDataURL();
170
+ }
171
+ throw new Error('OffscreenCanvas');
172
+ }
173
+ _initialize() {
174
+ this._startEventHandling();
175
+ this._initializeAnimationProps();
176
+ this._updateAnimationProps();
177
+ this._resizeCanvasDrawingBuffer();
178
+ this._resizeViewport();
179
+ }
180
+ _setDisplay(display) {
181
+ if (this.display) {
182
+ this.display.delete();
183
+ this.display.animationLoop = null;
184
+ }
185
+ if (display) {
186
+ display.animationLoop = this;
187
+ }
188
+ this.display = display;
189
+ }
190
+ _requestAnimationFrame() {
191
+ if (!this._running) {
192
+ return;
193
+ }
194
+ this._animationFrameId = requestAnimationFrame(this._animationFrame.bind(this));
195
+ }
196
+ _cancelAnimationFrame() {
197
+ if (this._animationFrameId !== null) {
198
+ return;
199
+ }
200
+ cancelAnimationFrame(this._animationFrameId);
201
+ this._animationFrameId = null;
202
+ }
203
+ _animationFrame() {
204
+ if (!this._running) {
205
+ return;
206
+ }
207
+ this.redraw();
208
+ this._requestAnimationFrame();
209
+ }
210
+ _renderFrame(animationProps) {
211
+ if (this.display) {
212
+ this.display._renderFrame(animationProps);
213
+ return;
214
+ }
215
+ this.props.onRender(this._getAnimationProps());
216
+ }
217
+ _clearNeedsRedraw() {
218
+ this.needsRedraw = false;
219
+ }
220
+ _setupFrame() {
221
+ this._resizeCanvasDrawingBuffer();
222
+ this._resizeViewport();
223
+ }
224
+ _initializeAnimationProps() {
225
+ var _this$device2, _this$device2$canvasC;
226
+ if (!this.device) {
227
+ throw new Error('loop');
228
+ }
229
+ this.animationProps = {
230
+ animationLoop: this,
231
+ device: this.device,
232
+ canvas: (_this$device2 = this.device) === null || _this$device2 === void 0 ? void 0 : (_this$device2$canvasC = _this$device2.canvasContext) === null || _this$device2$canvasC === void 0 ? void 0 : _this$device2$canvasC.canvas,
233
+ timeline: this.timeline,
234
+ useDevicePixels: this.props.useDevicePixels,
235
+ needsRedraw: false,
236
+ width: 1,
237
+ height: 1,
238
+ aspect: 1,
239
+ time: 0,
240
+ startTime: Date.now(),
241
+ engineTime: 0,
242
+ tick: 0,
243
+ tock: 0,
244
+ _mousePosition: null
245
+ };
246
+ }
247
+ _getAnimationProps() {
248
+ if (!this.animationProps) {
249
+ throw new Error('animationProps');
250
+ }
251
+ return this.animationProps;
252
+ }
253
+ _updateAnimationProps() {
254
+ if (!this.animationProps) {
255
+ return;
256
+ }
257
+ const {
258
+ width,
259
+ height,
260
+ aspect
261
+ } = this._getSizeAndAspect();
262
+ if (width !== this.animationProps.width || height !== this.animationProps.height) {
263
+ this.setNeedsRedraw('drawing buffer resized');
264
+ }
265
+ if (aspect !== this.animationProps.aspect) {
266
+ this.setNeedsRedraw('drawing buffer aspect changed');
267
+ }
268
+ this.animationProps.width = width;
269
+ this.animationProps.height = height;
270
+ this.animationProps.aspect = aspect;
271
+ this.animationProps.needsRedraw = this.needsRedraw;
272
+ this.animationProps.engineTime = Date.now() - this.animationProps.startTime;
273
+ if (this.timeline) {
274
+ this.timeline.update(this.animationProps.engineTime);
275
+ }
276
+ this.animationProps.tick = Math.floor(this.animationProps.time / 1000 * 60);
277
+ this.animationProps.tock++;
278
+ this.animationProps.time = this.timeline ? this.timeline.getTime() : this.animationProps.engineTime;
279
+ }
280
+ async _initDevice() {
281
+ var _this$device$canvasCo;
282
+ this.device = await this.props.device;
283
+ if (!this.device) {
284
+ throw new Error('No device provided');
285
+ }
286
+ this.canvas = ((_this$device$canvasCo = this.device.canvasContext) === null || _this$device$canvasCo === void 0 ? void 0 : _this$device$canvasCo.canvas) || null;
287
+ }
288
+ _createInfoDiv() {
289
+ if (this.canvas && this.props.onAddHTML) {
290
+ const wrapperDiv = document.createElement('div');
291
+ document.body.appendChild(wrapperDiv);
292
+ wrapperDiv.style.position = 'relative';
293
+ const div = document.createElement('div');
294
+ div.style.position = 'absolute';
295
+ div.style.left = '10px';
296
+ div.style.bottom = '10px';
297
+ div.style.width = '300px';
298
+ div.style.background = 'white';
299
+ if (this.canvas instanceof HTMLCanvasElement) {
300
+ wrapperDiv.appendChild(this.canvas);
301
+ }
302
+ wrapperDiv.appendChild(div);
303
+ const html = this.props.onAddHTML(div);
304
+ if (html) {
305
+ div.innerHTML = html;
306
+ }
307
+ }
308
+ }
309
+ _getSizeAndAspect() {
310
+ var _this$device3, _this$device3$canvasC, _this$device4, _this$device4$canvasC;
311
+ if (!this.device) {
312
+ return {
313
+ width: 1,
314
+ height: 1,
315
+ aspect: 1
316
+ };
317
+ }
318
+ const [width, height] = ((_this$device3 = this.device) === null || _this$device3 === void 0 ? void 0 : (_this$device3$canvasC = _this$device3.canvasContext) === null || _this$device3$canvasC === void 0 ? void 0 : _this$device3$canvasC.getPixelSize()) || [1, 1];
319
+ let aspect = 1;
320
+ const canvas = (_this$device4 = this.device) === null || _this$device4 === void 0 ? void 0 : (_this$device4$canvasC = _this$device4.canvasContext) === null || _this$device4$canvasC === void 0 ? void 0 : _this$device4$canvasC.canvas;
321
+ if (canvas && canvas.clientHeight) {
322
+ aspect = canvas.clientWidth / canvas.clientHeight;
323
+ } else if (width > 0 && height > 0) {
324
+ aspect = width / height;
325
+ }
326
+ return {
327
+ width,
328
+ height,
329
+ aspect
330
+ };
331
+ }
332
+ _resizeViewport() {
333
+ if (this.props.autoResizeViewport && this.device.gl) {
334
+ this.device.gl.viewport(0, 0, this.device.gl.drawingBufferWidth, this.device.gl.drawingBufferHeight);
335
+ }
336
+ }
337
+ _resizeCanvasDrawingBuffer() {
338
+ if (this.props.autoResizeDrawingBuffer) {
339
+ var _this$device5, _this$device5$canvasC;
340
+ (_this$device5 = this.device) === null || _this$device5 === void 0 ? void 0 : (_this$device5$canvasC = _this$device5.canvasContext) === null || _this$device5$canvasC === void 0 ? void 0 : _this$device5$canvasC.resize({
341
+ useDevicePixels: this.props.useDevicePixels
342
+ });
343
+ }
344
+ }
345
+ _beginTimers() {
346
+ this.frameRate.timeEnd();
347
+ this.frameRate.timeStart();
348
+ }
349
+ _endTimers() {
350
+ this.cpuTime.timeEnd();
351
+ }
352
+ _startEventHandling() {
353
+ if (this.canvas) {
354
+ this.canvas.addEventListener('mousemove', this._onMousemove);
355
+ this.canvas.addEventListener('mouseleave', this._onMouseleave);
356
+ }
357
+ }
358
+ _onMousemove(event) {
359
+ if (event instanceof MouseEvent) {
360
+ this._getAnimationProps()._mousePosition = [event.offsetX, event.offsetY];
361
+ }
362
+ }
363
+ _onMouseleave(event) {
364
+ this._getAnimationProps()._mousePosition = null;
365
+ }
366
+ }
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","concat","useDevicePixels","autoResizeViewport","autoResizeDrawingBuffer","AnimationLoop","constructor","props","_defineProperty","Error","id","cpuTime","gpuTime","frameRate","setProps","start","bind","stop","_onMousemove","_onMouseleave","destroy","_setDisplay","delete","setNeedsRedraw","reason","needsRedraw","_running","appContext","_initialized","_initDevice","_initialize","_getAnimationProps","_cancelAnimationFrame","_requestAnimationFrame","err","redraw","_this$device","isLost","_beginTimers","_setupFrame","_updateAnimationProps","_renderFrame","_clearNeedsRedraw","_resolveNextFrame","_nextFramePromise","_endTimers","animationProps","attachTimeline","timeline","detachTimeline","waitForRender","Promise","resolve","toDataURL","canvas","HTMLCanvasElement","_startEventHandling","_initializeAnimationProps","_resizeCanvasDrawingBuffer","_resizeViewport","display","animationLoop","_animationFrameId","_animationFrame","_this$device2","_this$device2$canvasC","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$device3$canvasC","_this$device4","_this$device4$canvasC","getPixelSize","clientHeight","clientWidth","gl","viewport","drawingBufferWidth","drawingBufferHeight","_this$device5","_this$device5$canvasC","resize","timeEnd","timeStart","addEventListener","event","MouseEvent","offsetX","offsetY"],"sources":["../../../src/animation-loop/animation-loop.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {luma, Device} from '@luma.gl/api';\nimport {requestAnimationFrame, cancelAnimationFrame} from '@luma.gl/api';\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 let {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._beginTimers();\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._endTimers();\n\n return this;\n }\n\n // Stops a render loop if already running, finalizing\n stop() {\n // console.debug(`Stopping ${this.constructor.name}`);\n if (this._running) {\n // 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.delete();\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 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 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 _beginTimers() {\n this.frameRate.timeEnd();\n this.frameRate.timeStart();\n\n // Check if timer for last frame has completed.\n // GPU timer results are never available in the same\n // frame they are captured.\n // if (\n // this._gpuTimeQuery &&\n // this._gpuTimeQuery.isResultAvailable() &&\n // !this._gpuTimeQuery.isTimerDisjoint()\n // ) {\n // this.stats.get('GPU Time').addTime(this._gpuTimeQuery.getTimerMilliseconds());\n // }\n\n // if (this._gpuTimeQuery) {\n // // GPU time query start\n // this._gpuTimeQuery.beginTimeElapsedQuery();\n // }\n\n // this.cpuTime.timeStart();\n }\n\n _endTimers() {\n this.cpuTime.timeEnd();\n\n // if (this._gpuTimeQuery) {\n // // GPU time query end. Results will be available on next frame.\n // this._gpuTimeQuery.end();\n // }\n }\n\n // Event handling\n\n _startEventHandling() {\n if (this.canvas) {\n this.canvas.addEventListener('mousemove', this._onMousemove);\n this.canvas.addEventListener('mouseleave', this._onMouseleave);\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":";AAEA,SAAQA,IAAI,QAAe,cAAc;AACzC,SAAQC,qBAAqB,EAAEC,oBAAoB,QAAO,cAAc;AAGxE,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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C3E;EACF;EAEAnG,aAAaA,CAACgG,KAAY,EAAE;IAC1B,IAAI,CAACpF,kBAAkB,EAAE,CAAC8C,cAAc,GAAG,IAAI;EACjD;AACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=animation-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation-props.js","names":[],"sources":["../../../src/animation-loop/animation-props.ts"],"sourcesContent":["import {Device} from '@luma.gl/api';\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,28 @@
1
+ import { luma } from '@luma.gl/api';
2
+ import { AnimationLoop } from './animation-loop';
3
+ export function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
4
+ let renderLoop = null;
5
+ const device = (props === null || props === void 0 ? void 0 : props.device) || luma.createDevice();
6
+ const animationLoop = new AnimationLoop({
7
+ ...props,
8
+ device,
9
+ async onInitialize(animationProps) {
10
+ var _renderLoop;
11
+ renderLoop = new AnimationLoopTemplateCtor(animationProps);
12
+ return await ((_renderLoop = renderLoop) === null || _renderLoop === void 0 ? void 0 : _renderLoop.onInitialize(animationProps));
13
+ },
14
+ onRender: animationProps => {
15
+ var _renderLoop2;
16
+ return (_renderLoop2 = renderLoop) === null || _renderLoop2 === void 0 ? void 0 : _renderLoop2.onRender(animationProps);
17
+ },
18
+ onFinalize: animationProps => {
19
+ var _renderLoop3;
20
+ return (_renderLoop3 = renderLoop) === null || _renderLoop3 === void 0 ? void 0 : _renderLoop3.onFinalize(animationProps);
21
+ }
22
+ });
23
+ animationLoop.getInfo = () => {
24
+ return this.AnimationLoopTemplateCtor.info;
25
+ };
26
+ return animationLoop;
27
+ }
28
+ //# sourceMappingURL=make-animation-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-animation-loop.js","names":["luma","AnimationLoop","makeAnimationLoop","AnimationLoopTemplateCtor","props","renderLoop","device","createDevice","animationLoop","onInitialize","animationProps","_renderLoop","onRender","_renderLoop2","onFinalize","_renderLoop3","getInfo","info"],"sources":["../../../src/animation-loop/make-animation-loop.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {luma} from '@luma.gl/api';\nimport {AnimationLoopTemplate} from './render-loop'\nimport {AnimationLoop, AnimationLoopProps} from './animation-loop'\nimport type {AnimationProps} from './animation-props';\n\nexport type MakeAnimationLoopProps = Omit<AnimationLoopProps, 'onCreateDevice' | 'onInitialize' | 'onRedraw' | 'onFinalize'>;\n\n/** Instantiates and runs the render loop */\nexport function makeAnimationLoop(AnimationLoopTemplateCtor: typeof AnimationLoopTemplate, props?: MakeAnimationLoopProps): AnimationLoop {\n let renderLoop: AnimationLoopTemplate | null = null;\n\n const device = props?.device || luma.createDevice();\n\n // Create an animation loop;\n const animationLoop = new AnimationLoop({\n ... props,\n\n device,\n\n async onInitialize(animationProps: AnimationProps): Promise<unknown> {\n // @ts-expect-error abstract to prevent instantiation\n renderLoop = new AnimationLoopTemplateCtor(animationProps);\n // Any async loading can be handled here\n return await renderLoop?.onInitialize(animationProps);\n },\n\n onRender: (animationProps: AnimationProps) => renderLoop?.onRender(animationProps),\n \n onFinalize: (animationProps: AnimationProps) => renderLoop?.onFinalize(animationProps)\n });\n\n // @ts-expect-error Hack: adds info for the website to find\n animationLoop.getInfo = () => {\n // @ts-ignore\n return this.AnimationLoopTemplateCtor.info;\n }\n\n // Start the loop automatically\n // animationLoop.start();\n\n return animationLoop;\n}\n"],"mappings":"AACA,SAAQA,IAAI,QAAO,cAAc;AAEjC,SAAQC,aAAa,QAA2B,kBAAkB;AAMlE,OAAO,SAASC,iBAAiBA,CAACC,yBAAuD,EAAEC,KAA8B,EAAiB;EACxI,IAAIC,UAAwC,GAAG,IAAI;EAEnD,MAAMC,MAAM,GAAG,CAAAF,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEE,MAAM,KAAIN,IAAI,CAACO,YAAY,EAAE;EAGnD,MAAMC,aAAa,GAAG,IAAIP,aAAa,CAAC;IACtC,GAAIG,KAAK;IAETE,MAAM;IAEN,MAAMG,YAAYA,CAACC,cAA8B,EAAoB;MAAA,IAAAC,WAAA;MAEnEN,UAAU,GAAG,IAAIF,yBAAyB,CAACO,cAAc,CAAC;MAE1D,OAAO,QAAAC,WAAA,GAAMN,UAAU,cAAAM,WAAA,uBAAVA,WAAA,CAAYF,YAAY,CAACC,cAAc,CAAC;IACvD,CAAC;IAEDE,QAAQ,EAAGF,cAA8B;MAAA,IAAAG,YAAA;MAAA,QAAAA,YAAA,GAAKR,UAAU,cAAAQ,YAAA,uBAAVA,YAAA,CAAYD,QAAQ,CAACF,cAAc,CAAC;IAAA;IAElFI,UAAU,EAAGJ,cAA8B;MAAA,IAAAK,YAAA;MAAA,QAAAA,YAAA,GAAKV,UAAU,cAAAU,YAAA,uBAAVA,YAAA,CAAYD,UAAU,CAACJ,cAAc,CAAC;IAAA;EACxF,CAAC,CAAC;EAGFF,aAAa,CAACQ,OAAO,GAAG,MAAM;IAE5B,OAAO,IAAI,CAACb,yBAAyB,CAACc,IAAI;EAC5C,CAAC;EAKD,OAAOT,aAAa;AACtB"}
@@ -0,0 +1,7 @@
1
+ export class AnimationLoopTemplate {
2
+ constructor(animationProps) {}
3
+ async onInitialize(animationProps) {
4
+ return null;
5
+ }
6
+ }
7
+ //# sourceMappingURL=render-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-loop.js","names":["AnimationLoopTemplate","constructor","animationProps","onInitialize"],"sources":["../../../src/animation-loop/render-loop.ts"],"sourcesContent":["import type {AnimationProps} from './animation-props';\n\n/**\n * Minimal class that represents a \"componentized\" rendering life cycle\n * (resource construction, repeated rendering, resource destruction)\n * \n * @note A motivation for this class compared to the raw animation loop is \n * that it simplifies TypeScript code by allowing resources to be typed unconditionally \n * since they are allocated in the constructor rather than in onInitialized\n * \n * @note Introduced in luma.gl v9\n * \n * @example AnimationLoopTemplate is intended to be subclassed, \n * but the subclass should not be instantiated directly. Instead the subclass\n * (i.e. the constructor of the subclass) should be used \n * as an argument to create an AnimationLoop.\n */\nexport abstract class AnimationLoopTemplate {\n constructor(animationProps?: AnimationProps) {}\n async onInitialize(animationProps: AnimationProps): Promise<unknown> { return null; }\n abstract onRender(animationProps: AnimationProps): unknown;\n abstract onFinalize(animationProps: AnimationProps): void;\n}\n"],"mappings":"AAiBA,OAAO,MAAeA,qBAAqB,CAAC;EAC1CC,WAAWA,CAACC,cAA+B,EAAE,CAAC;EAC9C,MAAMC,YAAYA,CAACD,cAA8B,EAAoB;IAAE,OAAO,IAAI;EAAE;AAGtF"}
@@ -0,0 +1,4 @@
1
+ const moduleExports = require('./index');
2
+ globalThis.luma = globalThis.luma || {};
3
+ module.exports = Object.assign(globalThis.luma, moduleExports);
4
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,IAAI,GAAGD,UAAU,CAACC,IAAI,IAAI,CAAC,CAAC;AACvCC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,IAAI,EAAEH,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { uid } from '@luma.gl/api';
2
+ import { TruncatedConeGeometry } from './truncated-cone-geometry';
3
+ export class ConeGeometry extends TruncatedConeGeometry {
4
+ constructor() {
5
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const {
7
+ id = uid('cone-geometry'),
8
+ radius = 1,
9
+ cap = true
10
+ } = props;
11
+ super({
12
+ ...props,
13
+ id,
14
+ topRadius: 0,
15
+ topCap: Boolean(cap),
16
+ bottomCap: Boolean(cap),
17
+ bottomRadius: radius
18
+ });
19
+ }
20
+ }
21
+ //# sourceMappingURL=cone-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cone-geometry.js","names":["uid","TruncatedConeGeometry","ConeGeometry","constructor","props","arguments","length","undefined","id","radius","cap","topRadius","topCap","Boolean","bottomCap","bottomRadius"],"sources":["../../../src/geometries/cone-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/api';\nimport {TruncatedConeGeometry} from './truncated-cone-geometry';\n\nexport type ConeGeometryProps = {\n id?: string;\n radius?: number;\n cap?: boolean;\n};\n\nexport class ConeGeometry extends TruncatedConeGeometry {\n constructor(props: ConeGeometryProps = {}) {\n const {id = uid('cone-geometry'), radius = 1, cap = true} = props;\n super({\n ...props,\n id,\n topRadius: 0,\n topCap: Boolean(cap),\n bottomCap: Boolean(cap),\n bottomRadius: radius\n });\n }\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,cAAc;AAChC,SAAQC,qBAAqB,QAAO,2BAA2B;AAQ/D,OAAO,MAAMC,YAAY,SAASD,qBAAqB,CAAC;EACtDE,WAAWA,CAAA,EAAgC;IAAA,IAA/BC,KAAwB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACvC,MAAM;MAACG,EAAE,GAAGR,GAAG,CAAC,eAAe,CAAC;MAAES,MAAM,GAAG,CAAC;MAAEC,GAAG,GAAG;IAAI,CAAC,GAAGN,KAAK;IACjE,KAAK,CAAC;MACJ,GAAGA,KAAK;MACRI,EAAE;MACFG,SAAS,EAAE,CAAC;MACZC,MAAM,EAAEC,OAAO,CAACH,GAAG,CAAC;MACpBI,SAAS,EAAED,OAAO,CAACH,GAAG,CAAC;MACvBK,YAAY,EAAEN;IAChB,CAAC,CAAC;EACJ;AACF"}
@@ -0,0 +1,67 @@
1
+ import { uid } from '@luma.gl/api';
2
+ import Geometry from '../geometry/geometry';
3
+ export class CubeGeometry extends Geometry {
4
+ constructor() {
5
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const {
7
+ id = uid('cube-geometry'),
8
+ indices = true
9
+ } = props;
10
+ super(indices ? {
11
+ ...props,
12
+ id,
13
+ indices: {
14
+ size: 1,
15
+ value: CUBE_INDICES
16
+ },
17
+ attributes: {
18
+ ...ATTRIBUTES,
19
+ ...props.attributes
20
+ }
21
+ } : {
22
+ ...props,
23
+ id,
24
+ indices: undefined,
25
+ attributes: {
26
+ ...NON_INDEXED_ATTRIBUTES,
27
+ ...props.attributes
28
+ }
29
+ });
30
+ }
31
+ }
32
+ const CUBE_INDICES = new Uint16Array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23]);
33
+ const CUBE_POSITIONS = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1]);
34
+ const CUBE_NORMALS = new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0]);
35
+ const CUBE_TEX_COORDS = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1]);
36
+ export const CUBE_NON_INDEXED_POSITIONS = new Float32Array([1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1]);
37
+ export const CUBE_NON_INDEXED_TEX_COORDS = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0]);
38
+ export const CUBE_NON_INDEXED_COLORS = new Float32Array([1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1]);
39
+ const ATTRIBUTES = {
40
+ POSITION: {
41
+ size: 3,
42
+ value: CUBE_POSITIONS
43
+ },
44
+ NORMAL: {
45
+ size: 3,
46
+ value: CUBE_NORMALS
47
+ },
48
+ TEXCOORD_0: {
49
+ size: 2,
50
+ value: CUBE_TEX_COORDS
51
+ }
52
+ };
53
+ const NON_INDEXED_ATTRIBUTES = {
54
+ POSITION: {
55
+ size: 4,
56
+ value: CUBE_NON_INDEXED_POSITIONS
57
+ },
58
+ TEXCOORD_0: {
59
+ size: 2,
60
+ value: CUBE_NON_INDEXED_TEX_COORDS
61
+ },
62
+ COLOR_0: {
63
+ size: 3,
64
+ value: CUBE_NON_INDEXED_COLORS
65
+ }
66
+ };
67
+ //# sourceMappingURL=cube-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cube-geometry.js","names":["uid","Geometry","CubeGeometry","constructor","props","arguments","length","undefined","id","indices","size","value","CUBE_INDICES","attributes","ATTRIBUTES","NON_INDEXED_ATTRIBUTES","Uint16Array","CUBE_POSITIONS","Float32Array","CUBE_NORMALS","CUBE_TEX_COORDS","CUBE_NON_INDEXED_POSITIONS","CUBE_NON_INDEXED_TEX_COORDS","CUBE_NON_INDEXED_COLORS","POSITION","NORMAL","TEXCOORD_0","COLOR_0"],"sources":["../../../src/geometries/cube-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/api';\nimport Geometry from '../geometry/geometry';\n// import type {GeometryType} from '../geometry/geometry-type';\n\nexport type CubeGeometryProps = {\n id?: string;\n indices?: boolean;\n attributes?: any;\n};\n\nexport class CubeGeometry extends Geometry {\n constructor(props: CubeGeometryProps = {}) {\n const {id = uid('cube-geometry'), indices = true} = props;\n super(indices ? {\n ...props,\n id,\n indices: {size: 1, value: CUBE_INDICES},\n attributes: {...ATTRIBUTES, ...props.attributes}\n } : {\n ...props,\n id,\n indices: undefined,\n attributes: {...NON_INDEXED_ATTRIBUTES, ...props.attributes}\n });\n }\n}\n\n// prettier-ignore\nconst CUBE_INDICES = new Uint16Array([\n 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13,\n 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23\n]);\n\n// prettier-ignore\nconst CUBE_POSITIONS = new Float32Array([\n -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1,\n -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1,\n -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1,\n -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1,\n 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1,\n -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1\n]);\n\n// TODO - could be Uint8\n// prettier-ignore\nconst CUBE_NORMALS = new Float32Array([\n // Front face\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,\n // Back face\n 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1,\n // Top face\n 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,\n // Bottom face\n 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0,\n // Right face\n 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,\n // Left face\n -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0\n]);\n\n// prettier-ignore\nconst CUBE_TEX_COORDS = new Float32Array([\n // Front face\n 0, 0, 1, 0, 1, 1, 0, 1,\n // Back face\n 1, 0, 1, 1, 0, 1, 0, 0,\n // Top face\n 0, 1, 0, 0, 1, 0, 1, 1,\n // Bottom face\n 1, 1, 0, 1, 0, 0, 1, 0,\n // Right face\n 1, 0, 1, 1, 0, 1, 0, 0,\n // Left face\n 0, 0, 1, 0, 1, 1, 0, 1\n]);\n\n// float4 position\n// prettier-ignore\nexport const CUBE_NON_INDEXED_POSITIONS = new Float32Array([\n 1, -1, 1, 1,\n -1, -1, 1, 1,\n -1, -1, -1, 1,\n 1, -1, -1, 1,\n 1, -1, 1, 1,\n -1, -1, -1, 1,\n\n 1, 1, 1, 1,\n 1, -1, 1, 1,\n 1, -1, -1, 1,\n 1, 1, -1, 1,\n 1, 1, 1, 1,\n 1, -1, -1, 1,\n\n -1, 1, 1, 1,\n 1, 1, 1, 1,\n 1, 1, -1, 1,\n -1, 1, -1, 1,\n -1, 1, 1, 1,\n 1, 1, -1, 1,\n\n -1, -1, 1, 1,\n -1, 1, 1, 1,\n -1, 1, -1, 1,\n -1, -1, -1, 1,\n -1, -1, 1, 1,\n -1, 1, -1, 1,\n\n 1, 1, 1, 1,\n -1, 1, 1, 1,\n -1, -1, 1, 1,\n -1, -1, 1, 1,\n 1, -1, 1, 1,\n 1, 1, 1, 1,\n\n 1, -1, -1, 1,\n -1, -1, -1, 1,\n -1, 1, -1, 1,\n 1, 1, -1, 1,\n 1, -1, -1, 1,\n -1, 1, -1, 1,\n]);\n\n// float2 uv,\n// prettier-ignore\nexport const CUBE_NON_INDEXED_TEX_COORDS = new Float32Array([\n 1, 1,\n 0, 1,\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 0,\n\n 1, 1,\n 0, 1,\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 0,\n\n 1, 1,\n 0, 1,\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 0,\n\n 1, 1,\n 0, 1,\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 0,\n\n 1, 1,\n 0, 1,\n 0, 0,\n 0, 0,\n 1, 0,\n 1, 1,\n\n 1, 1,\n 0, 1,\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 0,\n]);\n\n// float4 color\n// prettier-ignore\nexport const CUBE_NON_INDEXED_COLORS = new Float32Array([\n 1, 0, 1, 1,\n 0, 0, 1, 1,\n 0, 0, 0, 1,\n 1, 0, 0, 1,\n 1, 0, 1, 1,\n 0, 0, 0, 1,\n\n 1, 1, 1, 1,\n 1, 0, 1, 1,\n 1, 0, 0, 1,\n 1, 1, 0, 1,\n 1, 1, 1, 1,\n 1, 0, 0, 1,\n\n 0, 1, 1, 1,\n 1, 1, 1, 1,\n 1, 1, 0, 1,\n 0, 1, 0, 1,\n 0, 1, 1, 1,\n 1, 1, 0, 1,\n\n 0, 0, 1, 1,\n 0, 1, 1, 1,\n 0, 1, 0, 1,\n 0, 0, 0, 1,\n 0, 0, 1, 1,\n 0, 1, 0, 1,\n\n 1, 1, 1, 1,\n 0, 1, 1, 1,\n 0, 0, 1, 1,\n 0, 0, 1, 1,\n 1, 0, 1, 1,\n 1, 1, 1, 1,\n\n 1, 0, 0, 1,\n 0, 0, 0, 1,\n 0, 1, 0, 1,\n 1, 1, 0, 1,\n 1, 0, 0, 1,\n 0, 1, 0, 1,\n]);\n\nconst ATTRIBUTES = {\n POSITION: {size: 3, value: CUBE_POSITIONS},\n NORMAL: {size: 3, value: CUBE_NORMALS},\n TEXCOORD_0: {size: 2, value: CUBE_TEX_COORDS}\n};\n\nconst NON_INDEXED_ATTRIBUTES = {\n POSITION: {size: 4, value: CUBE_NON_INDEXED_POSITIONS},\n // NORMAL: {size: 3, value: CUBE_NON_INDEXED_NORMALS},\n TEXCOORD_0: {size: 2, value: CUBE_NON_INDEXED_TEX_COORDS},\n COLOR_0: {size: 3, value: CUBE_NON_INDEXED_COLORS}\n};\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,cAAc;AAChC,OAAOC,QAAQ,MAAM,sBAAsB;AAS3C,OAAO,MAAMC,YAAY,SAASD,QAAQ,CAAC;EACzCE,WAAWA,CAAA,EAAgC;IAAA,IAA/BC,KAAwB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACvC,MAAM;MAACG,EAAE,GAAGR,GAAG,CAAC,eAAe,CAAC;MAAES,OAAO,GAAG;IAAI,CAAC,GAAGL,KAAK;IACzD,KAAK,CAACK,OAAO,GAAG;MACd,GAAGL,KAAK;MACRI,EAAE;MACFC,OAAO,EAAE;QAACC,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAEC;MAAY,CAAC;MACvCC,UAAU,EAAE;QAAC,GAAGC,UAAU;QAAE,GAAGV,KAAK,CAACS;MAAU;IACjD,CAAC,GAAG;MACF,GAAGT,KAAK;MACRI,EAAE;MACFC,OAAO,EAAEF,SAAS;MAClBM,UAAU,EAAE;QAAC,GAAGE,sBAAsB;QAAE,GAAGX,KAAK,CAACS;MAAU;IAC7D,CAAC,CAAC;EACJ;AACF;AAGA,MAAMD,YAAY,GAAG,IAAII,WAAW,CAAC,CACnC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC/D,EAAE,EAAE,EAAE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E,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAEV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CACX,CAAC;AAEF,MAAMJ,UAAU,GAAG;EACjBU,QAAQ,EAAE;IAACd,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAEM;EAAc,CAAC;EAC1CQ,MAAM,EAAE;IAACf,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAEQ;EAAY,CAAC;EACtCO,UAAU,EAAE;IAAChB,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAES;EAAe;AAC9C,CAAC;AAED,MAAML,sBAAsB,GAAG;EAC7BS,QAAQ,EAAE;IAACd,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAEU;EAA0B,CAAC;EAEtDK,UAAU,EAAE;IAAChB,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAEW;EAA2B,CAAC;EACzDK,OAAO,EAAE;IAACjB,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAEY;EAAuB;AACnD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { uid } from '@luma.gl/api';
2
+ import { TruncatedConeGeometry } from './truncated-cone-geometry';
3
+ export class CylinderGeometry extends TruncatedConeGeometry {
4
+ constructor() {
5
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const {
7
+ id = uid('cylinder-geometry'),
8
+ radius = 1
9
+ } = props;
10
+ super({
11
+ ...props,
12
+ id,
13
+ bottomRadius: radius,
14
+ topRadius: radius
15
+ });
16
+ }
17
+ }
18
+ //# sourceMappingURL=cylinder-geometry.js.map