babylonjs-editor-tools 0.0.9 → 0.0.11
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/build/index.node.js +234 -101
- package/build/src/cinematic/events/apply-impulse.js +16 -3
- package/build/src/cinematic/generate.js +15 -0
- package/build/src/index.js +3 -0
- package/build/src/loading/loader.js +4 -0
- package/build/src/loading/physics.js +14 -6
- package/build/src/tools/guards.js +98 -0
- package/build/src/tools/mesh.js +2 -0
- package/declaration/src/cinematic/events/apply-impulse.d.ts +8 -0
- package/declaration/src/cinematic/events/set-enabled.d.ts +6 -0
- package/declaration/src/cinematic/generate.d.ts +9 -0
- package/declaration/src/cinematic/parse.d.ts +15 -0
- package/declaration/src/cinematic/tools.d.ts +15 -0
- package/declaration/src/cinematic/typings.d.ts +44 -0
- package/declaration/src/decorators/apply.d.ts +37 -0
- package/declaration/src/decorators/gui.d.ts +12 -0
- package/declaration/src/decorators/inspector.d.ts +82 -0
- package/declaration/src/decorators/particle-systems.d.ts +8 -0
- package/declaration/src/decorators/scene.d.ts +25 -0
- package/declaration/src/decorators/sound.d.ts +8 -0
- package/declaration/src/index.d.ts +19 -0
- package/declaration/src/loading/loader.d.ts +35 -0
- package/declaration/src/loading/physics.d.ts +6 -0
- package/declaration/src/loading/rendering.d.ts +2 -0
- package/declaration/src/loading/script.d.ts +3 -0
- package/declaration/src/loading/sound.d.ts +1 -0
- package/declaration/src/loading/texture.d.ts +1 -0
- package/declaration/src/rendering/default-pipeline.d.ts +15 -0
- package/declaration/src/rendering/motion-blur.d.ts +12 -0
- package/declaration/src/rendering/ssao.d.ts +12 -0
- package/declaration/src/rendering/ssr.d.ts +12 -0
- package/declaration/src/rendering/tools.d.ts +14 -0
- package/declaration/src/rendering/vls.d.ts +13 -0
- package/declaration/src/script.d.ts +13 -0
- package/declaration/src/tools/guards.d.ts +83 -0
- package/declaration/src/tools/light.d.ts +3 -0
- package/declaration/src/tools/mesh.d.ts +6 -0
- package/declaration/src/tools/scalar.d.ts +1 -0
- package/declaration/src/tools/sound.d.ts +13 -0
- package/declaration/src/tools/texture.d.ts +8 -0
- package/package.json +2 -2
package/build/index.node.js
CHANGED
|
@@ -22,6 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
animationGroupFromScene: () => animationGroupFromScene,
|
|
24
24
|
configureEngineToUseCompressedTextures: () => configureEngineToUseCompressedTextures,
|
|
25
|
+
configureShadowMapRefreshRate: () => configureShadowMapRefreshRate,
|
|
26
|
+
configureShadowMapRenderListPredicate: () => configureShadowMapRenderListPredicate,
|
|
25
27
|
createDefaultRenderingPipeline: () => createDefaultRenderingPipeline,
|
|
26
28
|
createMotionBlurPostProcess: () => createMotionBlurPostProcess,
|
|
27
29
|
createSSAO2RenderingPipeline: () => createSSAO2RenderingPipeline,
|
|
@@ -36,10 +38,25 @@ __export(index_exports, {
|
|
|
36
38
|
generateCinematicAnimationGroup: () => generateCinematicAnimationGroup,
|
|
37
39
|
getDefaultRenderingPipeline: () => getDefaultRenderingPipeline,
|
|
38
40
|
getMotionBlurPostProcess: () => getMotionBlurPostProcess,
|
|
41
|
+
getPowerOfTwoUntil: () => getPowerOfTwoUntil,
|
|
39
42
|
getSSAO2RenderingPipeline: () => getSSAO2RenderingPipeline,
|
|
40
43
|
getSSRRenderingPipeline: () => getSSRRenderingPipeline,
|
|
41
44
|
getVLSPostProcess: () => getVLSPostProcess,
|
|
42
45
|
guiFromAsset: () => guiFromAsset,
|
|
46
|
+
isAbstractMesh: () => isAbstractMesh,
|
|
47
|
+
isArcRotateCamera: () => isArcRotateCamera,
|
|
48
|
+
isBone: () => isBone,
|
|
49
|
+
isCamera: () => isCamera,
|
|
50
|
+
isDirectionalLight: () => isDirectionalLight,
|
|
51
|
+
isFreeCamera: () => isFreeCamera,
|
|
52
|
+
isGroundMesh: () => isGroundMesh,
|
|
53
|
+
isHemisphericLight: () => isHemisphericLight,
|
|
54
|
+
isInstancedMesh: () => isInstancedMesh,
|
|
55
|
+
isMesh: () => isMesh,
|
|
56
|
+
isPointLight: () => isPointLight,
|
|
57
|
+
isSpotLight: () => isSpotLight,
|
|
58
|
+
isTexture: () => isTexture,
|
|
59
|
+
isTransformNode: () => isTransformNode,
|
|
43
60
|
loadScene: () => loadScene,
|
|
44
61
|
motionBlurPostProcessCameraConfigurations: () => motionBlurPostProcessCameraConfigurations,
|
|
45
62
|
nodeFromDescendants: () => nodeFromDescendants,
|
|
@@ -71,6 +88,17 @@ __export(index_exports, {
|
|
|
71
88
|
module.exports = __toCommonJS(index_exports);
|
|
72
89
|
|
|
73
90
|
// src/tools/guards.ts
|
|
91
|
+
function isAbstractMesh(object) {
|
|
92
|
+
switch (object.getClassName?.()) {
|
|
93
|
+
case "Mesh":
|
|
94
|
+
case "LineMesh":
|
|
95
|
+
case "GroundMesh":
|
|
96
|
+
case "InstancedMesh":
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
__name(isAbstractMesh, "isAbstractMesh");
|
|
74
102
|
function isMesh(object) {
|
|
75
103
|
switch (object.getClassName?.()) {
|
|
76
104
|
case "Mesh":
|
|
@@ -80,17 +108,71 @@ function isMesh(object) {
|
|
|
80
108
|
return false;
|
|
81
109
|
}
|
|
82
110
|
__name(isMesh, "isMesh");
|
|
111
|
+
function isInstancedMesh(object) {
|
|
112
|
+
return object.getClassName?.() === "InstancedMesh";
|
|
113
|
+
}
|
|
114
|
+
__name(isInstancedMesh, "isInstancedMesh");
|
|
115
|
+
function isBone(object) {
|
|
116
|
+
return object.getClassName?.() === "Bone";
|
|
117
|
+
}
|
|
118
|
+
__name(isBone, "isBone");
|
|
83
119
|
function isGroundMesh(object) {
|
|
84
120
|
return object.getClassName?.() === "GroundMesh";
|
|
85
121
|
}
|
|
86
122
|
__name(isGroundMesh, "isGroundMesh");
|
|
123
|
+
function isTransformNode(object) {
|
|
124
|
+
return object.getClassName?.() === "TransformNode";
|
|
125
|
+
}
|
|
126
|
+
__name(isTransformNode, "isTransformNode");
|
|
87
127
|
function isTexture(object) {
|
|
88
128
|
return object?.getClassName?.() === "Texture";
|
|
89
129
|
}
|
|
90
130
|
__name(isTexture, "isTexture");
|
|
131
|
+
function isCamera(object) {
|
|
132
|
+
switch (object.getClassName?.()) {
|
|
133
|
+
case "Camera":
|
|
134
|
+
case "FreeCamera":
|
|
135
|
+
case "TargetCamera":
|
|
136
|
+
case "EditorCamera":
|
|
137
|
+
case "ArcRotateCamera":
|
|
138
|
+
case "UniversalCamera":
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
__name(isCamera, "isCamera");
|
|
144
|
+
function isFreeCamera(object) {
|
|
145
|
+
switch (object.getClassName?.()) {
|
|
146
|
+
case "FreeCamera":
|
|
147
|
+
case "UniversalCamera":
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
__name(isFreeCamera, "isFreeCamera");
|
|
153
|
+
function isArcRotateCamera(object) {
|
|
154
|
+
return object.getClassName?.() === "ArcRotateCamera";
|
|
155
|
+
}
|
|
156
|
+
__name(isArcRotateCamera, "isArcRotateCamera");
|
|
157
|
+
function isPointLight(object) {
|
|
158
|
+
return object.getClassName?.() === "PointLight";
|
|
159
|
+
}
|
|
160
|
+
__name(isPointLight, "isPointLight");
|
|
161
|
+
function isDirectionalLight(object) {
|
|
162
|
+
return object.getClassName?.() === "DirectionalLight";
|
|
163
|
+
}
|
|
164
|
+
__name(isDirectionalLight, "isDirectionalLight");
|
|
165
|
+
function isSpotLight(object) {
|
|
166
|
+
return object.getClassName?.() === "SpotLight";
|
|
167
|
+
}
|
|
168
|
+
__name(isSpotLight, "isSpotLight");
|
|
169
|
+
function isHemisphericLight(object) {
|
|
170
|
+
return object.getClassName?.() === "HemisphericLight";
|
|
171
|
+
}
|
|
172
|
+
__name(isHemisphericLight, "isHemisphericLight");
|
|
91
173
|
|
|
92
174
|
// src/decorators/apply.ts
|
|
93
|
-
var
|
|
175
|
+
var import_babylonjs16 = require("babylonjs");
|
|
94
176
|
var import_babylonjs_gui = require("babylonjs-gui");
|
|
95
177
|
function applyDecorators(scene, object, script, instance, rootUrl) {
|
|
96
178
|
const ctor = instance.constructor;
|
|
@@ -142,10 +224,10 @@ function applyDecorators(scene, object, script, instance, rootUrl) {
|
|
|
142
224
|
instance[propertyKey] = value;
|
|
143
225
|
break;
|
|
144
226
|
case "vector2":
|
|
145
|
-
instance[propertyKey] =
|
|
227
|
+
instance[propertyKey] = import_babylonjs16.Vector2.FromArray(value);
|
|
146
228
|
break;
|
|
147
229
|
case "vector3":
|
|
148
|
-
instance[propertyKey] =
|
|
230
|
+
instance[propertyKey] = import_babylonjs16.Vector3.FromArray(value);
|
|
149
231
|
break;
|
|
150
232
|
}
|
|
151
233
|
}
|
|
@@ -189,34 +271,41 @@ function applyScriptForObject(scene, object, scriptsMap, rootUrl) {
|
|
|
189
271
|
__name(applyScriptForObject, "applyScriptForObject");
|
|
190
272
|
|
|
191
273
|
// src/loading/physics.ts
|
|
192
|
-
var
|
|
193
|
-
var
|
|
194
|
-
function configurePhysicsAggregate(
|
|
195
|
-
const data =
|
|
274
|
+
var import_babylonjs20 = require("babylonjs");
|
|
275
|
+
var import_babylonjs21 = require("babylonjs");
|
|
276
|
+
function configurePhysicsAggregate(transformNode) {
|
|
277
|
+
const data = transformNode.metadata?.physicsAggregate;
|
|
196
278
|
if (!data) {
|
|
197
279
|
return;
|
|
198
280
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
mesh
|
|
281
|
+
let mesh = void 0;
|
|
282
|
+
if (isMesh(transformNode)) {
|
|
283
|
+
mesh = transformNode;
|
|
284
|
+
} else if (isInstancedMesh(transformNode)) {
|
|
285
|
+
mesh = transformNode.sourceMesh;
|
|
286
|
+
}
|
|
287
|
+
const aggregate = new import_babylonjs21.PhysicsAggregate(transformNode, data.shape.type, {
|
|
288
|
+
mesh,
|
|
289
|
+
mass: data.massProperties.mass
|
|
202
290
|
});
|
|
203
291
|
aggregate.body.setMassProperties({
|
|
204
292
|
mass: data.massProperties.mass,
|
|
205
|
-
inertia: data.massProperties.inertia ?
|
|
206
|
-
centerOfMass: data.massProperties.centerOfMass ?
|
|
207
|
-
inertiaOrientation: data.massProperties.inertiaOrientation ?
|
|
293
|
+
inertia: data.massProperties.inertia ? import_babylonjs20.Vector3.FromArray(data.massProperties.inertia) : void 0,
|
|
294
|
+
centerOfMass: data.massProperties.centerOfMass ? import_babylonjs20.Vector3.FromArray(data.massProperties.centerOfMass) : void 0,
|
|
295
|
+
inertiaOrientation: data.massProperties.inertiaOrientation ? import_babylonjs20.Quaternion.FromArray(data.massProperties.inertiaOrientation) : void 0
|
|
208
296
|
});
|
|
209
297
|
aggregate.shape.density = data.shape.density;
|
|
210
298
|
aggregate.body.setMotionType(data.body.motionType);
|
|
211
299
|
aggregate.shape.material = data.material;
|
|
212
|
-
|
|
300
|
+
transformNode.physicsAggregate = aggregate;
|
|
301
|
+
transformNode.metadata.physicsAggregate = void 0;
|
|
213
302
|
}
|
|
214
303
|
__name(configurePhysicsAggregate, "configurePhysicsAggregate");
|
|
215
304
|
|
|
216
305
|
// src/rendering/vls.ts
|
|
217
|
-
var
|
|
218
|
-
var
|
|
219
|
-
var
|
|
306
|
+
var import_babylonjs25 = require("babylonjs");
|
|
307
|
+
var import_babylonjs26 = require("babylonjs");
|
|
308
|
+
var import_babylonjs27 = require("babylonjs");
|
|
220
309
|
var vlsPostProcess = null;
|
|
221
310
|
var vlsPostProcessCameraConfigurations = /* @__PURE__ */ new Map();
|
|
222
311
|
function getVLSPostProcess() {
|
|
@@ -232,7 +321,7 @@ function disposeVLSPostProcess(scene) {
|
|
|
232
321
|
__name(disposeVLSPostProcess, "disposeVLSPostProcess");
|
|
233
322
|
function createVLSPostProcess(scene, mesh) {
|
|
234
323
|
mesh ??= scene.meshes.find((mesh2) => isMesh(mesh2));
|
|
235
|
-
vlsPostProcess = new
|
|
324
|
+
vlsPostProcess = new import_babylonjs27.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess", 1, scene.activeCamera, mesh, 100, import_babylonjs26.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
|
|
236
325
|
return vlsPostProcess;
|
|
237
326
|
}
|
|
238
327
|
__name(createVLSPostProcess, "createVLSPostProcess");
|
|
@@ -267,13 +356,13 @@ function parseVLSPostProcess(scene, data) {
|
|
|
267
356
|
vlsPostProcess2.density = data.density;
|
|
268
357
|
vlsPostProcess2.invert = data.invert;
|
|
269
358
|
vlsPostProcess2.useCustomMeshPosition = data.useCustomMeshPosition;
|
|
270
|
-
vlsPostProcess2.customMeshPosition.copyFrom(
|
|
359
|
+
vlsPostProcess2.customMeshPosition.copyFrom(import_babylonjs25.Vector3.FromArray(data.customMeshPosition));
|
|
271
360
|
return vlsPostProcess2;
|
|
272
361
|
}
|
|
273
362
|
__name(parseVLSPostProcess, "parseVLSPostProcess");
|
|
274
363
|
|
|
275
364
|
// src/rendering/ssr.ts
|
|
276
|
-
var
|
|
365
|
+
var import_babylonjs30 = require("babylonjs");
|
|
277
366
|
var ssrRenderingPipeline = null;
|
|
278
367
|
var ssrRenderingPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
279
368
|
function getSSRRenderingPipeline() {
|
|
@@ -288,7 +377,7 @@ function disposeSSRRenderingPipeline() {
|
|
|
288
377
|
}
|
|
289
378
|
__name(disposeSSRRenderingPipeline, "disposeSSRRenderingPipeline");
|
|
290
379
|
function createSSRRenderingPipeline(scene, camera) {
|
|
291
|
-
ssrRenderingPipeline = new
|
|
380
|
+
ssrRenderingPipeline = new import_babylonjs30.SSRRenderingPipeline("SSRRenderingPipeline", scene, [camera]);
|
|
292
381
|
ssrRenderingPipeline.samples = 4;
|
|
293
382
|
return ssrRenderingPipeline;
|
|
294
383
|
}
|
|
@@ -353,7 +442,7 @@ function parseSSRRenderingPipeline(scene, camera, data) {
|
|
|
353
442
|
__name(parseSSRRenderingPipeline, "parseSSRRenderingPipeline");
|
|
354
443
|
|
|
355
444
|
// src/rendering/ssao.ts
|
|
356
|
-
var
|
|
445
|
+
var import_babylonjs33 = require("babylonjs");
|
|
357
446
|
var ssaoRenderingPipeline = null;
|
|
358
447
|
var ssaoRenderingPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
359
448
|
function getSSAO2RenderingPipeline() {
|
|
@@ -368,7 +457,7 @@ function disposeSSAO2RenderingPipeline() {
|
|
|
368
457
|
}
|
|
369
458
|
__name(disposeSSAO2RenderingPipeline, "disposeSSAO2RenderingPipeline");
|
|
370
459
|
function createSSAO2RenderingPipeline(scene, camera) {
|
|
371
|
-
ssaoRenderingPipeline = new
|
|
460
|
+
ssaoRenderingPipeline = new import_babylonjs33.SSAO2RenderingPipeline("SSAO2RenderingPipeline", scene, 1, [camera]);
|
|
372
461
|
ssaoRenderingPipeline.samples = 4;
|
|
373
462
|
return ssaoRenderingPipeline;
|
|
374
463
|
}
|
|
@@ -415,7 +504,7 @@ function parseSSAO2RenderingPipeline(scene, camera, data) {
|
|
|
415
504
|
__name(parseSSAO2RenderingPipeline, "parseSSAO2RenderingPipeline");
|
|
416
505
|
|
|
417
506
|
// src/rendering/motion-blur.ts
|
|
418
|
-
var
|
|
507
|
+
var import_babylonjs36 = require("babylonjs");
|
|
419
508
|
var motionBlurPostProcess = null;
|
|
420
509
|
var motionBlurPostProcessCameraConfigurations = /* @__PURE__ */ new Map();
|
|
421
510
|
function getMotionBlurPostProcess() {
|
|
@@ -430,7 +519,7 @@ function disposeMotionBlurPostProcess() {
|
|
|
430
519
|
}
|
|
431
520
|
__name(disposeMotionBlurPostProcess, "disposeMotionBlurPostProcess");
|
|
432
521
|
function createMotionBlurPostProcess(scene, camera) {
|
|
433
|
-
motionBlurPostProcess = new
|
|
522
|
+
motionBlurPostProcess = new import_babylonjs36.MotionBlurPostProcess("MotionBlurPostProcess", scene, 1, camera);
|
|
434
523
|
motionBlurPostProcess.motionStrength = 1;
|
|
435
524
|
motionBlurPostProcess.isObjectBased = true;
|
|
436
525
|
return motionBlurPostProcess;
|
|
@@ -460,9 +549,9 @@ function parseMotionBlurPostProcess(scene, camera, data) {
|
|
|
460
549
|
__name(parseMotionBlurPostProcess, "parseMotionBlurPostProcess");
|
|
461
550
|
|
|
462
551
|
// src/rendering/default-pipeline.ts
|
|
463
|
-
var
|
|
464
|
-
var
|
|
465
|
-
var
|
|
552
|
+
var import_babylonjs39 = require("babylonjs");
|
|
553
|
+
var import_babylonjs40 = require("babylonjs");
|
|
554
|
+
var import_babylonjs41 = require("babylonjs");
|
|
466
555
|
var defaultRenderingPipeline = null;
|
|
467
556
|
var defaultPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
468
557
|
function getDefaultRenderingPipeline() {
|
|
@@ -477,7 +566,7 @@ function disposeDefaultRenderingPipeline() {
|
|
|
477
566
|
}
|
|
478
567
|
__name(disposeDefaultRenderingPipeline, "disposeDefaultRenderingPipeline");
|
|
479
568
|
function createDefaultRenderingPipeline(scene, camera) {
|
|
480
|
-
defaultRenderingPipeline = new
|
|
569
|
+
defaultRenderingPipeline = new import_babylonjs41.DefaultRenderingPipeline("DefaultRenderingPipeline", true, scene, [camera]);
|
|
481
570
|
defaultRenderingPipeline.samples = 4;
|
|
482
571
|
defaultRenderingPipeline.depthOfField.lensSize = 512;
|
|
483
572
|
defaultRenderingPipeline.depthOfField.fStop = 0.25;
|
|
@@ -549,7 +638,7 @@ function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
|
549
638
|
pipeline.imageProcessing.ditheringEnabled = data.ditheringEnabled;
|
|
550
639
|
pipeline.imageProcessing.ditheringIntensity = data.ditheringIntensity;
|
|
551
640
|
pipeline.imageProcessing.vignetteEnabled = data.vignetteEnabled ?? false;
|
|
552
|
-
pipeline.imageProcessing.vignetteColor =
|
|
641
|
+
pipeline.imageProcessing.vignetteColor = import_babylonjs39.Color4.FromArray(data.vignetteColor ?? [0, 0, 0]);
|
|
553
642
|
pipeline.imageProcessing.vignetteWeight = data.vignetteWeight ?? 0.3;
|
|
554
643
|
}
|
|
555
644
|
pipeline.bloomEnabled = data.bloomEnabled;
|
|
@@ -572,8 +661,8 @@ function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
|
572
661
|
pipeline.chromaticAberrationEnabled = data.chromaticAberrationEnabled ?? false;
|
|
573
662
|
pipeline.chromaticAberration.aberrationAmount = data.aberrationAmount ?? 10;
|
|
574
663
|
pipeline.chromaticAberration.radialIntensity = data.radialIntensity ?? 1;
|
|
575
|
-
pipeline.chromaticAberration.direction =
|
|
576
|
-
pipeline.chromaticAberration.centerPosition =
|
|
664
|
+
pipeline.chromaticAberration.direction = import_babylonjs40.Vector2.FromArray(data.direction ?? [0, 0]);
|
|
665
|
+
pipeline.chromaticAberration.centerPosition = import_babylonjs40.Vector2.FromArray(data.centerPosition ?? [0, 0]);
|
|
577
666
|
pipeline.glowLayerEnabled = data.glowLayerEnabled ?? false;
|
|
578
667
|
if (pipeline.glowLayer) {
|
|
579
668
|
pipeline.glowLayer.intensity = data.glowLayerIntensity ?? 1;
|
|
@@ -649,8 +738,8 @@ function applyRenderingConfigurationForCamera(camera) {
|
|
|
649
738
|
__name(applyRenderingConfigurationForCamera, "applyRenderingConfigurationForCamera");
|
|
650
739
|
|
|
651
740
|
// src/tools/light.ts
|
|
652
|
-
var
|
|
653
|
-
var
|
|
741
|
+
var import_babylonjs45 = require("babylonjs");
|
|
742
|
+
var import_babylonjs46 = require("babylonjs");
|
|
654
743
|
function configureShadowMapRenderListPredicate(scene) {
|
|
655
744
|
scene.lights.forEach((light) => {
|
|
656
745
|
const shadowMap = light.getShadowGenerator()?.getShadowMap();
|
|
@@ -658,7 +747,7 @@ function configureShadowMapRenderListPredicate(scene) {
|
|
|
658
747
|
return;
|
|
659
748
|
}
|
|
660
749
|
shadowMap.renderListPredicate = (mesh) => {
|
|
661
|
-
const distance =
|
|
750
|
+
const distance = import_babylonjs45.Vector3.Distance(mesh.getAbsolutePosition(), light.getAbsolutePosition());
|
|
662
751
|
return distance <= light.range;
|
|
663
752
|
};
|
|
664
753
|
});
|
|
@@ -669,7 +758,7 @@ async function configureShadowMapRefreshRate(scene) {
|
|
|
669
758
|
scene.lights.forEach((light) => {
|
|
670
759
|
const shadowMap = light.getShadowGenerator()?.getShadowMap();
|
|
671
760
|
if (shadowMap) {
|
|
672
|
-
shadowMap.refreshRate = light.metadata?.refreshRate ??
|
|
761
|
+
shadowMap.refreshRate = light.metadata?.refreshRate ?? import_babylonjs46.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;
|
|
673
762
|
}
|
|
674
763
|
});
|
|
675
764
|
});
|
|
@@ -677,10 +766,10 @@ async function configureShadowMapRefreshRate(scene) {
|
|
|
677
766
|
__name(configureShadowMapRefreshRate, "configureShadowMapRefreshRate");
|
|
678
767
|
|
|
679
768
|
// src/loading/sound.ts
|
|
680
|
-
var
|
|
681
|
-
var
|
|
682
|
-
var audioParser = (0,
|
|
683
|
-
(0,
|
|
769
|
+
var import_babylonjs49 = require("babylonjs");
|
|
770
|
+
var import_babylonjs50 = require("babylonjs");
|
|
771
|
+
var audioParser = (0, import_babylonjs50.GetParser)(import_babylonjs49.SceneComponentConstants.NAME_AUDIO);
|
|
772
|
+
(0, import_babylonjs50.AddParser)(import_babylonjs49.SceneComponentConstants.NAME_AUDIO, (parsedData, scene, container, rootUrl) => {
|
|
684
773
|
audioParser?.(parsedData, scene, container, rootUrl);
|
|
685
774
|
parsedData.sounds?.forEach((sound) => {
|
|
686
775
|
const instance = container.sounds?.find((s) => s.name === sound.name);
|
|
@@ -702,9 +791,9 @@ function getPowerOfTwoUntil(limit) {
|
|
|
702
791
|
__name(getPowerOfTwoUntil, "getPowerOfTwoUntil");
|
|
703
792
|
|
|
704
793
|
// src/loading/texture.ts
|
|
705
|
-
var
|
|
706
|
-
var textureParser =
|
|
707
|
-
|
|
794
|
+
var import_babylonjs54 = require("babylonjs");
|
|
795
|
+
var textureParser = import_babylonjs54.SerializationHelper._TextureParser;
|
|
796
|
+
import_babylonjs54.SerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {
|
|
708
797
|
if (scene.loadingQuality === "high" || !sourceProperty.metadata?.baseSize) {
|
|
709
798
|
return textureParser(sourceProperty, scene, rootUrl);
|
|
710
799
|
}
|
|
@@ -750,18 +839,19 @@ import_babylonjs43.SerializationHelper._TextureParser = (sourceProperty, scene,
|
|
|
750
839
|
};
|
|
751
840
|
|
|
752
841
|
// src/loading/loader.ts
|
|
753
|
-
var
|
|
754
|
-
var
|
|
842
|
+
var import_babylonjs56 = require("babylonjs");
|
|
843
|
+
var import_babylonjs57 = require("babylonjs");
|
|
844
|
+
var import_babylonjs58 = require("babylonjs");
|
|
755
845
|
async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, options) {
|
|
756
846
|
scene.loadingQuality = options?.quality ?? "high";
|
|
757
|
-
await (0,
|
|
847
|
+
await (0, import_babylonjs57.AppendSceneAsync)(`${rootUrl}${sceneFilename}`, scene, {
|
|
758
848
|
pluginExtension: ".babylon",
|
|
759
849
|
onProgress: /* @__PURE__ */ __name((event) => {
|
|
760
850
|
const progress = Math.min(event.loaded / event.total * 0.5);
|
|
761
851
|
options?.onProgress?.(progress);
|
|
762
852
|
}, "onProgress")
|
|
763
853
|
});
|
|
764
|
-
if (
|
|
854
|
+
if (import_babylonjs58.SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {
|
|
765
855
|
scene.meshes.forEach((m) => isMesh(m) && m._checkDelayState());
|
|
766
856
|
}
|
|
767
857
|
const waitingItemsCount = scene.getWaitingItemsCount();
|
|
@@ -781,6 +871,9 @@ async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, options) {
|
|
|
781
871
|
applyRenderingConfigurationForCamera(scene.activeCamera);
|
|
782
872
|
}
|
|
783
873
|
}
|
|
874
|
+
if (scene.metadata?.physicsGravity) {
|
|
875
|
+
scene.getPhysicsEngine()?.setGravity(import_babylonjs56.Vector3.FromArray(scene.metadata?.physicsGravity));
|
|
876
|
+
}
|
|
784
877
|
applyScriptForObject(scene, scene, scriptsMap, rootUrl);
|
|
785
878
|
scene.transformNodes.forEach((transformNode) => {
|
|
786
879
|
applyScriptForObject(scene, transformNode, scriptsMap, rootUrl);
|
|
@@ -974,14 +1067,14 @@ function getSoundById(id, scene) {
|
|
|
974
1067
|
__name(getSoundById, "getSoundById");
|
|
975
1068
|
|
|
976
1069
|
// src/cinematic/tools.ts
|
|
977
|
-
var
|
|
978
|
-
var
|
|
979
|
-
var
|
|
980
|
-
var
|
|
1070
|
+
var import_babylonjs61 = require("babylonjs");
|
|
1071
|
+
var import_babylonjs62 = require("babylonjs");
|
|
1072
|
+
var import_babylonjs63 = require("babylonjs");
|
|
1073
|
+
var import_babylonjs65 = require("babylonjs");
|
|
981
1074
|
function cloneKey(dataType, key) {
|
|
982
1075
|
let value;
|
|
983
1076
|
switch (dataType) {
|
|
984
|
-
case
|
|
1077
|
+
case import_babylonjs62.Animation.ANIMATIONTYPE_FLOAT:
|
|
985
1078
|
value = key.value;
|
|
986
1079
|
break;
|
|
987
1080
|
default:
|
|
@@ -992,26 +1085,26 @@ function cloneKey(dataType, key) {
|
|
|
992
1085
|
value,
|
|
993
1086
|
frame: key.frame,
|
|
994
1087
|
interpolation: key.interpolation,
|
|
995
|
-
inTangent: dataType ===
|
|
996
|
-
outTangent: dataType ===
|
|
1088
|
+
inTangent: dataType === import_babylonjs62.Animation.ANIMATIONTYPE_FLOAT ? key.inTangent : key.inTangent?.clone(),
|
|
1089
|
+
outTangent: dataType === import_babylonjs62.Animation.ANIMATIONTYPE_FLOAT ? key.outTangent : key.outTangent?.clone()
|
|
997
1090
|
};
|
|
998
1091
|
}
|
|
999
1092
|
__name(cloneKey, "cloneKey");
|
|
1000
1093
|
function getAnimationTypeForObject(effectiveProperty) {
|
|
1001
1094
|
if (!isNaN(parseFloat(effectiveProperty)) && isFinite(effectiveProperty)) {
|
|
1002
|
-
return
|
|
1003
|
-
} else if (effectiveProperty instanceof
|
|
1004
|
-
return
|
|
1005
|
-
} else if (effectiveProperty instanceof
|
|
1006
|
-
return
|
|
1007
|
-
} else if (effectiveProperty instanceof
|
|
1008
|
-
return
|
|
1009
|
-
} else if (effectiveProperty instanceof
|
|
1010
|
-
return
|
|
1011
|
-
} else if (effectiveProperty instanceof
|
|
1012
|
-
return
|
|
1013
|
-
} else if (effectiveProperty instanceof
|
|
1014
|
-
return
|
|
1095
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_FLOAT;
|
|
1096
|
+
} else if (effectiveProperty instanceof import_babylonjs65.Quaternion) {
|
|
1097
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_QUATERNION;
|
|
1098
|
+
} else if (effectiveProperty instanceof import_babylonjs65.Vector3) {
|
|
1099
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_VECTOR3;
|
|
1100
|
+
} else if (effectiveProperty instanceof import_babylonjs65.Vector2) {
|
|
1101
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_VECTOR2;
|
|
1102
|
+
} else if (effectiveProperty instanceof import_babylonjs63.Color3) {
|
|
1103
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_COLOR3;
|
|
1104
|
+
} else if (effectiveProperty instanceof import_babylonjs63.Color4) {
|
|
1105
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_COLOR4;
|
|
1106
|
+
} else if (effectiveProperty instanceof import_babylonjs61.Size) {
|
|
1107
|
+
return import_babylonjs62.Animation.ANIMATIONTYPE_SIZE;
|
|
1015
1108
|
}
|
|
1016
1109
|
return null;
|
|
1017
1110
|
}
|
|
@@ -1027,9 +1120,9 @@ function getPropertyValue(object, property) {
|
|
|
1027
1120
|
__name(getPropertyValue, "getPropertyValue");
|
|
1028
1121
|
|
|
1029
1122
|
// src/cinematic/parse.ts
|
|
1030
|
-
var
|
|
1031
|
-
var
|
|
1032
|
-
var
|
|
1123
|
+
var import_babylonjs68 = require("babylonjs");
|
|
1124
|
+
var import_babylonjs69 = require("babylonjs");
|
|
1125
|
+
var import_babylonjs70 = require("babylonjs");
|
|
1033
1126
|
function parseCinematic(data, scene) {
|
|
1034
1127
|
return {
|
|
1035
1128
|
name: data.name,
|
|
@@ -1102,20 +1195,20 @@ function parseCinematicKeyValue(value, type) {
|
|
|
1102
1195
|
return void 0;
|
|
1103
1196
|
}
|
|
1104
1197
|
switch (type) {
|
|
1105
|
-
case
|
|
1198
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_FLOAT:
|
|
1106
1199
|
return value;
|
|
1107
|
-
case
|
|
1108
|
-
return
|
|
1109
|
-
case
|
|
1110
|
-
return
|
|
1111
|
-
case
|
|
1112
|
-
return
|
|
1113
|
-
case
|
|
1114
|
-
return
|
|
1115
|
-
case
|
|
1116
|
-
return
|
|
1117
|
-
case
|
|
1118
|
-
return
|
|
1200
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_VECTOR2:
|
|
1201
|
+
return import_babylonjs70.Vector2.FromArray(value);
|
|
1202
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_VECTOR3:
|
|
1203
|
+
return import_babylonjs70.Vector3.FromArray(value);
|
|
1204
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_QUATERNION:
|
|
1205
|
+
return import_babylonjs70.Quaternion.FromArray(value);
|
|
1206
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_COLOR3:
|
|
1207
|
+
return import_babylonjs69.Color3.FromArray(value);
|
|
1208
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_COLOR4:
|
|
1209
|
+
return import_babylonjs69.Color4.FromArray(value);
|
|
1210
|
+
case import_babylonjs68.Animation.ANIMATIONTYPE_MATRIX:
|
|
1211
|
+
return import_babylonjs70.Matrix.FromArray(value);
|
|
1119
1212
|
}
|
|
1120
1213
|
}
|
|
1121
1214
|
__name(parseCinematicKeyValue, "parseCinematicKeyValue");
|
|
@@ -1128,27 +1221,37 @@ function handleSetEnabledEvent(scene, config) {
|
|
|
1128
1221
|
__name(handleSetEnabledEvent, "handleSetEnabledEvent");
|
|
1129
1222
|
|
|
1130
1223
|
// src/cinematic/events/apply-impulse.ts
|
|
1131
|
-
var
|
|
1224
|
+
var import_babylonjs73 = require("babylonjs");
|
|
1225
|
+
var zeroVector = import_babylonjs73.Vector3.Zero();
|
|
1132
1226
|
function handleApplyImpulseEvent(scene, config) {
|
|
1133
|
-
const
|
|
1227
|
+
const force = import_babylonjs73.Vector3.FromArray(config.force);
|
|
1228
|
+
const contactPoint = import_babylonjs73.Vector3.FromArray(config.contactPoint);
|
|
1229
|
+
let meshes = config.mesh ? [scene.getNodeById(config.mesh)] : scene.meshes.filter((m) => m.physicsAggregate);
|
|
1230
|
+
if (config.radius) {
|
|
1231
|
+
meshes = meshes.filter((mesh) => {
|
|
1232
|
+
const centerWorld = mesh.getBoundingInfo().boundingBox.centerWorld;
|
|
1233
|
+
return import_babylonjs73.Vector3.Distance(centerWorld, contactPoint) <= config.radius;
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1134
1236
|
meshes.forEach((mesh) => {
|
|
1135
1237
|
if (mesh.physicsAggregate?.body) {
|
|
1136
|
-
mesh.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
);
|
|
1238
|
+
const direction = contactPoint.subtract(mesh.getBoundingInfo().boundingBox.centerWorld);
|
|
1239
|
+
direction.multiplyInPlace(force);
|
|
1240
|
+
mesh.physicsAggregate.body.setLinearVelocity(zeroVector);
|
|
1241
|
+
mesh.physicsAggregate.body.setAngularVelocity(zeroVector);
|
|
1242
|
+
mesh.physicsAggregate.body.applyImpulse(direction.negateInPlace(), contactPoint);
|
|
1140
1243
|
}
|
|
1141
1244
|
});
|
|
1142
1245
|
}
|
|
1143
1246
|
__name(handleApplyImpulseEvent, "handleApplyImpulseEvent");
|
|
1144
1247
|
|
|
1145
1248
|
// src/cinematic/generate.ts
|
|
1146
|
-
var
|
|
1147
|
-
var
|
|
1148
|
-
var
|
|
1149
|
-
var
|
|
1249
|
+
var import_babylonjs76 = require("babylonjs");
|
|
1250
|
+
var import_babylonjs78 = require("babylonjs");
|
|
1251
|
+
var import_babylonjs80 = require("babylonjs");
|
|
1252
|
+
var import_babylonjs81 = require("babylonjs");
|
|
1150
1253
|
function generateCinematicAnimationGroup(cinematic, scene) {
|
|
1151
|
-
const result = new
|
|
1254
|
+
const result = new import_babylonjs81.AnimationGroup(cinematic.name, scene);
|
|
1152
1255
|
cinematic.tracks.forEach((track) => {
|
|
1153
1256
|
const animationGroup = track.animationGroup;
|
|
1154
1257
|
if (animationGroup) {
|
|
@@ -1166,7 +1269,7 @@ function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
1166
1269
|
}
|
|
1167
1270
|
animation2 = targetedAnimation.animation.clone();
|
|
1168
1271
|
animation2.setKeys([]);
|
|
1169
|
-
animation2.name =
|
|
1272
|
+
animation2.name = import_babylonjs76.Tools.RandomId();
|
|
1170
1273
|
animation2.framePerSecond = cinematic.framesPerSecond;
|
|
1171
1274
|
}
|
|
1172
1275
|
const keys2 = animation2.getKeys();
|
|
@@ -1192,17 +1295,17 @@ function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
1192
1295
|
const dummyObject = {
|
|
1193
1296
|
dummy: 0
|
|
1194
1297
|
};
|
|
1195
|
-
const soundAnimation = new
|
|
1298
|
+
const soundAnimation = new import_babylonjs78.Animation(sound.name, "dummy", 60, import_babylonjs78.Animation.ANIMATIONTYPE_FLOAT, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1196
1299
|
let maxFrame = 0;
|
|
1197
1300
|
track.sounds?.forEach((configuration) => {
|
|
1198
1301
|
const duration = configuration.endFrame - configuration.startFrame;
|
|
1199
1302
|
maxFrame = Math.max(maxFrame, configuration.frame + duration);
|
|
1200
|
-
soundAnimation.addEvent(new
|
|
1303
|
+
soundAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame, (currentFrame) => {
|
|
1201
1304
|
const frameDiff = currentFrame - configuration.frame;
|
|
1202
1305
|
const offset = (frameDiff + configuration.startFrame) / cinematic.framesPerSecond;
|
|
1203
1306
|
sound.play(0, offset);
|
|
1204
1307
|
}, false));
|
|
1205
|
-
soundAnimation.addEvent(new
|
|
1308
|
+
soundAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame + duration, () => {
|
|
1206
1309
|
sound.stop();
|
|
1207
1310
|
}));
|
|
1208
1311
|
});
|
|
@@ -1216,11 +1319,11 @@ function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
1216
1319
|
const dummyObject = {
|
|
1217
1320
|
dummy: 0
|
|
1218
1321
|
};
|
|
1219
|
-
const eventsAnimation = new
|
|
1322
|
+
const eventsAnimation = new import_babylonjs78.Animation("events", "dummy", 60, import_babylonjs78.Animation.ANIMATIONTYPE_FLOAT, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1220
1323
|
let maxFrame = 0;
|
|
1221
1324
|
track.keyFrameEvents?.forEach((configuration) => {
|
|
1222
1325
|
maxFrame = Math.max(maxFrame, configuration.frame);
|
|
1223
|
-
eventsAnimation.addEvent(new
|
|
1326
|
+
eventsAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame, () => {
|
|
1224
1327
|
switch (configuration.data?.type) {
|
|
1225
1328
|
case "set-enabled":
|
|
1226
1329
|
handleSetEnabledEvent(scene, configuration.data);
|
|
@@ -1246,7 +1349,7 @@ function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
1246
1349
|
if (animationType === null) {
|
|
1247
1350
|
return;
|
|
1248
1351
|
}
|
|
1249
|
-
const animation = new
|
|
1352
|
+
const animation = new import_babylonjs78.Animation(track.propertyPath, track.propertyPath, 60, animationType, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1250
1353
|
const keys = [];
|
|
1251
1354
|
track.keyFrameAnimations?.forEach((keyFrame) => {
|
|
1252
1355
|
const animationKey = keyFrame.type === "key" ? keyFrame : null;
|
|
@@ -1257,6 +1360,19 @@ function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
1257
1360
|
if (animationKeyCut) {
|
|
1258
1361
|
keys.push(animationKeyCut.key1);
|
|
1259
1362
|
keys.push(animationKeyCut.key2);
|
|
1363
|
+
if (isCamera(node) && track.propertyPath === "position") {
|
|
1364
|
+
animation.addEvent(new import_babylonjs80.AnimationEvent(animationKeyCut.key1.frame, () => {
|
|
1365
|
+
const motionBlur = getMotionBlurPostProcess();
|
|
1366
|
+
if (!motionBlur) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
let motionStrength = motionBlur.motionStrength;
|
|
1370
|
+
motionBlur.motionStrength = 0;
|
|
1371
|
+
requestAnimationFrame(() => {
|
|
1372
|
+
motionBlur.motionStrength = motionStrength;
|
|
1373
|
+
});
|
|
1374
|
+
}));
|
|
1375
|
+
}
|
|
1260
1376
|
}
|
|
1261
1377
|
});
|
|
1262
1378
|
animation.setKeys(keys);
|
|
@@ -1270,6 +1386,8 @@ __name(generateCinematicAnimationGroup, "generateCinematicAnimationGroup");
|
|
|
1270
1386
|
0 && (module.exports = {
|
|
1271
1387
|
animationGroupFromScene,
|
|
1272
1388
|
configureEngineToUseCompressedTextures,
|
|
1389
|
+
configureShadowMapRefreshRate,
|
|
1390
|
+
configureShadowMapRenderListPredicate,
|
|
1273
1391
|
createDefaultRenderingPipeline,
|
|
1274
1392
|
createMotionBlurPostProcess,
|
|
1275
1393
|
createSSAO2RenderingPipeline,
|
|
@@ -1284,10 +1402,25 @@ __name(generateCinematicAnimationGroup, "generateCinematicAnimationGroup");
|
|
|
1284
1402
|
generateCinematicAnimationGroup,
|
|
1285
1403
|
getDefaultRenderingPipeline,
|
|
1286
1404
|
getMotionBlurPostProcess,
|
|
1405
|
+
getPowerOfTwoUntil,
|
|
1287
1406
|
getSSAO2RenderingPipeline,
|
|
1288
1407
|
getSSRRenderingPipeline,
|
|
1289
1408
|
getVLSPostProcess,
|
|
1290
1409
|
guiFromAsset,
|
|
1410
|
+
isAbstractMesh,
|
|
1411
|
+
isArcRotateCamera,
|
|
1412
|
+
isBone,
|
|
1413
|
+
isCamera,
|
|
1414
|
+
isDirectionalLight,
|
|
1415
|
+
isFreeCamera,
|
|
1416
|
+
isGroundMesh,
|
|
1417
|
+
isHemisphericLight,
|
|
1418
|
+
isInstancedMesh,
|
|
1419
|
+
isMesh,
|
|
1420
|
+
isPointLight,
|
|
1421
|
+
isSpotLight,
|
|
1422
|
+
isTexture,
|
|
1423
|
+
isTransformNode,
|
|
1291
1424
|
loadScene,
|
|
1292
1425
|
motionBlurPostProcessCameraConfigurations,
|
|
1293
1426
|
nodeFromDescendants,
|