lecodes-cli 0.1.3 → 0.1.6
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/index.js +740 -267
- package/package.json +4 -3
- package/runtime/inject.js +4629 -0
- package/runtime/gl-matrix/common.js +0 -54
- package/runtime/gl-matrix/header.js +0 -12
- package/runtime/gl-matrix/index.js +0 -11
- package/runtime/gl-matrix/mat2.js +0 -425
- package/runtime/gl-matrix/mat2d.js +0 -476
- package/runtime/gl-matrix/mat3.js +0 -765
- package/runtime/gl-matrix/mat4.js +0 -1947
- package/runtime/gl-matrix/quat.js +0 -737
- package/runtime/gl-matrix/quat2.js +0 -822
- package/runtime/gl-matrix/vec2.js +0 -620
- package/runtime/gl-matrix/vec3.js +0 -791
- package/runtime/gl-matrix/vec4.js +0 -652
- package/runtime/worker/animate.js +0 -304
- package/runtime/worker/chunk-4ZN32GYS.js +0 -34
- package/runtime/worker/chunk-G5ZA3LKB.js +0 -52
- package/runtime/worker/chunk-MI3UXE5H.js +0 -1395
- package/runtime/worker/creator.js +0 -930
- package/runtime/worker/globals.js +0 -208
- package/runtime/worker/ui.js +0 -763
- package/runtime/worker/utils.js +0 -16
|
@@ -1,930 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ARScene,
|
|
3
|
-
Camera,
|
|
4
|
-
Component,
|
|
5
|
-
Entity,
|
|
6
|
-
FormData,
|
|
7
|
-
LitMaterial,
|
|
8
|
-
Material,
|
|
9
|
-
Mesh,
|
|
10
|
-
MeshGeometry,
|
|
11
|
-
Ray,
|
|
12
|
-
Scene,
|
|
13
|
-
ShadowMaterial,
|
|
14
|
-
Texture,
|
|
15
|
-
UnlitMaterial,
|
|
16
|
-
VideoMaterial,
|
|
17
|
-
createCubeGeometry,
|
|
18
|
-
createCubeMesh,
|
|
19
|
-
createCylinderGeometry,
|
|
20
|
-
createCylinderMesh,
|
|
21
|
-
createPlaneGeometry,
|
|
22
|
-
createPlaneMesh,
|
|
23
|
-
createSphereGeometry,
|
|
24
|
-
createSphereMesh,
|
|
25
|
-
entityMap,
|
|
26
|
-
getEntityById,
|
|
27
|
-
getPosition,
|
|
28
|
-
getScale,
|
|
29
|
-
normalizeInPlace,
|
|
30
|
-
registerTouchEndEvent,
|
|
31
|
-
registerTouchStartEvent,
|
|
32
|
-
vec3Cross
|
|
33
|
-
} from "./chunk-MI3UXE5H.js";
|
|
34
|
-
|
|
35
|
-
// ../worker/src/components/Animation.ts
|
|
36
|
-
var animatorRegistered = false;
|
|
37
|
-
var onAnimationComplete = (entityId, clipIndex) => {
|
|
38
|
-
const entity = entityMap.get(entityId);
|
|
39
|
-
const controller = entity.animation;
|
|
40
|
-
if (clipIndex !== controller["_clip"]) return true;
|
|
41
|
-
if (!controller["_loop"]) {
|
|
42
|
-
controller["_playing"] = false;
|
|
43
|
-
Entity.dispatch(entity, "completed", clipIndex);
|
|
44
|
-
} else {
|
|
45
|
-
Entity.dispatch(entity, "loopReached", clipIndex);
|
|
46
|
-
}
|
|
47
|
-
return controller["_playing"];
|
|
48
|
-
};
|
|
49
|
-
var Animation = class extends Component {
|
|
50
|
-
name = "animation";
|
|
51
|
-
_playing = false;
|
|
52
|
-
_clip = 0;
|
|
53
|
-
_speed = 1;
|
|
54
|
-
_loop = false;
|
|
55
|
-
constructor() {
|
|
56
|
-
super();
|
|
57
|
-
}
|
|
58
|
-
get clips() {
|
|
59
|
-
return _creator.getGlbAnimations(this.entity._id);
|
|
60
|
-
}
|
|
61
|
-
get playing() {
|
|
62
|
-
return this._playing;
|
|
63
|
-
}
|
|
64
|
-
set playing(value) {
|
|
65
|
-
this._playing = value;
|
|
66
|
-
_creator.setAnimation(this.entity._id, this._playing, this._clip, this._speed);
|
|
67
|
-
}
|
|
68
|
-
play(clip) {
|
|
69
|
-
if (typeof clip === "number") {
|
|
70
|
-
this._clip = clip;
|
|
71
|
-
}
|
|
72
|
-
this.playing = true;
|
|
73
|
-
if (!animatorRegistered) {
|
|
74
|
-
_creator.setOnAnimationComplete(onAnimationComplete);
|
|
75
|
-
animatorRegistered = true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
pause() {
|
|
79
|
-
this.playing = false;
|
|
80
|
-
}
|
|
81
|
-
get speed() {
|
|
82
|
-
return this._speed;
|
|
83
|
-
}
|
|
84
|
-
set speed(value) {
|
|
85
|
-
this._speed = value;
|
|
86
|
-
_creator.setAnimation(this.entity._id, this._playing, this._clip, this._speed);
|
|
87
|
-
}
|
|
88
|
-
get time() {
|
|
89
|
-
return _creator.getAnimationTime(this.entity._id);
|
|
90
|
-
}
|
|
91
|
-
set time(value) {
|
|
92
|
-
_creator.setAnimationTime(this.entity._id, this._clip, value);
|
|
93
|
-
}
|
|
94
|
-
get loop() {
|
|
95
|
-
return this._loop;
|
|
96
|
-
}
|
|
97
|
-
set loop(value) {
|
|
98
|
-
this._loop = value;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// ../worker/src/components/Collider.ts
|
|
103
|
-
var primitives = ["box", "sphere"];
|
|
104
|
-
var Collider = class extends Component {
|
|
105
|
-
name = "collider";
|
|
106
|
-
_form;
|
|
107
|
-
created = false;
|
|
108
|
-
constructor(form = "box") {
|
|
109
|
-
super();
|
|
110
|
-
this._form = form;
|
|
111
|
-
}
|
|
112
|
-
get form() {
|
|
113
|
-
return this._form;
|
|
114
|
-
}
|
|
115
|
-
set form(form) {
|
|
116
|
-
this._form = form;
|
|
117
|
-
if (this.entity) {
|
|
118
|
-
_creator.setColliderFromMesh(this.entity._id, this.entity._id, primitives.indexOf(form));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
setFromMesh(mesh) {
|
|
122
|
-
_creator.setColliderFromMesh(this.entity._id, mesh.entity._id, primitives.indexOf(this._form));
|
|
123
|
-
}
|
|
124
|
-
set(form, center, arg) {
|
|
125
|
-
this.created = true;
|
|
126
|
-
if (!this.entity) return;
|
|
127
|
-
if (form === "box") {
|
|
128
|
-
this._form = "box";
|
|
129
|
-
_creator.setColliderBox(this.entity._id, center[0], center[1], center[2], arg[0], arg[1], arg[2]);
|
|
130
|
-
} else if (form === "sphere") {
|
|
131
|
-
this._form = "sphere";
|
|
132
|
-
_creator.setColliderSphere(this.entity._id, center[0], center[1], center[2], arg);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
onAssign(entityId) {
|
|
136
|
-
if (this.entity.hasComponent(Mesh)) {
|
|
137
|
-
_creator.setColliderFromMesh(entityId, entityId, primitives.indexOf(this._form));
|
|
138
|
-
}
|
|
139
|
-
if (!this.entity._onListenerAdded) {
|
|
140
|
-
this.entity._onListenerAdded = {
|
|
141
|
-
"click": registerTouchEndEvent,
|
|
142
|
-
"touchstart": registerTouchStartEvent
|
|
143
|
-
};
|
|
144
|
-
} else {
|
|
145
|
-
this.entity._onListenerAdded["click"] = registerTouchEndEvent, this.entity._onListenerAdded["touchstart"] = registerTouchStartEvent;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// ../worker/src/components/Particles.ts
|
|
151
|
-
var Particles = class extends Component {
|
|
152
|
-
name = "particles";
|
|
153
|
-
custom = new Proxy([], {
|
|
154
|
-
set(target, property, value) {
|
|
155
|
-
if (property === "entityId") {
|
|
156
|
-
target.entityId = value;
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
const i = parseInt(property);
|
|
160
|
-
target[i] = value;
|
|
161
|
-
if (target.entityId) {
|
|
162
|
-
if (typeof value === "number") {
|
|
163
|
-
_creator.setParticleSystemParamValue(target.entityId, i, value);
|
|
164
|
-
} else if ("min" in value) {
|
|
165
|
-
_creator.setParticleSystemParamRange(target.entityId, i, value.min, value.max);
|
|
166
|
-
} else {
|
|
167
|
-
if (typeof value.value === "number") {
|
|
168
|
-
_creator.setParticleSystemParamValue(target.entityId, i, value.value);
|
|
169
|
-
} else if (value.value) {
|
|
170
|
-
_creator.setParticleSystemParamRange(target.entityId, i, value.value.min, value.value.max);
|
|
171
|
-
}
|
|
172
|
-
if (value.inc) {
|
|
173
|
-
_creator.setParticleSystemParamCurveA(target.entityId, i, value.inc, 1);
|
|
174
|
-
}
|
|
175
|
-
if (value.inc_b) {
|
|
176
|
-
_creator.setParticleSystemParamCurveB(target.entityId, i, value.inc_b);
|
|
177
|
-
}
|
|
178
|
-
if (value.mul) {
|
|
179
|
-
_creator.setParticleSystemParamCurveA(target.entityId, i, value.mul, 0);
|
|
180
|
-
}
|
|
181
|
-
if (value.mul_b) {
|
|
182
|
-
_creator.setParticleSystemParamCurveB(target.entityId, i, value.mul_b);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
_material;
|
|
190
|
-
constructor(material) {
|
|
191
|
-
super();
|
|
192
|
-
this._material = material;
|
|
193
|
-
}
|
|
194
|
-
spawnParticles(count) {
|
|
195
|
-
_creator.spawnParticles(this.entity._id, count);
|
|
196
|
-
}
|
|
197
|
-
_rate;
|
|
198
|
-
get rate() {
|
|
199
|
-
return this._rate ?? 5;
|
|
200
|
-
}
|
|
201
|
-
set rate(val) {
|
|
202
|
-
this._rate = val;
|
|
203
|
-
if (this.entity) {
|
|
204
|
-
if (typeof val === "number") {
|
|
205
|
-
_creator.setParticleSystemRateValue(this.entity._id, val);
|
|
206
|
-
} else {
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
_shape;
|
|
211
|
-
get shape() {
|
|
212
|
-
return this._shape ?? { type: "point", v: [0, 0, 0] };
|
|
213
|
-
}
|
|
214
|
-
set shape(shape) {
|
|
215
|
-
this._shape = shape;
|
|
216
|
-
if (this.entity) {
|
|
217
|
-
switch (shape.type) {
|
|
218
|
-
case "point":
|
|
219
|
-
_creator.setParticleSystemShapePoint(this.entity._id, shape.v[0], shape.v[1], shape.v[2]);
|
|
220
|
-
break;
|
|
221
|
-
case "box":
|
|
222
|
-
_creator.setParticleSystemShapeBox(this.entity._id, shape.min[0], shape.min[1], shape.min[2], shape.max[0], shape.max[1], shape.max[2]);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
_startVelocity;
|
|
228
|
-
get startVelocity() {
|
|
229
|
-
return this._startVelocity ?? [0, 0, 0];
|
|
230
|
-
}
|
|
231
|
-
set startVelocity(val) {
|
|
232
|
-
this._startVelocity = val;
|
|
233
|
-
if (this.entity) {
|
|
234
|
-
if (Array.isArray(val) || val instanceof Float32Array) {
|
|
235
|
-
_creator.setParticleSystemVelocityValue(this.entity._id, 1, val[0], val[1], val[2]);
|
|
236
|
-
} else {
|
|
237
|
-
if ("from" in val) {
|
|
238
|
-
_creator.setParticleSystemVelocityValue(this.entity._id, 2, val.from[0], val.from[1], val.from[2]);
|
|
239
|
-
} else if ("to" in val) {
|
|
240
|
-
_creator.setParticleSystemVelocityValue(this.entity._id, 3, val.to[0], val.to[1], val.to[2]);
|
|
241
|
-
} else if ("dir" in val) {
|
|
242
|
-
_creator.setParticleSystemVelocityValue(this.entity._id, 1, val.dir[0], val.dir[1], val.dir[2]);
|
|
243
|
-
} else {
|
|
244
|
-
_creator.setParticleSystemVelocityValue(this.entity._id, 0, 0, 0, 0);
|
|
245
|
-
}
|
|
246
|
-
if ("speed" in val) {
|
|
247
|
-
if (typeof val.speed === "number") {
|
|
248
|
-
_creator.setParticleSystemVelocitySpeedValue(this.entity._id, val.speed);
|
|
249
|
-
} else if (val.speed) {
|
|
250
|
-
_creator.setParticleSystemVelocitySpeedRange(this.entity._id, val.speed.min, val.speed.max);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if ("randomizeAngle" in val && val.randomizeAngle) {
|
|
254
|
-
_creator.setParticleSystemVelocityRndAngle(
|
|
255
|
-
this.entity._id,
|
|
256
|
-
val.randomizeAngle.min[0],
|
|
257
|
-
val.randomizeAngle.min[1],
|
|
258
|
-
val.randomizeAngle.min[2],
|
|
259
|
-
val.randomizeAngle.max[0],
|
|
260
|
-
val.randomizeAngle.max[1],
|
|
261
|
-
val.randomizeAngle.max[2]
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
_gravity;
|
|
268
|
-
get gravity() {
|
|
269
|
-
return this._drag ?? 0;
|
|
270
|
-
}
|
|
271
|
-
set gravity(val) {
|
|
272
|
-
this._gravity = val;
|
|
273
|
-
if (this.entity) {
|
|
274
|
-
_creator.setParticleSystemGravityValue(this.entity._id, val);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
_drag;
|
|
278
|
-
get drag() {
|
|
279
|
-
return this._drag ?? 0;
|
|
280
|
-
}
|
|
281
|
-
set drag(val) {
|
|
282
|
-
this._drag = val;
|
|
283
|
-
if (this.entity) {
|
|
284
|
-
_creator.setParticleSystemDragValue(this.entity._id, val);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
get size() {
|
|
288
|
-
return this.custom[0];
|
|
289
|
-
}
|
|
290
|
-
set size(val) {
|
|
291
|
-
this.custom[0] = val;
|
|
292
|
-
}
|
|
293
|
-
get rotation() {
|
|
294
|
-
return this.custom[1];
|
|
295
|
-
}
|
|
296
|
-
set rotation(val) {
|
|
297
|
-
this.custom[1] = val;
|
|
298
|
-
}
|
|
299
|
-
_lifetime;
|
|
300
|
-
get lifetime() {
|
|
301
|
-
return this._lifetime ?? 5;
|
|
302
|
-
}
|
|
303
|
-
set lifetime(val) {
|
|
304
|
-
this._lifetime = val;
|
|
305
|
-
if (this.entity) {
|
|
306
|
-
if (typeof val === "number") {
|
|
307
|
-
_creator.setParticleSystemLifetimeValue(this.entity._id, val);
|
|
308
|
-
} else {
|
|
309
|
-
_creator.setParticleSystemLifetimeRange(this.entity._id, val.min, val.max);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
_color;
|
|
314
|
-
get color() {
|
|
315
|
-
return this._color ?? "#FFFFFF";
|
|
316
|
-
}
|
|
317
|
-
set color(value) {
|
|
318
|
-
this._color = value;
|
|
319
|
-
if (typeof value === "string") {
|
|
320
|
-
_creator.setParticleSystemColorValue(this.entity._id, value);
|
|
321
|
-
} else if ("min" in value) {
|
|
322
|
-
_creator.setParticleSystemColorRange(this.entity._id, value.min, value.max);
|
|
323
|
-
} else {
|
|
324
|
-
if (typeof value.value === "string") {
|
|
325
|
-
_creator.setParticleSystemColorValue(this.entity._id, value.value);
|
|
326
|
-
} else if (value.value) {
|
|
327
|
-
_creator.setParticleSystemColorRange(this.entity._id, value.value.min, value.value.max);
|
|
328
|
-
}
|
|
329
|
-
if (value.mul) {
|
|
330
|
-
_creator.setParticleSystemColorCurveA(this.entity._id, value.mul, value.t);
|
|
331
|
-
}
|
|
332
|
-
if (value.mul_b) {
|
|
333
|
-
_creator.setParticleSystemColorCurveB(this.entity._id, value.mul_b, value.t);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
get material() {
|
|
338
|
-
return this._material;
|
|
339
|
-
}
|
|
340
|
-
set material(material) {
|
|
341
|
-
this._material = material;
|
|
342
|
-
if (this.entity) {
|
|
343
|
-
_creator.setMaterial(this.entity._id, Material.getInternalId(this._material), 0);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
_noise = null;
|
|
347
|
-
get noise() {
|
|
348
|
-
return this._noise;
|
|
349
|
-
}
|
|
350
|
-
set noise(noise) {
|
|
351
|
-
this._noise = noise;
|
|
352
|
-
if (this.entity) {
|
|
353
|
-
if (noise) {
|
|
354
|
-
_creator.setParticleSystemNoise(this.entity._id, noise.strength ?? 1, noise.frequency ?? 1, noise.speed ?? 1);
|
|
355
|
-
} else {
|
|
356
|
-
_creator.disableParticleSystemNoise(this.entity._id);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
onAssign(entityId) {
|
|
361
|
-
_creator.createParticleSystem(entityId, Material.getInternalId(this._material));
|
|
362
|
-
this.custom.entityId = entityId;
|
|
363
|
-
if (this._rate !== void 0) {
|
|
364
|
-
this.rate = this._rate;
|
|
365
|
-
}
|
|
366
|
-
if (this._shape !== void 0) {
|
|
367
|
-
this.shape = this._shape;
|
|
368
|
-
}
|
|
369
|
-
if (this._startVelocity !== void 0) {
|
|
370
|
-
this.startVelocity = this._startVelocity;
|
|
371
|
-
}
|
|
372
|
-
if (this._gravity !== void 0) {
|
|
373
|
-
this.gravity = this._gravity;
|
|
374
|
-
}
|
|
375
|
-
if (this._drag !== void 0) {
|
|
376
|
-
this.drag = this._drag;
|
|
377
|
-
}
|
|
378
|
-
if (this._lifetime !== void 0) {
|
|
379
|
-
this.lifetime = this._lifetime;
|
|
380
|
-
}
|
|
381
|
-
if (this._color !== void 0) {
|
|
382
|
-
this.color = this._color;
|
|
383
|
-
}
|
|
384
|
-
if (this._noise !== null) {
|
|
385
|
-
this.noise = this._noise;
|
|
386
|
-
}
|
|
387
|
-
for (let i = 0; i < 4; i++) {
|
|
388
|
-
if (this.custom[i] !== void 0) {
|
|
389
|
-
this.custom[i] = this.custom[i];
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
var dynamicColor = (baseValue, ...args) => {
|
|
395
|
-
const t = new Float32Array(args.length / 2);
|
|
396
|
-
const mul = [];
|
|
397
|
-
let mul_b = void 0;
|
|
398
|
-
for (let i = 0; i < args.length / 2; i++) {
|
|
399
|
-
if (typeof args[i * 2] !== "number") {
|
|
400
|
-
throw new Error(`Wrong particle system curve value ${i * 2}. Expected number, received ${typeof args[i * 2]}`);
|
|
401
|
-
}
|
|
402
|
-
t[i] = args[i * 2];
|
|
403
|
-
const val = args[i * 2 + 1];
|
|
404
|
-
if (typeof val === "string") {
|
|
405
|
-
mul[i] = val;
|
|
406
|
-
if (mul_b) {
|
|
407
|
-
mul_b[i] = val;
|
|
408
|
-
}
|
|
409
|
-
} else if (typeof val === "number") {
|
|
410
|
-
throw new Error(`Wrong particle system curve value ${i * 2 + 1}. Expected string, received ${typeof val}`);
|
|
411
|
-
} else {
|
|
412
|
-
mul[i] = val.min;
|
|
413
|
-
if (!mul_b) {
|
|
414
|
-
mul_b = [...mul];
|
|
415
|
-
}
|
|
416
|
-
mul_b[i] = val.max;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return {
|
|
420
|
-
value: baseValue,
|
|
421
|
-
mul: mul.join("\0"),
|
|
422
|
-
mul_b: mul_b?.join("\0"),
|
|
423
|
-
t
|
|
424
|
-
};
|
|
425
|
-
};
|
|
426
|
-
var dynamic = (baseValue, type, ...args) => {
|
|
427
|
-
const inc = new Float32Array(args.length);
|
|
428
|
-
let inc_b = void 0;
|
|
429
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
430
|
-
if (typeof args[i] !== "number") {
|
|
431
|
-
throw new Error(`Wrong particle system curve value ${i}. Expected number, received ${typeof args[i]}`);
|
|
432
|
-
}
|
|
433
|
-
inc[i] = args[i];
|
|
434
|
-
if (inc_b) {
|
|
435
|
-
inc_b[i] = args[i];
|
|
436
|
-
}
|
|
437
|
-
const val = args[i + 1];
|
|
438
|
-
if (typeof val === "number") {
|
|
439
|
-
inc[i + 1] = val;
|
|
440
|
-
if (inc_b) {
|
|
441
|
-
inc_b[i + 1] = val;
|
|
442
|
-
}
|
|
443
|
-
} else {
|
|
444
|
-
inc[i + 1] = val.min;
|
|
445
|
-
if (!inc_b) {
|
|
446
|
-
inc_b = new Float32Array(inc);
|
|
447
|
-
}
|
|
448
|
-
inc_b[i + 1] = val.max;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (type === "inc") {
|
|
452
|
-
return {
|
|
453
|
-
value: baseValue,
|
|
454
|
-
inc,
|
|
455
|
-
inc_b
|
|
456
|
-
};
|
|
457
|
-
} else {
|
|
458
|
-
return {
|
|
459
|
-
value: baseValue,
|
|
460
|
-
mul: inc,
|
|
461
|
-
mul_b: inc_b
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
// ../worker/src/glb.ts
|
|
467
|
-
var loadGlb = (urlOrResponse, options = {}) => {
|
|
468
|
-
if (typeof urlOrResponse === "string") {
|
|
469
|
-
return fetch(urlOrResponse, { useOnce: true, onProgress: options.onProgress }).then((resp) => {
|
|
470
|
-
if (resp.status >= 400) {
|
|
471
|
-
return Promise.reject(new Error(`Failed to load GLB from ${urlOrResponse}. HTTP code: ${resp.status}`));
|
|
472
|
-
} else {
|
|
473
|
-
return loadGlb(resp, options);
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
} else {
|
|
477
|
-
return new Promise((res, rej) => {
|
|
478
|
-
_creator.createGlb(urlOrResponse._id, (entityId) => {
|
|
479
|
-
if (entityId === 0) {
|
|
480
|
-
rej(new Error("Failed to load GLB from Data"));
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
const entity = new Entity(entityId);
|
|
484
|
-
entity.addComponent(new Animation());
|
|
485
|
-
if (options?.culling !== true) {
|
|
486
|
-
_creator.setGlbCulling(entityId, false);
|
|
487
|
-
}
|
|
488
|
-
res(entity);
|
|
489
|
-
}, rej);
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// ../worker/src/utils/Plane.ts
|
|
495
|
-
import * as vec3Op from "gl-matrix/vec3";
|
|
496
|
-
import * as mat4Op from "gl-matrix/mat4";
|
|
497
|
-
var Plane = class _Plane {
|
|
498
|
-
/** Outward-facing unit normal of the plane. */
|
|
499
|
-
normal;
|
|
500
|
-
/** Scalar offset: dot(normal, point) */
|
|
501
|
-
d;
|
|
502
|
-
/**
|
|
503
|
-
* @param normal - A vector perpendicular to the plane (need not be normalised).
|
|
504
|
-
* @param point - Any point that lies on the plane.
|
|
505
|
-
*/
|
|
506
|
-
constructor(normal, point) {
|
|
507
|
-
const n = vec3Op.create();
|
|
508
|
-
vec3Op.normalize(n, normal);
|
|
509
|
-
this.normal = n;
|
|
510
|
-
this.d = vec3Op.dot(n, point);
|
|
511
|
-
}
|
|
512
|
-
// ---------------------------------------------------------------------------
|
|
513
|
-
// Factory helpers
|
|
514
|
-
// ---------------------------------------------------------------------------
|
|
515
|
-
/**
|
|
516
|
-
* Construct a plane from three non-collinear points.
|
|
517
|
-
* The normal follows the right-hand rule: (b-a) × (c-a).
|
|
518
|
-
*/
|
|
519
|
-
static fromPoints(a, b, c) {
|
|
520
|
-
const ab = vec3Op.subtract(vec3Op.create(), b, a);
|
|
521
|
-
const ac = vec3Op.subtract(vec3Op.create(), c, a);
|
|
522
|
-
const normal = vec3Op.cross(vec3Op.create(), ab, ac);
|
|
523
|
-
return new _Plane(normal, a);
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* Construct a plane from the four coefficients of the equation ax+by+cz=d.
|
|
527
|
-
*/
|
|
528
|
-
static fromCoefficients(a, b, c, d) {
|
|
529
|
-
const rawNormal = vec3Op.fromValues(a, b, c);
|
|
530
|
-
const len = vec3Op.length(rawNormal);
|
|
531
|
-
const point = vec3Op.fromValues(
|
|
532
|
-
a * d / (len * len),
|
|
533
|
-
b * d / (len * len),
|
|
534
|
-
c * d / (len * len)
|
|
535
|
-
);
|
|
536
|
-
return new _Plane(rawNormal, point);
|
|
537
|
-
}
|
|
538
|
-
// ---------------------------------------------------------------------------
|
|
539
|
-
// Ray intersection
|
|
540
|
-
// ---------------------------------------------------------------------------
|
|
541
|
-
/**
|
|
542
|
-
* Test whether `ray` intersects the plane.
|
|
543
|
-
*
|
|
544
|
-
* @param ray - The ray to test.
|
|
545
|
-
* @returns The parameter `t` such that `ray.getPoint(t)` is the intersection
|
|
546
|
-
* point, or `null` when the ray misses (parallel or behind origin).
|
|
547
|
-
*
|
|
548
|
-
* Derivation:
|
|
549
|
-
* Substituting the ray into the plane equation:
|
|
550
|
-
* dot(n, origin + t*dir) = d
|
|
551
|
-
* dot(n, origin) + t * dot(n, dir) = d
|
|
552
|
-
* t = (d - dot(n, origin)) / dot(n, dir)
|
|
553
|
-
*/
|
|
554
|
-
intersectRay(ray) {
|
|
555
|
-
const denom = vec3Op.dot(this.normal, ray.dir);
|
|
556
|
-
if (Math.abs(denom) < 1e-8) return null;
|
|
557
|
-
const t = (this.d - vec3Op.dot(this.normal, ray.origin)) / denom;
|
|
558
|
-
if (t < 0) return null;
|
|
559
|
-
return t;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Like `intersectRay` but also accepts hits *behind* the origin (t < 0).
|
|
563
|
-
* Useful for line-plane intersection rather than ray-plane intersection.
|
|
564
|
-
*/
|
|
565
|
-
intersectLine(ray) {
|
|
566
|
-
const denom = vec3Op.dot(this.normal, ray.dir);
|
|
567
|
-
if (Math.abs(denom) < 1e-8) return null;
|
|
568
|
-
return (this.d - vec3Op.dot(this.normal, ray.origin)) / denom;
|
|
569
|
-
}
|
|
570
|
-
// ---------------------------------------------------------------------------
|
|
571
|
-
// Utility
|
|
572
|
-
// ---------------------------------------------------------------------------
|
|
573
|
-
/**
|
|
574
|
-
* Signed distance from `point` to the plane.
|
|
575
|
-
* Positive values are on the side the normal points toward.
|
|
576
|
-
*/
|
|
577
|
-
signedDistance(point) {
|
|
578
|
-
return vec3Op.dot(this.normal, point) - this.d;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Project `point` onto the plane.
|
|
582
|
-
*/
|
|
583
|
-
projectPoint(point) {
|
|
584
|
-
const dist = this.signedDistance(point);
|
|
585
|
-
return vec3Op.scaleAndAdd(vec3Op.create(), point, this.normal, -dist);
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Transform the plane by a 4×4 matrix.
|
|
589
|
-
* The normal is transformed by the inverse-transpose of `m`.
|
|
590
|
-
*/
|
|
591
|
-
transform(m) {
|
|
592
|
-
const pointOnPlane = vec3Op.scale(vec3Op.create(), this.normal, this.d);
|
|
593
|
-
const newPoint = vec3Op.transformMat4(vec3Op.create(), pointOnPlane, m);
|
|
594
|
-
const inv = mat4Op.invert(mat4Op.create(), m);
|
|
595
|
-
if (!inv) throw new Error("Matrix is not invertible.");
|
|
596
|
-
mat4Op.transpose(inv, inv);
|
|
597
|
-
const newNormal = vec3Op.transformMat4(vec3Op.create(), this.normal, inv);
|
|
598
|
-
return new _Plane(newNormal, newPoint);
|
|
599
|
-
}
|
|
600
|
-
toString() {
|
|
601
|
-
const [nx, ny, nz] = this.normal;
|
|
602
|
-
return `Plane(normal=[${nx.toFixed(4)}, ${ny.toFixed(4)}, ${nz.toFixed(4)}], d=${this.d.toFixed(4)})`;
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
// ../worker/src/utils/addControls.ts
|
|
607
|
-
import { quat, vec2, vec3 } from "gl-matrix";
|
|
608
|
-
var addControls = (scene, target, minScale = 0.08, maxScale = 2) => {
|
|
609
|
-
let tempQuat = quat.create();
|
|
610
|
-
const activeTouches = [];
|
|
611
|
-
scene.addEventListener("touchstart", (e) => {
|
|
612
|
-
const touch = { pointerId: e.pointerId, pos: vec2.fromValues(e.clientX, e.clientY) };
|
|
613
|
-
activeTouches.push(touch);
|
|
614
|
-
e.track({
|
|
615
|
-
onMove(e2) {
|
|
616
|
-
if (activeTouches.length === 2) {
|
|
617
|
-
const altTouch = activeTouches.find((item) => item != touch);
|
|
618
|
-
const dir = vec2.subtract(vec2.create(), altTouch.pos, touch.pos);
|
|
619
|
-
const dist = vec2.length(dir);
|
|
620
|
-
dir[0] /= dist;
|
|
621
|
-
dir[1] /= dist;
|
|
622
|
-
const dir2 = vec2.fromValues(-dir[1], dir[0]);
|
|
623
|
-
const delta = vec2.fromValues(e2.deltaX, e2.deltaY);
|
|
624
|
-
const dot2 = -vec2.dot(dir, delta);
|
|
625
|
-
const tangent = vec2.dot(dir2, delta);
|
|
626
|
-
const newScale = Math.max(Math.min(target.scale[0] * (dist + dot2) / dist, maxScale * 1.5), minScale * 0.4);
|
|
627
|
-
target.scale = vec3.fromValues(newScale, newScale, newScale);
|
|
628
|
-
target.quaternion = quat.rotateY(target.quaternion, target.quaternion, Math.atan2(tangent, dist));
|
|
629
|
-
} else {
|
|
630
|
-
const dir = scene.camera.forward;
|
|
631
|
-
const parent = target.parent;
|
|
632
|
-
if (parent) {
|
|
633
|
-
const inverted = quat.invert(tempQuat, parent.quaternion);
|
|
634
|
-
vec3.transformQuat(dir, dir, inverted);
|
|
635
|
-
}
|
|
636
|
-
dir[1] = 0;
|
|
637
|
-
const dist = vec3.dist(target.worldPosition, scene.camera.worldPosition);
|
|
638
|
-
const k = Math.hypot(dir[0], dir[2]);
|
|
639
|
-
const dir2 = vec3.fromValues(-dir[2], 0, dir[0]);
|
|
640
|
-
const screenSize = Math.max(...scene.camera.camera.displaySize);
|
|
641
|
-
vec3.scale(dir2, dir2, e2.deltaX / k / screenSize * dist);
|
|
642
|
-
vec3.scale(dir, dir, -e2.deltaY / k / screenSize * dist);
|
|
643
|
-
const pos = target.position;
|
|
644
|
-
target.position = [pos[0] + dir[0] + dir2[0], pos[1], pos[2] + dir[2] + dir2[2]];
|
|
645
|
-
}
|
|
646
|
-
touch.pos[0] = e2.clientX;
|
|
647
|
-
touch.pos[1] = e2.clientY;
|
|
648
|
-
},
|
|
649
|
-
onEnd() {
|
|
650
|
-
const index = activeTouches.indexOf(touch);
|
|
651
|
-
if (index >= 0) {
|
|
652
|
-
activeTouches.splice(index, 1);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
// ../worker/src/utils/EntityUtils.ts
|
|
660
|
-
function lookAt(entity, point, mode = "-z", ortho = [0, 1, 0]) {
|
|
661
|
-
const worldMatrix = entity.worldMatrix;
|
|
662
|
-
const pos = getPosition(worldMatrix);
|
|
663
|
-
const dir = new Float32Array(3);
|
|
664
|
-
dir[0] = point[0] - pos[0];
|
|
665
|
-
dir[1] = point[1] - pos[1];
|
|
666
|
-
dir[2] = point[2] - pos[2];
|
|
667
|
-
const l = 1 / Math.hypot(dir[0], dir[1], dir[2]);
|
|
668
|
-
if (l === Infinity) {
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
let _mode = mode;
|
|
672
|
-
if (mode.startsWith("-")) {
|
|
673
|
-
dir[0] = dir[0] * -l;
|
|
674
|
-
dir[1] = dir[1] * -l;
|
|
675
|
-
dir[2] = dir[2] * -l;
|
|
676
|
-
_mode = mode.slice(1);
|
|
677
|
-
} else {
|
|
678
|
-
dir[0] = dir[0] * l;
|
|
679
|
-
dir[1] = dir[1] * l;
|
|
680
|
-
dir[2] = dir[2] * l;
|
|
681
|
-
}
|
|
682
|
-
let forward, right, up;
|
|
683
|
-
switch (_mode) {
|
|
684
|
-
case "x":
|
|
685
|
-
right = dir;
|
|
686
|
-
up = vec3Cross(new Float32Array(3), ortho, right);
|
|
687
|
-
normalizeInPlace(up);
|
|
688
|
-
forward = vec3Cross(new Float32Array(3), up, right);
|
|
689
|
-
normalizeInPlace(forward);
|
|
690
|
-
break;
|
|
691
|
-
case "y":
|
|
692
|
-
up = dir;
|
|
693
|
-
right = vec3Cross(new Float32Array(3), ortho, up);
|
|
694
|
-
normalizeInPlace(right);
|
|
695
|
-
forward = vec3Cross(new Float32Array(3), up, right);
|
|
696
|
-
normalizeInPlace(forward);
|
|
697
|
-
break;
|
|
698
|
-
case "z":
|
|
699
|
-
forward = dir;
|
|
700
|
-
right = vec3Cross(new Float32Array(3), ortho, dir);
|
|
701
|
-
normalizeInPlace(right);
|
|
702
|
-
up = vec3Cross(new Float32Array(3), dir, right);
|
|
703
|
-
break;
|
|
704
|
-
default:
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
const s = getScale(worldMatrix);
|
|
708
|
-
entity.worldMatrix = Float32Array.of(
|
|
709
|
-
// write X axis (right)
|
|
710
|
-
right[0] * s[0],
|
|
711
|
-
right[1] * s[0],
|
|
712
|
-
right[2] * s[0],
|
|
713
|
-
0,
|
|
714
|
-
// write Y axis (up)
|
|
715
|
-
up[0] * s[1],
|
|
716
|
-
up[1] * s[1],
|
|
717
|
-
up[2] * s[1],
|
|
718
|
-
0,
|
|
719
|
-
// write Z axis (forward)
|
|
720
|
-
forward[0] * s[2],
|
|
721
|
-
forward[1] * s[2],
|
|
722
|
-
forward[2] * s[2],
|
|
723
|
-
0,
|
|
724
|
-
worldMatrix[12],
|
|
725
|
-
worldMatrix[13],
|
|
726
|
-
worldMatrix[14],
|
|
727
|
-
worldMatrix[15]
|
|
728
|
-
);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
// ../worker/src/utils/smoothDamp.ts
|
|
732
|
-
import * as vec2Op from "gl-matrix/vec3";
|
|
733
|
-
import * as vec3Op2 from "gl-matrix/vec3";
|
|
734
|
-
import * as quatOp from "gl-matrix/quat";
|
|
735
|
-
function lerp3(a, b, t) {
|
|
736
|
-
return typeof a === "number" ? a + (b - a) * t : a.length === 2 ? vec2Op.lerp(vec2Op.create(), a, b, t) : a.length === 3 ? vec3Op2.lerp(vec3Op2.create(), a, b, t) : a.length === 4 ? quatOp.slerp(quatOp.create(), a, b, t) : a;
|
|
737
|
-
}
|
|
738
|
-
function clamp(value, min, max) {
|
|
739
|
-
return value < min ? min : value > max ? max : value;
|
|
740
|
-
}
|
|
741
|
-
function smoothDamp(initialValue, smoothTime, maxSpeed = Infinity) {
|
|
742
|
-
let current = typeof initialValue === "number" ? initialValue : initialValue.length === 2 ? vec2Op.clone(initialValue) : initialValue.length === 3 ? vec3Op2.clone(initialValue) : initialValue.length === 4 ? quatOp.clone(initialValue) : 0;
|
|
743
|
-
let velocity = typeof initialValue === "number" ? 0 : initialValue.length === 2 ? vec2Op.create() : initialValue.length === 3 ? vec3Op2.create() : initialValue.length === 4 ? 0 : 0;
|
|
744
|
-
const damp = function damp2(target, deltaTime) {
|
|
745
|
-
smoothTime = Math.max(1e-4, smoothTime);
|
|
746
|
-
const omega = 2 / smoothTime;
|
|
747
|
-
const x = omega * deltaTime;
|
|
748
|
-
const exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);
|
|
749
|
-
const maxDelta = maxSpeed * smoothTime;
|
|
750
|
-
if (typeof current === "number") {
|
|
751
|
-
let delta = current - target;
|
|
752
|
-
if (delta > maxDelta) {
|
|
753
|
-
delta = maxDelta;
|
|
754
|
-
} else if (delta < -maxDelta) {
|
|
755
|
-
delta = -maxDelta;
|
|
756
|
-
}
|
|
757
|
-
const newTarget = current - delta;
|
|
758
|
-
const temp = (velocity + omega * delta) * deltaTime;
|
|
759
|
-
velocity = (velocity - omega * temp) * exp;
|
|
760
|
-
current = newTarget + (delta + temp) * exp;
|
|
761
|
-
return current;
|
|
762
|
-
}
|
|
763
|
-
if (current.length === 2) {
|
|
764
|
-
let delta = vec2Op.sub(vec2Op.create(), current, target);
|
|
765
|
-
let l = Math.hypot(delta[0], delta[1]);
|
|
766
|
-
if (l > maxDelta) {
|
|
767
|
-
vec2Op.scale(delta, delta, maxDelta / l);
|
|
768
|
-
}
|
|
769
|
-
vec2Op.sub(current, current, delta);
|
|
770
|
-
const temp = vec2Op.scaleAndAdd(vec2Op.create(), velocity, delta, omega);
|
|
771
|
-
vec2Op.scale(temp, temp, deltaTime);
|
|
772
|
-
vec2Op.scaleAndAdd(velocity, velocity, temp, -omega);
|
|
773
|
-
vec2Op.scale(velocity, velocity, exp);
|
|
774
|
-
vec2Op.add(temp, temp, delta);
|
|
775
|
-
vec2Op.scaleAndAdd(current, current, temp, exp);
|
|
776
|
-
return current;
|
|
777
|
-
}
|
|
778
|
-
if (current.length === 3) {
|
|
779
|
-
let delta = vec3Op2.sub(vec3Op2.create(), current, target);
|
|
780
|
-
let l = Math.hypot(delta[0], delta[1]);
|
|
781
|
-
if (l > maxDelta) {
|
|
782
|
-
vec3Op2.scale(delta, delta, maxDelta / l);
|
|
783
|
-
}
|
|
784
|
-
vec3Op2.sub(current, current, delta);
|
|
785
|
-
const temp = vec3Op2.scaleAndAdd(vec3Op2.create(), velocity, delta, omega);
|
|
786
|
-
vec3Op2.scale(temp, temp, deltaTime);
|
|
787
|
-
vec3Op2.scaleAndAdd(velocity, velocity, temp, -omega);
|
|
788
|
-
vec3Op2.scale(velocity, velocity, exp);
|
|
789
|
-
vec3Op2.add(temp, temp, delta);
|
|
790
|
-
vec3Op2.scaleAndAdd(current, current, temp, exp);
|
|
791
|
-
return current;
|
|
792
|
-
}
|
|
793
|
-
if (current.length === 4) {
|
|
794
|
-
let angle = quatOp.getAngle(current, target);
|
|
795
|
-
if (angle < 1e-6) {
|
|
796
|
-
quatOp.copy(current, target);
|
|
797
|
-
velocity = 0;
|
|
798
|
-
return current;
|
|
799
|
-
}
|
|
800
|
-
const maxDeltaAngle = maxSpeed * smoothTime;
|
|
801
|
-
let c = angle;
|
|
802
|
-
let delta = c;
|
|
803
|
-
if (delta > maxDeltaAngle) delta = maxDeltaAngle;
|
|
804
|
-
else if (delta < -maxDeltaAngle) delta = -maxDeltaAngle;
|
|
805
|
-
const targetAngle = c - delta;
|
|
806
|
-
const temp = (velocity + omega * delta) * deltaTime;
|
|
807
|
-
velocity = (velocity - omega * temp) * exp;
|
|
808
|
-
let newAngle = targetAngle + (delta + temp) * exp;
|
|
809
|
-
if (!Number.isFinite(newAngle) || newAngle < 0) {
|
|
810
|
-
newAngle = 0;
|
|
811
|
-
velocity = 0;
|
|
812
|
-
}
|
|
813
|
-
let t = 1 - newAngle / c;
|
|
814
|
-
if (t < 0) t = 0;
|
|
815
|
-
else if (t > 1) t = 1;
|
|
816
|
-
quatOp.slerp(current, current, target, t);
|
|
817
|
-
return current;
|
|
818
|
-
}
|
|
819
|
-
return current;
|
|
820
|
-
};
|
|
821
|
-
damp.setValue = (value) => {
|
|
822
|
-
current = typeof value === "number" ? value : value.length === 2 ? vec2Op.clone(value) : value.length === 3 ? vec3Op2.clone(value) : 0;
|
|
823
|
-
};
|
|
824
|
-
return damp;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// ../worker/src/utils/PerlinNoise.ts
|
|
828
|
-
var PerlinNoise = class {
|
|
829
|
-
_id;
|
|
830
|
-
constructor() {
|
|
831
|
-
this._id = _creator.createNoise();
|
|
832
|
-
}
|
|
833
|
-
get(x, y) {
|
|
834
|
-
return _creator.getNoise2D(this._id, x, y);
|
|
835
|
-
}
|
|
836
|
-
get3d(x, y, z) {
|
|
837
|
-
return _creator.getNoise3D(this._id, x, y, z);
|
|
838
|
-
}
|
|
839
|
-
_frequency = 0.01;
|
|
840
|
-
get frequency() {
|
|
841
|
-
return this._frequency;
|
|
842
|
-
}
|
|
843
|
-
set frequency(value) {
|
|
844
|
-
this._frequency = value;
|
|
845
|
-
_creator.setNoiseFrequency(this._id, value);
|
|
846
|
-
}
|
|
847
|
-
_fractalLunacrity = 0.01;
|
|
848
|
-
get fractalLunacrity() {
|
|
849
|
-
return this._fractalLunacrity;
|
|
850
|
-
}
|
|
851
|
-
set fractalLunacrity(value) {
|
|
852
|
-
this._fractalLunacrity = value;
|
|
853
|
-
_creator.setNoiseFractalLunacrity(this._id, value);
|
|
854
|
-
}
|
|
855
|
-
_fractalGain = 0.01;
|
|
856
|
-
get fractalGain() {
|
|
857
|
-
return this._fractalGain;
|
|
858
|
-
}
|
|
859
|
-
set fractalGain(value) {
|
|
860
|
-
this._fractalGain = value;
|
|
861
|
-
_creator.setNoiseFractalGain(this._id, value);
|
|
862
|
-
}
|
|
863
|
-
_octaves = 0.01;
|
|
864
|
-
get octaves() {
|
|
865
|
-
return this._octaves;
|
|
866
|
-
}
|
|
867
|
-
set octaves(value) {
|
|
868
|
-
this._octaves = value;
|
|
869
|
-
_creator.setNoiseOctaves(this._id, value);
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
// ../worker/src/utils/SceneCapture.ts
|
|
874
|
-
var SceneCapture = {
|
|
875
|
-
captureImage(scene) {
|
|
876
|
-
return new Promise((res, rej) => {
|
|
877
|
-
_creator.captureImage(scene._id, (bufferId, name, size) => {
|
|
878
|
-
res(new File(bufferId, name, size));
|
|
879
|
-
}, rej);
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
// startCapture(scene: Scene): void {
|
|
883
|
-
// _creator.startCapture((scene as any)._id)
|
|
884
|
-
// },
|
|
885
|
-
// stopCapture(): Promise<FetchResponse> {
|
|
886
|
-
// return new Promise<FetchResponse>((res, rej) => {
|
|
887
|
-
// _creator.stopCapture((bufferId) => res({ _id: bufferId } as any), rej)
|
|
888
|
-
// })
|
|
889
|
-
// }
|
|
890
|
-
};
|
|
891
|
-
export {
|
|
892
|
-
ARScene,
|
|
893
|
-
Animation,
|
|
894
|
-
Camera,
|
|
895
|
-
Collider,
|
|
896
|
-
Component,
|
|
897
|
-
Entity,
|
|
898
|
-
FormData,
|
|
899
|
-
LitMaterial,
|
|
900
|
-
Material,
|
|
901
|
-
Mesh,
|
|
902
|
-
MeshGeometry,
|
|
903
|
-
Particles,
|
|
904
|
-
PerlinNoise,
|
|
905
|
-
Plane,
|
|
906
|
-
Ray,
|
|
907
|
-
Scene,
|
|
908
|
-
SceneCapture,
|
|
909
|
-
ShadowMaterial,
|
|
910
|
-
Texture,
|
|
911
|
-
UnlitMaterial,
|
|
912
|
-
VideoMaterial,
|
|
913
|
-
addControls,
|
|
914
|
-
clamp,
|
|
915
|
-
createCubeGeometry,
|
|
916
|
-
createCubeMesh,
|
|
917
|
-
createCylinderGeometry,
|
|
918
|
-
createCylinderMesh,
|
|
919
|
-
createPlaneGeometry,
|
|
920
|
-
createPlaneMesh,
|
|
921
|
-
createSphereGeometry,
|
|
922
|
-
createSphereMesh,
|
|
923
|
-
dynamic,
|
|
924
|
-
dynamicColor,
|
|
925
|
-
getEntityById,
|
|
926
|
-
lerp3 as lerp,
|
|
927
|
-
loadGlb,
|
|
928
|
-
lookAt,
|
|
929
|
-
smoothDamp
|
|
930
|
-
};
|