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

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 (188) 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 +55 -54
  4. package/dist/animation/key-frames.js.map +1 -0
  5. package/dist/animation/timeline.d.ts +4 -4
  6. package/dist/animation/timeline.d.ts.map +1 -1
  7. package/dist/animation/timeline.js +101 -94
  8. package/dist/animation/timeline.js.map +1 -0
  9. package/dist/animation-loop/animation-loop.d.ts +4 -2
  10. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  11. package/dist/animation-loop/animation-loop.js +358 -414
  12. package/dist/animation-loop/animation-loop.js.map +1 -0
  13. package/dist/animation-loop/animation-props.d.ts +3 -1
  14. package/dist/animation-loop/animation-props.d.ts.map +1 -1
  15. package/dist/animation-loop/animation-props.js +1 -0
  16. package/dist/animation-loop/animation-props.js.map +1 -0
  17. package/dist/animation-loop/make-animation-loop.d.ts +1 -1
  18. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  19. package/dist/animation-loop/make-animation-loop.js +25 -26
  20. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  21. package/dist/animation-loop/render-loop.js +5 -17
  22. package/dist/animation-loop/render-loop.js.map +1 -0
  23. package/dist/dist.dev.js +12517 -0
  24. package/dist/geometries/cone-geometry.d.ts +1 -1
  25. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  26. package/dist/geometries/cone-geometry.js +18 -12
  27. package/dist/geometries/cone-geometry.js.map +1 -0
  28. package/dist/geometries/cube-geometry.d.ts +1 -1
  29. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  30. package/dist/geometries/cube-geometry.js +60 -187
  31. package/dist/geometries/cube-geometry.js.map +1 -0
  32. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  33. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  34. package/dist/geometries/cylinder-geometry.js +15 -10
  35. package/dist/geometries/cylinder-geometry.js.map +1 -0
  36. package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
  37. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  38. package/dist/geometries/ico-sphere-geometry.js +160 -141
  39. package/dist/geometries/ico-sphere-geometry.js.map +1 -0
  40. package/dist/geometries/plane-geometry.d.ts +1 -1
  41. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  42. package/dist/geometries/plane-geometry.js +111 -93
  43. package/dist/geometries/plane-geometry.js.map +1 -0
  44. package/dist/geometries/sphere-geometry.d.ts +1 -1
  45. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  46. package/dist/geometries/sphere-geometry.js +95 -76
  47. package/dist/geometries/sphere-geometry.js.map +1 -0
  48. package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
  49. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  50. package/dist/geometries/truncated-cone-geometry.js +126 -105
  51. package/dist/geometries/truncated-cone-geometry.js.map +1 -0
  52. package/dist/geometry/geometry-table.d.ts +1 -1
  53. package/dist/geometry/geometry-table.d.ts.map +1 -1
  54. package/dist/geometry/geometry-table.js +1 -0
  55. package/dist/geometry/geometry-table.js.map +1 -0
  56. package/dist/geometry/geometry-utils.js +32 -22
  57. package/dist/geometry/geometry-utils.js.map +1 -0
  58. package/dist/geometry/geometry.d.ts +4 -4
  59. package/dist/geometry/geometry.d.ts.map +1 -1
  60. package/dist/geometry/geometry.js +109 -96
  61. package/dist/geometry/geometry.js.map +1 -0
  62. package/dist/geometry/primitive-utils.js +1 -30
  63. package/dist/geometry/primitive-utils.js.map +1 -0
  64. package/dist/index.cjs +2268 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +17 -20
  68. package/dist/index.js.map +1 -0
  69. package/dist/lib/clip-space.d.ts +8 -0
  70. package/dist/lib/clip-space.d.ts.map +1 -1
  71. package/dist/lib/clip-space.js +32 -45
  72. package/dist/lib/clip-space.js.map +1 -0
  73. package/dist/lib/model-utils.js +28 -101
  74. package/dist/lib/model-utils.js.map +1 -0
  75. package/dist/lib/model.d.ts +1 -1
  76. package/dist/lib/model.d.ts.map +1 -1
  77. package/dist/lib/model.js +129 -121
  78. package/dist/lib/model.js.map +1 -0
  79. package/dist/lib/pipeline-factory.d.ts +3 -3
  80. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  81. package/dist/lib/pipeline-factory.js +165 -136
  82. package/dist/lib/pipeline-factory.js.map +1 -0
  83. package/dist.min.js +295 -0
  84. package/package.json +22 -13
  85. package/src/animation/timeline.ts +1 -1
  86. package/src/animation-loop/animation-loop.ts +5 -5
  87. package/src/animation-loop/make-animation-loop.ts +2 -1
  88. package/src/geometry/geometry.ts +2 -2
  89. package/src/index.ts +1 -1
  90. package/src/lib/clip-space.ts +14 -11
  91. package/src/lib/pipeline-factory.ts +1 -1
  92. package/dist/bundle.d.ts +0 -2
  93. package/dist/bundle.d.ts.map +0 -1
  94. package/dist/bundle.js +0 -5
  95. package/dist/dist.min.js +0 -31
  96. package/dist/es5/animation/key-frames.js +0 -84
  97. package/dist/es5/animation/key-frames.js.map +0 -1
  98. package/dist/es5/animation/timeline.js +0 -183
  99. package/dist/es5/animation/timeline.js.map +0 -1
  100. package/dist/es5/animation-loop/animation-loop.js +0 -534
  101. package/dist/es5/animation-loop/animation-loop.js.map +0 -1
  102. package/dist/es5/animation-loop/animation-props.js +0 -2
  103. package/dist/es5/animation-loop/animation-props.js.map +0 -1
  104. package/dist/es5/animation-loop/make-animation-loop.js +0 -53
  105. package/dist/es5/animation-loop/make-animation-loop.js.map +0 -1
  106. package/dist/es5/animation-loop/render-loop.js +0 -39
  107. package/dist/es5/animation-loop/render-loop.js.map +0 -1
  108. package/dist/es5/bundle.js +0 -6
  109. package/dist/es5/bundle.js.map +0 -1
  110. package/dist/es5/geometries/cone-geometry.js +0 -43
  111. package/dist/es5/geometries/cone-geometry.js.map +0 -1
  112. package/dist/es5/geometries/cube-geometry.js +0 -84
  113. package/dist/es5/geometries/cube-geometry.js.map +0 -1
  114. package/dist/es5/geometries/cylinder-geometry.js +0 -39
  115. package/dist/es5/geometries/cylinder-geometry.js.map +0 -1
  116. package/dist/es5/geometries/ico-sphere-geometry.js +0 -185
  117. package/dist/es5/geometries/ico-sphere-geometry.js.map +0 -1
  118. package/dist/es5/geometries/plane-geometry.js +0 -137
  119. package/dist/es5/geometries/plane-geometry.js.map +0 -1
  120. package/dist/es5/geometries/sphere-geometry.js +0 -120
  121. package/dist/es5/geometries/sphere-geometry.js.map +0 -1
  122. package/dist/es5/geometries/truncated-cone-geometry.js +0 -160
  123. package/dist/es5/geometries/truncated-cone-geometry.js.map +0 -1
  124. package/dist/es5/geometry/geometry-table.js +0 -2
  125. package/dist/es5/geometry/geometry-table.js.map +0 -1
  126. package/dist/es5/geometry/geometry-utils.js +0 -39
  127. package/dist/es5/geometry/geometry-utils.js.map +0 -1
  128. package/dist/es5/geometry/geometry.js +0 -150
  129. package/dist/es5/geometry/geometry.js.map +0 -1
  130. package/dist/es5/geometry/primitive-utils.js +0 -2
  131. package/dist/es5/geometry/primitive-utils.js.map +0 -1
  132. package/dist/es5/index.js +0 -112
  133. package/dist/es5/index.js.map +0 -1
  134. package/dist/es5/lib/clip-space.js +0 -2
  135. package/dist/es5/lib/clip-space.js.map +0 -1
  136. package/dist/es5/lib/model-utils.js +0 -52
  137. package/dist/es5/lib/model-utils.js.map +0 -1
  138. package/dist/es5/lib/model.js +0 -173
  139. package/dist/es5/lib/model.js.map +0 -1
  140. package/dist/es5/lib/pipeline-factory.js +0 -244
  141. package/dist/es5/lib/pipeline-factory.js.map +0 -1
  142. package/dist/esm/animation/key-frames.js +0 -57
  143. package/dist/esm/animation/key-frames.js.map +0 -1
  144. package/dist/esm/animation/timeline.js +0 -113
  145. package/dist/esm/animation/timeline.js.map +0 -1
  146. package/dist/esm/animation-loop/animation-loop.js +0 -367
  147. package/dist/esm/animation-loop/animation-loop.js.map +0 -1
  148. package/dist/esm/animation-loop/animation-props.js +0 -2
  149. package/dist/esm/animation-loop/animation-props.js.map +0 -1
  150. package/dist/esm/animation-loop/make-animation-loop.js +0 -28
  151. package/dist/esm/animation-loop/make-animation-loop.js.map +0 -1
  152. package/dist/esm/animation-loop/render-loop.js +0 -7
  153. package/dist/esm/animation-loop/render-loop.js.map +0 -1
  154. package/dist/esm/bundle.js +0 -4
  155. package/dist/esm/bundle.js.map +0 -1
  156. package/dist/esm/geometries/cone-geometry.js +0 -21
  157. package/dist/esm/geometries/cone-geometry.js.map +0 -1
  158. package/dist/esm/geometries/cube-geometry.js +0 -67
  159. package/dist/esm/geometries/cube-geometry.js.map +0 -1
  160. package/dist/esm/geometries/cylinder-geometry.js +0 -18
  161. package/dist/esm/geometries/cylinder-geometry.js.map +0 -1
  162. package/dist/esm/geometries/ico-sphere-geometry.js +0 -170
  163. package/dist/esm/geometries/ico-sphere-geometry.js.map +0 -1
  164. package/dist/esm/geometries/plane-geometry.js +0 -119
  165. package/dist/esm/geometries/plane-geometry.js.map +0 -1
  166. package/dist/esm/geometries/sphere-geometry.js +0 -102
  167. package/dist/esm/geometries/sphere-geometry.js.map +0 -1
  168. package/dist/esm/geometries/truncated-cone-geometry.js +0 -136
  169. package/dist/esm/geometries/truncated-cone-geometry.js.map +0 -1
  170. package/dist/esm/geometry/geometry-table.js +0 -2
  171. package/dist/esm/geometry/geometry-table.js.map +0 -1
  172. package/dist/esm/geometry/geometry-utils.js +0 -37
  173. package/dist/esm/geometry/geometry-utils.js.map +0 -1
  174. package/dist/esm/geometry/geometry.js +0 -119
  175. package/dist/esm/geometry/geometry.js.map +0 -1
  176. package/dist/esm/geometry/primitive-utils.js +0 -2
  177. package/dist/esm/geometry/primitive-utils.js.map +0 -1
  178. package/dist/esm/index.js +0 -16
  179. package/dist/esm/index.js.map +0 -1
  180. package/dist/esm/lib/clip-space.js +0 -2
  181. package/dist/esm/lib/clip-space.js.map +0 -1
  182. package/dist/esm/lib/model-utils.js +0 -40
  183. package/dist/esm/lib/model-utils.js.map +0 -1
  184. package/dist/esm/lib/model.js +0 -146
  185. package/dist/esm/lib/model.js.map +0 -1
  186. package/dist/esm/lib/pipeline-factory.js +0 -180
  187. package/dist/esm/lib/pipeline-factory.js.map +0 -1
  188. package/src/bundle.ts +0 -4
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@luma.gl/engine",
3
- "version": "9.0.0-alpha.16",
3
+ "version": "9.0.0-alpha.19",
4
4
  "description": "WebGL2 Components for High Performance Rendering and Computation",
