@luma.gl/engine 9.4.0-alpha.3 → 9.4.0-beta.1

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 (255) hide show
  1. package/LICENSE +5 -1
  2. package/dist/animation/animation-clip.d.ts +18 -0
  3. package/dist/animation/animation-clip.d.ts.map +1 -0
  4. package/dist/animation/animation-clip.js +15 -0
  5. package/dist/animation/animation-clip.js.map +1 -0
  6. package/dist/animation/animation-interpolation.d.ts +18 -0
  7. package/dist/animation/animation-interpolation.d.ts.map +1 -0
  8. package/dist/animation/animation-interpolation.js +101 -0
  9. package/dist/animation/animation-interpolation.js.map +1 -0
  10. package/dist/animation/animation-mixer.d.ts +88 -0
  11. package/dist/animation/animation-mixer.d.ts.map +1 -0
  12. package/dist/animation/animation-mixer.js +287 -0
  13. package/dist/animation/animation-mixer.js.map +1 -0
  14. package/dist/animation/animation-track.d.ts +42 -0
  15. package/dist/animation/animation-track.d.ts.map +1 -0
  16. package/dist/animation/animation-track.js +34 -0
  17. package/dist/animation/animation-track.js.map +1 -0
  18. package/dist/animation/animator.js +1 -1
  19. package/dist/animation/animator.js.map +1 -1
  20. package/dist/animation/key-frames.js +1 -1
  21. package/dist/animation/key-frames.js.map +1 -1
  22. package/dist/animation/morph-targets.d.ts +15 -0
  23. package/dist/animation/morph-targets.d.ts.map +1 -0
  24. package/dist/animation/morph-targets.js +151 -0
  25. package/dist/animation/morph-targets.js.map +1 -0
  26. package/dist/animation/skin.d.ts +18 -0
  27. package/dist/animation/skin.d.ts.map +1 -0
  28. package/dist/animation/skin.js +30 -0
  29. package/dist/animation/skin.js.map +1 -0
  30. package/dist/animation/timeline.js +1 -1
  31. package/dist/animation/timeline.js.map +1 -1
  32. package/dist/animation-loop/animation-loop-template.js +1 -1
  33. package/dist/animation-loop/animation-loop-template.js.map +1 -1
  34. package/dist/animation-loop/animation-loop.d.ts +5 -4
  35. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  36. package/dist/animation-loop/animation-loop.js +3 -3
  37. package/dist/animation-loop/animation-loop.js.map +1 -1
  38. package/dist/animation-loop/animation-props.d.ts +1 -1
  39. package/dist/animation-loop/animation-props.js +1 -1
  40. package/dist/animation-loop/animation-props.js.map +1 -1
  41. package/dist/animation-loop/make-animation-loop.d.ts +9 -1
  42. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  43. package/dist/animation-loop/make-animation-loop.js +24 -5
  44. package/dist/animation-loop/make-animation-loop.js.map +1 -1
  45. package/dist/animation-loop/request-animation-frame.js +1 -1
  46. package/dist/animation-loop/request-animation-frame.js.map +1 -1
  47. package/dist/application-utils/load-file.js +1 -1
  48. package/dist/application-utils/load-file.js.map +1 -1
  49. package/dist/application-utils/random.js +1 -1
  50. package/dist/application-utils/random.js.map +1 -1
  51. package/dist/compute/buffer-transform.d.ts +1 -1
  52. package/dist/compute/buffer-transform.d.ts.map +1 -1
  53. package/dist/compute/buffer-transform.js +1 -1
  54. package/dist/compute/buffer-transform.js.map +1 -1
  55. package/dist/compute/computation.d.ts +4 -1
  56. package/dist/compute/computation.d.ts.map +1 -1
  57. package/dist/compute/computation.js +34 -15
  58. package/dist/compute/computation.js.map +1 -1
  59. package/dist/compute/swap.js +1 -1
  60. package/dist/compute/swap.js.map +1 -1
  61. package/dist/compute/texture-transform.js +1 -1
  62. package/dist/compute/texture-transform.js.map +1 -1
  63. package/dist/controls/orbit-controls.d.ts +61 -0
  64. package/dist/controls/orbit-controls.d.ts.map +1 -0
  65. package/dist/controls/orbit-controls.js +179 -0
  66. package/dist/controls/orbit-controls.js.map +1 -0
  67. package/dist/debug/copy-texture-to-image.js +1 -1
  68. package/dist/debug/copy-texture-to-image.js.map +1 -1
  69. package/dist/debug/debug-framebuffer.js +1 -1
  70. package/dist/debug/debug-framebuffer.js.map +1 -1
  71. package/dist/debug/debug-shader-layout.js +1 -1
  72. package/dist/debug/debug-shader-layout.js.map +1 -1
  73. package/dist/debug/pixel-data-utils.js +1 -1
  74. package/dist/debug/pixel-data-utils.js.map +1 -1
  75. package/dist/dist.dev.js +7605 -6249
  76. package/dist/dist.min.js +31 -31
  77. package/dist/dynamic-buffer/dynamic-buffer.js +1 -1
  78. package/dist/dynamic-buffer/dynamic-buffer.js.map +1 -1
  79. package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
  80. package/dist/dynamic-texture/dynamic-texture.js +3 -2
  81. package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
  82. package/dist/dynamic-texture/texture-binding-source.js +1 -1
  83. package/dist/dynamic-texture/texture-binding-source.js.map +1 -1
  84. package/dist/dynamic-texture/texture-data.js +1 -1
  85. package/dist/dynamic-texture/texture-data.js.map +1 -1
  86. package/dist/dynamic-texture/video-texture.js +1 -1
  87. package/dist/dynamic-texture/video-texture.js.map +1 -1
  88. package/dist/geometries/cone-geometry.js +1 -1
  89. package/dist/geometries/cone-geometry.js.map +1 -1
  90. package/dist/geometries/cube-geometry.js +1 -1
  91. package/dist/geometries/cube-geometry.js.map +1 -1
  92. package/dist/geometries/cylinder-geometry.js +1 -1
  93. package/dist/geometries/cylinder-geometry.js.map +1 -1
  94. package/dist/geometries/ico-sphere-geometry.js +1 -1
  95. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  96. package/dist/geometry/geometry-table.js +1 -1
  97. package/dist/geometry/geometry-table.js.map +1 -1
  98. package/dist/geometry/geometry-utils.js +1 -1
  99. package/dist/geometry/geometry-utils.js.map +1 -1
  100. package/dist/geometry/geometry.js +1 -1
  101. package/dist/geometry/geometry.js.map +1 -1
  102. package/dist/geometry/gpu-geometry.js +1 -1
  103. package/dist/geometry/gpu-geometry.js.map +1 -1
  104. package/dist/geometry/mesh-simplification.d.ts +29 -0
  105. package/dist/geometry/mesh-simplification.d.ts.map +1 -0
  106. package/dist/geometry/mesh-simplification.js +402 -0
  107. package/dist/geometry/mesh-simplification.js.map +1 -0
  108. package/dist/index.cjs +9874 -1407
  109. package/dist/index.cjs.map +3 -4
  110. package/dist/index.d.ts +17 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +9 -1
  113. package/dist/index.js.map +1 -1
  114. package/dist/material/material-factory.js +1 -1
  115. package/dist/material/material-factory.js.map +1 -1
  116. package/dist/material/material.js +1 -1
  117. package/dist/material/material.js.map +1 -1
  118. package/dist/model/model.d.ts +1 -1
  119. package/dist/model/model.d.ts.map +1 -1
  120. package/dist/model/model.js +35 -10
  121. package/dist/model/model.js.map +1 -1
  122. package/dist/model/split-uniforms-and-bindings.js +1 -1
  123. package/dist/model/split-uniforms-and-bindings.js.map +1 -1
  124. package/dist/models/billboard-texture-model.js +1 -1
  125. package/dist/models/billboard-texture-model.js.map +1 -1
  126. package/dist/models/billboard-texture-module.js +1 -1
  127. package/dist/models/billboard-texture-module.js.map +1 -1
  128. package/dist/models/clip-space.js +1 -1
  129. package/dist/models/clip-space.js.map +1 -1
  130. package/dist/models/directional-light-model.js +1 -1
  131. package/dist/models/directional-light-model.js.map +1 -1
  132. package/dist/models/light-model-utils.js +1 -1
  133. package/dist/models/light-model-utils.js.map +1 -1
  134. package/dist/models/point-light-model.js +1 -1
  135. package/dist/models/point-light-model.js.map +1 -1
  136. package/dist/models/spot-light-model.js +1 -1
  137. package/dist/models/spot-light-model.js.map +1 -1
  138. package/dist/modules/picking/color-picking.js +1 -1
  139. package/dist/modules/picking/color-picking.js.map +1 -1
  140. package/dist/modules/picking/index-color-picking.js +1 -1
  141. package/dist/modules/picking/index-color-picking.js.map +1 -1
  142. package/dist/modules/picking/index-picking.js +1 -1
  143. package/dist/modules/picking/index-picking.js.map +1 -1
  144. package/dist/modules/picking/legacy-color-picking.js +1 -1
  145. package/dist/modules/picking/legacy-color-picking.js.map +1 -1
  146. package/dist/modules/picking/legacy-picking-manager.js +1 -1
  147. package/dist/modules/picking/legacy-picking-manager.js.map +1 -1
  148. package/dist/modules/picking/picking-manager.js +1 -1
  149. package/dist/modules/picking/picking-manager.js.map +1 -1
  150. package/dist/modules/picking/picking-uniforms.js +1 -1
  151. package/dist/modules/picking/picking-uniforms.js.map +1 -1
  152. package/dist/modules/picking/picking.js +1 -1
  153. package/dist/modules/picking/picking.js.map +1 -1
  154. package/dist/passes/get-fragment-shader.js +1 -1
  155. package/dist/passes/get-fragment-shader.js.map +1 -1
  156. package/dist/passes/shader-pass-renderer.d.ts +19 -1
  157. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  158. package/dist/passes/shader-pass-renderer.js +180 -11
  159. package/dist/passes/shader-pass-renderer.js.map +1 -1
  160. package/dist/passes/texture-transform-module.js +1 -1
  161. package/dist/passes/texture-transform-module.js.map +1 -1
  162. package/dist/scenegraph/group-node.d.ts.map +1 -1
  163. package/dist/scenegraph/group-node.js +7 -1
  164. package/dist/scenegraph/group-node.js.map +1 -1
  165. package/dist/scenegraph/model-node.js +1 -1
  166. package/dist/scenegraph/model-node.js.map +1 -1
  167. package/dist/scenegraph/scenegraph-bounds.js +1 -1
  168. package/dist/scenegraph/scenegraph-bounds.js.map +1 -1
  169. package/dist/scenegraph/scenegraph-node.js +4 -4
  170. package/dist/scenegraph/scenegraph-node.js.map +1 -1
  171. package/dist/shader-inputs.js +1 -1
  172. package/dist/shader-inputs.js.map +1 -1
  173. package/dist/utils/buffer-layout-helper.js +1 -1
  174. package/dist/utils/buffer-layout-helper.js.map +1 -1
  175. package/dist/utils/buffer-layout-order.js +1 -1
  176. package/dist/utils/buffer-layout-order.js.map +1 -1
  177. package/dist/utils/deep-equal.js +1 -1
  178. package/dist/utils/deep-equal.js.map +1 -1
  179. package/dist/utils/shader-module-utils.js +1 -1
  180. package/dist/utils/shader-module-utils.js.map +1 -1
  181. package/dist/utils/uid.js +1 -1
  182. package/dist/utils/uid.js.map +1 -1
  183. package/package.json +2 -2
  184. package/src/animation/animation-clip.ts +28 -0
  185. package/src/animation/animation-interpolation.ts +175 -0
  186. package/src/animation/animation-mixer.ts +370 -0
  187. package/src/animation/animation-track.ts +70 -0
  188. package/src/animation/animator.ts +1 -1
  189. package/src/animation/key-frames.ts +1 -1
  190. package/src/animation/morph-targets.ts +191 -0
  191. package/src/animation/skin.ts +50 -0
  192. package/src/animation/timeline.ts +1 -1
  193. package/src/animation-loop/animation-loop-template.ts +1 -1
  194. package/src/animation-loop/animation-loop.ts +8 -7
  195. package/src/animation-loop/animation-props.ts +2 -2
  196. package/src/animation-loop/make-animation-loop.ts +36 -6
  197. package/src/animation-loop/request-animation-frame.ts +1 -1
  198. package/src/application-utils/load-file.ts +1 -1
  199. package/src/application-utils/random.ts +1 -1
  200. package/src/compute/buffer-transform.ts +2 -2
  201. package/src/compute/computation.ts +47 -20
  202. package/src/compute/swap.ts +1 -1
  203. package/src/compute/texture-transform.ts +1 -1
  204. package/src/controls/orbit-controls.ts +248 -0
  205. package/src/debug/copy-texture-to-image.ts +1 -1
  206. package/src/debug/debug-framebuffer.ts +1 -1
  207. package/src/debug/debug-shader-layout.ts +1 -1
  208. package/src/debug/pixel-data-utils.ts +1 -1
  209. package/src/dynamic-buffer/dynamic-buffer.ts +1 -1
  210. package/src/dynamic-texture/dynamic-texture.ts +3 -2
  211. package/src/dynamic-texture/texture-binding-source.ts +1 -1
  212. package/src/dynamic-texture/texture-data.ts +1 -1
  213. package/src/dynamic-texture/video-texture.ts +1 -1
  214. package/src/geometries/cone-geometry.ts +1 -1
  215. package/src/geometries/cube-geometry.ts +1 -1
  216. package/src/geometries/cylinder-geometry.ts +1 -1
  217. package/src/geometries/ico-sphere-geometry.ts +1 -1
  218. package/src/geometry/geometry-table.ts +1 -1
  219. package/src/geometry/geometry-utils.ts +1 -1
  220. package/src/geometry/geometry.ts +1 -1
  221. package/src/geometry/gpu-geometry.ts +1 -1
  222. package/src/geometry/mesh-simplification.ts +554 -0
  223. package/src/index.ts +32 -1
  224. package/src/material/material-factory.ts +1 -1
  225. package/src/material/material.ts +1 -1
  226. package/src/model/model.ts +67 -12
  227. package/src/model/split-uniforms-and-bindings.ts +1 -1
  228. package/src/models/billboard-texture-model.ts +1 -1
  229. package/src/models/billboard-texture-module.ts +1 -1
  230. package/src/models/clip-space.ts +1 -1
  231. package/src/models/directional-light-model.ts +1 -1
  232. package/src/models/light-model-utils.ts +1 -1
  233. package/src/models/point-light-model.ts +1 -1
  234. package/src/models/spot-light-model.ts +1 -1
  235. package/src/modules/picking/color-picking.ts +1 -1
  236. package/src/modules/picking/index-color-picking.ts +1 -1
  237. package/src/modules/picking/index-picking.ts +1 -1
  238. package/src/modules/picking/legacy-color-picking.ts +1 -1
  239. package/src/modules/picking/legacy-picking-manager.ts +1 -1
  240. package/src/modules/picking/picking-manager.ts +1 -1
  241. package/src/modules/picking/picking-uniforms.ts +1 -1
  242. package/src/modules/picking/picking.ts +1 -1
  243. package/src/passes/get-fragment-shader.ts +1 -1
  244. package/src/passes/shader-pass-renderer.ts +246 -14
  245. package/src/passes/texture-transform-module.ts +1 -1
  246. package/src/scenegraph/group-node.ts +8 -1
  247. package/src/scenegraph/model-node.ts +1 -1
  248. package/src/scenegraph/scenegraph-bounds.ts +1 -1
  249. package/src/scenegraph/scenegraph-node.ts +4 -4
  250. package/src/shader-inputs.ts +1 -1
  251. package/src/utils/buffer-layout-helper.ts +1 -1
  252. package/src/utils/buffer-layout-order.ts +1 -1
  253. package/src/utils/deep-equal.ts +1 -1
  254. package/src/utils/shader-module-utils.ts +1 -1
  255. package/src/utils/uid.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {BufferProps, FramebufferProps} from '@luma.gl/core';
