@luma.gl/engine 9.0.0-alpha.15 → 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.
- package/dist/animation/key-frames.d.ts +1 -1
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +51 -72
- package/dist/animation/timeline.d.ts +4 -4
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +94 -131
- package/dist/animation-loop/animation-loop.d.ts +2 -3
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +414 -473
- package/dist/animation-loop/animation-props.d.ts +1 -2
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/animation-props.js +0 -1
- package/dist/animation-loop/make-animation-loop.d.ts +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +26 -31
- package/dist/animation-loop/render-loop.js +17 -7
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +31 -0
- package/dist/es5/animation/key-frames.js +84 -0
- package/dist/es5/animation/key-frames.js.map +1 -0
- package/dist/es5/animation/timeline.js +183 -0
- package/dist/es5/animation/timeline.js.map +1 -0
- package/dist/es5/animation-loop/animation-loop.js +534 -0
- package/dist/es5/animation-loop/animation-loop.js.map +1 -0
- package/dist/es5/animation-loop/animation-props.js +2 -0
- package/dist/es5/animation-loop/animation-props.js.map +1 -0
- package/dist/es5/animation-loop/make-animation-loop.js +53 -0
- package/dist/es5/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/es5/animation-loop/render-loop.js +39 -0
- package/dist/es5/animation-loop/render-loop.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/geometries/cone-geometry.js +43 -0
- package/dist/es5/geometries/cone-geometry.js.map +1 -0
- package/dist/es5/geometries/cube-geometry.js +84 -0
- package/dist/es5/geometries/cube-geometry.js.map +1 -0
- package/dist/es5/geometries/cylinder-geometry.js +39 -0
- package/dist/es5/geometries/cylinder-geometry.js.map +1 -0
- package/dist/es5/geometries/ico-sphere-geometry.js +185 -0
- package/dist/es5/geometries/ico-sphere-geometry.js.map +1 -0
- package/dist/es5/geometries/plane-geometry.js +137 -0
- package/dist/es5/geometries/plane-geometry.js.map +1 -0
- package/dist/es5/geometries/sphere-geometry.js +120 -0
- package/dist/es5/geometries/sphere-geometry.js.map +1 -0
- package/dist/es5/geometries/truncated-cone-geometry.js +160 -0
- package/dist/es5/geometries/truncated-cone-geometry.js.map +1 -0
- package/dist/es5/geometry/geometry-table.js +2 -0
- package/dist/es5/geometry/geometry-table.js.map +1 -0
- package/dist/es5/geometry/geometry-utils.js +39 -0
- package/dist/es5/geometry/geometry-utils.js.map +1 -0
- package/dist/es5/geometry/geometry.js +150 -0
- package/dist/es5/geometry/geometry.js.map +1 -0
- package/dist/es5/geometry/primitive-utils.js +2 -0
- package/dist/es5/geometry/primitive-utils.js.map +1 -0
- package/dist/es5/index.js +112 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/clip-space.js +2 -0
- package/dist/es5/lib/clip-space.js.map +1 -0
- package/dist/es5/lib/model-utils.js +52 -0
- package/dist/es5/lib/model-utils.js.map +1 -0
- package/dist/es5/lib/model.js +173 -0
- package/dist/es5/lib/model.js.map +1 -0
- package/dist/es5/lib/pipeline-factory.js +244 -0
- package/dist/es5/lib/pipeline-factory.js.map +1 -0
- package/dist/esm/animation/key-frames.js +57 -0
- package/dist/esm/animation/key-frames.js.map +1 -0
- package/dist/esm/animation/timeline.js +113 -0
- package/dist/esm/animation/timeline.js.map +1 -0
- package/dist/esm/animation-loop/animation-loop.js +367 -0
- package/dist/esm/animation-loop/animation-loop.js.map +1 -0
- package/dist/esm/animation-loop/animation-props.js +2 -0
- package/dist/esm/animation-loop/animation-props.js.map +1 -0
- package/dist/esm/animation-loop/make-animation-loop.js +28 -0
- package/dist/esm/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/esm/animation-loop/render-loop.js +7 -0
- package/dist/esm/animation-loop/render-loop.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/geometries/cone-geometry.js +21 -0
- package/dist/esm/geometries/cone-geometry.js.map +1 -0
- package/dist/esm/geometries/cube-geometry.js +67 -0
- package/dist/esm/geometries/cube-geometry.js.map +1 -0
- package/dist/esm/geometries/cylinder-geometry.js +18 -0
- package/dist/esm/geometries/cylinder-geometry.js.map +1 -0
- package/dist/esm/geometries/ico-sphere-geometry.js +170 -0
- package/dist/esm/geometries/ico-sphere-geometry.js.map +1 -0
- package/dist/esm/geometries/plane-geometry.js +119 -0
- package/dist/esm/geometries/plane-geometry.js.map +1 -0
- package/dist/esm/geometries/sphere-geometry.js +102 -0
- package/dist/esm/geometries/sphere-geometry.js.map +1 -0
- package/dist/esm/geometries/truncated-cone-geometry.js +136 -0
- package/dist/esm/geometries/truncated-cone-geometry.js.map +1 -0
- package/dist/esm/geometry/geometry-table.js +2 -0
- package/dist/esm/geometry/geometry-table.js.map +1 -0
- package/dist/esm/geometry/geometry-utils.js +37 -0
- package/dist/esm/geometry/geometry-utils.js.map +1 -0
- package/dist/esm/geometry/geometry.js +119 -0
- package/dist/esm/geometry/geometry.js.map +1 -0
- package/dist/esm/geometry/primitive-utils.js +2 -0
- package/dist/esm/geometry/primitive-utils.js.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/clip-space.js +2 -0
- package/dist/esm/lib/clip-space.js.map +1 -0
- package/dist/esm/lib/model-utils.js +40 -0
- package/dist/esm/lib/model-utils.js.map +1 -0
- package/dist/esm/lib/model.js +146 -0
- package/dist/esm/lib/model.js.map +1 -0
- package/dist/esm/lib/pipeline-factory.js +180 -0
- package/dist/esm/lib/pipeline-factory.js.map +1 -0
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +12 -17
- package/dist/geometries/cube-geometry.d.ts +1 -1
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +187 -56
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +10 -14
- package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +141 -170
- package/dist/geometries/plane-geometry.d.ts +1 -1
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +93 -121
- package/dist/geometries/sphere-geometry.d.ts +1 -1
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +76 -100
- package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +104 -131
- package/dist/geometry/geometry-table.d.ts +1 -1
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js +0 -1
- package/dist/geometry/geometry-utils.js +22 -41
- package/dist/geometry/geometry.d.ts +4 -4
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +96 -142
- package/dist/geometry/primitive-utils.js +30 -1
- package/dist/index.js +20 -16
- package/dist/lib/clip-space.js +50 -1
- package/dist/lib/model-utils.js +97 -29
- package/dist/lib/model.d.ts +1 -1
- package/dist/lib/model.d.ts.map +1 -1
- package/dist/lib/model.js +122 -166
- package/dist/lib/pipeline-factory.d.ts +3 -3
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +136 -204
- package/package.json +11 -10
- package/dist/animation/key-frames.js.map +0 -1
- package/dist/animation/timeline.js.map +0 -1
- package/dist/animation-loop/animation-loop.js.map +0 -1
- package/dist/animation-loop/animation-props.js.map +0 -1
- package/dist/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/animation-loop/render-loop.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/geometry/geometry-table.js.map +0 -1
- package/dist/geometry/geometry-utils.js.map +0 -1
- package/dist/geometry/geometry.js.map +0 -1
- package/dist/geometry/primitive-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/clip-space.js.map +0 -1
- package/dist/lib/model-utils.js.map +0 -1
- package/dist/lib/model.js.map +0 -1
- package/dist/lib/pipeline-factory.js.map +0 -1
|
@@ -1,219 +1,151 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import { assembleShaders } from '@luma.gl/shadertools';
|
|
3
2
|
const DEFAULT_RENDER_PIPELINE_OPTIONS = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
vs: '',
|
|
4
|
+
fs: '',
|
|
5
|
+
modules: [],
|
|
6
|
+
defines: {},
|
|
7
|
+
inject: {},
|
|
8
|
+
transpileToGLSL100: false,
|
|
9
|
+
layout: null,
|
|
10
|
+
varyings: [],
|
|
11
|
+
bufferMode: 0x8c8d,
|
|
12
|
+
topology: 'triangle-list',
|
|
13
|
+
parameters: {}
|
|
15
14
|
};
|
|
15
|
+
/** Efficiently create shared pipelines with varying parameters */
|
|
16
16
|
export class PipelineFactory {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "device", void 0);
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "stateHash", 0);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "_hashCounter", 0);
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "_hashes", {});
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "_useCounts", {});
|
|
32
|
-
|
|
33
|
-
_defineProperty(this, "_pipelineCache", {});
|
|
34
|
-
|
|
35
|
-
_defineProperty(this, "_getUniforms", {});
|
|
36
|
-
|
|
37
|
-
_defineProperty(this, "_hookFunctions", []);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "_defaultModules", []);
|
|
40
|
-
|
|
41
|
-
this.device = device;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
addDefaultModule(module) {
|
|
45
|
-
if (!this._defaultModules.find(m => m.name === (typeof module === 'string' ? module : module.name))) {
|
|
46
|
-
this._defaultModules.push(module);
|
|
17
|
+
// private readonly _registeredModules = {}; // TODO: Remove? This isn't used anywhere in luma.gl
|
|
18
|
+
static getDefaultPipelineFactory(device) {
|
|
19
|
+
// @ts-expect-error Add to device
|
|
20
|
+
device.defaultPipelineFactory = device.defaultPipelineFactory || new PipelineFactory(device);
|
|
21
|
+
// @ts-expect-error Add to device
|
|
22
|
+
return device.defaultPipelineFactory;
|
|
47
23
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
addShaderHook(hook, opts) {
|
|
59
|
-
if (opts) {
|
|
60
|
-
hook = Object.assign(opts, {
|
|
61
|
-
hook
|
|
62
|
-
});
|
|
24
|
+
constructor(device) {
|
|
25
|
+
this.stateHash = 0; // Used to change hashing if hooks are modified
|
|
26
|
+
this._hashCounter = 0;
|
|
27
|
+
this._hashes = {};
|
|
28
|
+
this._useCounts = {};
|
|
29
|
+
this._pipelineCache = {};
|
|
30
|
+
this._getUniforms = {};
|
|
31
|
+
this._hookFunctions = [];
|
|
32
|
+
this._defaultModules = [];
|
|
33
|
+
this.device = device;
|
|
63
34
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
createRenderPipeline(options) {
|
|
71
|
-
const props = { ...DEFAULT_RENDER_PIPELINE_OPTIONS,
|
|
72
|
-
...options
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const modules = this._getModuleList(props.modules);
|
|
76
|
-
|
|
77
|
-
const hash = this._hashRenderPipeline({ ...props,
|
|
78
|
-
modules
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
if (!this._pipelineCache[hash]) {
|
|
82
|
-
const {
|
|
83
|
-
pipeline,
|
|
84
|
-
getUniforms
|
|
85
|
-
} = this._createRenderPipeline({ ...props,
|
|
86
|
-
modules
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
pipeline.hash = hash;
|
|
90
|
-
this._pipelineCache[hash] = pipeline;
|
|
91
|
-
|
|
92
|
-
this._getUniforms[hash] = getUniforms || (x => ({}));
|
|
93
|
-
|
|
94
|
-
this._useCounts[hash] = 0;
|
|
35
|
+
addDefaultModule(module) {
|
|
36
|
+
if (!this._defaultModules.find((m) => m.name === (typeof module === 'string' ? module : module.name))) {
|
|
37
|
+
this._defaultModules.push(module);
|
|
38
|
+
}
|
|
39
|
+
this.stateHash++;
|
|
95
40
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
getUniforms: this._getUniforms[hash]
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
release(pipeline) {
|
|
105
|
-
const hash = pipeline.hash;
|
|
106
|
-
this._useCounts[hash]--;
|
|
107
|
-
|
|
108
|
-
if (this._useCounts[hash] === 0) {
|
|
109
|
-
this._pipelineCache[hash].destroy();
|
|
110
|
-
|
|
111
|
-
delete this._pipelineCache[hash];
|
|
112
|
-
delete this._getUniforms[hash];
|
|
113
|
-
delete this._useCounts[hash];
|
|
41
|
+
removeDefaultModule(module) {
|
|
42
|
+
const moduleName = typeof module === 'string' ? module : module.name;
|
|
43
|
+
this._defaultModules = this._defaultModules.filter((m) => m.name !== moduleName);
|
|
44
|
+
this.stateHash++;
|
|
114
45
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
_createRenderPipeline(props) {
|
|
122
|
-
const platformInfo = {
|
|
123
|
-
gpu: this.device.info.gpu,
|
|
124
|
-
features: this.device.features
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
if (!props.fs) {
|
|
128
|
-
throw new Error('fs');
|
|
46
|
+
addShaderHook(hook, opts) {
|
|
47
|
+
if (opts) {
|
|
48
|
+
hook = Object.assign(opts, { hook });
|
|
49
|
+
}
|
|
50
|
+
this._hookFunctions.push(hook);
|
|
51
|
+
this.stateHash++;
|
|
129
52
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
pipeline,
|
|
147
|
-
getUniforms: assembled.getUniforms
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_hashRenderPipeline(props) {
|
|
152
|
-
const {
|
|
153
|
-
modules = [],
|
|
154
|
-
varyings = [],
|
|
155
|
-
defines = {},
|
|
156
|
-
inject = {},
|
|
157
|
-
parameters = {}
|
|
158
|
-
} = props;
|
|
159
|
-
|
|
160
|
-
const vsHash = this._getHash(props.vs);
|
|
161
|
-
|
|
162
|
-
const fsHash = props.fs ? this._getHash(props.fs) : 0;
|
|
163
|
-
const moduleHashes = modules.map(m => this._getHash(typeof m === 'string' ? m : m.name)).sort();
|
|
164
|
-
const varyingHashes = varyings.map(v => this._getHash(v));
|
|
165
|
-
const defineKeys = Object.keys(defines).sort();
|
|
166
|
-
const injectKeys = Object.keys(inject).sort();
|
|
167
|
-
const defineHashes = [];
|
|
168
|
-
const injectHashes = [];
|
|
169
|
-
|
|
170
|
-
for (const key of defineKeys) {
|
|
171
|
-
defineHashes.push(this._getHash(key));
|
|
172
|
-
defineHashes.push(this._getHash(String(defines[key])));
|
|
53
|
+
createRenderPipeline(options) {
|
|
54
|
+
const props = { ...DEFAULT_RENDER_PIPELINE_OPTIONS, ...options };
|
|
55
|
+
const modules = this._getModuleList(props.modules); // Combine with default modules
|
|
56
|
+
const hash = this._hashRenderPipeline({ ...props, modules });
|
|
57
|
+
if (!this._pipelineCache[hash]) {
|
|
58
|
+
const { pipeline, getUniforms } = this._createRenderPipeline({ ...props, modules });
|
|
59
|
+
pipeline.hash = hash;
|
|
60
|
+
this._pipelineCache[hash] = pipeline;
|
|
61
|
+
this._getUniforms[hash] = getUniforms || ((x) => ({}));
|
|
62
|
+
this._useCounts[hash] = 0;
|
|
63
|
+
}
|
|
64
|
+
this._useCounts[hash]++;
|
|
65
|
+
return {
|
|
66
|
+
pipeline: this._pipelineCache[hash],
|
|
67
|
+
getUniforms: this._getUniforms[hash]
|
|
68
|
+
};
|
|
173
69
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
70
|
+
release(pipeline) {
|
|
71
|
+
const hash = pipeline.hash;
|
|
72
|
+
this._useCounts[hash]--;
|
|
73
|
+
if (this._useCounts[hash] === 0) {
|
|
74
|
+
this._pipelineCache[hash].destroy();
|
|
75
|
+
delete this._pipelineCache[hash];
|
|
76
|
+
delete this._getUniforms[hash];
|
|
77
|
+
delete this._useCounts[hash];
|
|
78
|
+
}
|
|
178
79
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return "".concat(vsHash, "/").concat(fsHash, "D").concat(defineHashes.join('/'), "M").concat(moduleHashes.join('/'), "I").concat(injectHashes.join('/'), "V").concat(varyingHashes.join('/'), "H").concat(this.stateHash, "B").concat(props.bufferMode).concat(props.transpileToGLSL100 ? 'T' : '', "P").concat(parameterHash);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
_getHash(key) {
|
|
185
|
-
if (this._hashes[key] === undefined) {
|
|
186
|
-
this._hashes[key] = this._hashCounter++;
|
|
80
|
+
getUniforms(pipeline) {
|
|
81
|
+
return this._getUniforms[pipeline.hash] || null;
|
|
187
82
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
83
|
+
// PRIVATE
|
|
84
|
+
_createRenderPipeline(props) {
|
|
85
|
+
const platformInfo = {
|
|
86
|
+
gpu: this.device.info.gpu,
|
|
87
|
+
features: this.device.features
|
|
88
|
+
};
|
|
89
|
+
if (!props.fs) {
|
|
90
|
+
throw new Error('fs');
|
|
91
|
+
}
|
|
92
|
+
const assembled = assembleShaders(platformInfo, { ...props, fs: props.fs, hookFunctions: this._hookFunctions });
|
|
93
|
+
const pipeline = this.device.createRenderPipeline({
|
|
94
|
+
...props,
|
|
95
|
+
vs: this.device.createShader({ stage: 'vertex', source: assembled.vs }),
|
|
96
|
+
fs: assembled.fs ? this.device.createShader({ stage: 'fragment', source: assembled.fs }) : null,
|
|
97
|
+
});
|
|
98
|
+
return { pipeline, getUniforms: assembled.getUniforms };
|
|
202
99
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
100
|
+
/** Calculate a hash based on all the inputs for a render pipeline */
|
|
101
|
+
_hashRenderPipeline(props) {
|
|
102
|
+
const { modules = [], varyings = [], defines = {}, inject = {}, parameters = {} } = props;
|
|
103
|
+
const vsHash = this._getHash(props.vs);
|
|
104
|
+
const fsHash = props.fs ? this._getHash(props.fs) : 0;
|
|
105
|
+
const moduleHashes = modules.map((m) => this._getHash(typeof m === 'string' ? m : m.name)).sort();
|
|
106
|
+
const varyingHashes = varyings.map((v) => this._getHash(v));
|
|
107
|
+
const defineKeys = Object.keys(defines).sort();
|
|
108
|
+
const injectKeys = Object.keys(inject).sort();
|
|
109
|
+
const defineHashes = [];
|
|
110
|
+
const injectHashes = [];
|
|
111
|
+
for (const key of defineKeys) {
|
|
112
|
+
defineHashes.push(this._getHash(key));
|
|
113
|
+
defineHashes.push(this._getHash(String(defines[key])));
|
|
114
|
+
}
|
|
115
|
+
for (const key of injectKeys) {
|
|
116
|
+
injectHashes.push(this._getHash(key));
|
|
117
|
+
injectHashes.push(this._getHash(inject[key]));
|
|
118
|
+
}
|
|
119
|
+
// TODO - hash parameters!
|
|
120
|
+
const parameterHash = JSON.stringify(parameters);
|
|
121
|
+
return `${vsHash}/${fsHash}D${defineHashes.join('/')}M${moduleHashes.join('/')}I${injectHashes.join('/')}V${varyingHashes.join('/')}H${this.stateHash}B${props.bufferMode}${props.transpileToGLSL100 ? 'T' : ''}P${parameterHash}`;
|
|
122
|
+
}
|
|
123
|
+
_getHash(key) {
|
|
124
|
+
if (this._hashes[key] === undefined) {
|
|
125
|
+
this._hashes[key] = this._hashCounter++;
|
|
126
|
+
}
|
|
127
|
+
return this._hashes[key];
|
|
128
|
+
}
|
|
129
|
+
// Dedupe and combine with default modules
|
|
130
|
+
_getModuleList(appModules = []) {
|
|
131
|
+
const modules = new Array(this._defaultModules.length + appModules.length);
|
|
132
|
+
const seen = {};
|
|
133
|
+
let count = 0;
|
|
134
|
+
for (let i = 0, len = this._defaultModules.length; i < len; ++i) {
|
|
135
|
+
const module = this._defaultModules[i];
|
|
136
|
+
const name = module.name;
|
|
137
|
+
modules[count++] = module;
|
|
138
|
+
seen[name] = true;
|
|
139
|
+
}
|
|
140
|
+
for (let i = 0, len = appModules.length; i < len; ++i) {
|
|
141
|
+
const module = appModules[i];
|
|
142
|
+
const name = module.name;
|
|
143
|
+
if (!seen[name]) {
|
|
144
|
+
modules[count++] = module;
|
|
145
|
+
seen[name] = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
modules.length = count;
|
|
149
|
+
return modules;
|
|
212
150
|
}
|
|
213
|
-
|
|
214
|
-
modules.length = count;
|
|
215
|
-
return modules;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
151
|
}
|
|
219
|
-
//# sourceMappingURL=pipeline-factory.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/engine",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.16",
|
|
4
4
|
"description": "WebGL2 Components for High Performance Rendering and Computation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"animation",
|
|
17
17
|
"3d"
|
|
18
18
|
],
|
|
19
|
-
"types": "
|
|
20
|
-
"main": "dist/index.js",
|
|
21
|
-
"module": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"main": "dist/es5/index.js",
|
|
21
|
+
"module": "dist/esm/index.js",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
24
|
"dist",
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
|
-
"@luma.gl/
|
|
35
|
-
"@luma.gl/
|
|
36
|
-
"@luma.gl/
|
|
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",
|
|
37
38
|
"@math.gl/core": "4.0.0-alpha.1",
|
|
38
|
-
"@probe.gl/log": "4.0.0
|
|
39
|
-
"@probe.gl/stats": "4.0.0
|
|
39
|
+
"@probe.gl/log": "^4.0.0",
|
|
40
|
+
"@probe.gl/stats": "^4.0.0"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "697bc4ef1deff8438e2f3be51bf0bd245882106a"
|
|
42
43
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/animation/key-frames.ts"],"names":["KeyFrames","constructor","keyFrames","setKeyFrames","setTime","numKeys","length","times","values","i","_calculateKeys","_lastTime","time","Math","max","getStartTime","startIndex","getEndTime","endIndex","getStartData","getEndData","index","startTime","endTime","factor","min"],"mappings":";AAIA,OAAO,MAAMA,SAAN,CAA4B;AAQjCC,EAAAA,WAAW,CAACC,SAAD,EAA2B;AAAA,wCAPjB,CAAC,CAOgB;;AAAA,sCANnB,CAAC,CAMkB;;AAAA,oCALrB,CAKqB;;AAAA,mCAJpB,EAIoB;;AAAA,oCAHxB,EAGwB;;AAAA,uCAFlB,CAAC,CAEiB;;AACpC,SAAKC,YAAL,CAAkBD,SAAlB;AACA,SAAKE,OAAL,CAAa,CAAb;AACD;;AAEDD,EAAAA,YAAY,CAACD,SAAD,EAAiC;AAC3C,UAAMG,OAAO,GAAGH,SAAS,CAACI,MAA1B;AACA,SAAKC,KAAL,CAAWD,MAAX,GAAoBD,OAApB;AACA,SAAKG,MAAL,CAAYF,MAAZ,GAAqBD,OAArB;;AAEA,SAAK,IAAII,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,OAApB,EAA6B,EAAEI,CAA/B,EAAkC;AAChC,WAAKF,KAAL,CAAWE,CAAX,IAAgBP,SAAS,CAACO,CAAD,CAAT,CAAa,CAA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,KAAL,CAAW,KAAKW,QAAhB,CAAhB;AACA,SAAKM,MAAL,GAAcX,IAAI,CAACY,GAAL,CAASZ,IAAI,CAACC,GAAL,CAAS,CAAT,EAAY,CAACF,IAAI,GAAGU,SAAR,KAAsBC,OAAO,GAAGD,SAAhC,CAAZ,CAAT,EAAkE,CAAlE,CAAd;AACD;;AAnEgC","sourcesContent":["// keyframes\nexport type KeyFrame<T> = [number, T];\n\n/** Holds a list of key frames (timestamped values) */\nexport class KeyFrames<T = number> {\n startIndex: number = -1;\n endIndex: number = -1;\n factor: number = 0;\n times: number[] = [];\n values: T[] = [];\n private _lastTime = -1;\n\n constructor(keyFrames: KeyFrame<T>[]) {\n this.setKeyFrames(keyFrames);\n this.setTime(0);\n }\n\n setKeyFrames(keyFrames: KeyFrame<T>[]): void {\n const numKeys = keyFrames.length;\n this.times.length = numKeys;\n this.values.length = numKeys;\n\n for (let i = 0; i < numKeys; ++i) {\n this.times[i] = keyFrames[i][0];\n this.values[i] = keyFrames[i][1];\n }\n\n this._calculateKeys(this._lastTime);\n }\n\n setTime(time: number): void {\n time = Math.max(0, time);\n\n if (time !== this._lastTime) {\n this._calculateKeys(time);\n this._lastTime = time;\n }\n }\n\n getStartTime(): number {\n return this.times[this.startIndex];\n }\n\n getEndTime(): number {\n return this.times[this.endIndex];\n }\n\n getStartData(): T {\n return this.values[this.startIndex];\n }\n\n getEndData(): T {\n return this.values[this.endIndex];\n }\n\n _calculateKeys(time: number): void {\n let index = 0;\n const numKeys = this.times.length;\n\n for (index = 0; index < numKeys - 2; ++index) {\n if (this.times[index + 1] > time) {\n break;\n }\n }\n\n this.startIndex = index;\n this.endIndex = index + 1;\n\n const startTime = this.times[this.startIndex];\n const endTime = this.times[this.endIndex];\n this.factor = Math.min(Math.max(0, (time - startTime) / (endTime - startTime)), 1);\n }\n}\n"],"file":"key-frames.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/animation/timeline.ts"],"names":["channelHandles","animationHandles","Timeline","constructor","Map","addChannel","props","delay","duration","Number","POSITIVE_INFINITY","rate","repeat","handle","channel","time","_setChannelTime","channels","set","removeChannel","delete","animationHandle","animation","animations","detachAnimation","isFinished","get","undefined","getTime","setTime","Math","max","values","animationData","play","playing","pause","lastEngineTime","reset","attachAnimation","channelHandle","update","engineTime","offsetTime","totalDuration"],"mappings":";AAmCA,IAAIA,cAAc,GAAG,CAArB;AACA,IAAIC,gBAAgB,GAAG,CAAvB;AAEA,OAAO,MAAMC,QAAN,CAAe;AAOpBC,EAAAA,WAAW,GAAG;AAAA,kCANC,CAMD;;AAAA,sCALH,IAAIC,GAAJ,EAKG;;AAAA,wCAJD,IAAIA,GAAJ,EAIC;;AAAA,qCAHK,KAGL;;AAAA,4CAFW,CAAC,CAEZ;AACb;;AAEDC,EAAAA,UAAU,CAACC,KAAD,EAAgC;AACxC,UAAM;AAACC,MAAAA,KAAK,GAAG,CAAT;AAAYC,MAAAA,QAAQ,GAAGC,MAAM,CAACC,iBAA9B;AAAiDC,MAAAA,IAAI,GAAG,CAAxD;AAA2DC,MAAAA,MAAM,GAAG;AAApE,QAAyEN,KAA/E;AAEA,UAAMO,MAAM,GAAGb,cAAc,EAA7B;AACA,UAAMc,OAAgB,GAAG;AACvBC,MAAAA,IAAI,EAAE,CADiB;AAEvBR,MAAAA,KAFuB;AAGvBC,MAAAA,QAHuB;AAIvBG,MAAAA,IAJuB;AAKvBC,MAAAA;AALuB,KAAzB;;AAOA,SAAKI,eAAL,CAAqBF,OAArB,EAA8B,KAAKC,IAAnC;;AACA,SAAKE,QAAL,CAAcC,GAAd,CAAkBL,MAAlB,EAA0BC,OAA1B;AAEA,WAAOD,MAAP;AACD;;AAEDM,EAAAA,aAAa,CAACN,MAAD,EAAuB;AAClC,SAAKI,QAAL,CAAcG,MAAd,CAAqBP,MAArB;;AAEA,SAAK,MAAM,CAACQ,eAAD,EAAkBC,SAAlB,CAAX,IAA2C,KAAKC,UAAhD,EAA4D;AAC1D,UA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QAAR,GAAmBM,OAAO,CAACH,IAA1C;AACD,KAFD,MAEO;AACLG,MAAAA,OAAO,CAACC,IAAR,GAAee,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYY,UAAZ,IAA0B7B,OAAO,CAACN,QAAjD;AACAM,MAAAA,OAAO,CAACC,IAAR,IAAgBD,OAAO,CAACH,IAAxB;AACD;AACF;;AA7HmB","sourcesContent":["// luma.gl, MIT license\n\n/**\n * Timeline channel properties\n * @param delay = 0;\n * @param duration = Number.POSITIVE_INFINITY;\n * @param rate = 1\n * @param repeat = 1\n */\n export type ChannelOptions = {\n delay?: number\n duration?: number\n rate?: number\n repeat?: number\n}\n\nexport type AnimationOptions = {\n setTime: (time: number) => void\n}\n\n type Channel = {\n time: number\n delay: number\n duration: number\n rate: number\n repeat: number\n}\n\ntype Animation = {\n channel?: number;\n animation: {\n setTime: (time: number) => void\n }\n}\n\nlet channelHandles = 1;\nlet animationHandles = 1;\n\nexport class Timeline {\n time: number = 0;\n channels = new Map<number, Channel>();\n animations = new Map<number, Animation>();\n playing: boolean = false;\n lastEngineTime: number = -1;\n\n constructor() {\n }\n\n addChannel(props: ChannelOptions): number {\n const {delay = 0, duration = Number.POSITIVE_INFINITY, rate = 1, repeat = 1} = props;\n\n const handle = channelHandles++;\n const channel: Channel = {\n time: 0,\n delay,\n duration,\n rate,\n repeat\n };\n this._setChannelTime(channel, this.time);\n this.channels.set(handle, channel);\n\n return handle;\n }\n\n removeChannel(handle: number): void {\n this.channels.delete(handle);\n\n for (const [animationHandle, animation] of this.animations) {\n if (animation.channel === handle) {\n this.detachAnimation(animationHandle);\n }\n }\n }\n\n isFinished(handle: number): boolean {\n const channel = this.channels.get(handle);\n if (channel === undefined) {\n return false;\n }\n\n return this.time >= channel.delay + channel.duration * channel.repeat;\n }\n\n getTime(handle?: number): number {\n if (handle === undefined) {\n return this.time;\n }\n\n const channel = this.channels.get(handle);\n\n if (channel === undefined) {\n return -1;\n }\n\n return channel.time;\n }\n\n setTime(time: number): void {\n this.time = Math.max(0, time);\n\n const channels = this.channels.values();\n for (const channel of channels) {\n this._setChannelTime(channel, this.time);\n }\n\n const animations = this.animations.values();\n for (const animationData of animations) {\n const {animation, channel} = animationData;\n animation.setTime(this.getTime(channel));\n }\n }\n\n play(): void {\n this.playing = true;\n }\n\n pause(): void {\n this.playing = false;\n this.lastEngineTime = -1;\n }\n\n reset(): void {\n this.setTime(0);\n }\n\n attachAnimation(animation: AnimationOptions, channelHandle?: number): number {\n const animationHandle = animationHandles++;\n\n this.animations.set(animationHandle, {\n animation,\n channel: channelHandle\n });\n\n animation.setTime(this.getTime(channelHandle));\n\n return animationHandle;\n }\n\n detachAnimation(handle: number): void {\n this.animations.delete(handle);\n }\n\n update(engineTime: number): void {\n if (this.playing) {\n if (this.lastEngineTime === -1) {\n this.lastEngineTime = engineTime;\n }\n this.setTime(this.time + (engineTime - this.lastEngineTime));\n this.lastEngineTime = engineTime;\n }\n }\n\n _setChannelTime(channel: Channel, time: number): void {\n const offsetTime = time - channel.delay;\n const totalDuration = channel.duration * channel.repeat;\n // Note(Tarek): Don't loop on final repeat.\n if (offsetTime >= totalDuration) {\n channel.time = channel.duration * channel.rate;\n } else {\n channel.time = Math.max(0, offsetTime) % channel.duration;\n channel.time *= channel.rate;\n }\n }\n}\n"],"file":"timeline.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/animation-loop/animation-loop.ts"],"names":["luma","requestAnimationFrame","cancelAnimationFrame","Stats","statIdCounter","DEFAULT_ANIMATION_LOOP_PROPS","device","onAddHTML","onInitialize","onRender","onFinalize","onError","error","console","stats","get","useDevicePixels","autoResizeViewport","autoResizeDrawingBuffer","AnimationLoop","constructor","props","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","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","canvasContext","width","height","aspect","time","startTime","Date","now","engineTime","tick","tock","_mousePosition","_getSizeAndAspect","update","Math","floor","getTime","_createInfoDiv","wrapperDiv","document","createElement","body","appendChild","style","position","div","left","bottom","background","html","innerHTML","getPixelSize","clientHeight","clientWidth","gl","viewport","drawingBufferWidth","drawingBufferHeight","resize","timeEnd","timeStart","addEventListener","event","MouseEvent","offsetX","offsetY"],"mappings":";AAEA,SAAQA,IAAR,QAA2B,cAA3B;AACA,SAAQC,qBAAR,EAA+BC,oBAA/B,QAA0D,cAA1D;AAGA,SAAQC,KAAR,QAA0B,iBAA1B;AAEA,IAAIC,aAAa,GAAG,CAApB;AA4BA,MAAMC,4BAA0D,GAAG;AACjEC,EAAAA,MAAM,EAAE,IADyD;AAGjEC,EAAAA,SAAS,EAAE,MAAM,EAHgD;AAIjEC,EAAAA,YAAY,EAAE,YAAY;AAAE,WAAO,IAAP;AAAc,GAJuB;AAKjEC,EAAAA,QAAQ,EAAE,MAAM,CAAE,CAL+C;AAMjEC,EAAAA,UAAU,EAAE,MAAM,CAAE,CAN6C;AAOjEC,EAAAA,OAAO,EAAGC,KAAD,IAAWC,OAAO,CAACD,KAAR,CAAcA,KAAd,CAP6C;AASjEE,EAAAA,KAAK,EAAEd,IAAI,CAACc,KAAL,CAAWC,GAAX,0BAAiCX,aAAa,EAA9C,EAT0D;AAYjEY,EAAAA,eAAe,EAAE,IAZgD;AAajEC,EAAAA,kBAAkB,EAAE,KAb6C;AAcjEC,EAAAA,uBAAuB,EAAE;AAdwC,CAAnE;AAkBA,OAAO,MAAMC,aAAN,CAAoB;AA4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AAL,CAAYwG,EAAZ,CAAeC,QAAf,CAAwB,CAAxB,EAA2B,CAA3B,EAA8B,KAAKzG,MAAL,CAAYwG,EAAZ,CAAeE,kBAA7C,EAAiE,KAAK1G,MAAL,CAAYwG,EAAZ,CAAeG,mBAAhF;AACD;AACF;;AAMD3C,EAAAA,0BAA0B,GAAG;AAC3B,QAAI,KAAKjD,KAAL,CAAWH,uBAAf,EAAwC;AAAA;;AACtC,4BAAKZ,MAAL,yFAAasE,aAAb,gFAA4BsC,MAA5B,CAAmC;AAAClG,QAAAA,eAAe,EAAE,KAAKK,KAAL,CAAWL;AAA7B,OAAnC;AACD;AACF;;AAEDkC,EAAAA,YAAY,GAAG;AACb,SAAKxB,SAAL,CAAeyF,OAAf;AACA,SAAKzF,SAAL,CAAe0F,SAAf;AAmBD;;AAED3D,EAAAA,UAAU,GAAG;AACX,SAAKjC,OAAL,CAAa2F,OAAb;AAMD;;AAID/C,EAAAA,mBAAmB,GAAG;AACpB,QAAI,KAAKF,MAAT,EAAiB;AACf,WAAKA,MAAL,CAAYmD,gBAAZ,CAA6B,WAA7B,EAA0C,KAAKtF,YAA/C;AACA,WAAKmC,MAAL,CAAYmD,gBAAZ,CAA6B,YAA7B,EAA2C,KAAKrF,aAAhD;AACD;AACF;;AAEDD,EAAAA,YAAY,CAACuF,KAAD,EAAe;AACzB,QAAIA,KAAK,YAAYC,UAArB,EAAiC;AAC/B,WAAK3E,kBAAL,GAA0B2C,cAA1B,GAA2C,CAAC+B,KAAK,CAACE,OAAP,EAAgBF,KAAK,CAACG,OAAtB,CAA3C;AACD;AACF;;AAEDzF,EAAAA,aAAa,CAACsF,KAAD,EAAe;AAC1B,SAAK1E,kBAAL,GAA0B2C,cAA1B,GAA2C,IAA3C;AACD;;AA7ewB","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"],"file":"animation-loop.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"animation-props.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/animation-loop/make-animation-loop.ts"],"names":["luma","AnimationLoop","makeAnimationLoop","AnimationLoopTemplateCtor","props","renderLoop","device","createDevice","animationLoop","onInitialize","animationProps","onRender","onFinalize","getInfo","info"],"mappings":"AACA,SAAQA,IAAR,QAAmB,cAAnB;AAEA,SAAQC,aAAR,QAAgD,kBAAhD;AAMA,OAAO,SAASC,iBAAT,CAA2BC,yBAA3B,EAAoFC,KAApF,EAAmI;AACxI,MAAIC,UAAwC,GAAG,IAA/C;AAEA,QAAMC,MAAM,GAAG,CAAAF,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEE,MAAP,KAAiBN,IAAI,CAACO,YAAL,EAAhC;AAGA,QAAMC,aAAa,GAAG,IAAIP,aAAJ,CAAkB,EACtC,GAAIG,KADkC;AAGtCE,IAAAA,MAHsC;;AAKtC,UAAMG,YAAN,CAAmBC,cAAnB,EAAqE;AAAA;;AAEnEL,MAAAA,UAAU,GAAG,IAAIF,yBAAJ,CAA8BO,cAA9B,CAAb;AAEA,aAAO,sBAAML,UAAN,gDAAM,YAAYI,YAAZ,CAAyBC,cAAzB,CAAN,CAAP;AACD,KAVqC;;AAYtCC,IAAAA,QAAQ,EAAGD,cAAD;AAAA;;AAAA,6BAAoCL,UAApC,iDAAoC,aAAYM,QAAZ,CAAqBD,cAArB,CAApC;AAAA,KAZ4B;AActCE,IAAAA,UAAU,EAAGF,cAAD;AAAA;;AAAA,6BAAoCL,UAApC,iDAAoC,aAAYO,UAAZ,CAAuBF,cAAvB,CAApC;AAAA;AAd0B,GAAlB,CAAtB;;AAkBAF,EAAAA,aAAa,CAACK,OAAd,GAAwB,MAAM;AAE5B,WAAO,KAAKV,yBAAL,CAA+BW,IAAtC;AACD,GAHD;;AAQA,SAAON,aAAP;AACD","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"],"file":"make-animation-loop.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/animation-loop/render-loop.ts"],"names":["AnimationLoopTemplate","constructor","animationProps","onInitialize"],"mappings":"AAiBA,OAAO,MAAeA,qBAAf,CAAqC;AAC1CC,EAAAA,WAAW,CAACC,cAAD,EAAkC,CAAE;;AAC7B,QAAZC,YAAY,CAACD,cAAD,EAAmD;AAAE,WAAO,IAAP;AAAc;;AAF3C","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"],"file":"render-loop.js"}
|
package/dist/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,IAAX,GAAkBD,UAAU,CAACC,IAAX,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,IAAzB,EAA+BH,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"file":"bundle.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geometries/cone-geometry.ts"],"names":["uid","TruncatedConeGeometry","ConeGeometry","constructor","props","id","radius","cap","topRadius","topCap","Boolean","bottomCap","bottomRadius"],"mappings":"AAAA,SAAQA,GAAR,QAAkB,cAAlB;AACA,SAAQC,qBAAR,QAAoC,2BAApC;AAQA,OAAO,MAAMC,YAAN,SAA2BD,qBAA3B,CAAiD;AACtDE,EAAAA,WAAW,CAACC,KAAwB,GAAG,EAA5B,EAAgC;AACzC,UAAM;AAACC,MAAAA,EAAE,GAAGL,GAAG,CAAC,eAAD,CAAT;AAA4BM,MAAAA,MAAM,GAAG,CAArC;AAAwCC,MAAAA,GAAG,GAAG;AAA9C,QAAsDH,KAA5D;AACA,UAAM,EACJ,GAAGA,KADC;AAEJC,MAAAA,EAFI;AAGJG,MAAAA,SAAS,EAAE,CAHP;AAIJC,MAAAA,MAAM,EAAEC,OAAO,CAACH,GAAD,CAJX;AAKJI,MAAAA,SAAS,EAAED,OAAO,CAACH,GAAD,CALd;AAMJK,MAAAA,YAAY,EAAEN;AANV,KAAN;AAQD;;AAXqD","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"],"file":"cone-geometry.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geometries/cube-geometry.ts"],"names":["uid","Geometry","CubeGeometry","constructor","props","id","indices","size","value","CUBE_INDICES","attributes","ATTRIBUTES","undefined","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"],"m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7C,CAjC6C,EAkCtD,CAlCsD,EAkCnD,CAlCmD,EAkChD,CAlCgD,EAkC7C,CAlC6C,EAoCtD,CApCsD,EAoCnD,CApCmD,EAoChD,CApCgD,EAoC7C,CApC6C,EAqCtD,CArCsD,EAqCnD,CArCmD,EAqChD,CArCgD,EAqC7C,CArC6C,EAsCtD,CAtCsD,EAsCnD,CAtCmD,EAsChD,CAtCgD,EAsC7C,CAtC6C,EAuCtD,CAvCsD,EAuCnD,CAvCmD,EAuChD,CAvCgD,EAuC7C,CAvC6C,EAwCtD,CAxCsD,EAwCnD,CAxCmD,EAwChD,CAxCgD,EAwC7C,CAxC6C,EAyCtD,CAzCsD,EAyCnD,CAzCmD,EAyChD,CAzCgD,EAyC7C,CAzC6C,CAAjB,CAAhC;AA4CP,MAAML,UAAU,GAAG;AACjBW,EAAAA,QAAQ,EAAE;AAACf,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAEO;AAAjB,GADO;AAEjBQ,EAAAA,MAAM,EAAE;AAAChB,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAES;AAAjB,GAFS;AAGjBO,EAAAA,UAAU,EAAE;AAACjB,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAEU;AAAjB;AAHK,CAAnB;AAMA,MAAML,sBAAsB,GAAG;AAC7BS,EAAAA,QAAQ,EAAE;AAACf,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAEW;AAAjB,GADmB;AAG7BK,EAAAA,UAAU,EAAE;AAACjB,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAEY;AAAjB,GAHiB;AAI7BK,EAAAA,OAAO,EAAE;AAAClB,IAAAA,IAAI,EAAE,CAAP;AAAUC,IAAAA,KAAK,EAAEa;AAAjB;AAJoB,CAA/B","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"],"file":"cube-geometry.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geometries/cylinder-geometry.ts"],"names":["uid","TruncatedConeGeometry","CylinderGeometry","constructor","props","id","radius","bottomRadius","topRadius"],"mappings":"AAAA,SAAQA,GAAR,QAAkB,cAAlB;AACA,SAAQC,qBAAR,QAAoC,2BAApC;AAQA,OAAO,MAAMC,gBAAN,SAA+BD,qBAA/B,CAAqD;AAC1DE,EAAAA,WAAW,CAACC,KAA4B,GAAG,EAAhC,EAAoC;AAC7C,UAAM;AAACC,MAAAA,EAAE,GAAGL,GAAG,CAAC,mBAAD,CAAT;AAAgCM,MAAAA,MAAM,GAAG;AAAzC,QAA8CF,KAApD;AACA,UAAM,EACJ,GAAGA,KADC;AAEJC,MAAAA,EAFI;AAGJE,MAAAA,YAAY,EAAED,MAHV;AAIJE,MAAAA,SAAS,EAAEF;AAJP,KAAN;AAMD;;AATyD","sourcesContent":["import {uid} from '@luma.gl/api';\nimport {TruncatedConeGeometry} from './truncated-cone-geometry';\n\nexport type CylinderGeometryProps = {\n id?: string;\n radius?: number;\n attributes?: any;\n};\n\nexport class CylinderGeometry extends TruncatedConeGeometry {\n constructor(props: CylinderGeometryProps = {}) {\n const {id = uid('cylinder-geometry'), radius = 1} = props;\n super({\n ...props,\n id,\n bottomRadius: radius,\n topRadius: radius\n });\n }\n}\n"],"file":"cylinder-geometry.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geometries/ico-sphere-geometry.ts"],"names":["uid","Vector3","Geometry","ICO_POSITIONS","ICO_INDICES","IcoSphereGeometry","constructor","props","id","indices","attributes","tesselateIcosaHedron","iterations","PI","Math","PI2","positions","push","getMiddlePoint","pointMemo","i1","i2","mini","maxi","key","x1","y1","z1","x2","y2","z2","xm","ym","zm","len","sqrt","length","i","indices2","j","a","b","c","normals","Array","texCoords","l","i3","in1","in2","in3","iu1","iu2","iu3","theta1","acos","phi1","atan2","v1","u1","theta2","phi2","v2","u2","x3","y3","z3","theta3","phi3","v3","u3","vec1","vec2","normal","cross","normalize","newIndex","x","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O,CAACM,GAAG,GAAG,CAAP,CAAP,GAAmBN,OAAO,CAACO,GAAG,GAAG,CAAP,CAAP,GAAmBuB,MAAM,CAACM,CAAhE;AAEAlC,IAAAA,SAAS,CAACM,GAAG,GAAG,CAAP,CAAT,GAAqBQ,EAArB;AACAd,IAAAA,SAAS,CAACM,GAAG,GAAG,CAAP,CAAT,GAAqBO,EAArB;AAEAb,IAAAA,SAAS,CAACO,GAAG,GAAG,CAAP,CAAT,GAAqBW,EAArB;AACAlB,IAAAA,SAAS,CAACO,GAAG,GAAG,CAAP,CAAT,GAAqBU,EAArB;AAEAjB,IAAAA,SAAS,CAACQ,GAAG,GAAG,CAAP,CAAT,GAAqBiB,EAArB;AACAzB,IAAAA,SAAS,CAACQ,GAAG,GAAG,CAAP,CAAT,GAAqBgB,EAArB;AACD;;AAED,SAAO;AACL5D,IAAAA,OAAO,EAAE;AAACuE,MAAAA,IAAI,EAAE,CAAP;AAAUC,MAAAA,KAAK,EAAE,IAAIC,WAAJ,CAAgBzE,OAAhB;AAAjB,KADJ;AAELC,IAAAA,UAAU,EAAE;AACVyE,MAAAA,QAAQ,EAAE;AAACH,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAE,IAAIG,YAAJ,CAAiBpE,SAAjB;AAAjB,OADA;AAEVqE,MAAAA,MAAM,EAAE;AAACL,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAE,IAAIG,YAAJ,CAAiBzC,OAAjB;AAAjB,OAFE;AAGV2C,MAAAA,UAAU,EAAE;AAACN,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAE,IAAIG,YAAJ,CAAiBvC,SAAjB;AAAjB;AAHF;AAFP,GAAP;AAQD","sourcesContent":["import {uid} from '@luma.gl/api';\nimport {Vector3} from '@math.gl/core';\nimport Geometry from '../geometry/geometry';\n\n/* eslint-disable comma-spacing, max-statements, complexity */\n\nconst ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];\nconst ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];\n\nexport type IcoSphereGeometryProps = {\n id?: string;\n radius?: number;\n iterations?: number;\n attributes?: any\n};\n\nexport class IcoSphereGeometry extends Geometry {\n constructor(props: IcoSphereGeometryProps = {}) {\n const {id = uid('ico-sphere-geometry')} = props;\n const {indices, attributes} = tesselateIcosaHedron(props);\n super({\n ...props,\n id,\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\nfunction tesselateIcosaHedron(props: IcoSphereGeometryProps) {\n const {iterations = 0} = props;\n\n const PI = Math.PI;\n const PI2 = PI * 2;\n\n const positions = [...ICO_POSITIONS];\n let indices = [...ICO_INDICES];\n\n positions.push();\n indices.push();\n\n const getMiddlePoint = (() => {\n const pointMemo: Record<string, number> = {};\n\n return (i1: number, i2: number) => {\n i1 *= 3;\n i2 *= 3;\n const mini = i1 < i2 ? i1 : i2;\n const maxi = i1 > i2 ? i1 : i2;\n const key = `${mini}|${maxi}`;\n\n if (key in pointMemo) {\n return pointMemo[key];\n }\n\n const x1 = positions[i1];\n const y1 = positions[i1 + 1];\n const z1 = positions[i1 + 2];\n const x2 = positions[i2];\n const y2 = positions[i2 + 1];\n const z2 = positions[i2 + 2];\n let xm = (x1 + x2) / 2;\n let ym = (y1 + y2) / 2;\n let zm = (z1 + z2) / 2;\n const len = Math.sqrt(xm * xm + ym * ym + zm * zm);\n\n xm /= len;\n ym /= len;\n zm /= len;\n\n positions.push(xm, ym, zm);\n\n return (pointMemo[key] = positions.length / 3 - 1);\n };\n })();\n\n for (let i = 0; i < iterations; i++) {\n const indices2: number[] = [];\n for (let j = 0; j < indices.length; j += 3) {\n const a = getMiddlePoint(indices[j + 0], indices[j + 1]);\n const b = getMiddlePoint(indices[j + 1], indices[j + 2]);\n const c = getMiddlePoint(indices[j + 2], indices[j + 0]);\n\n indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);\n }\n indices = indices2;\n }\n\n // Calculate texCoords and normals\n const normals = new Array(positions.length);\n const texCoords = new Array((positions.length / 3) * 2);\n\n const l = indices.length;\n for (let i = l - 3; i >= 0; i -= 3) {\n const i1 = indices[i + 0];\n const i2 = indices[i + 1];\n const i3 = indices[i + 2];\n const in1 = i1 * 3;\n const in2 = i2 * 3;\n const in3 = i3 * 3;\n const iu1 = i1 * 2;\n const iu2 = i2 * 2;\n const iu3 = i3 * 2;\n const x1 = positions[in1 + 0];\n const y1 = positions[in1 + 1];\n const z1 = positions[in1 + 2];\n const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));\n const phi1 = Math.atan2(y1, x1) + PI;\n const v1 = theta1 / PI;\n const u1 = 1 - phi1 / PI2;\n const x2 = positions[in2 + 0];\n const y2 = positions[in2 + 1];\n const z2 = positions[in2 + 2];\n const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));\n const phi2 = Math.atan2(y2, x2) + PI;\n const v2 = theta2 / PI;\n const u2 = 1 - phi2 / PI2;\n const x3 = positions[in3 + 0];\n const y3 = positions[in3 + 1];\n const z3 = positions[in3 + 2];\n const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));\n const phi3 = Math.atan2(y3, x3) + PI;\n const v3 = theta3 / PI;\n const u3 = 1 - phi3 / PI2;\n const vec1 = [x3 - x2, y3 - y2, z3 - z2];\n const vec2 = [x1 - x2, y1 - y2, z1 - z2];\n const normal = new Vector3(vec1).cross(vec2).normalize();\n let newIndex;\n\n if (\n (u1 === 0 || u2 === 0 || u3 === 0) &&\n (u1 === 0 || u1 > 0.5) &&\n (u2 === 0 || u2 > 0.5) &&\n (u3 === 0 || u3 > 0.5)\n ) {\n positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v1;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n\n positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v2;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n\n positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v3;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n }\n\n normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;\n normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;\n normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;\n\n texCoords[iu1 + 0] = u1;\n texCoords[iu1 + 1] = v1;\n\n texCoords[iu2 + 0] = u2;\n texCoords[iu2 + 1] = v2;\n\n texCoords[iu3 + 0] = u3;\n texCoords[iu3 + 1] = v3;\n }\n\n return {\n indices: {size: 1, value: new Uint16Array(indices)},\n attributes: {\n POSITION: {size: 3, value: new Float32Array(positions)},\n NORMAL: {size: 3, value: new Float32Array(normals)},\n TEXCOORD_0: {size: 2, value: new Float32Array(texCoords)}\n }\n };\n}\n"],"file":"ico-sphere-geometry.js"}
|