5
+ "type": "module",
5
6
  "license": "MIT",
6
7
  "publishConfig": {
7
8
  "access": "public"
@@ -17,27 +18,35 @@
17
18
  "3d"
18
19
  ],
19
20
  "types": "dist/index.d.ts",
20
- "main": "dist/es5/index.js",
21
- "module": "dist/esm/index.js",
21
+ "main": "dist/index.cjs",
22
+ "module": "dist/index.js",
23
+ "exports": {
24
+ ".": {
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs",
27
+ "types": "./dist/index.d.ts"
28
+ }
29
+ },
22
30
  "files": [
23
31
  "src",
24
32
  "dist",
33
+ "dist.min.js",
25
34
  "README.md"
26
35
  ],
27
36
  "sideEffects": false,
28
37
  "scripts": {
29
- "pre-build": "npm run build-bundle",
30
- "build-bundle": "webpack --display=minimal --config ../../scripts/bundle.config.js"
38
+ "build-bundle": "ocular-bundle ./src/index.ts",
39
+ "pre-build": "npm run build-bundle && npm run build-bundle -- --env=dev"
31
40
  },
32
41
  "dependencies": {
33
42
  "@babel/runtime": "^7.0.0",
34
- "@luma.gl/api": "9.0.0-alpha.16",
35
- "@luma.gl/constants": "9.0.0-alpha.16",
36
- "@luma.gl/shadertools": "9.0.0-alpha.16",
37
- "@luma.gl/webgl": "9.0.0-alpha.16",
38
- "@math.gl/core": "4.0.0-alpha.1",
39
- "@probe.gl/log": "^4.0.0",
40
- "@probe.gl/stats": "^4.0.0"
43
+ "@luma.gl/api": "9.0.0-alpha.19",
44
+ "@luma.gl/constants": "9.0.0-alpha.19",
45
+ "@luma.gl/shadertools": "9.0.0-alpha.19",
46
+ "@luma.gl/webgl": "9.0.0-alpha.19",
47
+ "@math.gl/core": "4.0.0-alpha.4",
48
+ "@probe.gl/log": "^4.0.2",
49
+ "@probe.gl/stats": "^4.0.2"
41
50
  },