6
6
  import {Device, Resource, Buffer, Framebuffer, Texture} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {Buffer, Device, Framebuffer, RenderPassProps, Sampler, Texture} from '@luma.gl/core';
6
6
  import {getPassthroughFS} from '@luma.gl/shadertools';
@@ -0,0 +1,248 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ export type OrbitPosition = [number, number, number];
6
+
7
+ export type OrbitControlsProps = {
8
+ target?: Readonly<OrbitPosition>;
9
+ distance?: number;
10
+ yaw?: number;
11
+ pitch?: number;
12
+ minDistance?: number;
13
+ maxDistance?: number;
14
+ minPitch?: number;
15
+ maxPitch?: number;
16
+ rotateSpeed?: number;
17
+ pitchSpeed?: number;
18
+ zoomSpeed?: number;
19
+ enabled?: boolean;
20
+ enableZoom?: boolean;
21
+ enablePan?: boolean;
22
+ panSpeed?: number;
23
+ autoRotate?: boolean;
24
+ autoRotateSpeed?: number;
25
+ onInteractionStart?: () => void;
26
+ };
27
+
28
+ type ResolvedOrbitControlsProps = Required<
29
+ Omit<OrbitControlsProps, 'pitchSpeed' | 'onInteractionStart'>
30
+ > &
31
+ Pick<OrbitControlsProps, 'pitchSpeed' | 'onInteractionStart'>;
32
+
33
+ const DEFAULT_PROPS: ResolvedOrbitControlsProps = {
34
+ target: [0, 0, 0],
35
+ distance: 10,
36
+ yaw: 0,
37
+ pitch: 0.25,
38
+ minDistance: 1,
39
+ maxDistance: 100,
40
+ minPitch: -Math.PI / 2 + 0.01,
41
+ maxPitch: Math.PI / 2 - 0.01,
42
+ rotateSpeed: 0.006,
43
+ zoomSpeed: 0.001,
44
+ enabled: true,
45
+ enableZoom: true,
46
+ enablePan: false,
47
+ panSpeed: 0.0018,
48
+ autoRotate: false,
49
+ autoRotateSpeed: 0.1
50
+ };
51
+
52
+ /**
53
+ * Pointer orbit, wheel zoom, and optional automatic rotation controls for an HTML canvas.
54
+ *
55
+ * Call {@link update} once per frame with an animation-loop timestamp in milliseconds before
56
+ * reading {@link getEyePosition}. Manual dragging temporarily pauses automatic rotation and
57
+ * resumes it from the new angle when the pointer is released.
58
+ */
59
+ export class OrbitControls {
60
+ readonly canvas: HTMLCanvasElement;
61
+ readonly props: ResolvedOrbitControlsProps;
62
+ yaw: number;
63
+ pitch: number;
64
+ distance: number;
65
+
66
+ private dragging = false;
67
+ private pointerId: number | null = null;
68
+ private lastPointer: [number, number] = [0, 0];
69
+ private previousTimeMilliseconds: number | null = null;
70
+ private readonly previousCursor: string;
71
+ private readonly previousTouchAction: string;
72
+
73
+ constructor(canvas: HTMLCanvasElement, props: OrbitControlsProps = {}) {
74
+ this.canvas = canvas;
75
+ this.props = {...DEFAULT_PROPS, ...props};
76
+ this.props.target = [...this.props.target];
77
+ this.yaw = this.props.yaw;
78
+ this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
79
+ this.distance = clampNumber(
80
+ this.props.distance,
81
+ this.props.minDistance,
82
+ this.props.maxDistance
83
+ );
84
+ this.previousCursor = canvas.style.cursor;
85
+ this.previousTouchAction = canvas.style.touchAction;
86
+ canvas.style.cursor = 'grab';
87
+ canvas.style.touchAction = 'none';
88
+ canvas.addEventListener('pointerdown', this.handlePointerDown);
89
+ canvas.addEventListener('pointermove', this.handlePointerMove);
90
+ canvas.addEventListener('pointerup', this.handlePointerUp);
91
+ canvas.addEventListener('pointercancel', this.handlePointerUp);
92
+ canvas.addEventListener('wheel', this.handleWheel, {passive: false});
93
+ }
94
+
95
+ /** Advances optional auto-rotation using an animation-loop timestamp in milliseconds. */
96
+ update(timeMilliseconds: number): void {
97
+ if (
98
+ this.previousTimeMilliseconds !== null &&
99
+ this.props.enabled &&
100
+ this.props.autoRotate &&
101
+ !this.dragging
102
+ ) {
103
+ const deltaSeconds = Math.min(
104
+ Math.max(timeMilliseconds - this.previousTimeMilliseconds, 0) / 1000,
105
+ 0.1
106
+ );
107
+ this.yaw += this.props.autoRotateSpeed * deltaSeconds;
108
+ }
109
+ this.previousTimeMilliseconds = timeMilliseconds;
110
+ }
111
+
112
+ /** Returns the current camera eye around the configured target. */
113
+ getEyePosition(): OrbitPosition {
114
+ const horizontalDistance = this.distance * Math.cos(this.pitch);
115
+ return [
116
+ this.props.target[0] + horizontalDistance * Math.sin(this.yaw),
117
+ this.props.target[1] + this.distance * Math.sin(this.pitch),
118
+ this.props.target[2] + horizontalDistance * Math.cos(this.yaw)
119
+ ];
120
+ }
121
+
122
+ /** Enables or pauses automatic rotation without losing the current manual angle. */
123
+ setAutoRotate(autoRotate: boolean): void {
124
+ this.props.autoRotate = autoRotate;
125
+ }
126
+
127
+ /** Updates orbit configuration and applies supplied camera state immediately. */
128
+ setProps(props: OrbitControlsProps): void {
129
+ Object.assign(this.props, props);
130
+ if (props.enabled === false && this.dragging) {
131
+ this.endPointerInteraction();
132
+ }
133
+ if (props.target) {
134
+ this.props.target = [...props.target];
135
+ }
136
+ if (props.yaw !== undefined) {
137
+ this.yaw = props.yaw;
138
+ }
139
+ if (props.pitch !== undefined || props.minPitch !== undefined || props.maxPitch !== undefined) {
140
+ this.pitch = clampNumber(props.pitch ?? this.pitch, this.props.minPitch, this.props.maxPitch);
141
+ }
142
+ if (
143
+ props.distance !== undefined ||
144
+ props.minDistance !== undefined ||
145
+ props.maxDistance !== undefined
146
+ ) {
147
+ this.distance = clampNumber(
148
+ props.distance ?? this.distance,
149
+ this.props.minDistance,
150
+ this.props.maxDistance
151
+ );
152
+ }
153
+ }
154
+
155
+ /** Restores the configured starting angle and zoom. */
156
+ reset(): void {
157
+ this.yaw = this.props.yaw;
158
+ this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
159
+ this.distance = clampNumber(
160
+ this.props.distance,
161
+ this.props.minDistance,
162
+ this.props.maxDistance
163
+ );
164
+ }
165
+
166
+ destroy(): void {
167
+ this.canvas.removeEventListener('pointerdown', this.handlePointerDown);
168
+ this.canvas.removeEventListener('pointermove', this.handlePointerMove);
169
+ this.canvas.removeEventListener('pointerup', this.handlePointerUp);
170
+ this.canvas.removeEventListener('pointercancel', this.handlePointerUp);
171
+ this.canvas.removeEventListener('wheel', this.handleWheel);
172
+ if (this.pointerId !== null && this.canvas.hasPointerCapture(this.pointerId)) {
173
+ this.canvas.releasePointerCapture(this.pointerId);
174
+ }
175
+ this.canvas.style.cursor = this.previousCursor;
176
+ this.canvas.style.touchAction = this.previousTouchAction;
177
+ }
178
+
179
+ private readonly handlePointerDown = (event: PointerEvent): void => {
180
+ if (!this.props.enabled || event.button !== 0) {
181
+ return;
182
+ }
183
+ this.props.onInteractionStart?.();
184
+ this.dragging = true;
185
+ this.pointerId = event.pointerId;
186
+ this.lastPointer = [event.clientX, event.clientY];
187
+ this.canvas.setPointerCapture(event.pointerId);
188
+ this.canvas.style.cursor = 'grabbing';
189
+ };
190
+
191
+ private readonly handlePointerMove = (event: PointerEvent): void => {
192
+ if (!this.props.enabled || !this.dragging || event.pointerId !== this.pointerId) {
193
+ return;
194
+ }
195
+ const deltaX = event.clientX - this.lastPointer[0];
196
+ const deltaY = event.clientY - this.lastPointer[1];
197
+ this.lastPointer = [event.clientX, event.clientY];
198
+ if (this.props.enablePan && event.shiftKey) {
199
+ const panScale = this.distance * this.props.panSpeed;
200
+ this.props.target = [
201
+ this.props.target[0] - Math.cos(this.yaw) * deltaX * panScale,
202
+ this.props.target[1] + deltaY * panScale,
203
+ this.props.target[2] + Math.sin(this.yaw) * deltaX * panScale
204
+ ];
205
+ } else {
206
+ this.yaw -= deltaX * this.props.rotateSpeed;
207
+ this.pitch = clampNumber(
208
+ this.pitch - deltaY * (this.props.pitchSpeed ?? this.props.rotateSpeed),
209
+ this.props.minPitch,
210
+ this.props.maxPitch
211
+ );
212
+ }
213
+ };
214
+
215
+ private readonly handlePointerUp = (event: PointerEvent): void => {
216
+ if (event.pointerId !== this.pointerId) {
217
+ return;
218
+ }
219
+ this.endPointerInteraction();
220
+ };
221
+
222
+ private endPointerInteraction(): void {
223
+ this.dragging = false;
224
+ if (this.pointerId !== null && this.canvas.hasPointerCapture(this.pointerId)) {
225
+ this.canvas.releasePointerCapture(this.pointerId);
226
+ }
227
+ this.pointerId = null;
228
+ this.canvas.style.cursor = 'grab';
229
+ }
230
+
231
+ private readonly handleWheel = (event: WheelEvent): void => {
232
+ if (!this.props.enabled || !this.props.enableZoom) {
233
+ return;
234
+ }
235
+ event.preventDefault();
236
+ this.props.onInteractionStart?.();
237
+ const deltaY = clampNumber(event.deltaY, -240, 240);
238
+ this.distance = clampNumber(
239
+ this.distance * Math.exp(deltaY * this.props.zoomSpeed),
240
+ this.props.minDistance,
241
+ this.props.maxDistance
242
+ );
243
+ };
244
+ }
245
+
246
+ function clampNumber(value: number, minimum: number, maximum: number): number {
247
+ return Math.min(Math.max(value, minimum), maximum);
248
+ }
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {Texture, Framebuffer, TypedArray} from '@luma.gl/core';
6
6
 
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Device, Framebuffer, RenderPass, Texture} from '@luma.gl/core';
6
6
 
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {ShaderLayout} from '@luma.gl/core';
6
6
 
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {TypedArray} from '@math.gl/core';
6
6
 
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {BufferMapCallback, BufferProps, Device, Binding as CoreBinding} from '@luma.gl/core';
6
6
  import {Buffer} from '@luma.gl/core';
