@luma.gl/engine 9.0.0-alpha.3 → 9.0.0-alpha.31

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 (148) hide show
  1. package/LICENSE +2 -1
  2. package/dist/animation/key-frames.d.ts +1 -1
  3. package/dist/animation/key-frames.d.ts.map +1 -1
  4. package/dist/animation/key-frames.js +0 -20
  5. package/dist/animation/key-frames.js.map +1 -1
  6. package/dist/animation/timeline.d.ts +5 -5
  7. package/dist/animation/timeline.d.ts.map +1 -1
  8. package/dist/animation/timeline.js +0 -30
  9. package/dist/animation/timeline.js.map +1 -1
  10. package/dist/{lib → animation-loop}/animation-loop.d.ts +28 -29
  11. package/dist/animation-loop/animation-loop.d.ts.map +1 -0
  12. package/dist/{lib → animation-loop}/animation-loop.js +96 -175
  13. package/dist/animation-loop/animation-loop.js.map +1 -0
  14. package/dist/{lib → animation-loop}/animation-props.d.ts +7 -7
  15. package/dist/animation-loop/animation-props.d.ts.map +1 -0
  16. package/dist/animation-loop/animation-props.js.map +1 -0
  17. package/dist/animation-loop/make-animation-loop.d.ts +6 -0
  18. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
  19. package/dist/animation-loop/make-animation-loop.js +28 -0
  20. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  21. package/dist/animation-loop/render-loop.d.ts +23 -0
  22. package/dist/animation-loop/render-loop.d.ts.map +1 -0
  23. package/dist/animation-loop/render-loop.js +7 -0
  24. package/dist/animation-loop/render-loop.js.map +1 -0
  25. package/dist/dist.dev.js +14977 -0
  26. package/dist/geometries/cone-geometry.d.ts +1 -1
  27. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  28. package/dist/geometries/cone-geometry.js +6 -5
  29. package/dist/geometries/cone-geometry.js.map +1 -1
  30. package/dist/geometries/cube-geometry.d.ts +2 -2
  31. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  32. package/dist/geometries/cube-geometry.js +15 -8
  33. package/dist/geometries/cube-geometry.js.map +1 -1
  34. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  35. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  36. package/dist/geometries/cylinder-geometry.js +6 -5
  37. package/dist/geometries/cylinder-geometry.js.map +1 -1
  38. package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
  39. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  40. package/dist/geometries/ico-sphere-geometry.js +9 -18
  41. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  42. package/dist/geometries/plane-geometry.d.ts +2 -2
  43. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  44. package/dist/geometries/plane-geometry.js +10 -19
  45. package/dist/geometries/plane-geometry.js.map +1 -1
  46. package/dist/geometries/sphere-geometry.d.ts +2 -2
  47. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  48. package/dist/geometries/sphere-geometry.js +9 -13
  49. package/dist/geometries/sphere-geometry.js.map +1 -1
  50. package/dist/geometries/truncated-cone-geometry.d.ts +2 -2
  51. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  52. package/dist/geometries/truncated-cone-geometry.js +9 -14
  53. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  54. package/dist/geometry/geometry-table.d.ts +2 -2
  55. package/dist/geometry/geometry-table.d.ts.map +1 -1
  56. package/dist/geometry/geometry-table.js.map +1 -1
  57. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  58. package/dist/geometry/geometry-utils.js +0 -9
  59. package/dist/geometry/geometry-utils.js.map +1 -1
  60. package/dist/geometry/geometry.d.ts +35 -58
  61. package/dist/geometry/geometry.d.ts.map +1 -1
  62. package/dist/geometry/geometry.js +26 -89
  63. package/dist/geometry/geometry.js.map +1 -1
  64. package/dist/geometry/primitive-utils.js.map +1 -1
  65. package/dist/index.cjs +2576 -0
  66. package/dist/index.d.ts +18 -9
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +20 -13
  69. package/dist/index.js.map +1 -1
  70. package/dist/lib/clip-space.d.ts +8 -0
  71. package/dist/lib/clip-space.d.ts.map +1 -1
  72. package/dist/lib/clip-space.js +36 -1
  73. package/dist/lib/clip-space.js.map +1 -1
  74. package/dist/lib/pipeline-factory.d.ts +19 -14
  75. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  76. package/dist/lib/pipeline-factory.js +52 -63
  77. package/dist/lib/pipeline-factory.js.map +1 -1
  78. package/dist/{lib → model}/model-utils.d.ts +2 -2
  79. package/dist/model/model-utils.d.ts.map +1 -0
  80. package/dist/{lib → model}/model-utils.js +3 -8
  81. package/dist/model/model-utils.js.map +1 -0
  82. package/dist/model/model.d.ts +67 -0
  83. package/dist/model/model.d.ts.map +1 -0
  84. package/dist/{lib → model}/model.js +59 -76
  85. package/dist/model/model.js.map +1 -0
  86. package/dist/scenegraph/group-node.d.ts +21 -0
  87. package/dist/scenegraph/group-node.d.ts.map +1 -0
  88. package/dist/scenegraph/group-node.js +95 -0
  89. package/dist/scenegraph/group-node.js.map +1 -0
  90. package/dist/scenegraph/model-node.d.ts +18 -0
  91. package/dist/scenegraph/model-node.d.ts.map +1 -0
  92. package/dist/scenegraph/model-node.js +29 -0
  93. package/dist/scenegraph/model-node.js.map +1 -0
  94. package/dist/scenegraph/scenegraph-node.d.ts +56 -0
  95. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
  96. package/dist/scenegraph/scenegraph-node.js +142 -0
  97. package/dist/scenegraph/scenegraph-node.js.map +1 -0
  98. package/dist/transform/transform.d.ts +98 -0
  99. package/dist/transform/transform.d.ts.map +1 -0
  100. package/dist/transform/transform.js +67 -0
  101. package/dist/transform/transform.js.map +1 -0
  102. package/dist.min.js +314 -0
  103. package/package.json +22 -12
  104. package/src/animation/timeline.ts +2 -2
  105. package/src/{lib → animation-loop}/animation-loop.ts +115 -97
  106. package/src/{lib → animation-loop}/animation-props.ts +6 -5
  107. package/src/animation-loop/make-animation-loop.ts +44 -0
  108. package/src/animation-loop/render-loop.ts +23 -0
  109. package/src/geometries/cone-geometry.ts +1 -1
  110. package/src/geometries/cube-geometry.ts +6 -3
  111. package/src/geometries/cylinder-geometry.ts +2 -2
  112. package/src/geometries/ico-sphere-geometry.ts +7 -6
  113. package/src/geometries/plane-geometry.ts +5 -4
  114. package/src/geometries/sphere-geometry.ts +4 -3
  115. package/src/geometries/truncated-cone-geometry.ts +4 -3
  116. package/src/geometry/geometry-table.ts +1 -1
  117. package/src/geometry/geometry-utils.ts +3 -3
  118. package/src/geometry/geometry.ts +72 -115
  119. package/src/index.ts +28 -12
  120. package/src/lib/clip-space.ts +17 -15
  121. package/src/lib/pipeline-factory.ts +60 -50
  122. package/src/{lib → model}/model-utils.ts +5 -4
  123. package/src/model/model.ts +230 -0
  124. package/src/scenegraph/group-node.ts +103 -0
  125. package/src/scenegraph/model-node.ts +50 -0
  126. package/src/scenegraph/scenegraph-node.ts +204 -0
  127. package/src/transform/transform.ts +246 -0
  128. package/dist/bundle.d.ts +0 -2
  129. package/dist/bundle.d.ts.map +0 -1
  130. package/dist/bundle.js +0 -5
  131. package/dist/bundle.js.map +0 -1
  132. package/dist/lib/animation-loop.d.ts.map +0 -1
  133. package/dist/lib/animation-loop.js.map +0 -1
  134. package/dist/lib/animation-props.d.ts.map +0 -1
  135. package/dist/lib/animation-props.js.map +0 -1
  136. package/dist/lib/model-utils.d.ts.map +0 -1
  137. package/dist/lib/model-utils.js.map +0 -1
  138. package/dist/lib/model.d.ts +0 -41
  139. package/dist/lib/model.d.ts.map +0 -1
  140. package/dist/lib/model.js.map +0 -1
  141. package/dist/lib/render-loop.d.ts +0 -14
  142. package/dist/lib/render-loop.d.ts.map +0 -1
  143. package/dist/lib/render-loop.js +0 -49
  144. package/dist/lib/render-loop.js.map +0 -1
  145. package/src/bundle.ts +0 -4
  146. package/src/lib/model.ts +0 -179
  147. package/src/lib/render-loop.ts +0 -58
  148. /package/dist/{lib → animation-loop}/animation-props.js +0 -0