42
- "gitHead": "697bc4ef1deff8438e2f3be51bf0bd245882106a"
51
+ "gitHead": "d57e5fd81825ae4c7c23040ba63f54ad4ea7e972"
43
52
  }
@@ -7,7 +7,7 @@
7
7
  * @param rate = 1
8
8
  * @param repeat = 1
9
9
  */
10
- export type ChannelOptions = {
10
+ export type ChannelOptions = {
11
11
  delay?: number
12
12
  duration?: number
13
13
  rate?: number
@@ -88,7 +88,7 @@ export class AnimationLoop {
88
88
  throw new Error('No device provided');
89
89
  }
90
90
 
91
- let {useDevicePixels = true} = this.props;
91
+ const {useDevicePixels = true} = this.props;
92
92
 
93
93
  // state
94
94
  this.stats = props.stats || new Stats({id: 'animation-loop-stats'});
@@ -313,7 +313,7 @@ export class AnimationLoop {
313
313
  // if (this.display && this.display.cancelAnimationFrame) {
314
314
  // this.display.cancelAnimationFrame(this._animationFrameId);
315
315
  // }
316
- cancelAnimationFrame(this._animationFrameId);
316
+ cancelAnimationFrame(this._animationFrameId);
317
317
  this._animationFrameId = null;
318
318
  }
319
319
 
@@ -356,7 +356,7 @@ export class AnimationLoop {
356
356
  this.animationProps = {
357
357
  animationLoop: this,
358
358
  device: this.device,
359
- canvas: this.device?.canvasContext?.canvas!,
359
+ canvas: this.device?.canvasContext?.canvas,
360
360
  timeline: this.timeline,
361
361
 
362
362
  // Initial values
@@ -532,8 +532,8 @@ export class AnimationLoop {
532
532
 
533
533
  _startEventHandling() {
534
534
  if (this.canvas) {
535
- this.canvas.addEventListener('mousemove', this._onMousemove);
536
- this.canvas.addEventListener('mouseleave', this._onMouseleave);
535
+ this.canvas.addEventListener('mousemove', this._onMousemove.bind(this));
536
+ this.canvas.addEventListener('mouseleave', this._onMouseleave.bind(this));
537
537
  }
538
538
  }
539
539
 
@@ -19,7 +19,7 @@ export function makeAnimationLoop(AnimationLoopTemplateCtor: typeof AnimationLoo
19
19
  device,
20
20
 
21
21
  async onInitialize(animationProps: AnimationProps): Promise<unknown> {
22
- // @ts-expect-error abstract to prevent instantiation
22
+ // @ts-expect-error abstract to prevent instantiation
23
23
  renderLoop = new AnimationLoopTemplateCtor(animationProps);
24
24
  // Any async loading can be handled here
25
25
  return await renderLoop?.onInitialize(animationProps);
@@ -33,6 +33,7 @@ export function makeAnimationLoop(AnimationLoopTemplateCtor: typeof AnimationLoo
33
33
  // @ts-expect-error Hack: adds info for the website to find
34
34
  animationLoop.getInfo = () => {
35
35
  // @ts-ignore
36
+ // eslint-disable-next-line no-invalid-this
36
37
  return this.AnimationLoopTemplateCtor.info;
37
38
  }
38
39
 
@@ -117,8 +117,8 @@ export default class Geometry {
117
117
  }
118
118
  }
119
119
 
120
- // @ts-expect-error
121
- if (this.indices && this.indices.isIndexed !== undefined) {
120
+ // @ts-expect-error
121
+ if (this.indices && this.indices.isIndexed !== undefined) {
122
122
  this.indices = Object.assign({}, this.indices);
123
123
  // @ts-expect-error
124
124
  delete this.indices.isIndexed;
package/src/index.ts CHANGED
@@ -19,7 +19,7 @@ export {Model} from './lib/model';
19
19
  export {PipelineFactory} from './lib/pipeline-factory';
20
20
 
21
21
  // Utils
22
- // export {default as ClipSpace} from './lib/clip-space';
22
+ export {ClipSpace} from './lib/clip-space';
23
23
 
24
24
  // Geometries
25
25
  export {default as Geometry} from './geometry/geometry';
@@ -1,9 +1,10 @@
1
1
 
2
2
  // ClipSpace
3
- /*
4
3
  import GL from '@luma.gl/constants';
5
- import Model, {ModelProps} from './model';
4
+ import {Device, glsl} from '@luma.gl/api';
5
+ import {Model, ModelProps} from './model';
6
6
  import Geometry from '../geometry/geometry';
7
+ import {WebGLDevice} from '@luma.gl/webgl/index';
7
8
 
8
9
  const CLIPSPACE_VERTEX_SHADER = glsl`\
9
10
  attribute vec2 aClipSpacePosition;
@@ -22,18 +23,22 @@ void main(void) {
22
23
  }
23
24
  `;
24
25
 
25
- /* eslint-disable indent, no-multi-spaces *
26
+ /* eslint-disable indent, no-multi-spaces */
26
27
  const POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];
27
28
 
28
-
29
- export default class ClipSpace extends Model {
30
- constructor(gl: WebGLRenderingContext, opts?: ModelProps) {
29
+ /**
30
+ * A flat geometry that covers the "visible area" that the GPU renders.
31
+ */
32
+ export class ClipSpace extends Model {
33
+ constructor(device: Device | WebGLRenderingContext, opts?: ModelProps) {
31
34
  const TEX_COORDS = POSITIONS.map((coord) => (coord === -1 ? 0 : coord));
32
35
 
33
36
  super(
34
- gl,
35
- Object.assign({}, opts, {
37
+ WebGLDevice.attach(device),
38
+ {
39
+ ...opts,
36
40
  vs: CLIPSPACE_VERTEX_SHADER,
41
+ vertexCount: 4,
37
42
  geometry: new Geometry({
38
43
  drawMode: GL.TRIANGLE_STRIP,
39
44
  vertexCount: 4,
@@ -43,9 +48,7 @@ export default class ClipSpace extends Model {
43
48
  aCoordinate: {size: 2, value: new Float32Array(TEX_COORDS)}
44
49
  }
45
50
  })
46
- })
51
+ }
47
52
  );
48
- this.setVertexCount(4);
49
53
  }
50
54
  }
51
- */
@@ -167,7 +167,7 @@ export class PipelineFactory {
167
167
  /** Calculate a hash based on all the inputs for a render pipeline */
168
168
  _hashRenderPipeline(props: GetRenderPipelineOptions): string {
169
169
  const {modules = [], varyings = [], defines = {}, inject = {}, parameters = {}} = props;
170
- const vsHash = this._getHash(props.vs);
170
+ const vsHash = this._getHash(props.vs);
171
171
  const fsHash = props.fs ? this._getHash(props.fs) : 0;
172
172
 
173
173
  const moduleHashes = modules.map((m) => this._getHash(typeof m === 'string' ? m : m.name)).sort();
package/dist/bundle.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const moduleExports: any;
2
- //# sourceMappingURL=bundle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,KAAqB,CAAC"}
package/dist/bundle.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- const moduleExports = require('./index');
4
- globalThis.luma = globalThis.luma || {};
5
- module.exports = Object.assign(globalThis.luma, moduleExports);