@@ -1,5 +1,6 @@
1
- // luma.gl, MIT license
2
- // Copyright (c) vis.gl contributors
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
3
4
 
4
5
  import type {
5
6
  TextureProps,
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Binding, BindingDeclaration, ComputeShaderLayout, ShaderLayout} from '@luma.gl/core';
6
6
  import {getShaderLayoutBinding} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {TypedArray, TextureFormat, ExternalImage} from '@luma.gl/core';
6
6
  import {isExternalImage, getExternalImageSize} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Device, ExternalTexture, ResourceProps, Sampler, SamplerProps} from '@luma.gl/core';
6
6
  import {Texture, assert} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {TruncatedConeGeometryProps} from './truncated-cone-geometry';
6
6
  import {TruncatedConeGeometry} from './truncated-cone-geometry';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {Geometry} from '../geometry/geometry';
6
6
  import {uid} from '../utils/uid';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {TruncatedConeGeometryProps} from './truncated-cone-geometry';
6
6
  import {TruncatedConeGeometry} from './truncated-cone-geometry';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import {Vector3} from '@math.gl/core';
6
6
  import {Geometry} from '../geometry/geometry';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {TypedArray} from '@math.gl/core';
6
6
  import type {VertexFormat} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {VertexFormat} from '@luma.gl/core';
6
6
  import {vertexFormatDecoder} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {TypedArray} from '@math.gl/core';
6
6
  import type {BufferLayout, PrimitiveTopology} from '@luma.gl/core';
@@ -1,6 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';
6
6
  import {Device, Buffer} from '@luma.gl/core';