@@ -1,49 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import AnimationLoop from './animation-loop';
3
- export class RenderLoop {
4
- constructor(animationProps) {}
5
-
6
- static run(RenderLoopConstructor, deviceProps) {
7
- const animationLoop = new SyncInitAnimationLoop(RenderLoopConstructor, deviceProps);
8
- return animationLoop;
9
- }
10
-
11
- }
12
-
13
- class SyncInitAnimationLoop extends AnimationLoop {
14
- getInfo() {
15
- return this.RenderLoopConstructor.info;
16
- }
17
-
18
- constructor(RenderLoopConstructor, deviceProps) {
19
- super({
20
- deviceProps
21
- });
22
-
23
- _defineProperty(this, "RenderLoopConstructor", void 0);
24
-
25
- _defineProperty(this, "renderLoop", void 0);
26
-
27
- this.RenderLoopConstructor = RenderLoopConstructor;
28
- }
29
-
30
- onInitialize(animationProps) {
31
- this.renderLoop = new this.RenderLoopConstructor(animationProps);
32
- }
33
-
34
- onRender(animationProps) {
35
- var _this$renderLoop, _this$renderLoop$onRe, _this$renderLoop2, _this$renderLoop2$fra;
36
-
37
- (_this$renderLoop = this.renderLoop) === null || _this$renderLoop === void 0 ? void 0 : (_this$renderLoop$onRe = _this$renderLoop.onRender) === null || _this$renderLoop$onRe === void 0 ? void 0 : _this$renderLoop$onRe.call(_this$renderLoop, animationProps);
38
- (_this$renderLoop2 = this.renderLoop) === null || _this$renderLoop2 === void 0 ? void 0 : (_this$renderLoop2$fra = _this$renderLoop2.frame) === null || _this$renderLoop2$fra === void 0 ? void 0 : _this$renderLoop2$fra.call(_this$renderLoop2, animationProps);
39
- }
40
-
41
- onFinalize(animationProps) {
42
- var _this$renderLoop3, _this$renderLoop3$onF, _this$renderLoop4, _this$renderLoop4$des;
43
-
44
- (_this$renderLoop3 = this.renderLoop) === null || _this$renderLoop3 === void 0 ? void 0 : (_this$renderLoop3$onF = _this$renderLoop3.onFinalize) === null || _this$renderLoop3$onF === void 0 ? void 0 : _this$renderLoop3$onF.call(_this$renderLoop3, animationProps);
45
- (_this$renderLoop4 = this.renderLoop) === null || _this$renderLoop4 === void 0 ? void 0 : (_this$renderLoop4$des = _this$renderLoop4.destroy) === null || _this$renderLoop4$des === void 0 ? void 0 : _this$renderLoop4$des.call(_this$renderLoop4, animationProps);
46
- }
47
-
48
- }
49
- //# sourceMappingURL=render-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/render-loop.ts"],"names":["AnimationLoop","RenderLoop","constructor","animationProps","run","RenderLoopConstructor","deviceProps","animationLoop","SyncInitAnimationLoop","getInfo","info","onInitialize","renderLoop","onRender","frame","onFinalize","destroy"],"mappings":";AAEA,OAAOA,aAAP,MAA0B,kBAA1B;AAOA,OAAO,MAAeC,UAAf,CAA0B;AAC/BC,EAAAA,WAAW,CAACC,cAAD,EAAkC,CAAE;;AAGrC,SAAHC,GAAG,CAACC,qBAAD,EAA2CC,WAA3C,EAAqF;AAE7F,UAAMC,aAAa,GAAG,IAAIC,qBAAJ,CAA0BH,qBAA1B,EAAiDC,WAAjD,CAAtB;AAKA,WAAOC,aAAP;AACD;;AAZ8B;;AAgBjC,MAAMC,qBAAN,SAAoCR,aAApC,CAAkD;AAIhDS,EAAAA,OAAO,GAAG;AAER,WAAO,KAAKJ,qBAAL,CAA2BK,IAAlC;AACD;;AAEDR,EAAAA,WAAW,CAACG,qBAAD,EAA2CC,WAA3C,EAAsE;AAC/E,UAAM;AAACA,MAAAA;AAAD,KAAN;;AAD+E;;AAAA;;AAE/E,SAAKD,qBAAL,GAA6BA,qBAA7B;AACD;;AAEDM,EAAAA,YAAY,CAACR,cAAD,EAAiC;AAE3C,SAAKS,UAAL,GAAkB,IAAI,KAAKP,qBAAT,CAA+BF,cAA/B,CAAlB;AACD;;AAEDU,EAAAA,QAAQ,CAACV,cAAD,EAAiC;AAAA;;AAEvC,6BAAKS,UAAL,+FAAiBC,QAAjB,uGAA4BV,cAA5B;AAEA,8BAAKS,UAAL,iGAAiBE,KAAjB,wGAAyBX,cAAzB;AACD;;AAEDY,EAAAA,UAAU,CAACZ,cAAD,EAAiC;AAAA;;AAEzC,8BAAKS,UAAL,iGAAiBG,UAAjB,wGAA8BZ,cAA9B;AAEA,8BAAKS,UAAL,iGAAiBI,OAAjB,wGAA2Bb,cAA3B;AACD;;AA/B+C","sourcesContent":["import type {DeviceProps} from '@luma.gl/api';\nimport type {AnimationProps} from '../lib/animation-props';\nimport AnimationLoop from './animation-loop';\n\n/**\n * Minimal animation loop that initializes models in constructor\n * Simplifying type management\n * v9 API\n */\nexport abstract class RenderLoop {\n constructor(animationProps?: AnimationProps) {}\n\n /** Instantiates and runs the render loop */\n static run(RenderLoopConstructor: typeof RenderLoop, deviceProps?: DeviceProps): AnimationLoop {\n // Create an animation loop;\n const animationLoop = new SyncInitAnimationLoop(RenderLoopConstructor, deviceProps);\n\n // Start the loop automatically\n // animationLoop.start();\n\n return animationLoop;\n }\n}\n\n/** Instantiates the RenderLoop once the device is created */\nclass SyncInitAnimationLoop extends AnimationLoop {\n RenderLoopConstructor: typeof RenderLoop;\n renderLoop: RenderLoop;\n\n getInfo() {\n // @ts-ignore\n return this.RenderLoopConstructor.info;\n }\n\n constructor(RenderLoopConstructor: typeof RenderLoop, deviceProps?: DeviceProps) {\n super({deviceProps});\n this.RenderLoopConstructor = RenderLoopConstructor;\n }\n\n onInitialize(animationProps: AnimationProps) {\n // @ts-expect-error\n this.renderLoop = new this.RenderLoopConstructor(animationProps);\n }\n\n onRender(animationProps: AnimationProps) {\n // @ts-expect-error API still TBD\n this.renderLoop?.onRender?.(animationProps);\n // @ts-expect-error API still TBD\n this.renderLoop?.frame?.(animationProps);\n }\n\n onFinalize(animationProps: AnimationProps) {\n // @ts-expect-error API still TBD\n this.renderLoop?.onFinalize?.(animationProps);\n // @ts-expect-error API still TBD\n this.renderLoop?.destroy?.(animationProps);\n }\n}\n"],"file":"render-loop.js"}
package/src/bundle.ts DELETED
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- const moduleExports = require('./index');
3
- globalThis.luma = globalThis.luma || {};
4
- module.exports = Object.assign(globalThis.luma, moduleExports);
package/src/lib/model.ts DELETED
@@ -1,179 +0,0 @@
1
- import type {Device, Buffer, RenderPipelineProps, RenderPass, Binding} from '@luma.gl/api';
2
- import {RenderPipeline, Shader, cast} from '@luma.gl/api';
3
- import type { ShaderModule } from '@luma.gl/shadertools';
4
- import type Geometry from '../geometry/geometry';
5
- import {getAttributeBuffersFromGeometry, getIndexBufferFromGeometry} from './model-utils';
6
- import PipelineFactory from './pipeline-factory';
7
-
8
- export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
9
- // Model also accepts a string
10
- vs?: {glsl?: string; wgsl?: string} | string;
11
- fs?: {glsl?: string; wgsl?: string} | string;
12
- modules?: ShaderModule[];
13
- moduleSettings?: Record<string, Record<string, any>>;
14
- geometry?: Geometry;
15
- };
16
-
17
- const DEFAULT_MODEL_PROPS: Required<ModelProps> = {
18
- ...RenderPipeline._DEFAULT_PROPS,
19
- vs: undefined,
20
- fs: undefined,
21
- id: 'unnamed',
22
- handle: undefined,
23
- userData: {},
24
- modules: [],
25
- moduleSettings: {},
26
- geometry: undefined
27
- };
28
-
29
- /** v9 API */
30
- export default class Model {
31
- readonly device: Device;
32
- readonly pipeline: RenderPipeline;
33
- readonly id: string;
34
- readonly vs: string;
35
- readonly fs: string | undefined;
36
- readonly topology: string;
37
- readonly vertexCount;
38
- props: Required<ModelProps>;
39
-
40
- private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;
41
-
42
- constructor(device: Device, props: ModelProps) {
43
- this.props = {...DEFAULT_MODEL_PROPS, ...props};
44
- props = this.props;
45
- this.id = props.id;
46
- this.device = device;
47
-
48
- // Create the pipeline
49
- this.vs = getShaderSource(this.device, props.vs);
50
- if (props.fs) {
51
- this.fs = getShaderSource(this.device, props.fs);
52
- }
53
-
54
- this.vertexCount = this.props.vertexCount;
55
- this.topology = this.props.topology;
56
-
57
- if (this.props.geometry) {
58
- this.vertexCount = this.props.geometry.vertexCount;
59
- this.topology = this.props.geometry.topology;
60
- }
61
-
62
- const {renderPipeline, getUniforms} = PipelineFactory.getDefaultPipelineFactory(this.device).createRenderPipeline({
63
- ...this.props,
64
- vs: this.vs,
65
- fs: this.fs,
66
- topology: this.topology,
67
- parameters: props.parameters,
68
- // Geometry in the vertex shader!
69
- // @ts-expect-error
70
- layout: props.layout
71
- });
72
-
73
- this.pipeline = renderPipeline;
74
- this._getModuleUniforms = getUniforms;
75
-
76
- if (this.props.geometry) {
77
- this._setGeometry(this.props.geometry);
78
- }
79
- this.setUniforms(this._getModuleUniforms()) // Get all default module uniforms
80
- this.setProps(this.props);
81
- }
82
-
83
- destroy(): void {
84
- this.pipeline.destroy();
85
- }
86
-
87
- draw(renderPass?: RenderPass): this {
88
- this.pipeline.draw({
89
- renderPass,
90
- vertexCount: this.vertexCount,
91
- instanceCount: this.props.instanceCount
92
- });
93
- return this;
94
- }
95
-
96
- setProps(props: ModelProps): this {
97
- if (props.indices) {
98
- this.setIndexBuffer(props.indices);
99
- }
100
- if (props.attributes) {
101
- this.setAttributes(props.attributes);
102
- }
103
- if (props.bindings) {
104
- this.setBindings(props.bindings);
105
- }
106
- if (props.uniforms) {
107
- this.setUniforms(props.uniforms);
108
- }
109
- if (props.moduleSettings) {
110
- this.updateModuleSettings(props.moduleSettings);
111
- }
112
- return this;
113
- }
114
-
115
- updateModuleSettings(props: Record<string, any>): this {
116
- const uniforms = this._getModuleUniforms(props);
117
- this.setUniforms(uniforms);
118
- return this;
119
- }
120
-
121
- setIndexBuffer(indices: Buffer): this {
122
- this.pipeline.setIndexBuffer(indices);
123
- // this._indices = indices;
124
- return this;
125
- }
126
-
127
- setAttributes(attributes: Record<string, Buffer>): this {
128
- this.pipeline.setAttributes(attributes);
129
- Object.assign(this.props.attributes, attributes);
130
- return this;
131
- }
132
-
133
- /** Set the bindings */
134
- setBindings(bindings: Record<string, Binding>): this {
135
- this.pipeline.setBindings(bindings);
136
- Object.assign(this.props.bindings, bindings);
137
- return this;
138
- }
139
-
140
- setUniforms(uniforms: Record<string, any>): this {
141
- this.pipeline.setUniforms(uniforms);
142
- Object.assign(this.props.uniforms, uniforms);
143
- return this;
144
- }
145
-
146
- _setGeometry(geometry: Geometry): void {
147
- // this._deleteGeometryBuffers();
148
-
149
- const geometryBuffers = getAttributeBuffersFromGeometry(this.device, geometry);
150
- this.setAttributes(geometryBuffers);
151
-
152
- const indexBuffer = getIndexBufferFromGeometry(this.device, geometry);
153
- if (indexBuffer) {
154
- this.setIndexBuffer(indexBuffer);
155
- }
156
- }
157
- }
158
-
159
- /** Create a shader from the different overloads */
160
- function getShaderSource(device: Device, shader: string | {glsl?: string; wgsl?: string}): string {
161
- // TODO - detect WGSL/GLSL and throw an error if not supported
162
- if (typeof shader === 'string') {
163
- return shader;
164
- }
165
-
166
- switch (device.info.type) {
167
- case 'webgpu':
168
- if (shader?.wgsl) {
169
- return shader.wgsl;
170
- }
171
- throw new Error('WebGPU does not support GLSL shaders');
172
-
173
- default:
174
- if (shader?.glsl) {
175
- return shader.glsl;
176
- }
177
- throw new Error('WebGL does not support WGSL shaders');
178
- }
179
- }
@@ -1,58 +0,0 @@
1
- import type {DeviceProps} from '@luma.gl/api';
2
- import type {AnimationProps} from '../lib/animation-props';
3
- import AnimationLoop from './animation-loop';
4
-
5
- /**
6
- * Minimal animation loop that initializes models in constructor
7
- * Simplifying type management
8
- * v9 API
9
- */
10
- export abstract class RenderLoop {
11
- constructor(animationProps?: AnimationProps) {}
12
-
13
- /** Instantiates and runs the render loop */
14
- static run(RenderLoopConstructor: typeof RenderLoop, deviceProps?: DeviceProps): AnimationLoop {
15
- // Create an animation loop;
16
- const animationLoop = new SyncInitAnimationLoop(RenderLoopConstructor, deviceProps);
17
-
18
- // Start the loop automatically
19
- // animationLoop.start();
20
-
21
- return animationLoop;
22
- }
23
- }
24
-
25
- /** Instantiates the RenderLoop once the device is created */
26
- class SyncInitAnimationLoop extends AnimationLoop {
27
- RenderLoopConstructor: typeof RenderLoop;
28
- renderLoop: RenderLoop;
29
-
30
- getInfo() {
31
- // @ts-ignore
32
- return this.RenderLoopConstructor.info;
33
- }
34
-
35
- constructor(RenderLoopConstructor: typeof RenderLoop, deviceProps?: DeviceProps) {
36
- super({deviceProps});
37
- this.RenderLoopConstructor = RenderLoopConstructor;
38
- }
39
-
40
- onInitialize(animationProps: AnimationProps) {
41
- // @ts-expect-error
42
- this.renderLoop = new this.RenderLoopConstructor(animationProps);
43
- }
44
-
45
- onRender(animationProps: AnimationProps) {
46
- // @ts-expect-error API still TBD
47
- this.renderLoop?.onRender?.(animationProps);
48
- // @ts-expect-error API still TBD
49
- this.renderLoop?.frame?.(animationProps);
50
- }
51
-
52
- onFinalize(animationProps: AnimationProps) {
53
- // @ts-expect-error API still TBD
54
- this.renderLoop?.onFinalize?.(animationProps);
55
- // @ts-expect-error API still TBD
56
- this.renderLoop?.destroy?.(animationProps);
57
- }
58
- }
File without changes