babylonjs-editor-tools 0.0.10 → 0.0.12
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 +1 -1451
- package/build/src/cinematic/events/apply-impulse.js +5 -7
- package/build/src/cinematic/events/set-enabled.js +2 -3
- package/build/src/cinematic/generate.js +6 -4
- package/build/src/cinematic/guards.js +16 -0
- package/build/src/cinematic/parse.js +30 -2
- package/build/src/cinematic/tools.js +0 -31
- package/build/src/decorators/apply.js +25 -0
- package/build/src/decorators/inspector.js +27 -1
- package/build/src/index.js +2 -0
- package/build/src/loading/loader.js +1 -1
- package/build/src/rendering/default-pipeline.js +69 -1
- package/build/src/rendering/motion-blur.js +7 -0
- package/build/src/rendering/ssao.js +7 -0
- package/build/src/rendering/ssr.js +7 -0
- package/build/src/rendering/tools.js +3 -2
- package/build/src/rendering/vls.js +7 -0
- package/build/src/tools/animation.js +21 -0
- package/declaration/src/cinematic/events/apply-impulse.d.ts +10 -0
- package/declaration/src/cinematic/events/set-enabled.d.ts +6 -0
- package/declaration/src/cinematic/generate.d.ts +18 -0
- package/declaration/src/cinematic/guards.d.ts +6 -0
- package/declaration/src/cinematic/parse.d.ts +15 -0
- package/declaration/src/cinematic/tools.d.ts +10 -0
- package/declaration/src/cinematic/typings.d.ts +46 -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 +98 -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 +21 -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 +20 -0
- package/declaration/src/rendering/motion-blur.d.ts +17 -0
- package/declaration/src/rendering/ssao.d.ts +17 -0
- package/declaration/src/rendering/ssr.d.ts +17 -0
- package/declaration/src/rendering/tools.d.ts +15 -0
- package/declaration/src/rendering/vls.d.ts +18 -0
- package/declaration/src/script.d.ts +13 -0
- package/declaration/src/tools/animation.d.ts +5 -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 +8 -8
package/build/index.node.js
CHANGED
|
@@ -1,1451 +1 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
animationGroupFromScene: () => animationGroupFromScene,
|
|
24
|
-
configureEngineToUseCompressedTextures: () => configureEngineToUseCompressedTextures,
|
|
25
|
-
configureShadowMapRefreshRate: () => configureShadowMapRefreshRate,
|
|
26
|
-
configureShadowMapRenderListPredicate: () => configureShadowMapRenderListPredicate,
|
|
27
|
-
createDefaultRenderingPipeline: () => createDefaultRenderingPipeline,
|
|
28
|
-
createMotionBlurPostProcess: () => createMotionBlurPostProcess,
|
|
29
|
-
createSSAO2RenderingPipeline: () => createSSAO2RenderingPipeline,
|
|
30
|
-
createSSRRenderingPipeline: () => createSSRRenderingPipeline,
|
|
31
|
-
createVLSPostProcess: () => createVLSPostProcess,
|
|
32
|
-
defaultPipelineCameraConfigurations: () => defaultPipelineCameraConfigurations,
|
|
33
|
-
disposeDefaultRenderingPipeline: () => disposeDefaultRenderingPipeline,
|
|
34
|
-
disposeMotionBlurPostProcess: () => disposeMotionBlurPostProcess,
|
|
35
|
-
disposeSSAO2RenderingPipeline: () => disposeSSAO2RenderingPipeline,
|
|
36
|
-
disposeSSRRenderingPipeline: () => disposeSSRRenderingPipeline,
|
|
37
|
-
disposeVLSPostProcess: () => disposeVLSPostProcess,
|
|
38
|
-
generateCinematicAnimationGroup: () => generateCinematicAnimationGroup,
|
|
39
|
-
getDefaultRenderingPipeline: () => getDefaultRenderingPipeline,
|
|
40
|
-
getMotionBlurPostProcess: () => getMotionBlurPostProcess,
|
|
41
|
-
getPowerOfTwoUntil: () => getPowerOfTwoUntil,
|
|
42
|
-
getSSAO2RenderingPipeline: () => getSSAO2RenderingPipeline,
|
|
43
|
-
getSSRRenderingPipeline: () => getSSRRenderingPipeline,
|
|
44
|
-
getVLSPostProcess: () => getVLSPostProcess,
|
|
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,
|
|
60
|
-
loadScene: () => loadScene,
|
|
61
|
-
motionBlurPostProcessCameraConfigurations: () => motionBlurPostProcessCameraConfigurations,
|
|
62
|
-
nodeFromDescendants: () => nodeFromDescendants,
|
|
63
|
-
nodeFromScene: () => nodeFromScene,
|
|
64
|
-
parseCinematic: () => parseCinematic,
|
|
65
|
-
parseCinematicKeyValue: () => parseCinematicKeyValue,
|
|
66
|
-
parseDefaultRenderingPipeline: () => parseDefaultRenderingPipeline,
|
|
67
|
-
parseMotionBlurPostProcess: () => parseMotionBlurPostProcess,
|
|
68
|
-
parseSSAO2RenderingPipeline: () => parseSSAO2RenderingPipeline,
|
|
69
|
-
parseSSRRenderingPipeline: () => parseSSRRenderingPipeline,
|
|
70
|
-
parseVLSPostProcess: () => parseVLSPostProcess,
|
|
71
|
-
particleSystemFromScene: () => particleSystemFromScene,
|
|
72
|
-
serializeDefaultRenderingPipeline: () => serializeDefaultRenderingPipeline,
|
|
73
|
-
serializeMotionBlurPostProcess: () => serializeMotionBlurPostProcess,
|
|
74
|
-
serializeSSAO2RenderingPipeline: () => serializeSSAO2RenderingPipeline,
|
|
75
|
-
serializeSSRRenderingPipeline: () => serializeSSRRenderingPipeline,
|
|
76
|
-
serializeVLSPostProcess: () => serializeVLSPostProcess,
|
|
77
|
-
soundFromScene: () => soundFromScene,
|
|
78
|
-
ssaoRenderingPipelineCameraConfigurations: () => ssaoRenderingPipelineCameraConfigurations,
|
|
79
|
-
ssrRenderingPipelineCameraConfigurations: () => ssrRenderingPipelineCameraConfigurations,
|
|
80
|
-
visibleAsBoolean: () => visibleAsBoolean,
|
|
81
|
-
visibleAsColor3: () => visibleAsColor3,
|
|
82
|
-
visibleAsColor4: () => visibleAsColor4,
|
|
83
|
-
visibleAsNumber: () => visibleAsNumber,
|
|
84
|
-
visibleAsVector2: () => visibleAsVector2,
|
|
85
|
-
visibleAsVector3: () => visibleAsVector3,
|
|
86
|
-
vlsPostProcessCameraConfigurations: () => vlsPostProcessCameraConfigurations
|
|
87
|
-
});
|
|
88
|
-
module.exports = __toCommonJS(index_exports);
|
|
89
|
-
|
|
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");
|
|
102
|
-
function isMesh(object) {
|
|
103
|
-
switch (object.getClassName?.()) {
|
|
104
|
-
case "Mesh":
|
|
105
|
-
case "GroundMesh":
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
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");
|
|
119
|
-
function isGroundMesh(object) {
|
|
120
|
-
return object.getClassName?.() === "GroundMesh";
|
|
121
|
-
}
|
|
122
|
-
__name(isGroundMesh, "isGroundMesh");
|
|
123
|
-
function isTransformNode(object) {
|
|
124
|
-
return object.getClassName?.() === "TransformNode";
|
|
125
|
-
}
|
|
126
|
-
__name(isTransformNode, "isTransformNode");
|
|
127
|
-
function isTexture(object) {
|
|
128
|
-
return object?.getClassName?.() === "Texture";
|
|
129
|
-
}
|
|
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");
|
|
173
|
-
|
|
174
|
-
// src/decorators/apply.ts
|
|
175
|
-
var import_babylonjs16 = require("babylonjs");
|
|
176
|
-
var import_babylonjs_gui = require("babylonjs-gui");
|
|
177
|
-
function applyDecorators(scene, object, script, instance, rootUrl) {
|
|
178
|
-
const ctor = instance.constructor;
|
|
179
|
-
if (!ctor) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
ctor._NodesFromScene?.forEach((params) => {
|
|
183
|
-
instance[params.propertyKey.toString()] = scene.getNodeByName(params.nodeName);
|
|
184
|
-
});
|
|
185
|
-
ctor._NodesFromDescendants?.forEach((params) => {
|
|
186
|
-
const descendant = object.getDescendants?.(params.directDescendantsOnly, (node) => node.name === params.nodeName)[0];
|
|
187
|
-
instance[params.propertyKey.toString()] = descendant ?? null;
|
|
188
|
-
});
|
|
189
|
-
ctor._AnimationGroups?.forEach((params) => {
|
|
190
|
-
instance[params.propertyKey.toString()] = scene.getAnimationGroupByName(params.animationGroupName);
|
|
191
|
-
});
|
|
192
|
-
ctor._SoundsFromScene?.forEach((params) => {
|
|
193
|
-
const sound = scene.getSoundByName?.(params.soundName);
|
|
194
|
-
instance[params.propertyKey.toString()] = sound ?? null;
|
|
195
|
-
});
|
|
196
|
-
ctor._GuiFromAsset?.forEach(async (params) => {
|
|
197
|
-
const guiUrl = `${rootUrl}assets/${params.pathInAssets}`;
|
|
198
|
-
try {
|
|
199
|
-
const response = await fetch(guiUrl);
|
|
200
|
-
const data = await response.json();
|
|
201
|
-
const gui = import_babylonjs_gui.AdvancedDynamicTexture.CreateFullscreenUI(data.name, true, scene);
|
|
202
|
-
gui.parseSerializedObject(data.content, false);
|
|
203
|
-
instance[params.propertyKey.toString()] = gui;
|
|
204
|
-
params.onGuiCreated?.(instance, gui);
|
|
205
|
-
} catch (e) {
|
|
206
|
-
console.error(`Failed to load GUI from asset: ${guiUrl}`);
|
|
207
|
-
throw e;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
ctor._ParticleSystemsFromScene?.forEach((params) => {
|
|
211
|
-
const particleSystem = scene.particleSystems?.find((particleSystem2) => {
|
|
212
|
-
return particleSystem2.name === params.particleSystemName;
|
|
213
|
-
});
|
|
214
|
-
instance[params.propertyKey.toString()] = particleSystem;
|
|
215
|
-
});
|
|
216
|
-
ctor._VisibleInInspector?.forEach((params) => {
|
|
217
|
-
const propertyKey = params.propertyKey.toString();
|
|
218
|
-
const attachedScripts = script.values;
|
|
219
|
-
if (attachedScripts.hasOwnProperty(propertyKey) && attachedScripts[propertyKey].hasOwnProperty("value")) {
|
|
220
|
-
const value = attachedScripts[propertyKey].value;
|
|
221
|
-
switch (params.configuration.type) {
|
|
222
|
-
case "number":
|
|
223
|
-
case "boolean":
|
|
224
|
-
instance[propertyKey] = value;
|
|
225
|
-
break;
|
|
226
|
-
case "vector2":
|
|
227
|
-
instance[propertyKey] = import_babylonjs16.Vector2.FromArray(value);
|
|
228
|
-
break;
|
|
229
|
-
case "vector3":
|
|
230
|
-
instance[propertyKey] = import_babylonjs16.Vector3.FromArray(value);
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
__name(applyDecorators, "applyDecorators");
|
|
237
|
-
|
|
238
|
-
// src/loading/script.ts
|
|
239
|
-
function applyScriptForObject(scene, object, scriptsMap, rootUrl) {
|
|
240
|
-
if (!object.metadata) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
object.metadata.scripts?.forEach((script) => {
|
|
244
|
-
if (!script.enabled) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const exports2 = scriptsMap[script.key];
|
|
248
|
-
if (!exports2) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (exports2.default) {
|
|
252
|
-
const instance = new exports2.default(object);
|
|
253
|
-
applyDecorators(scene, object, script, instance, rootUrl);
|
|
254
|
-
if (instance.onStart) {
|
|
255
|
-
scene.onBeforeRenderObservable.addOnce(() => instance.onStart());
|
|
256
|
-
}
|
|
257
|
-
if (instance.onUpdate) {
|
|
258
|
-
scene.onBeforeRenderObservable.add(() => instance.onUpdate());
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
if (exports2.onStart) {
|
|
262
|
-
scene.onBeforeRenderObservable.addOnce(() => exports2.onStart(object));
|
|
263
|
-
}
|
|
264
|
-
if (exports2.onUpdate) {
|
|
265
|
-
scene.onBeforeRenderObservable.add(() => exports2.onUpdate(object));
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
object.metadata.scripts = void 0;
|
|
270
|
-
}
|
|
271
|
-
__name(applyScriptForObject, "applyScriptForObject");
|
|
272
|
-
|
|
273
|
-
// src/loading/physics.ts
|
|
274
|
-
var import_babylonjs20 = require("babylonjs");
|
|
275
|
-
var import_babylonjs21 = require("babylonjs");
|
|
276
|
-
function configurePhysicsAggregate(transformNode) {
|
|
277
|
-
const data = transformNode.metadata?.physicsAggregate;
|
|
278
|
-
if (!data) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
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
|
|
290
|
-
});
|
|
291
|
-
aggregate.body.setMassProperties({
|
|
292
|
-
mass: data.massProperties.mass,
|
|
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
|
|
296
|
-
});
|
|
297
|
-
aggregate.shape.density = data.shape.density;
|
|
298
|
-
aggregate.body.setMotionType(data.body.motionType);
|
|
299
|
-
aggregate.shape.material = data.material;
|
|
300
|
-
transformNode.physicsAggregate = aggregate;
|
|
301
|
-
transformNode.metadata.physicsAggregate = void 0;
|
|
302
|
-
}
|
|
303
|
-
__name(configurePhysicsAggregate, "configurePhysicsAggregate");
|
|
304
|
-
|
|
305
|
-
// src/rendering/vls.ts
|
|
306
|
-
var import_babylonjs25 = require("babylonjs");
|
|
307
|
-
var import_babylonjs26 = require("babylonjs");
|
|
308
|
-
var import_babylonjs27 = require("babylonjs");
|
|
309
|
-
var vlsPostProcess = null;
|
|
310
|
-
var vlsPostProcessCameraConfigurations = /* @__PURE__ */ new Map();
|
|
311
|
-
function getVLSPostProcess() {
|
|
312
|
-
return vlsPostProcess;
|
|
313
|
-
}
|
|
314
|
-
__name(getVLSPostProcess, "getVLSPostProcess");
|
|
315
|
-
function disposeVLSPostProcess(scene) {
|
|
316
|
-
if (vlsPostProcess && scene.activeCamera) {
|
|
317
|
-
vlsPostProcess.dispose(scene.activeCamera);
|
|
318
|
-
vlsPostProcess = null;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
__name(disposeVLSPostProcess, "disposeVLSPostProcess");
|
|
322
|
-
function createVLSPostProcess(scene, mesh) {
|
|
323
|
-
mesh ??= scene.meshes.find((mesh2) => isMesh(mesh2));
|
|
324
|
-
vlsPostProcess = new import_babylonjs27.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess", 1, scene.activeCamera, mesh, 100, import_babylonjs26.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
|
|
325
|
-
return vlsPostProcess;
|
|
326
|
-
}
|
|
327
|
-
__name(createVLSPostProcess, "createVLSPostProcess");
|
|
328
|
-
function serializeVLSPostProcess() {
|
|
329
|
-
if (!vlsPostProcess) {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
return {
|
|
333
|
-
meshId: vlsPostProcess.mesh?.id,
|
|
334
|
-
exposure: vlsPostProcess.exposure,
|
|
335
|
-
decay: vlsPostProcess.decay,
|
|
336
|
-
weight: vlsPostProcess.weight,
|
|
337
|
-
density: vlsPostProcess.density,
|
|
338
|
-
invert: vlsPostProcess.invert,
|
|
339
|
-
useCustomMeshPosition: vlsPostProcess.useCustomMeshPosition,
|
|
340
|
-
customMeshPosition: vlsPostProcess.customMeshPosition.asArray()
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
__name(serializeVLSPostProcess, "serializeVLSPostProcess");
|
|
344
|
-
function parseVLSPostProcess(scene, data) {
|
|
345
|
-
let mesh = null;
|
|
346
|
-
if (data.meshId) {
|
|
347
|
-
const result = scene.getMeshById(data.meshId);
|
|
348
|
-
if (result && isMesh(result)) {
|
|
349
|
-
mesh = result;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
const vlsPostProcess2 = createVLSPostProcess(scene, mesh);
|
|
353
|
-
vlsPostProcess2.exposure = data.exposure;
|
|
354
|
-
vlsPostProcess2.decay = data.decay;
|
|
355
|
-
vlsPostProcess2.weight = data.weight;
|
|
356
|
-
vlsPostProcess2.density = data.density;
|
|
357
|
-
vlsPostProcess2.invert = data.invert;
|
|
358
|
-
vlsPostProcess2.useCustomMeshPosition = data.useCustomMeshPosition;
|
|
359
|
-
vlsPostProcess2.customMeshPosition.copyFrom(import_babylonjs25.Vector3.FromArray(data.customMeshPosition));
|
|
360
|
-
return vlsPostProcess2;
|
|
361
|
-
}
|
|
362
|
-
__name(parseVLSPostProcess, "parseVLSPostProcess");
|
|
363
|
-
|
|
364
|
-
// src/rendering/ssr.ts
|
|
365
|
-
var import_babylonjs30 = require("babylonjs");
|
|
366
|
-
var ssrRenderingPipeline = null;
|
|
367
|
-
var ssrRenderingPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
368
|
-
function getSSRRenderingPipeline() {
|
|
369
|
-
return ssrRenderingPipeline;
|
|
370
|
-
}
|
|
371
|
-
__name(getSSRRenderingPipeline, "getSSRRenderingPipeline");
|
|
372
|
-
function disposeSSRRenderingPipeline() {
|
|
373
|
-
if (ssrRenderingPipeline) {
|
|
374
|
-
ssrRenderingPipeline.dispose();
|
|
375
|
-
ssrRenderingPipeline = null;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
__name(disposeSSRRenderingPipeline, "disposeSSRRenderingPipeline");
|
|
379
|
-
function createSSRRenderingPipeline(scene, camera) {
|
|
380
|
-
ssrRenderingPipeline = new import_babylonjs30.SSRRenderingPipeline("SSRRenderingPipeline", scene, [camera]);
|
|
381
|
-
ssrRenderingPipeline.samples = 4;
|
|
382
|
-
return ssrRenderingPipeline;
|
|
383
|
-
}
|
|
384
|
-
__name(createSSRRenderingPipeline, "createSSRRenderingPipeline");
|
|
385
|
-
function serializeSSRRenderingPipeline() {
|
|
386
|
-
if (!ssrRenderingPipeline) {
|
|
387
|
-
return null;
|
|
388
|
-
}
|
|
389
|
-
return {
|
|
390
|
-
samples: ssrRenderingPipeline.samples,
|
|
391
|
-
step: ssrRenderingPipeline.step,
|
|
392
|
-
thickness: ssrRenderingPipeline.thickness,
|
|
393
|
-
strength: ssrRenderingPipeline.strength,
|
|
394
|
-
reflectionSpecularFalloffExponent: ssrRenderingPipeline.reflectionSpecularFalloffExponent,
|
|
395
|
-
maxSteps: ssrRenderingPipeline.maxSteps,
|
|
396
|
-
maxDistance: ssrRenderingPipeline.maxDistance,
|
|
397
|
-
roughnessFactor: ssrRenderingPipeline.roughnessFactor,
|
|
398
|
-
reflectivityThreshold: ssrRenderingPipeline.reflectivityThreshold,
|
|
399
|
-
blurDispersionStrehgth: ssrRenderingPipeline.blurDispersionStrength,
|
|
400
|
-
clipToFrustum: ssrRenderingPipeline.clipToFrustum,
|
|
401
|
-
enableSmoothReflections: ssrRenderingPipeline.enableSmoothReflections,
|
|
402
|
-
enableAutomaticThicknessComputation: ssrRenderingPipeline.enableAutomaticThicknessComputation,
|
|
403
|
-
attenuateFacingCamera: ssrRenderingPipeline.attenuateFacingCamera,
|
|
404
|
-
attenuateScreenBorders: ssrRenderingPipeline.attenuateScreenBorders,
|
|
405
|
-
attenuateIntersectionDistance: ssrRenderingPipeline.attenuateIntersectionDistance,
|
|
406
|
-
attenuateBackfaceReflection: ssrRenderingPipeline.attenuateBackfaceReflection,
|
|
407
|
-
blurDownsample: ssrRenderingPipeline.blurDownsample,
|
|
408
|
-
selfCollisionNumSkip: ssrRenderingPipeline.selfCollisionNumSkip,
|
|
409
|
-
ssrDownsample: ssrRenderingPipeline.ssrDownsample,
|
|
410
|
-
backfaceDepthTextureDownsample: ssrRenderingPipeline.backfaceDepthTextureDownsample
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
__name(serializeSSRRenderingPipeline, "serializeSSRRenderingPipeline");
|
|
414
|
-
function parseSSRRenderingPipeline(scene, camera, data) {
|
|
415
|
-
if (ssrRenderingPipeline) {
|
|
416
|
-
return ssrRenderingPipeline;
|
|
417
|
-
}
|
|
418
|
-
const pipeline = createSSRRenderingPipeline(scene, camera);
|
|
419
|
-
pipeline.samples = data.samples;
|
|
420
|
-
pipeline.step = data.step;
|
|
421
|
-
pipeline.thickness = data.thickness;
|
|
422
|
-
pipeline.strength = data.strength;
|
|
423
|
-
pipeline.reflectionSpecularFalloffExponent = data.reflectionSpecularFalloffExponent;
|
|
424
|
-
pipeline.maxSteps = data.maxSteps;
|
|
425
|
-
pipeline.maxDistance = data.maxDistance;
|
|
426
|
-
pipeline.roughnessFactor = data.roughnessFactor;
|
|
427
|
-
pipeline.reflectivityThreshold = data.reflectivityThreshold;
|
|
428
|
-
pipeline.blurDispersionStrength = data.blurDispersionStrehgth;
|
|
429
|
-
pipeline.clipToFrustum = data.clipToFrustum;
|
|
430
|
-
pipeline.enableSmoothReflections = data.enableSmoothReflections;
|
|
431
|
-
pipeline.enableAutomaticThicknessComputation = data.enableAutomaticThicknessComputation;
|
|
432
|
-
pipeline.attenuateFacingCamera = data.attenuateFacingCamera;
|
|
433
|
-
pipeline.attenuateScreenBorders = data.attenuateScreenBorders;
|
|
434
|
-
pipeline.attenuateIntersectionDistance = data.attenuateIntersectionDistance;
|
|
435
|
-
pipeline.attenuateBackfaceReflection = data.attenuateBackfaceReflection;
|
|
436
|
-
pipeline.blurDownsample = data.blurDownsample;
|
|
437
|
-
pipeline.selfCollisionNumSkip = data.selfCollisionNumSkip;
|
|
438
|
-
pipeline.ssrDownsample = data.ssrDownsample;
|
|
439
|
-
pipeline.backfaceDepthTextureDownsample = data.backfaceDepthTextureDownsample;
|
|
440
|
-
return pipeline;
|
|
441
|
-
}
|
|
442
|
-
__name(parseSSRRenderingPipeline, "parseSSRRenderingPipeline");
|
|
443
|
-
|
|
444
|
-
// src/rendering/ssao.ts
|
|
445
|
-
var import_babylonjs33 = require("babylonjs");
|
|
446
|
-
var ssaoRenderingPipeline = null;
|
|
447
|
-
var ssaoRenderingPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
448
|
-
function getSSAO2RenderingPipeline() {
|
|
449
|
-
return ssaoRenderingPipeline;
|
|
450
|
-
}
|
|
451
|
-
__name(getSSAO2RenderingPipeline, "getSSAO2RenderingPipeline");
|
|
452
|
-
function disposeSSAO2RenderingPipeline() {
|
|
453
|
-
if (ssaoRenderingPipeline) {
|
|
454
|
-
ssaoRenderingPipeline.dispose();
|
|
455
|
-
ssaoRenderingPipeline = null;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
__name(disposeSSAO2RenderingPipeline, "disposeSSAO2RenderingPipeline");
|
|
459
|
-
function createSSAO2RenderingPipeline(scene, camera) {
|
|
460
|
-
ssaoRenderingPipeline = new import_babylonjs33.SSAO2RenderingPipeline("SSAO2RenderingPipeline", scene, 1, [camera]);
|
|
461
|
-
ssaoRenderingPipeline.samples = 4;
|
|
462
|
-
return ssaoRenderingPipeline;
|
|
463
|
-
}
|
|
464
|
-
__name(createSSAO2RenderingPipeline, "createSSAO2RenderingPipeline");
|
|
465
|
-
function serializeSSAO2RenderingPipeline() {
|
|
466
|
-
if (!ssaoRenderingPipeline) {
|
|
467
|
-
return null;
|
|
468
|
-
}
|
|
469
|
-
return {
|
|
470
|
-
radius: ssaoRenderingPipeline.radius,
|
|
471
|
-
totalStrength: ssaoRenderingPipeline.totalStrength,
|
|
472
|
-
samples: ssaoRenderingPipeline.samples,
|
|
473
|
-
maxZ: ssaoRenderingPipeline.maxZ,
|
|
474
|
-
minZAspect: ssaoRenderingPipeline.minZAspect,
|
|
475
|
-
epsilon: ssaoRenderingPipeline.epsilon,
|
|
476
|
-
textureSamples: ssaoRenderingPipeline.textureSamples,
|
|
477
|
-
bypassBlur: ssaoRenderingPipeline.bypassBlur,
|
|
478
|
-
bilateralSamples: ssaoRenderingPipeline.bilateralSamples,
|
|
479
|
-
bilateralSoften: ssaoRenderingPipeline.bilateralSoften,
|
|
480
|
-
bilateralTolerance: ssaoRenderingPipeline.bilateralTolerance,
|
|
481
|
-
expensiveBlur: ssaoRenderingPipeline.expensiveBlur
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
__name(serializeSSAO2RenderingPipeline, "serializeSSAO2RenderingPipeline");
|
|
485
|
-
function parseSSAO2RenderingPipeline(scene, camera, data) {
|
|
486
|
-
if (ssaoRenderingPipeline) {
|
|
487
|
-
return ssaoRenderingPipeline;
|
|
488
|
-
}
|
|
489
|
-
const pipeline = createSSAO2RenderingPipeline(scene, camera);
|
|
490
|
-
pipeline.radius = data.radius;
|
|
491
|
-
pipeline.totalStrength = data.totalStrength;
|
|
492
|
-
pipeline.samples = data.samples;
|
|
493
|
-
pipeline.maxZ = data.maxZ;
|
|
494
|
-
pipeline.minZAspect = data.minZAspect;
|
|
495
|
-
pipeline.epsilon = data.epsilon;
|
|
496
|
-
pipeline.textureSamples = data.textureSamples;
|
|
497
|
-
pipeline.bypassBlur = data.bypassBlur;
|
|
498
|
-
pipeline.bilateralSamples = data.bilateralSamples;
|
|
499
|
-
pipeline.bilateralSoften = data.bilateralSoften;
|
|
500
|
-
pipeline.bilateralTolerance = data.bilateralTolerance;
|
|
501
|
-
pipeline.expensiveBlur = data.expensiveBlur;
|
|
502
|
-
return pipeline;
|
|
503
|
-
}
|
|
504
|
-
__name(parseSSAO2RenderingPipeline, "parseSSAO2RenderingPipeline");
|
|
505
|
-
|
|
506
|
-
// src/rendering/motion-blur.ts
|
|
507
|
-
var import_babylonjs36 = require("babylonjs");
|
|
508
|
-
var motionBlurPostProcess = null;
|
|
509
|
-
var motionBlurPostProcessCameraConfigurations = /* @__PURE__ */ new Map();
|
|
510
|
-
function getMotionBlurPostProcess() {
|
|
511
|
-
return motionBlurPostProcess;
|
|
512
|
-
}
|
|
513
|
-
__name(getMotionBlurPostProcess, "getMotionBlurPostProcess");
|
|
514
|
-
function disposeMotionBlurPostProcess() {
|
|
515
|
-
if (motionBlurPostProcess) {
|
|
516
|
-
motionBlurPostProcess.dispose();
|
|
517
|
-
motionBlurPostProcess = null;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
__name(disposeMotionBlurPostProcess, "disposeMotionBlurPostProcess");
|
|
521
|
-
function createMotionBlurPostProcess(scene, camera) {
|
|
522
|
-
motionBlurPostProcess = new import_babylonjs36.MotionBlurPostProcess("MotionBlurPostProcess", scene, 1, camera);
|
|
523
|
-
motionBlurPostProcess.motionStrength = 1;
|
|
524
|
-
motionBlurPostProcess.isObjectBased = true;
|
|
525
|
-
return motionBlurPostProcess;
|
|
526
|
-
}
|
|
527
|
-
__name(createMotionBlurPostProcess, "createMotionBlurPostProcess");
|
|
528
|
-
function serializeMotionBlurPostProcess() {
|
|
529
|
-
if (!motionBlurPostProcess) {
|
|
530
|
-
return null;
|
|
531
|
-
}
|
|
532
|
-
return {
|
|
533
|
-
isObjectBased: motionBlurPostProcess.isObjectBased,
|
|
534
|
-
motionStrength: motionBlurPostProcess.motionStrength,
|
|
535
|
-
motionBlurSamples: motionBlurPostProcess.motionBlurSamples
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
__name(serializeMotionBlurPostProcess, "serializeMotionBlurPostProcess");
|
|
539
|
-
function parseMotionBlurPostProcess(scene, camera, data) {
|
|
540
|
-
if (motionBlurPostProcess) {
|
|
541
|
-
return motionBlurPostProcess;
|
|
542
|
-
}
|
|
543
|
-
const postProcess = createMotionBlurPostProcess(scene, camera);
|
|
544
|
-
postProcess.isObjectBased = data.isObjectBased;
|
|
545
|
-
postProcess.motionStrength = data.motionStrength;
|
|
546
|
-
postProcess.motionBlurSamples = data.motionBlurSamples;
|
|
547
|
-
return postProcess;
|
|
548
|
-
}
|
|
549
|
-
__name(parseMotionBlurPostProcess, "parseMotionBlurPostProcess");
|
|
550
|
-
|
|
551
|
-
// src/rendering/default-pipeline.ts
|
|
552
|
-
var import_babylonjs39 = require("babylonjs");
|
|
553
|
-
var import_babylonjs40 = require("babylonjs");
|
|
554
|
-
var import_babylonjs41 = require("babylonjs");
|
|
555
|
-
var defaultRenderingPipeline = null;
|
|
556
|
-
var defaultPipelineCameraConfigurations = /* @__PURE__ */ new Map();
|
|
557
|
-
function getDefaultRenderingPipeline() {
|
|
558
|
-
return defaultRenderingPipeline;
|
|
559
|
-
}
|
|
560
|
-
__name(getDefaultRenderingPipeline, "getDefaultRenderingPipeline");
|
|
561
|
-
function disposeDefaultRenderingPipeline() {
|
|
562
|
-
if (defaultRenderingPipeline) {
|
|
563
|
-
defaultRenderingPipeline.dispose();
|
|
564
|
-
defaultRenderingPipeline = null;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
__name(disposeDefaultRenderingPipeline, "disposeDefaultRenderingPipeline");
|
|
568
|
-
function createDefaultRenderingPipeline(scene, camera) {
|
|
569
|
-
defaultRenderingPipeline = new import_babylonjs41.DefaultRenderingPipeline("DefaultRenderingPipeline", true, scene, [camera]);
|
|
570
|
-
defaultRenderingPipeline.samples = 4;
|
|
571
|
-
defaultRenderingPipeline.depthOfField.lensSize = 512;
|
|
572
|
-
defaultRenderingPipeline.depthOfField.fStop = 0.25;
|
|
573
|
-
defaultRenderingPipeline.depthOfField.focusDistance = 55e3;
|
|
574
|
-
return defaultRenderingPipeline;
|
|
575
|
-
}
|
|
576
|
-
__name(createDefaultRenderingPipeline, "createDefaultRenderingPipeline");
|
|
577
|
-
function serializeDefaultRenderingPipeline() {
|
|
578
|
-
if (!defaultRenderingPipeline) {
|
|
579
|
-
return null;
|
|
580
|
-
}
|
|
581
|
-
return {
|
|
582
|
-
samples: defaultRenderingPipeline.samples,
|
|
583
|
-
fxaaEnabled: defaultRenderingPipeline.fxaaEnabled,
|
|
584
|
-
imageProcessingEnabled: defaultRenderingPipeline.imageProcessingEnabled,
|
|
585
|
-
exposure: defaultRenderingPipeline.imageProcessing?.exposure,
|
|
586
|
-
contrast: defaultRenderingPipeline.imageProcessing?.contrast,
|
|
587
|
-
fromLinearSpace: defaultRenderingPipeline.imageProcessing?.fromLinearSpace,
|
|
588
|
-
toneMappingEnabled: defaultRenderingPipeline.imageProcessing?.toneMappingEnabled,
|
|
589
|
-
toneMappingType: defaultRenderingPipeline.imageProcessing?.toneMappingType,
|
|
590
|
-
ditheringEnabled: defaultRenderingPipeline.imageProcessing?.ditheringEnabled,
|
|
591
|
-
ditheringIntensity: defaultRenderingPipeline.imageProcessing?.ditheringIntensity,
|
|
592
|
-
bloomEnabled: defaultRenderingPipeline.bloomEnabled,
|
|
593
|
-
bloomThreshold: defaultRenderingPipeline.bloomThreshold,
|
|
594
|
-
bloomWeight: defaultRenderingPipeline.bloomWeight,
|
|
595
|
-
bloomScale: defaultRenderingPipeline.bloomScale,
|
|
596
|
-
bloomKernel: defaultRenderingPipeline.bloomKernel,
|
|
597
|
-
sharpenEnabled: defaultRenderingPipeline.sharpenEnabled,
|
|
598
|
-
sharpenEdgeAmount: defaultRenderingPipeline.sharpen.edgeAmount,
|
|
599
|
-
sharpenColorAmount: defaultRenderingPipeline.sharpen.colorAmount,
|
|
600
|
-
grainEnabled: defaultRenderingPipeline.grainEnabled,
|
|
601
|
-
grainIntensity: defaultRenderingPipeline.grain.intensity,
|
|
602
|
-
grainAnimated: defaultRenderingPipeline.grain.animated,
|
|
603
|
-
depthOfFieldEnabled: defaultRenderingPipeline.depthOfFieldEnabled,
|
|
604
|
-
depthOfFieldBlurLevel: defaultRenderingPipeline.depthOfFieldBlurLevel,
|
|
605
|
-
lensSize: defaultRenderingPipeline.depthOfField.lensSize,
|
|
606
|
-
fStop: defaultRenderingPipeline.depthOfField.fStop,
|
|
607
|
-
focusDistance: defaultRenderingPipeline.depthOfField.focusDistance,
|
|
608
|
-
focalLength: defaultRenderingPipeline.depthOfField.focalLength,
|
|
609
|
-
// Since v5.0.0-alpha.9
|
|
610
|
-
vignetteEnabled: defaultRenderingPipeline.imageProcessing?.vignetteEnabled,
|
|
611
|
-
vignetteColor: defaultRenderingPipeline.imageProcessing?.vignetteColor.asArray(),
|
|
612
|
-
vignetteWeight: defaultRenderingPipeline.imageProcessing?.vignetteWeight,
|
|
613
|
-
chromaticAberrationEnabled: defaultRenderingPipeline.chromaticAberrationEnabled,
|
|
614
|
-
aberrationAmount: defaultRenderingPipeline.chromaticAberration.aberrationAmount,
|
|
615
|
-
radialIntensity: defaultRenderingPipeline.chromaticAberration.radialIntensity,
|
|
616
|
-
direction: defaultRenderingPipeline.chromaticAberration.direction.asArray(),
|
|
617
|
-
centerPosition: defaultRenderingPipeline.chromaticAberration.centerPosition.asArray(),
|
|
618
|
-
glowLayerEnabled: defaultRenderingPipeline.glowLayerEnabled,
|
|
619
|
-
glowLayerIntensity: defaultRenderingPipeline.glowLayer?.intensity,
|
|
620
|
-
glowLayerBlurKernelSize: defaultRenderingPipeline.glowLayer?.blurKernelSize
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
__name(serializeDefaultRenderingPipeline, "serializeDefaultRenderingPipeline");
|
|
624
|
-
function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
625
|
-
if (defaultRenderingPipeline) {
|
|
626
|
-
return defaultRenderingPipeline;
|
|
627
|
-
}
|
|
628
|
-
const pipeline = createDefaultRenderingPipeline(scene, camera);
|
|
629
|
-
pipeline.samples = data.samples;
|
|
630
|
-
pipeline.fxaaEnabled = data.fxaaEnabled;
|
|
631
|
-
pipeline.imageProcessingEnabled = data.imageProcessingEnabled;
|
|
632
|
-
if (pipeline.imageProcessing) {
|
|
633
|
-
pipeline.imageProcessing.exposure = data.exposure;
|
|
634
|
-
pipeline.imageProcessing.contrast = data.contrast;
|
|
635
|
-
pipeline.imageProcessing.fromLinearSpace = data.fromLinearSpace;
|
|
636
|
-
pipeline.imageProcessing.toneMappingEnabled = data.toneMappingEnabled;
|
|
637
|
-
pipeline.imageProcessing.toneMappingType = data.toneMappingType;
|
|
638
|
-
pipeline.imageProcessing.ditheringEnabled = data.ditheringEnabled;
|
|
639
|
-
pipeline.imageProcessing.ditheringIntensity = data.ditheringIntensity;
|
|
640
|
-
pipeline.imageProcessing.vignetteEnabled = data.vignetteEnabled ?? false;
|
|
641
|
-
pipeline.imageProcessing.vignetteColor = import_babylonjs39.Color4.FromArray(data.vignetteColor ?? [0, 0, 0]);
|
|
642
|
-
pipeline.imageProcessing.vignetteWeight = data.vignetteWeight ?? 0.3;
|
|
643
|
-
}
|
|
644
|
-
pipeline.bloomEnabled = data.bloomEnabled;
|
|
645
|
-
pipeline.bloomThreshold = data.bloomThreshold;
|
|
646
|
-
pipeline.bloomWeight = data.bloomWeight;
|
|
647
|
-
pipeline.bloomScale = data.bloomScale;
|
|
648
|
-
pipeline.bloomKernel = data.bloomKernel;
|
|
649
|
-
pipeline.sharpenEnabled = data.sharpenEnabled;
|
|
650
|
-
pipeline.sharpen.edgeAmount = data.sharpenEdgeAmount;
|
|
651
|
-
pipeline.sharpen.colorAmount = data.sharpenColorAmount;
|
|
652
|
-
pipeline.grainEnabled = data.grainEnabled;
|
|
653
|
-
pipeline.grain.intensity = data.grainIntensity;
|
|
654
|
-
pipeline.grain.animated = data.grainAnimated;
|
|
655
|
-
pipeline.depthOfFieldEnabled = data.depthOfFieldEnabled;
|
|
656
|
-
pipeline.depthOfFieldBlurLevel = data.depthOfFieldBlurLevel;
|
|
657
|
-
pipeline.depthOfField.lensSize = data.lensSize;
|
|
658
|
-
pipeline.depthOfField.fStop = data.fStop;
|
|
659
|
-
pipeline.depthOfField.focusDistance = data.focusDistance;
|
|
660
|
-
pipeline.depthOfField.focalLength = data.focalLength;
|
|
661
|
-
pipeline.chromaticAberrationEnabled = data.chromaticAberrationEnabled ?? false;
|
|
662
|
-
pipeline.chromaticAberration.aberrationAmount = data.aberrationAmount ?? 10;
|
|
663
|
-
pipeline.chromaticAberration.radialIntensity = data.radialIntensity ?? 1;
|
|
664
|
-
pipeline.chromaticAberration.direction = import_babylonjs40.Vector2.FromArray(data.direction ?? [0, 0]);
|
|
665
|
-
pipeline.chromaticAberration.centerPosition = import_babylonjs40.Vector2.FromArray(data.centerPosition ?? [0, 0]);
|
|
666
|
-
pipeline.glowLayerEnabled = data.glowLayerEnabled ?? false;
|
|
667
|
-
if (pipeline.glowLayer) {
|
|
668
|
-
pipeline.glowLayer.intensity = data.glowLayerIntensity ?? 1;
|
|
669
|
-
pipeline.glowLayer.blurKernelSize = data.glowLayerBlurKernelSize ?? 32;
|
|
670
|
-
}
|
|
671
|
-
return pipeline;
|
|
672
|
-
}
|
|
673
|
-
__name(parseDefaultRenderingPipeline, "parseDefaultRenderingPipeline");
|
|
674
|
-
|
|
675
|
-
// src/loading/rendering.ts
|
|
676
|
-
function applyRenderingConfigurations(scene, rendering) {
|
|
677
|
-
const postProcessConfigurations = Array.isArray(rendering) ? rendering : [];
|
|
678
|
-
postProcessConfigurations.forEach((configuration) => {
|
|
679
|
-
const camera = scene.getCameraById(configuration.cameraId);
|
|
680
|
-
if (!camera) {
|
|
681
|
-
return;
|
|
682
|
-
}
|
|
683
|
-
if (configuration.ssao2RenderingPipeline) {
|
|
684
|
-
ssaoRenderingPipelineCameraConfigurations.set(camera, configuration.ssao2RenderingPipeline);
|
|
685
|
-
}
|
|
686
|
-
if (configuration.vlsPostProcess) {
|
|
687
|
-
vlsPostProcessCameraConfigurations.set(camera, configuration.vlsPostProcess);
|
|
688
|
-
}
|
|
689
|
-
if (configuration.ssrRenderingPipeline) {
|
|
690
|
-
ssrRenderingPipelineCameraConfigurations.set(camera, configuration.ssrRenderingPipeline);
|
|
691
|
-
}
|
|
692
|
-
if (configuration.motionBlurPostProcess) {
|
|
693
|
-
motionBlurPostProcessCameraConfigurations.set(camera, configuration.motionBlurPostProcess);
|
|
694
|
-
}
|
|
695
|
-
if (configuration.defaultRenderingPipeline) {
|
|
696
|
-
defaultPipelineCameraConfigurations.set(camera, configuration.defaultRenderingPipeline);
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
__name(applyRenderingConfigurations, "applyRenderingConfigurations");
|
|
701
|
-
|
|
702
|
-
// src/rendering/tools.ts
|
|
703
|
-
function saveRenderingConfigurationForCamera(camera) {
|
|
704
|
-
ssaoRenderingPipelineCameraConfigurations.set(camera, serializeSSAO2RenderingPipeline());
|
|
705
|
-
vlsPostProcessCameraConfigurations.set(camera, serializeVLSPostProcess());
|
|
706
|
-
ssrRenderingPipelineCameraConfigurations.set(camera, serializeSSRRenderingPipeline());
|
|
707
|
-
motionBlurPostProcessCameraConfigurations.set(camera, serializeMotionBlurPostProcess());
|
|
708
|
-
defaultPipelineCameraConfigurations.set(camera, serializeDefaultRenderingPipeline());
|
|
709
|
-
}
|
|
710
|
-
__name(saveRenderingConfigurationForCamera, "saveRenderingConfigurationForCamera");
|
|
711
|
-
function applyRenderingConfigurationForCamera(camera) {
|
|
712
|
-
disposeSSAO2RenderingPipeline();
|
|
713
|
-
disposeVLSPostProcess(camera.getScene());
|
|
714
|
-
disposeSSRRenderingPipeline();
|
|
715
|
-
disposeMotionBlurPostProcess();
|
|
716
|
-
disposeDefaultRenderingPipeline();
|
|
717
|
-
const ssao2RenderingPipeline = ssaoRenderingPipelineCameraConfigurations.get(camera);
|
|
718
|
-
if (ssao2RenderingPipeline) {
|
|
719
|
-
parseSSAO2RenderingPipeline(camera.getScene(), camera, ssao2RenderingPipeline);
|
|
720
|
-
}
|
|
721
|
-
const vlsPostProcess2 = vlsPostProcessCameraConfigurations.get(camera);
|
|
722
|
-
if (vlsPostProcess2) {
|
|
723
|
-
parseVLSPostProcess(camera.getScene(), vlsPostProcess2);
|
|
724
|
-
}
|
|
725
|
-
const ssrRenderingPipeline2 = ssrRenderingPipelineCameraConfigurations.get(camera);
|
|
726
|
-
if (ssrRenderingPipeline2) {
|
|
727
|
-
parseSSRRenderingPipeline(camera.getScene(), camera, ssrRenderingPipeline2);
|
|
728
|
-
}
|
|
729
|
-
const motionBlurPostProcess2 = motionBlurPostProcessCameraConfigurations.get(camera);
|
|
730
|
-
if (motionBlurPostProcess2) {
|
|
731
|
-
parseMotionBlurPostProcess(camera.getScene(), camera, motionBlurPostProcess2);
|
|
732
|
-
}
|
|
733
|
-
const defaultRenderingPipeline2 = defaultPipelineCameraConfigurations.get(camera);
|
|
734
|
-
if (defaultRenderingPipeline2) {
|
|
735
|
-
parseDefaultRenderingPipeline(camera.getScene(), camera, defaultRenderingPipeline2);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
__name(applyRenderingConfigurationForCamera, "applyRenderingConfigurationForCamera");
|
|
739
|
-
|
|
740
|
-
// src/tools/light.ts
|
|
741
|
-
var import_babylonjs45 = require("babylonjs");
|
|
742
|
-
var import_babylonjs46 = require("babylonjs");
|
|
743
|
-
function configureShadowMapRenderListPredicate(scene) {
|
|
744
|
-
scene.lights.forEach((light) => {
|
|
745
|
-
const shadowMap = light.getShadowGenerator()?.getShadowMap();
|
|
746
|
-
if (!shadowMap) {
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
shadowMap.renderListPredicate = (mesh) => {
|
|
750
|
-
const distance = import_babylonjs45.Vector3.Distance(mesh.getAbsolutePosition(), light.getAbsolutePosition());
|
|
751
|
-
return distance <= light.range;
|
|
752
|
-
};
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
__name(configureShadowMapRenderListPredicate, "configureShadowMapRenderListPredicate");
|
|
756
|
-
async function configureShadowMapRefreshRate(scene) {
|
|
757
|
-
scene.executeWhenReady(() => {
|
|
758
|
-
scene.lights.forEach((light) => {
|
|
759
|
-
const shadowMap = light.getShadowGenerator()?.getShadowMap();
|
|
760
|
-
if (shadowMap) {
|
|
761
|
-
shadowMap.refreshRate = light.metadata?.refreshRate ?? import_babylonjs46.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;
|
|
762
|
-
}
|
|
763
|
-
});
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
__name(configureShadowMapRefreshRate, "configureShadowMapRefreshRate");
|
|
767
|
-
|
|
768
|
-
// src/loading/sound.ts
|
|
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) => {
|
|
773
|
-
audioParser?.(parsedData, scene, container, rootUrl);
|
|
774
|
-
parsedData.sounds?.forEach((sound) => {
|
|
775
|
-
const instance = container.sounds?.find((s) => s.name === sound.name);
|
|
776
|
-
if (instance) {
|
|
777
|
-
instance.id = sound.id;
|
|
778
|
-
instance.uniqueId = sound.uniqueId;
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
});
|
|
782
|
-
|
|
783
|
-
// src/tools/scalar.ts
|
|
784
|
-
function getPowerOfTwoUntil(limit) {
|
|
785
|
-
let size = 1;
|
|
786
|
-
while (size <= limit) {
|
|
787
|
-
size <<= 1;
|
|
788
|
-
}
|
|
789
|
-
return size >> 1;
|
|
790
|
-
}
|
|
791
|
-
__name(getPowerOfTwoUntil, "getPowerOfTwoUntil");
|
|
792
|
-
|
|
793
|
-
// src/loading/texture.ts
|
|
794
|
-
var import_babylonjs54 = require("babylonjs");
|
|
795
|
-
var textureParser = import_babylonjs54.SerializationHelper._TextureParser;
|
|
796
|
-
import_babylonjs54.SerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {
|
|
797
|
-
if (scene.loadingQuality === "high" || !sourceProperty.metadata?.baseSize) {
|
|
798
|
-
return textureParser(sourceProperty, scene, rootUrl);
|
|
799
|
-
}
|
|
800
|
-
const width = sourceProperty.metadata.baseSize.width;
|
|
801
|
-
const height = sourceProperty.metadata.baseSize.height;
|
|
802
|
-
const isPowerOfTwo = width === getPowerOfTwoUntil(width) || height === getPowerOfTwoUntil(height);
|
|
803
|
-
let suffix = "";
|
|
804
|
-
switch (scene.loadingQuality) {
|
|
805
|
-
case "medium":
|
|
806
|
-
let midWidth = width * 0.66 >> 0;
|
|
807
|
-
let midHeight = height * 0.66 >> 0;
|
|
808
|
-
if (isPowerOfTwo) {
|
|
809
|
-
midWidth = getPowerOfTwoUntil(midWidth);
|
|
810
|
-
midHeight = getPowerOfTwoUntil(midHeight);
|
|
811
|
-
}
|
|
812
|
-
suffix = `_${midWidth}_${midHeight}`;
|
|
813
|
-
break;
|
|
814
|
-
case "low":
|
|
815
|
-
let lowWidth = width * 0.33 >> 0;
|
|
816
|
-
let lowHeight = height * 0.33 >> 0;
|
|
817
|
-
if (isPowerOfTwo) {
|
|
818
|
-
lowWidth = getPowerOfTwoUntil(lowWidth);
|
|
819
|
-
lowHeight = getPowerOfTwoUntil(lowHeight);
|
|
820
|
-
}
|
|
821
|
-
suffix = `_${lowWidth}_${lowHeight}`;
|
|
822
|
-
break;
|
|
823
|
-
}
|
|
824
|
-
const name = sourceProperty.name;
|
|
825
|
-
if (!name || !suffix) {
|
|
826
|
-
return textureParser(sourceProperty, scene, rootUrl);
|
|
827
|
-
}
|
|
828
|
-
const finalUrl = name.split("/");
|
|
829
|
-
const filename = finalUrl.pop();
|
|
830
|
-
if (!filename) {
|
|
831
|
-
return textureParser(sourceProperty, scene, rootUrl);
|
|
832
|
-
}
|
|
833
|
-
const extension = filename.split(".").pop();
|
|
834
|
-
const baseFilename = filename.replace(`.${extension}`, "");
|
|
835
|
-
const newFilename = `${baseFilename}${suffix}.${extension}`;
|
|
836
|
-
finalUrl.push(newFilename);
|
|
837
|
-
sourceProperty.name = finalUrl.join("/");
|
|
838
|
-
return textureParser(sourceProperty, scene, rootUrl);
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
// src/loading/loader.ts
|
|
842
|
-
var import_babylonjs56 = require("babylonjs");
|
|
843
|
-
var import_babylonjs57 = require("babylonjs");
|
|
844
|
-
var import_babylonjs58 = require("babylonjs");
|
|
845
|
-
async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, options) {
|
|
846
|
-
scene.loadingQuality = options?.quality ?? "high";
|
|
847
|
-
await (0, import_babylonjs57.AppendSceneAsync)(`${rootUrl}${sceneFilename}`, scene, {
|
|
848
|
-
pluginExtension: ".babylon",
|
|
849
|
-
onProgress: /* @__PURE__ */ __name((event) => {
|
|
850
|
-
const progress = Math.min(event.loaded / event.total * 0.5);
|
|
851
|
-
options?.onProgress?.(progress);
|
|
852
|
-
}, "onProgress")
|
|
853
|
-
});
|
|
854
|
-
if (import_babylonjs58.SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {
|
|
855
|
-
scene.meshes.forEach((m) => isMesh(m) && m._checkDelayState());
|
|
856
|
-
}
|
|
857
|
-
const waitingItemsCount = scene.getWaitingItemsCount();
|
|
858
|
-
while (!scene.isReady() || scene.getWaitingItemsCount() > 0) {
|
|
859
|
-
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
860
|
-
const loadedItemsCount = waitingItemsCount - scene.getWaitingItemsCount();
|
|
861
|
-
options?.onProgress?.(
|
|
862
|
-
0.5 + loadedItemsCount / waitingItemsCount * 0.5
|
|
863
|
-
);
|
|
864
|
-
}
|
|
865
|
-
options?.onProgress?.(1);
|
|
866
|
-
configureShadowMapRenderListPredicate(scene);
|
|
867
|
-
configureShadowMapRefreshRate(scene);
|
|
868
|
-
if (scene.metadata?.rendering) {
|
|
869
|
-
applyRenderingConfigurations(scene, scene.metadata.rendering);
|
|
870
|
-
if (scene.activeCamera) {
|
|
871
|
-
applyRenderingConfigurationForCamera(scene.activeCamera);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
if (scene.metadata?.physicsGravity) {
|
|
875
|
-
scene.getPhysicsEngine()?.setGravity(import_babylonjs56.Vector3.FromArray(scene.metadata?.physicsGravity));
|
|
876
|
-
}
|
|
877
|
-
applyScriptForObject(scene, scene, scriptsMap, rootUrl);
|
|
878
|
-
scene.transformNodes.forEach((transformNode) => {
|
|
879
|
-
applyScriptForObject(scene, transformNode, scriptsMap, rootUrl);
|
|
880
|
-
});
|
|
881
|
-
scene.meshes.forEach((mesh) => {
|
|
882
|
-
configurePhysicsAggregate(mesh);
|
|
883
|
-
applyScriptForObject(scene, mesh, scriptsMap, rootUrl);
|
|
884
|
-
});
|
|
885
|
-
scene.lights.forEach((light) => {
|
|
886
|
-
applyScriptForObject(scene, light, scriptsMap, rootUrl);
|
|
887
|
-
});
|
|
888
|
-
scene.cameras.forEach((camera) => {
|
|
889
|
-
applyScriptForObject(scene, camera, scriptsMap, rootUrl);
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
__name(loadScene, "loadScene");
|
|
893
|
-
|
|
894
|
-
// src/tools/texture.ts
|
|
895
|
-
function configureEngineToUseCompressedTextures(engine) {
|
|
896
|
-
engine.setTextureFormatToUse([
|
|
897
|
-
"-dxt.ktx",
|
|
898
|
-
"-astc.ktx",
|
|
899
|
-
"-pvrtc.ktx",
|
|
900
|
-
"-etc1.ktx",
|
|
901
|
-
"-etc2.ktx"
|
|
902
|
-
]);
|
|
903
|
-
}
|
|
904
|
-
__name(configureEngineToUseCompressedTextures, "configureEngineToUseCompressedTextures");
|
|
905
|
-
|
|
906
|
-
// src/decorators/scene.ts
|
|
907
|
-
function nodeFromScene(nodeName) {
|
|
908
|
-
return function(target, propertyKey) {
|
|
909
|
-
const ctor = target.constructor;
|
|
910
|
-
ctor._NodesFromScene ??= [];
|
|
911
|
-
ctor._NodesFromScene.push({ propertyKey, nodeName });
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
__name(nodeFromScene, "nodeFromScene");
|
|
915
|
-
function nodeFromDescendants(nodeName, directDescendantsOnly = false) {
|
|
916
|
-
return function(target, propertyKey) {
|
|
917
|
-
const ctor = target.constructor;
|
|
918
|
-
ctor._NodesFromDescendants ??= [];
|
|
919
|
-
ctor._NodesFromDescendants.push({ propertyKey, nodeName, directDescendantsOnly });
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
__name(nodeFromDescendants, "nodeFromDescendants");
|
|
923
|
-
function animationGroupFromScene(animationGroupName) {
|
|
924
|
-
return function(target, propertyKey) {
|
|
925
|
-
const ctor = target.constructor;
|
|
926
|
-
ctor._AnimationGroups ??= [];
|
|
927
|
-
ctor._AnimationGroups.push({ animationGroupName, propertyKey });
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
__name(animationGroupFromScene, "animationGroupFromScene");
|
|
931
|
-
|
|
932
|
-
// src/decorators/gui.ts
|
|
933
|
-
function guiFromAsset(pathInAssets, onGuiCreated) {
|
|
934
|
-
return function(target, propertyKey) {
|
|
935
|
-
const ctor = target.constructor;
|
|
936
|
-
ctor._GuiFromAsset ??= [];
|
|
937
|
-
ctor._GuiFromAsset.push({ propertyKey, pathInAssets, onGuiCreated });
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
__name(guiFromAsset, "guiFromAsset");
|
|
941
|
-
|
|
942
|
-
// src/decorators/sound.ts
|
|
943
|
-
function soundFromScene(soundName) {
|
|
944
|
-
return function(target, propertyKey) {
|
|
945
|
-
const ctor = target.constructor;
|
|
946
|
-
ctor._SoundsFromScene ??= [];
|
|
947
|
-
ctor._SoundsFromScene.push({ propertyKey, soundName });
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
__name(soundFromScene, "soundFromScene");
|
|
951
|
-
|
|
952
|
-
// src/decorators/particle-systems.ts
|
|
953
|
-
function particleSystemFromScene(particleSystemName) {
|
|
954
|
-
return function(target, propertyKey) {
|
|
955
|
-
const ctor = target.constructor;
|
|
956
|
-
ctor._ParticleSystemsFromScene ??= [];
|
|
957
|
-
ctor._ParticleSystemsFromScene.push({ propertyKey, particleSystemName });
|
|
958
|
-
};
|
|
959
|
-
}
|
|
960
|
-
__name(particleSystemFromScene, "particleSystemFromScene");
|
|
961
|
-
|
|
962
|
-
// src/decorators/inspector.ts
|
|
963
|
-
function visibleAsBoolean(label) {
|
|
964
|
-
return function(target, propertyKey) {
|
|
965
|
-
const ctor = target.constructor;
|
|
966
|
-
ctor._VisibleInInspector ??= [];
|
|
967
|
-
ctor._VisibleInInspector.push({
|
|
968
|
-
label,
|
|
969
|
-
propertyKey,
|
|
970
|
-
configuration: {
|
|
971
|
-
type: "boolean"
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
__name(visibleAsBoolean, "visibleAsBoolean");
|
|
977
|
-
function visibleAsNumber(label, configuration) {
|
|
978
|
-
return function(target, propertyKey) {
|
|
979
|
-
const ctor = target.constructor;
|
|
980
|
-
ctor._VisibleInInspector ??= [];
|
|
981
|
-
ctor._VisibleInInspector.push({
|
|
982
|
-
label,
|
|
983
|
-
propertyKey,
|
|
984
|
-
configuration: {
|
|
985
|
-
...configuration,
|
|
986
|
-
type: "number"
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
__name(visibleAsNumber, "visibleAsNumber");
|
|
992
|
-
function visibleAsVector2(label, configuration) {
|
|
993
|
-
return function(target, propertyKey) {
|
|
994
|
-
const ctor = target.constructor;
|
|
995
|
-
ctor._VisibleInInspector ??= [];
|
|
996
|
-
ctor._VisibleInInspector.push({
|
|
997
|
-
label,
|
|
998
|
-
propertyKey,
|
|
999
|
-
configuration: {
|
|
1000
|
-
...configuration,
|
|
1001
|
-
type: "vector2"
|
|
1002
|
-
}
|
|
1003
|
-
});
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
__name(visibleAsVector2, "visibleAsVector2");
|
|
1007
|
-
function visibleAsVector3(label, configuration) {
|
|
1008
|
-
return function(target, propertyKey) {
|
|
1009
|
-
const ctor = target.constructor;
|
|
1010
|
-
ctor._VisibleInInspector ??= [];
|
|
1011
|
-
ctor._VisibleInInspector.push({
|
|
1012
|
-
label,
|
|
1013
|
-
propertyKey,
|
|
1014
|
-
configuration: {
|
|
1015
|
-
...configuration,
|
|
1016
|
-
type: "vector3"
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
1019
|
-
};
|
|
1020
|
-
}
|
|
1021
|
-
__name(visibleAsVector3, "visibleAsVector3");
|
|
1022
|
-
function visibleAsColor3(label, configuration) {
|
|
1023
|
-
return function(target, propertyKey) {
|
|
1024
|
-
const ctor = target.constructor;
|
|
1025
|
-
ctor._VisibleInInspector ??= [];
|
|
1026
|
-
ctor._VisibleInInspector.push({
|
|
1027
|
-
label,
|
|
1028
|
-
propertyKey,
|
|
1029
|
-
configuration: {
|
|
1030
|
-
...configuration,
|
|
1031
|
-
type: "color3"
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
__name(visibleAsColor3, "visibleAsColor3");
|
|
1037
|
-
function visibleAsColor4(label, configuration) {
|
|
1038
|
-
return function(target, propertyKey) {
|
|
1039
|
-
const ctor = target.constructor;
|
|
1040
|
-
ctor._VisibleInInspector ??= [];
|
|
1041
|
-
ctor._VisibleInInspector.push({
|
|
1042
|
-
label,
|
|
1043
|
-
propertyKey,
|
|
1044
|
-
configuration: {
|
|
1045
|
-
...configuration,
|
|
1046
|
-
type: "color4"
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
};
|
|
1050
|
-
}
|
|
1051
|
-
__name(visibleAsColor4, "visibleAsColor4");
|
|
1052
|
-
|
|
1053
|
-
// src/tools/sound.ts
|
|
1054
|
-
function getSoundById(id, scene) {
|
|
1055
|
-
const soundTracks = scene.soundTracks ?? [];
|
|
1056
|
-
if (!soundTracks.length) {
|
|
1057
|
-
soundTracks.push(scene.mainSoundTrack);
|
|
1058
|
-
}
|
|
1059
|
-
for (let i = 0, len = soundTracks.length; i < len; i++) {
|
|
1060
|
-
const sound = soundTracks[i].soundCollection.find((s) => s.id === id);
|
|
1061
|
-
if (sound) {
|
|
1062
|
-
return sound;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
return null;
|
|
1066
|
-
}
|
|
1067
|
-
__name(getSoundById, "getSoundById");
|
|
1068
|
-
|
|
1069
|
-
// src/cinematic/tools.ts
|
|
1070
|
-
var import_babylonjs61 = require("babylonjs");
|
|
1071
|
-
var import_babylonjs62 = require("babylonjs");
|
|
1072
|
-
var import_babylonjs63 = require("babylonjs");
|
|
1073
|
-
var import_babylonjs65 = require("babylonjs");
|
|
1074
|
-
function cloneKey(dataType, key) {
|
|
1075
|
-
let value;
|
|
1076
|
-
switch (dataType) {
|
|
1077
|
-
case import_babylonjs62.Animation.ANIMATIONTYPE_FLOAT:
|
|
1078
|
-
value = key.value;
|
|
1079
|
-
break;
|
|
1080
|
-
default:
|
|
1081
|
-
value = key.value.clone();
|
|
1082
|
-
break;
|
|
1083
|
-
}
|
|
1084
|
-
return {
|
|
1085
|
-
value,
|
|
1086
|
-
frame: key.frame,
|
|
1087
|
-
interpolation: key.interpolation,
|
|
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()
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
__name(cloneKey, "cloneKey");
|
|
1093
|
-
function getAnimationTypeForObject(effectiveProperty) {
|
|
1094
|
-
if (!isNaN(parseFloat(effectiveProperty)) && isFinite(effectiveProperty)) {
|
|
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;
|
|
1108
|
-
}
|
|
1109
|
-
return null;
|
|
1110
|
-
}
|
|
1111
|
-
__name(getAnimationTypeForObject, "getAnimationTypeForObject");
|
|
1112
|
-
function getPropertyValue(object, property) {
|
|
1113
|
-
const parts = property.split(".");
|
|
1114
|
-
let value = object;
|
|
1115
|
-
for (let i = 0; i < parts.length; ++i) {
|
|
1116
|
-
value = value[parts[i]];
|
|
1117
|
-
}
|
|
1118
|
-
return value;
|
|
1119
|
-
}
|
|
1120
|
-
__name(getPropertyValue, "getPropertyValue");
|
|
1121
|
-
|
|
1122
|
-
// src/cinematic/parse.ts
|
|
1123
|
-
var import_babylonjs68 = require("babylonjs");
|
|
1124
|
-
var import_babylonjs69 = require("babylonjs");
|
|
1125
|
-
var import_babylonjs70 = require("babylonjs");
|
|
1126
|
-
function parseCinematic(data, scene) {
|
|
1127
|
-
return {
|
|
1128
|
-
name: data.name,
|
|
1129
|
-
framesPerSecond: data.framesPerSecond,
|
|
1130
|
-
outputFramesPerSecond: data.outputFramesPerSecond,
|
|
1131
|
-
tracks: data.tracks.map((track) => {
|
|
1132
|
-
let node = null;
|
|
1133
|
-
let animationType = null;
|
|
1134
|
-
if (track.node) {
|
|
1135
|
-
node = scene.getNodeById(track.node);
|
|
1136
|
-
} else if (track.defaultRenderingPipeline) {
|
|
1137
|
-
node = getDefaultRenderingPipeline();
|
|
1138
|
-
}
|
|
1139
|
-
if (track.propertyPath) {
|
|
1140
|
-
const value = getPropertyValue(node, track.propertyPath);
|
|
1141
|
-
animationType = getAnimationTypeForObject(value);
|
|
1142
|
-
}
|
|
1143
|
-
let sound = null;
|
|
1144
|
-
if (track.sound) {
|
|
1145
|
-
sound = getSoundById(track.sound, scene);
|
|
1146
|
-
}
|
|
1147
|
-
return {
|
|
1148
|
-
node,
|
|
1149
|
-
sound,
|
|
1150
|
-
propertyPath: track.propertyPath,
|
|
1151
|
-
defaultRenderingPipeline: track.defaultRenderingPipeline,
|
|
1152
|
-
animationGroup: track.animationGroup ? scene.getAnimationGroupByName(track.animationGroup) : null,
|
|
1153
|
-
animationGroups: track.animationGroups,
|
|
1154
|
-
sounds: track.sounds,
|
|
1155
|
-
keyFrameEvents: track.keyFrameEvents,
|
|
1156
|
-
keyFrameAnimations: node && animationType !== null && track.keyFrameAnimations?.map((keyFrame) => {
|
|
1157
|
-
const animationKey = keyFrame.type === "key" ? keyFrame : null;
|
|
1158
|
-
if (animationKey) {
|
|
1159
|
-
return {
|
|
1160
|
-
...animationKey,
|
|
1161
|
-
value: parseCinematicKeyValue(animationKey.value, animationType),
|
|
1162
|
-
inTangent: parseCinematicKeyValue(animationKey.inTangent, animationType),
|
|
1163
|
-
outTangent: parseCinematicKeyValue(animationKey.outTangent, animationType)
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
const animationKeyCut = keyFrame.type === "cut" ? keyFrame : null;
|
|
1167
|
-
if (animationKeyCut) {
|
|
1168
|
-
return {
|
|
1169
|
-
...animationKeyCut,
|
|
1170
|
-
key1: {
|
|
1171
|
-
...animationKeyCut.key1,
|
|
1172
|
-
value: parseCinematicKeyValue(animationKeyCut.key1.value, animationType),
|
|
1173
|
-
inTangent: parseCinematicKeyValue(animationKeyCut.key1.inTangent, animationType),
|
|
1174
|
-
outTangent: parseCinematicKeyValue(animationKeyCut.key1.outTangent, animationType)
|
|
1175
|
-
},
|
|
1176
|
-
key2: {
|
|
1177
|
-
...animationKeyCut.key2,
|
|
1178
|
-
value: parseCinematicKeyValue(animationKeyCut.key2.value, animationType),
|
|
1179
|
-
inTangent: parseCinematicKeyValue(animationKeyCut.key2.inTangent, animationType),
|
|
1180
|
-
outTangent: parseCinematicKeyValue(animationKeyCut.key2.outTangent, animationType)
|
|
1181
|
-
}
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
})
|
|
1185
|
-
};
|
|
1186
|
-
})
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
__name(parseCinematic, "parseCinematic");
|
|
1190
|
-
function parseCinematicKeyValue(value, type) {
|
|
1191
|
-
if (value === null) {
|
|
1192
|
-
return null;
|
|
1193
|
-
}
|
|
1194
|
-
if (value === void 0) {
|
|
1195
|
-
return void 0;
|
|
1196
|
-
}
|
|
1197
|
-
switch (type) {
|
|
1198
|
-
case import_babylonjs68.Animation.ANIMATIONTYPE_FLOAT:
|
|
1199
|
-
return value;
|
|
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);
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
__name(parseCinematicKeyValue, "parseCinematicKeyValue");
|
|
1215
|
-
|
|
1216
|
-
// src/cinematic/events/set-enabled.ts
|
|
1217
|
-
function handleSetEnabledEvent(scene, config) {
|
|
1218
|
-
const node = scene.getNodeById(config.node);
|
|
1219
|
-
node?.setEnabled(config.value);
|
|
1220
|
-
}
|
|
1221
|
-
__name(handleSetEnabledEvent, "handleSetEnabledEvent");
|
|
1222
|
-
|
|
1223
|
-
// src/cinematic/events/apply-impulse.ts
|
|
1224
|
-
var import_babylonjs73 = require("babylonjs");
|
|
1225
|
-
var zeroVector = import_babylonjs73.Vector3.Zero();
|
|
1226
|
-
function handleApplyImpulseEvent(scene, config) {
|
|
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
|
-
}
|
|
1236
|
-
meshes.forEach((mesh) => {
|
|
1237
|
-
if (mesh.physicsAggregate?.body) {
|
|
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);
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
__name(handleApplyImpulseEvent, "handleApplyImpulseEvent");
|
|
1247
|
-
|
|
1248
|
-
// src/cinematic/generate.ts
|
|
1249
|
-
var import_babylonjs76 = require("babylonjs");
|
|
1250
|
-
var import_babylonjs78 = require("babylonjs");
|
|
1251
|
-
var import_babylonjs80 = require("babylonjs");
|
|
1252
|
-
var import_babylonjs81 = require("babylonjs");
|
|
1253
|
-
function generateCinematicAnimationGroup(cinematic, scene) {
|
|
1254
|
-
const result = new import_babylonjs81.AnimationGroup(cinematic.name, scene);
|
|
1255
|
-
cinematic.tracks.forEach((track) => {
|
|
1256
|
-
const animationGroup = track.animationGroup;
|
|
1257
|
-
if (animationGroup) {
|
|
1258
|
-
track.animationGroups?.forEach((configuration) => {
|
|
1259
|
-
animationGroup.targetedAnimations.forEach((targetedAnimation) => {
|
|
1260
|
-
let animation2 = null;
|
|
1261
|
-
defer: {
|
|
1262
|
-
const existingTargetedAnimations = result.targetedAnimations.filter((ta2) => ta2.target === targetedAnimation.target);
|
|
1263
|
-
if (existingTargetedAnimations.length) {
|
|
1264
|
-
const existingTargetedAnimationsPair = existingTargetedAnimations.find((et) => et.animation.targetProperty === targetedAnimation.animation.targetProperty);
|
|
1265
|
-
if (existingTargetedAnimationsPair) {
|
|
1266
|
-
animation2 = existingTargetedAnimationsPair.animation;
|
|
1267
|
-
break defer;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
animation2 = targetedAnimation.animation.clone();
|
|
1271
|
-
animation2.setKeys([]);
|
|
1272
|
-
animation2.name = import_babylonjs76.Tools.RandomId();
|
|
1273
|
-
animation2.framePerSecond = cinematic.framesPerSecond;
|
|
1274
|
-
}
|
|
1275
|
-
const keys2 = animation2.getKeys();
|
|
1276
|
-
const sourceKeys = targetedAnimation.animation.getKeys();
|
|
1277
|
-
const speed = configuration.speed;
|
|
1278
|
-
const normalizedFps = cinematic.framesPerSecond / targetedAnimation.animation.framePerSecond / speed;
|
|
1279
|
-
sourceKeys.forEach((k) => {
|
|
1280
|
-
if (k.frame >= configuration.startFrame && k.frame <= configuration.endFrame) {
|
|
1281
|
-
keys2.push({
|
|
1282
|
-
...cloneKey(targetedAnimation.animation.dataType, k),
|
|
1283
|
-
frame: configuration.frame + k.frame * normalizedFps
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1287
|
-
animation2.setKeys(keys2);
|
|
1288
|
-
result.addTargetedAnimation(animation2, targetedAnimation.target);
|
|
1289
|
-
});
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
const sound = track.sound;
|
|
1293
|
-
const soundBuffer = sound?.getAudioBuffer();
|
|
1294
|
-
if (sound && soundBuffer && track.sounds?.length) {
|
|
1295
|
-
const dummyObject = {
|
|
1296
|
-
dummy: 0
|
|
1297
|
-
};
|
|
1298
|
-
const soundAnimation = new import_babylonjs78.Animation(sound.name, "dummy", 60, import_babylonjs78.Animation.ANIMATIONTYPE_FLOAT, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1299
|
-
let maxFrame = 0;
|
|
1300
|
-
track.sounds?.forEach((configuration) => {
|
|
1301
|
-
const duration = configuration.endFrame - configuration.startFrame;
|
|
1302
|
-
maxFrame = Math.max(maxFrame, configuration.frame + duration);
|
|
1303
|
-
soundAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame, (currentFrame) => {
|
|
1304
|
-
const frameDiff = currentFrame - configuration.frame;
|
|
1305
|
-
const offset = (frameDiff + configuration.startFrame) / cinematic.framesPerSecond;
|
|
1306
|
-
sound.play(0, offset);
|
|
1307
|
-
}, false));
|
|
1308
|
-
soundAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame + duration, () => {
|
|
1309
|
-
sound.stop();
|
|
1310
|
-
}));
|
|
1311
|
-
});
|
|
1312
|
-
soundAnimation.setKeys([
|
|
1313
|
-
{ frame: 0, value: 0 },
|
|
1314
|
-
{ frame: maxFrame, value: maxFrame }
|
|
1315
|
-
]);
|
|
1316
|
-
result.addTargetedAnimation(soundAnimation, dummyObject);
|
|
1317
|
-
}
|
|
1318
|
-
if (track.keyFrameEvents) {
|
|
1319
|
-
const dummyObject = {
|
|
1320
|
-
dummy: 0
|
|
1321
|
-
};
|
|
1322
|
-
const eventsAnimation = new import_babylonjs78.Animation("events", "dummy", 60, import_babylonjs78.Animation.ANIMATIONTYPE_FLOAT, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1323
|
-
let maxFrame = 0;
|
|
1324
|
-
track.keyFrameEvents?.forEach((configuration) => {
|
|
1325
|
-
maxFrame = Math.max(maxFrame, configuration.frame);
|
|
1326
|
-
eventsAnimation.addEvent(new import_babylonjs80.AnimationEvent(configuration.frame, () => {
|
|
1327
|
-
switch (configuration.data?.type) {
|
|
1328
|
-
case "set-enabled":
|
|
1329
|
-
handleSetEnabledEvent(scene, configuration.data);
|
|
1330
|
-
break;
|
|
1331
|
-
case "apply-impulse":
|
|
1332
|
-
handleApplyImpulseEvent(scene, configuration.data);
|
|
1333
|
-
break;
|
|
1334
|
-
}
|
|
1335
|
-
}));
|
|
1336
|
-
});
|
|
1337
|
-
eventsAnimation.setKeys([
|
|
1338
|
-
{ frame: 0, value: 0 },
|
|
1339
|
-
{ frame: maxFrame, value: maxFrame }
|
|
1340
|
-
]);
|
|
1341
|
-
result.addTargetedAnimation(eventsAnimation, dummyObject);
|
|
1342
|
-
}
|
|
1343
|
-
const node = track.defaultRenderingPipeline ? getDefaultRenderingPipeline() : track.node;
|
|
1344
|
-
if (!node || !track.propertyPath || !track.keyFrameAnimations) {
|
|
1345
|
-
return;
|
|
1346
|
-
}
|
|
1347
|
-
const value = getPropertyValue(node, track.propertyPath);
|
|
1348
|
-
const animationType = getAnimationTypeForObject(value);
|
|
1349
|
-
if (animationType === null) {
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
const animation = new import_babylonjs78.Animation(track.propertyPath, track.propertyPath, 60, animationType, import_babylonjs78.Animation.ANIMATIONLOOPMODE_CYCLE, false);
|
|
1353
|
-
const keys = [];
|
|
1354
|
-
track.keyFrameAnimations?.forEach((keyFrame) => {
|
|
1355
|
-
const animationKey = keyFrame.type === "key" ? keyFrame : null;
|
|
1356
|
-
if (animationKey) {
|
|
1357
|
-
return keys.push(animationKey);
|
|
1358
|
-
}
|
|
1359
|
-
const animationKeyCut = keyFrame.type === "cut" ? keyFrame : null;
|
|
1360
|
-
if (animationKeyCut) {
|
|
1361
|
-
keys.push(animationKeyCut.key1);
|
|
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
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
animation.setKeys(keys);
|
|
1379
|
-
result.addTargetedAnimation(animation, node);
|
|
1380
|
-
});
|
|
1381
|
-
result.normalize();
|
|
1382
|
-
return result;
|
|
1383
|
-
}
|
|
1384
|
-
__name(generateCinematicAnimationGroup, "generateCinematicAnimationGroup");
|
|
1385
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1386
|
-
0 && (module.exports = {
|
|
1387
|
-
animationGroupFromScene,
|
|
1388
|
-
configureEngineToUseCompressedTextures,
|
|
1389
|
-
configureShadowMapRefreshRate,
|
|
1390
|
-
configureShadowMapRenderListPredicate,
|
|
1391
|
-
createDefaultRenderingPipeline,
|
|
1392
|
-
createMotionBlurPostProcess,
|
|
1393
|
-
createSSAO2RenderingPipeline,
|
|
1394
|
-
createSSRRenderingPipeline,
|
|
1395
|
-
createVLSPostProcess,
|
|
1396
|
-
defaultPipelineCameraConfigurations,
|
|
1397
|
-
disposeDefaultRenderingPipeline,
|
|
1398
|
-
disposeMotionBlurPostProcess,
|
|
1399
|
-
disposeSSAO2RenderingPipeline,
|
|
1400
|
-
disposeSSRRenderingPipeline,
|
|
1401
|
-
disposeVLSPostProcess,
|
|
1402
|
-
generateCinematicAnimationGroup,
|
|
1403
|
-
getDefaultRenderingPipeline,
|
|
1404
|
-
getMotionBlurPostProcess,
|
|
1405
|
-
getPowerOfTwoUntil,
|
|
1406
|
-
getSSAO2RenderingPipeline,
|
|
1407
|
-
getSSRRenderingPipeline,
|
|
1408
|
-
getVLSPostProcess,
|
|
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,
|
|
1424
|
-
loadScene,
|
|
1425
|
-
motionBlurPostProcessCameraConfigurations,
|
|
1426
|
-
nodeFromDescendants,
|
|
1427
|
-
nodeFromScene,
|
|
1428
|
-
parseCinematic,
|
|
1429
|
-
parseCinematicKeyValue,
|
|
1430
|
-
parseDefaultRenderingPipeline,
|
|
1431
|
-
parseMotionBlurPostProcess,
|
|
1432
|
-
parseSSAO2RenderingPipeline,
|
|
1433
|
-
parseSSRRenderingPipeline,
|
|
1434
|
-
parseVLSPostProcess,
|
|
1435
|
-
particleSystemFromScene,
|
|
1436
|
-
serializeDefaultRenderingPipeline,
|
|
1437
|
-
serializeMotionBlurPostProcess,
|
|
1438
|
-
serializeSSAO2RenderingPipeline,
|
|
1439
|
-
serializeSSRRenderingPipeline,
|
|
1440
|
-
serializeVLSPostProcess,
|
|
1441
|
-
soundFromScene,
|
|
1442
|
-
ssaoRenderingPipelineCameraConfigurations,
|
|
1443
|
-
ssrRenderingPipelineCameraConfigurations,
|
|
1444
|
-
visibleAsBoolean,
|
|
1445
|
-
visibleAsColor3,
|
|
1446
|
-
visibleAsColor4,
|
|
1447
|
-
visibleAsNumber,
|
|
1448
|
-
visibleAsVector2,
|
|
1449
|
-
visibleAsVector3,
|
|
1450
|
-
vlsPostProcessCameraConfigurations
|
|
1451
|
-
});
|
|
1
|
+
var j=Object.defineProperty;var to=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.prototype.hasOwnProperty;var i=(e,t)=>j(e,"name",{value:t,configurable:!0});var ao=(e,t)=>{for(var o in t)j(e,o,{get:t[o],enumerable:!0})},lo=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of io(t))!so.call(e,r)&&r!==o&&j(e,r,{get:()=>t[r],enumerable:!(n=to(t,r))||n.enumerable});return e};var co=e=>lo(j({},"__esModule",{value:!0}),e);var Xo={};ao(Xo,{animationGroupFromScene:()=>No,configureEngineToUseCompressedTextures:()=>Fo,configureShadowMapRefreshRate:()=>Pe,configureShadowMapRenderListPredicate:()=>be,createDefaultRenderingPipeline:()=>je,createMotionBlurPostProcess:()=>_e,createSSAO2RenderingPipeline:()=>Be,createSSRRenderingPipeline:()=>Ne,createVLSPostProcess:()=>Me,defaultPipelineCameraConfigurations:()=>L,disposeDefaultRenderingPipeline:()=>ye,disposeMotionBlurPostProcess:()=>pe,disposeSSAO2RenderingPipeline:()=>le,disposeSSRRenderingPipeline:()=>ie,disposeVLSPostProcess:()=>ne,generateCinematicAnimationGroup:()=>Wo,getAnimationTypeForObject:()=>K,getDefaultRenderingPipeline:()=>G,getMotionBlurPostProcess:()=>ue,getPowerOfTwoUntil:()=>D,getSSAO2RenderingPipeline:()=>Eo,getSSRRenderingPipeline:()=>xo,getVLSPostProcess:()=>Co,guiFromAsset:()=>Vo,isAbstractMesh:()=>mo,isArcRotateCamera:()=>yo,isBone:()=>uo,isCamera:()=>oe,isCinematicGroup:()=>Zo,isCinematicKey:()=>$o,isCinematicKeyCut:()=>Qo,isCinematicKeyEvent:()=>Uo,isCinematicSound:()=>qo,isDirectionalLight:()=>So,isFreeCamera:()=>fo,isGroundMesh:()=>po,isHemisphericLight:()=>Po,isInstancedMesh:()=>J,isMesh:()=>T,isPointLight:()=>ho,isSpotLight:()=>bo,isTexture:()=>ee,isTransformNode:()=>go,loadScene:()=>Oo,motionBlurPostProcessCameraConfigurations:()=>B,nodeFromDescendants:()=>wo,nodeFromScene:()=>Mo,parseCinematic:()=>Ho,parseCinematicKeyValue:()=>C,parseDefaultRenderingPipeline:()=>Se,parseMotionBlurPostProcess:()=>fe,parseSSAO2RenderingPipeline:()=>me,parseSSRRenderingPipeline:()=>ae,parseVLSPostProcess:()=>te,particleSystemFromScene:()=>Lo,serializeDefaultRenderingPipeline:()=>he,serializeMotionBlurPostProcess:()=>ge,serializeSSAO2RenderingPipeline:()=>ce,serializeSSRRenderingPipeline:()=>se,serializeVLSPostProcess:()=>re,setDefaultRenderingPipelineRef:()=>vo,setMotionBlurPostProcessRef:()=>Do,setSSAO2RenderingPipelineRef:()=>To,setSSRRenderingPipelineRef:()=>Ao,setVLSPostProcessRef:()=>Io,soundFromScene:()=>Bo,ssaoRenderingPipelineCameraConfigurations:()=>V,ssrRenderingPipelineCameraConfigurations:()=>N,visibleAsBoolean:()=>_o,visibleAsColor3:()=>zo,visibleAsColor4:()=>jo,visibleAsEntity:()=>Yo,visibleAsNumber:()=>Go,visibleAsVector2:()=>Ko,visibleAsVector3:()=>ko,vlsPostProcessCameraConfigurations:()=>w});module.exports=co(Xo);function mo(e){switch(e.getClassName?.()){case"Mesh":case"LineMesh":case"GroundMesh":case"InstancedMesh":return!0}return!1}i(mo,"isAbstractMesh");function T(e){switch(e.getClassName?.()){case"Mesh":case"GroundMesh":return!0}return!1}i(T,"isMesh");function J(e){return e.getClassName?.()==="InstancedMesh"}i(J,"isInstancedMesh");function uo(e){return e.getClassName?.()==="Bone"}i(uo,"isBone");function po(e){return e.getClassName?.()==="GroundMesh"}i(po,"isGroundMesh");function go(e){return e.getClassName?.()==="TransformNode"}i(go,"isTransformNode");function ee(e){return e?.getClassName?.()==="Texture"}i(ee,"isTexture");function oe(e){switch(e.getClassName?.()){case"Camera":case"FreeCamera":case"TargetCamera":case"EditorCamera":case"ArcRotateCamera":case"UniversalCamera":return!0}return!1}i(oe,"isCamera");function fo(e){switch(e.getClassName?.()){case"FreeCamera":case"UniversalCamera":return!0}return!1}i(fo,"isFreeCamera");function yo(e){return e.getClassName?.()==="ArcRotateCamera"}i(yo,"isArcRotateCamera");function ho(e){return e.getClassName?.()==="PointLight"}i(ho,"isPointLight");function So(e){return e.getClassName?.()==="DirectionalLight"}i(So,"isDirectionalLight");function bo(e){return e.getClassName?.()==="SpotLight"}i(bo,"isSpotLight");function Po(e){return e.getClassName?.()==="HemisphericLight"}i(Po,"isHemisphericLight");function Y(e,t){let o=t.soundTracks??[];o.length||o.push(t.mainSoundTrack);for(let n=0,r=o.length;n<r;n++){let l=o[n].soundCollection.find(s=>s.id===e);if(l)return l}return null}i(Y,"getSoundById");var H=require("babylonjs"),W=require("babylonjs"),Ee=require("babylonjs-gui");function Te(e,t,o,n,r){let l=n.constructor;l&&(l._NodesFromScene?.forEach(s=>{n[s.propertyKey.toString()]=e.getNodeByName(s.nodeName)}),l._NodesFromDescendants?.forEach(s=>{let c=t.getDescendants?.(s.directDescendantsOnly,u=>u.name===s.nodeName)[0];n[s.propertyKey.toString()]=c??null}),l._AnimationGroups?.forEach(s=>{n[s.propertyKey.toString()]=e.getAnimationGroupByName(s.animationGroupName)}),l._SoundsFromScene?.forEach(s=>{let c=e.getSoundByName?.(s.soundName);n[s.propertyKey.toString()]=c??null}),l._GuiFromAsset?.forEach(async s=>{let c=`${r}assets/${s.pathInAssets}`;try{let y=await(await fetch(c)).json(),P=Ee.AdvancedDynamicTexture.CreateFullscreenUI(y.name,!0,e);P.parseSerializedObject(y.content,!1),n[s.propertyKey.toString()]=P,s.onGuiCreated?.(n,P)}catch(u){throw console.error(`Failed to load GUI from asset: ${c}`),u}}),l._ParticleSystemsFromScene?.forEach(s=>{let c=e.particleSystems?.find(u=>u.name===s.particleSystemName);n[s.propertyKey.toString()]=c}),l._VisibleInInspector?.forEach(s=>{let c=s.propertyKey.toString(),u=o.values;if(u.hasOwnProperty(c)&&u[c].hasOwnProperty("value")){let y=u[c].value;switch(s.configuration.type){case"number":case"boolean":n[c]=y;break;case"vector2":n[c]=W.Vector2.FromArray(y);break;case"vector3":n[c]=W.Vector3.FromArray(y);break;case"color3":n[c]=H.Color3.FromArray(y);break;case"color4":n[c]=H.Color4.FromArray(y);break;case"entity":switch(s.configuration.entityType){case"node":n[c]=e.getNodeById(y)??null;break;case"animationGroup":n[c]=e.getAnimationGroupByName(y)??null;break;case"sound":n[c]=Y(y,e);break;case"particleSystem":n[c]=e.particleSystems?.find(R=>R.id===y)??null;break}break}}}))}i(Te,"applyDecorators");function M(e,t,o,n){t.metadata&&(t.metadata.scripts?.forEach(r=>{if(!r.enabled)return;let l=o[r.key];if(l)if(l.default){let s=new l.default(t);Te(e,t,r,s,n),s.onStart&&e.onBeforeRenderObservable.addOnce(()=>s.onStart()),s.onUpdate&&e.onBeforeRenderObservable.add(()=>s.onUpdate())}else l.onStart&&e.onBeforeRenderObservable.addOnce(()=>l.onStart(t)),l.onUpdate&&e.onBeforeRenderObservable.add(()=>l.onUpdate(t))}),t.metadata.scripts=void 0)}i(M,"applyScriptForObject");var _=require("babylonjs"),De=require("babylonjs");function ve(e){let t=e.metadata?.physicsAggregate;if(!t)return;let o;T(e)?o=e:J(e)&&(o=e.sourceMesh);let n=new De.PhysicsAggregate(e,t.shape.type,{mesh:o,mass:t.massProperties.mass});n.body.setMassProperties({mass:t.massProperties.mass,inertia:t.massProperties.inertia?_.Vector3.FromArray(t.massProperties.inertia):void 0,centerOfMass:t.massProperties.centerOfMass?_.Vector3.FromArray(t.massProperties.centerOfMass):void 0,inertiaOrientation:t.massProperties.inertiaOrientation?_.Quaternion.FromArray(t.massProperties.inertiaOrientation):void 0}),n.shape.density=t.shape.density,n.body.setMotionType(t.body.motionType),n.shape.material=t.material,e.physicsAggregate=n,e.metadata.physicsAggregate=void 0}i(ve,"configurePhysicsAggregate");var Re=require("babylonjs"),Oe=require("babylonjs"),Fe=require("babylonjs"),S=null,w=new Map;function Co(){return S}i(Co,"getVLSPostProcess");function Io(e){S=e}i(Io,"setVLSPostProcessRef");function ne(e){S&&e.activeCamera&&(S.dispose(e.activeCamera),S=null)}i(ne,"disposeVLSPostProcess");function Me(e,t){return t??=e.meshes.find(o=>T(o)),S=new Fe.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess",1,e.activeCamera,t,100,Oe.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1),S}i(Me,"createVLSPostProcess");function re(){return S?{meshId:S.mesh?.id,exposure:S.exposure,decay:S.decay,weight:S.weight,density:S.density,invert:S.invert,useCustomMeshPosition:S.useCustomMeshPosition,customMeshPosition:S.customMeshPosition.asArray()}:null}i(re,"serializeVLSPostProcess");function te(e,t){let o=null;if(t.meshId){let r=e.getMeshById(t.meshId);r&&T(r)&&(o=r)}let n=Me(e,o);return n.exposure=t.exposure,n.decay=t.decay,n.weight=t.weight,n.density=t.density,n.invert=t.invert,n.useCustomMeshPosition=t.useCustomMeshPosition,n.customMeshPosition.copyFrom(Re.Vector3.FromArray(t.customMeshPosition)),n}i(te,"parseVLSPostProcess");var we=require("babylonjs"),m=null,N=new Map;function xo(){return m}i(xo,"getSSRRenderingPipeline");function Ao(e){m=e}i(Ao,"setSSRRenderingPipelineRef");function ie(){m&&(m.dispose(),m=null)}i(ie,"disposeSSRRenderingPipeline");function Ne(e,t){return m=new we.SSRRenderingPipeline("SSRRenderingPipeline",e,[t]),m.samples=4,m}i(Ne,"createSSRRenderingPipeline");function se(){return m?{samples:m.samples,step:m.step,thickness:m.thickness,strength:m.strength,reflectionSpecularFalloffExponent:m.reflectionSpecularFalloffExponent,maxSteps:m.maxSteps,maxDistance:m.maxDistance,roughnessFactor:m.roughnessFactor,reflectivityThreshold:m.reflectivityThreshold,blurDispersionStrehgth:m.blurDispersionStrength,clipToFrustum:m.clipToFrustum,enableSmoothReflections:m.enableSmoothReflections,enableAutomaticThicknessComputation:m.enableAutomaticThicknessComputation,attenuateFacingCamera:m.attenuateFacingCamera,attenuateScreenBorders:m.attenuateScreenBorders,attenuateIntersectionDistance:m.attenuateIntersectionDistance,attenuateBackfaceReflection:m.attenuateBackfaceReflection,blurDownsample:m.blurDownsample,selfCollisionNumSkip:m.selfCollisionNumSkip,ssrDownsample:m.ssrDownsample,backfaceDepthTextureDownsample:m.backfaceDepthTextureDownsample}:null}i(se,"serializeSSRRenderingPipeline");function ae(e,t,o){if(m)return m;let n=Ne(e,t);return n.samples=o.samples,n.step=o.step,n.thickness=o.thickness,n.strength=o.strength,n.reflectionSpecularFalloffExponent=o.reflectionSpecularFalloffExponent,n.maxSteps=o.maxSteps,n.maxDistance=o.maxDistance,n.roughnessFactor=o.roughnessFactor,n.reflectivityThreshold=o.reflectivityThreshold,n.blurDispersionStrength=o.blurDispersionStrehgth,n.clipToFrustum=o.clipToFrustum,n.enableSmoothReflections=o.enableSmoothReflections,n.enableAutomaticThicknessComputation=o.enableAutomaticThicknessComputation,n.attenuateFacingCamera=o.attenuateFacingCamera,n.attenuateScreenBorders=o.attenuateScreenBorders,n.attenuateIntersectionDistance=o.attenuateIntersectionDistance,n.attenuateBackfaceReflection=o.attenuateBackfaceReflection,n.blurDownsample=o.blurDownsample,n.selfCollisionNumSkip=o.selfCollisionNumSkip,n.ssrDownsample=o.ssrDownsample,n.backfaceDepthTextureDownsample=o.backfaceDepthTextureDownsample,n}i(ae,"parseSSRRenderingPipeline");var Ve=require("babylonjs"),d=null,V=new Map;function Eo(){return d}i(Eo,"getSSAO2RenderingPipeline");function To(e){d=e}i(To,"setSSAO2RenderingPipelineRef");function le(){d&&(d.dispose(),d=null)}i(le,"disposeSSAO2RenderingPipeline");function Be(e,t){return d=new Ve.SSAO2RenderingPipeline("SSAO2RenderingPipeline",e,1,[t]),d.samples=4,d}i(Be,"createSSAO2RenderingPipeline");function ce(){return d?{radius:d.radius,totalStrength:d.totalStrength,samples:d.samples,maxZ:d.maxZ,minZAspect:d.minZAspect,epsilon:d.epsilon,textureSamples:d.textureSamples,bypassBlur:d.bypassBlur,bilateralSamples:d.bilateralSamples,bilateralSoften:d.bilateralSoften,bilateralTolerance:d.bilateralTolerance,expensiveBlur:d.expensiveBlur}:null}i(ce,"serializeSSAO2RenderingPipeline");function me(e,t,o){if(d)return d;let n=Be(e,t);return n.radius=o.radius,n.totalStrength=o.totalStrength,n.samples=o.samples,n.maxZ=o.maxZ,n.minZAspect=o.minZAspect,n.epsilon=o.epsilon,n.textureSamples=o.textureSamples,n.bypassBlur=o.bypassBlur,n.bilateralSamples=o.bilateralSamples,n.bilateralSoften=o.bilateralSoften,n.bilateralTolerance=o.bilateralTolerance,n.expensiveBlur=o.expensiveBlur,n}i(me,"parseSSAO2RenderingPipeline");var Le=require("babylonjs"),b=null,B=new Map;function ue(){return b}i(ue,"getMotionBlurPostProcess");function Do(e){b=e}i(Do,"setMotionBlurPostProcessRef");function pe(){b&&(b.dispose(),b=null)}i(pe,"disposeMotionBlurPostProcess");function _e(e,t){return b=new Le.MotionBlurPostProcess("MotionBlurPostProcess",e,1,t),b.motionStrength=1,b.isObjectBased=!0,b}i(_e,"createMotionBlurPostProcess");function ge(){return b?{isObjectBased:b.isObjectBased,motionStrength:b.motionStrength,motionBlurSamples:b.motionBlurSamples}:null}i(ge,"serializeMotionBlurPostProcess");function fe(e,t,o){if(b)return b;let n=_e(e,t);return n.isObjectBased=o.isObjectBased,n.motionStrength=o.motionStrength,n.motionBlurSamples=o.motionBlurSamples,n}i(fe,"parseMotionBlurPostProcess");var Ge=require("babylonjs"),de=require("babylonjs"),Ke=require("babylonjs"),ke=require("babylonjs"),ze=require("babylonjs"),a=null,L=new Map;function G(){return a}i(G,"getDefaultRenderingPipeline");function vo(e){a=e}i(vo,"setDefaultRenderingPipelineRef");function ye(){a&&(a.dispose(),a=null)}i(ye,"disposeDefaultRenderingPipeline");function je(e,t){return a=new ze.DefaultRenderingPipeline("DefaultRenderingPipeline",!0,e,[t]),a.samples=4,a.depthOfField.lensSize=512,a.depthOfField.fStop=.25,a.depthOfField.focusDistance=55e3,a}i(je,"createDefaultRenderingPipeline");function he(){return a?{samples:a.samples,fxaaEnabled:a.fxaaEnabled,imageProcessingEnabled:a.imageProcessingEnabled,exposure:a.imageProcessing?.exposure,contrast:a.imageProcessing?.contrast,fromLinearSpace:a.imageProcessing?.fromLinearSpace,toneMappingEnabled:a.imageProcessing?.toneMappingEnabled,toneMappingType:a.imageProcessing?.toneMappingType,ditheringEnabled:a.imageProcessing?.ditheringEnabled,ditheringIntensity:a.imageProcessing?.ditheringIntensity,bloomEnabled:a.bloomEnabled,bloomThreshold:a.bloomThreshold,bloomWeight:a.bloomWeight,bloomScale:a.bloomScale,bloomKernel:a.bloomKernel,sharpenEnabled:a.sharpenEnabled,sharpenEdgeAmount:a.sharpen.edgeAmount,sharpenColorAmount:a.sharpen.colorAmount,grainEnabled:a.grainEnabled,grainIntensity:a.grain.intensity,grainAnimated:a.grain.animated,depthOfFieldEnabled:a.depthOfFieldEnabled,depthOfFieldBlurLevel:a.depthOfFieldBlurLevel,lensSize:a.depthOfField.lensSize,fStop:a.depthOfField.fStop,focusDistance:a.depthOfField.focusDistance,focalLength:a.depthOfField.focalLength,vignetteEnabled:a.imageProcessing?.vignetteEnabled,vignetteColor:a.imageProcessing?.vignetteColor.asArray(),vignetteWeight:a.imageProcessing?.vignetteWeight,chromaticAberrationEnabled:a.chromaticAberrationEnabled,aberrationAmount:a.chromaticAberration.aberrationAmount,radialIntensity:a.chromaticAberration.radialIntensity,direction:a.chromaticAberration.direction.asArray(),centerPosition:a.chromaticAberration.centerPosition.asArray(),glowLayerEnabled:a.glowLayerEnabled,glowLayerIntensity:a.glowLayer?.intensity,glowLayerBlurKernelSize:a.glowLayer?.blurKernelSize,colorGradingEnabled:a.imageProcessing.colorGradingEnabled,colorGradingTexture:a.imageProcessing.colorGradingTexture?.serialize(),colorGradingWithGreenDepth:a.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,colorCurvesEnabled:a.imageProcessing.colorCurvesEnabled,globalHue:a.imageProcessing.colorCurves?.globalHue,globalDensity:a.imageProcessing.colorCurves?.globalDensity,globalExposure:a.imageProcessing.colorCurves?.globalExposure,globalSaturation:a.imageProcessing.colorCurves?.globalSaturation,highlightsHue:a.imageProcessing.colorCurves?.highlightsHue,highlightsDensity:a.imageProcessing.colorCurves?.highlightsDensity,highlightsExposure:a.imageProcessing.colorCurves?.highlightsExposure,highlightsSaturation:a.imageProcessing.colorCurves?.highlightsSaturation,midtonesHue:a.imageProcessing.colorCurves?.midtonesHue,midtonesDensity:a.imageProcessing.colorCurves?.midtonesDensity,midtonesExposure:a.imageProcessing.colorCurves?.midtonesExposure,midtonesSaturation:a.imageProcessing.colorCurves?.midtonesSaturation,shadowsHue:a.imageProcessing.colorCurves?.shadowsHue,shadowsDensity:a.imageProcessing.colorCurves?.shadowsDensity,shadowsExposure:a.imageProcessing.colorCurves?.shadowsExposure,shadowsSaturation:a.imageProcessing.colorCurves?.shadowsSaturation}:null}i(he,"serializeDefaultRenderingPipeline");function Se(e,t,o,n){if(a)return a;let r=je(e,t);if(r.samples=o.samples,r.fxaaEnabled=o.fxaaEnabled,r.imageProcessingEnabled=o.imageProcessingEnabled,r.imageProcessing){if(r.imageProcessing.exposure=o.exposure,r.imageProcessing.contrast=o.contrast,r.imageProcessing.fromLinearSpace=o.fromLinearSpace,r.imageProcessing.toneMappingEnabled=o.toneMappingEnabled,r.imageProcessing.toneMappingType=o.toneMappingType,r.imageProcessing.ditheringEnabled=o.ditheringEnabled,r.imageProcessing.ditheringIntensity=o.ditheringIntensity,r.imageProcessing.vignetteEnabled=o.vignetteEnabled??!1,r.imageProcessing.vignetteColor=Ge.Color4.FromArray(o.vignetteColor??[0,0,0]),r.imageProcessing.vignetteWeight=o.vignetteWeight??.3,r.imageProcessing.colorGradingEnabled=o.colorGradingEnabled??!1,r.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth=o.colorGradingWithGreenDepth??!0,o.colorGradingTexture){let l=null;if(o.colorGradingTexture.customType==="BABYLON.ColorGradingTexture"){let s=n+o.colorGradingTexture.name;l=new ke.ColorGradingTexture(s,e),l.level=o.colorGradingTexture.level}else{let s=Ke.Texture.Parse(o.colorGradingTexture,e,n);ee(s)&&(l=s)}r.imageProcessing.colorGradingTexture=l}r.imageProcessing.colorCurvesEnabled=o.colorCurvesEnabled??!1,r.imageProcessing.colorCurves&&(r.imageProcessing.colorCurves.globalHue=o.globalHue??30,r.imageProcessing.colorCurves.globalDensity=o.globalDensity??0,r.imageProcessing.colorCurves.globalExposure=o.globalExposure??0,r.imageProcessing.colorCurves.globalSaturation=o.globalSaturation??0,r.imageProcessing.colorCurves.highlightsHue=o.highlightsHue??30,r.imageProcessing.colorCurves.highlightsDensity=o.highlightsDensity??0,r.imageProcessing.colorCurves.highlightsExposure=o.highlightsExposure??0,r.imageProcessing.colorCurves.highlightsSaturation=o.highlightsSaturation??0,r.imageProcessing.colorCurves.midtonesHue=o.midtonesHue??30,r.imageProcessing.colorCurves.midtonesDensity=o.midtonesDensity??0,r.imageProcessing.colorCurves.midtonesExposure=o.midtonesExposure??0,r.imageProcessing.colorCurves.midtonesSaturation=o.midtonesSaturation??0,r.imageProcessing.colorCurves.shadowsHue=o.shadowsHue??30,r.imageProcessing.colorCurves.shadowsDensity=o.shadowsDensity??0,r.imageProcessing.colorCurves.shadowsExposure=o.shadowsExposure??0,r.imageProcessing.colorCurves.shadowsSaturation=o.shadowsSaturation??0)}return r.bloomEnabled=o.bloomEnabled,r.bloomThreshold=o.bloomThreshold,r.bloomWeight=o.bloomWeight,r.bloomScale=o.bloomScale,r.bloomKernel=o.bloomKernel,r.sharpenEnabled=o.sharpenEnabled,r.sharpen.edgeAmount=o.sharpenEdgeAmount,r.sharpen.colorAmount=o.sharpenColorAmount,r.grainEnabled=o.grainEnabled,r.grain.intensity=o.grainIntensity,r.grain.animated=o.grainAnimated,r.depthOfFieldEnabled=o.depthOfFieldEnabled,r.depthOfFieldBlurLevel=o.depthOfFieldBlurLevel,r.depthOfField.lensSize=o.lensSize,r.depthOfField.fStop=o.fStop,r.depthOfField.focusDistance=o.focusDistance,r.depthOfField.focalLength=o.focalLength,r.chromaticAberrationEnabled=o.chromaticAberrationEnabled??!1,r.chromaticAberration.aberrationAmount=o.aberrationAmount??10,r.chromaticAberration.radialIntensity=o.radialIntensity??1,r.chromaticAberration.direction=de.Vector2.FromArray(o.direction??[0,0]),r.chromaticAberration.centerPosition=de.Vector2.FromArray(o.centerPosition??[0,0]),r.glowLayerEnabled=o.glowLayerEnabled??!1,r.glowLayer&&(r.glowLayer.intensity=o.glowLayerIntensity??1,r.glowLayer.blurKernelSize=o.glowLayerBlurKernelSize??32),r}i(Se,"parseDefaultRenderingPipeline");function Ye(e,t){(Array.isArray(t)?t:[]).forEach(n=>{let r=e.getCameraById(n.cameraId);r&&(n.ssao2RenderingPipeline&&V.set(r,n.ssao2RenderingPipeline),n.vlsPostProcess&&w.set(r,n.vlsPostProcess),n.ssrRenderingPipeline&&N.set(r,n.ssrRenderingPipeline),n.motionBlurPostProcess&&B.set(r,n.motionBlurPostProcess),n.defaultRenderingPipeline&&L.set(r,n.defaultRenderingPipeline))})}i(Ye,"applyRenderingConfigurations");function Jr(e){V.set(e,ce()),w.set(e,re()),N.set(e,se()),B.set(e,ge()),L.set(e,he())}i(Jr,"saveRenderingConfigurationForCamera");function He(e,t){le(),ne(e.getScene()),ie(),pe(),ye();let o=V.get(e);o&&me(e.getScene(),e,o);let n=w.get(e);n&&te(e.getScene(),n);let r=N.get(e);r&&ae(e.getScene(),e,r);let l=B.get(e);l&&fe(e.getScene(),e,l);let s=L.get(e);s&&Se(e.getScene(),e,s,t)}i(He,"applyRenderingConfigurationForCamera");var We=require("babylonjs"),$e=require("babylonjs");function be(e){e.lights.forEach(t=>{let o=t.getShadowGenerator()?.getShadowMap();o&&(o.renderListPredicate=n=>We.Vector3.Distance(n.getAbsolutePosition(),t.getAbsolutePosition())<=t.range)})}i(be,"configureShadowMapRenderListPredicate");async function Pe(e){e.executeWhenReady(()=>{e.lights.forEach(t=>{let o=t.getShadowGenerator()?.getShadowMap();o&&(o.refreshRate=t.metadata?.refreshRate??$e.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME)})})}i(Pe,"configureShadowMapRefreshRate");var Ce=require("babylonjs"),$=require("babylonjs"),Ro=(0,$.GetParser)(Ce.SceneComponentConstants.NAME_AUDIO);(0,$.AddParser)(Ce.SceneComponentConstants.NAME_AUDIO,(e,t,o,n)=>{Ro?.(e,t,o,n),e.sounds?.forEach(r=>{let l=o.sounds?.find(s=>s.name===r.name);l&&(l.id=r.id,l.uniqueId=r.uniqueId)})});function D(e){let t=1;for(;t<=e;)t<<=1;return t>>1}i(D,"getPowerOfTwoUntil");var Ie=require("babylonjs"),Q=Ie.SerializationHelper._TextureParser;Ie.SerializationHelper._TextureParser=(e,t,o)=>{if(t.loadingQuality==="high"||!e.metadata?.baseSize)return Q(e,t,o);let n=e.metadata.baseSize.width,r=e.metadata.baseSize.height,l=n===D(n)||r===D(r),s="";switch(t.loadingQuality){case"medium":let h=n*.66>>0,f=r*.66>>0;l&&(h=D(h),f=D(f)),s=`_${h}_${f}`;break;case"low":let p=n*.33>>0,g=r*.33>>0;l&&(p=D(p),g=D(g)),s=`_${p}_${g}`;break}let c=e.name;if(!c||!s)return Q(e,t,o);let u=c.split("/"),y=u.pop();if(!y)return Q(e,t,o);let P=y.split(".").pop(),O=`${y.replace(`.${P}`,"")}${s}.${P}`;return u.push(O),e.name=u.join("/"),Q(e,t,o)};var Qe=require("babylonjs"),Ue=require("babylonjs"),Ze=require("babylonjs");async function Oo(e,t,o,n,r){o.loadingQuality=r?.quality??"high",await(0,Ue.AppendSceneAsync)(`${e}${t}`,o,{pluginExtension:".babylon",onProgress:i(s=>{let c=Math.min(s.loaded/s.total*.5);r?.onProgress?.(c)},"onProgress")}),Ze.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&o.meshes.forEach(s=>T(s)&&s._checkDelayState());let l=o.getWaitingItemsCount();for(;!o.isReady()||o.getWaitingItemsCount()>0;){await new Promise(c=>setTimeout(c,150));let s=l-o.getWaitingItemsCount();r?.onProgress?.(.5+s/l*.5)}r?.onProgress?.(1),be(o),Pe(o),o.metadata?.rendering&&(Ye(o,o.metadata.rendering),o.activeCamera&&He(o.activeCamera,e)),o.metadata?.physicsGravity&&o.getPhysicsEngine()?.setGravity(Qe.Vector3.FromArray(o.metadata?.physicsGravity)),M(o,o,n,e),o.transformNodes.forEach(s=>{M(o,s,n,e)}),o.meshes.forEach(s=>{ve(s),M(o,s,n,e)}),o.lights.forEach(s=>{M(o,s,n,e)}),o.cameras.forEach(s=>{M(o,s,n,e)})}i(Oo,"loadScene");function Fo(e){e.setTextureFormatToUse(["-dxt.ktx","-astc.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"])}i(Fo,"configureEngineToUseCompressedTextures");var A=require("babylonjs");function K(e){if(!isNaN(parseFloat(e))&&isFinite(e))return A.Animation.ANIMATIONTYPE_FLOAT;switch(e?.getClassName?.()){case"Vector2":return A.Animation.ANIMATIONTYPE_VECTOR2;case"Vector3":return A.Animation.ANIMATIONTYPE_VECTOR3;case"Quaternion":return A.Animation.ANIMATIONTYPE_QUATERNION;case"Color3":return A.Animation.ANIMATIONTYPE_COLOR3;case"Color4":return A.Animation.ANIMATIONTYPE_COLOR4;case"Size":return A.Animation.ANIMATIONTYPE_SIZE;case"Matrix":return A.Animation.ANIMATIONTYPE_MATRIX}return null}i(K,"getAnimationTypeForObject");function Mo(e){return function(t,o){let n=t.constructor;n._NodesFromScene??=[],n._NodesFromScene.push({propertyKey:o,nodeName:e})}}i(Mo,"nodeFromScene");function wo(e,t=!1){return function(o,n){let r=o.constructor;r._NodesFromDescendants??=[],r._NodesFromDescendants.push({propertyKey:n,nodeName:e,directDescendantsOnly:t})}}i(wo,"nodeFromDescendants");function No(e){return function(t,o){let n=t.constructor;n._AnimationGroups??=[],n._AnimationGroups.push({animationGroupName:e,propertyKey:o})}}i(No,"animationGroupFromScene");function Vo(e,t){return function(o,n){let r=o.constructor;r._GuiFromAsset??=[],r._GuiFromAsset.push({propertyKey:n,pathInAssets:e,onGuiCreated:t})}}i(Vo,"guiFromAsset");function Bo(e){return function(t,o){let n=t.constructor;n._SoundsFromScene??=[],n._SoundsFromScene.push({propertyKey:o,soundName:e})}}i(Bo,"soundFromScene");function Lo(e){return function(t,o){let n=t.constructor;n._ParticleSystemsFromScene??=[],n._ParticleSystemsFromScene.push({propertyKey:o,particleSystemName:e})}}i(Lo,"particleSystemFromScene");function _o(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"boolean"}})}}i(_o,"visibleAsBoolean");function Go(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"number"}})}}i(Go,"visibleAsNumber");function Ko(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"vector2"}})}}i(Ko,"visibleAsVector2");function ko(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"vector3"}})}}i(ko,"visibleAsVector3");function zo(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"color3"}})}}i(zo,"visibleAsColor3");function jo(e,t){return function(o,n){let r=o.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:e,propertyKey:n,configuration:{...t,type:"color4"}})}}i(jo,"visibleAsColor4");function Yo(e,t,o){return function(n,r){let l=n.constructor;l._VisibleInInspector??=[],l._VisibleInInspector.push({label:t,propertyKey:r,configuration:{...o,entityType:e,type:"entity"}})}}i(Yo,"visibleAsEntity");var U=require("babylonjs");function qe(e,t){let o;switch(e){case U.Animation.ANIMATIONTYPE_FLOAT:o=t.value;break;default:o=t.value.clone();break}return{value:o,frame:t.frame,interpolation:t.interpolation,inTangent:e===U.Animation.ANIMATIONTYPE_FLOAT?t.inTangent:t.inTangent?.clone(),outTangent:e===U.Animation.ANIMATIONTYPE_FLOAT?t.outTangent:t.outTangent?.clone()}}i(qe,"cloneKey");function Z(e,t){let o=t.split("."),n=e;for(let r=0;r<o.length;++r)n=n[o[r]];return n}i(Z,"getPropertyValue");var v=require("babylonjs"),q=require("babylonjs"),I=require("babylonjs");function Ho(e,t){return{name:e.name,framesPerSecond:e.framesPerSecond,outputFramesPerSecond:e.outputFramesPerSecond,tracks:e.tracks.map(o=>{let n=null,r=null;if(o.node?(n=t.getNodeById(o.node),n||(n=t.particleSystems?.find(s=>s.id===o.node)??null)):o.defaultRenderingPipeline&&(n=G()),o.propertyPath){let s=Z(n,o.propertyPath);r=K(s)}let l=null;return o.sound&&(l=Y(o.sound,t)),{node:n,sound:l,propertyPath:o.propertyPath,defaultRenderingPipeline:o.defaultRenderingPipeline,animationGroup:o.animationGroup?t.getAnimationGroupByName(o.animationGroup):null,animationGroups:o.animationGroups,sounds:o.sounds,keyFrameEvents:o.keyFrameEvents?.map(s=>{let c={...s};switch(s.data?.type){case"set-enabled":c.data={type:"set-enabled",value:s.data.value,node:t.getNodeById(s.data.node)};break;case"apply-impulse":c.data={type:"apply-impulse",radius:s.data.radius,mesh:t.getMeshById(s.data.mesh),force:I.Vector3.FromArray(s.data.force),contactPoint:I.Vector3.FromArray(s.data.contactPoint)};break}return c}),keyFrameAnimations:n&&r!==null&&o.keyFrameAnimations?.map(s=>{let c=s.type==="key"?s:null;if(c)return{...c,value:C(c.value,r),inTangent:C(c.inTangent,r),outTangent:C(c.outTangent,r)};let u=s.type==="cut"?s:null;if(u)return{...u,key1:{...u.key1,value:C(u.key1.value,r),inTangent:C(u.key1.inTangent,r),outTangent:C(u.key1.outTangent,r)},key2:{...u.key2,value:C(u.key2.value,r),inTangent:C(u.key2.inTangent,r),outTangent:C(u.key2.outTangent,r)}};throw new Error(`Unknown key frame type: ${s.type}`)})}})}}i(Ho,"parseCinematic");function C(e,t){if(e===null)return null;if(e!==void 0)switch(t){case v.Animation.ANIMATIONTYPE_FLOAT:return e;case v.Animation.ANIMATIONTYPE_VECTOR2:return I.Vector2.FromArray(e);case v.Animation.ANIMATIONTYPE_VECTOR3:return I.Vector3.FromArray(e);case v.Animation.ANIMATIONTYPE_QUATERNION:return I.Quaternion.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR3:return q.Color3.FromArray(e);case v.Animation.ANIMATIONTYPE_COLOR4:return q.Color4.FromArray(e);case v.Animation.ANIMATIONTYPE_MATRIX:return I.Matrix.FromArray(e)}}i(C,"parseCinematicKeyValue");function Xe(e){e.node?.setEnabled(e.value)}i(Xe,"handleSetEnabledEvent");var xe=require("babylonjs"),Je=xe.Vector3.Zero();function eo(e,t){let o=t.mesh?[t.mesh]:e.meshes.filter(n=>n.physicsAggregate);t.radius&&(o=o.filter(n=>{let r=n.getBoundingInfo().boundingBox.centerWorld;return xe.Vector3.Distance(r,t.contactPoint)<=t.radius})),o.forEach(n=>{if(n.physicsAggregate?.body){let r=t.contactPoint.subtract(n.getBoundingInfo().boundingBox.centerWorld);r.multiplyInPlace(t.force),n.physicsAggregate.body.setLinearVelocity(Je),n.physicsAggregate.body.setAngularVelocity(Je),n.physicsAggregate.body.applyImpulse(r.negateInPlace(),t.contactPoint)}})}i(eo,"handleApplyImpulseEvent");var oo=require("babylonjs"),E=require("babylonjs"),k=require("babylonjs"),no=require("babylonjs");function Wo(e,t,o){let n=new no.AnimationGroup(e.name,t);return e.tracks.forEach(r=>{let l=r.animationGroup;l&&r.animationGroups?.forEach(h=>{l.targetedAnimations.forEach(f=>{let p=null;e:{let x=n.targetedAnimations.filter(z=>z.target===f.target);if(x.length){let z=x.find(ro=>ro.animation.targetProperty===f.animation.targetProperty);if(z){p=z.animation;break e}}p=f.animation.clone(),p.setKeys([]),p.name=oo.Tools.RandomId(),p.framePerSecond=e.framesPerSecond}let g=p.getKeys(),F=f.animation.getKeys(),X=h.speed,Ae=e.framesPerSecond/f.animation.framePerSecond/X;F.forEach(x=>{x.frame>=h.startFrame&&x.frame<=h.endFrame&&g.push({...qe(f.animation.dataType,x),frame:h.frame+x.frame*Ae})}),p.setKeys(g),n.addTargetedAnimation(p,f.target)})});let s=r.sound,c=s?.getAudioBuffer();if(!o?.ignoreSounds&&s&&c&&r.sounds?.length){let h={dummy:0},f=new E.Animation(s.name,"dummy",60,E.Animation.ANIMATIONTYPE_FLOAT,E.Animation.ANIMATIONLOOPMODE_CYCLE,!1),p=0;r.sounds?.forEach(g=>{let F=g.endFrame-g.startFrame;p=Math.max(p,g.frame+F),f.addEvent(new k.AnimationEvent(g.frame,X=>{let x=(X-g.frame+g.startFrame)/e.framesPerSecond;s.play(0,x)},!1)),f.addEvent(new k.AnimationEvent(g.frame+F,()=>{s.stop()}))}),f.setKeys([{frame:0,value:0},{frame:p,value:p}]),n.addTargetedAnimation(f,h)}if(r.keyFrameEvents){let h={dummy:0},f=new E.Animation("events","dummy",60,E.Animation.ANIMATIONTYPE_FLOAT,E.Animation.ANIMATIONLOOPMODE_CYCLE,!1),p=0;r.keyFrameEvents?.forEach(g=>{p=Math.max(p,g.frame),f.addEvent(new k.AnimationEvent(g.frame,()=>{switch(g.data?.type){case"set-enabled":Xe(g.data);break;case"apply-impulse":eo(t,g.data);break}}))}),f.setKeys([{frame:0,value:0},{frame:p,value:p}]),n.addTargetedAnimation(f,h)}let u=r.defaultRenderingPipeline?G():r.node;if(!u||!r.propertyPath||!r.keyFrameAnimations)return;let y=Z(u,r.propertyPath),P=K(y);if(P===null)return;let R=new E.Animation(r.propertyPath,r.propertyPath,60,P,E.Animation.ANIMATIONLOOPMODE_CYCLE,!1),O=[];r.keyFrameAnimations?.forEach(h=>{let f=h.type==="key"?h:null;if(f)return O.push(f);let p=h.type==="cut"?h:null;p&&(O.push(p.key1),O.push(p.key2),oe(u)&&r.propertyPath==="position"&&R.addEvent(new k.AnimationEvent(p.key1.frame,()=>{let g=ue();if(!g)return;let F=g.motionStrength;g.motionStrength=0,requestAnimationFrame(()=>{g.motionStrength=F})})))}),R.setKeys(O),n.addTargetedAnimation(R,u)}),n.normalize(),n}i(Wo,"generateCinematicAnimationGroup");function $o(e){return e.type==="key"}i($o,"isCinematicKey");function Qo(e){return e.type==="cut"}i(Qo,"isCinematicKeyCut");function Uo(e){return e.type==="event"}i(Uo,"isCinematicKeyEvent");function Zo(e){return e.type==="group"}i(Zo,"isCinematicGroup");function qo(e){return e.type==="sound"}i(qo,"isCinematicSound");0&&(module.exports={animationGroupFromScene,configureEngineToUseCompressedTextures,configureShadowMapRefreshRate,configureShadowMapRenderListPredicate,createDefaultRenderingPipeline,createMotionBlurPostProcess,createSSAO2RenderingPipeline,createSSRRenderingPipeline,createVLSPostProcess,defaultPipelineCameraConfigurations,disposeDefaultRenderingPipeline,disposeMotionBlurPostProcess,disposeSSAO2RenderingPipeline,disposeSSRRenderingPipeline,disposeVLSPostProcess,generateCinematicAnimationGroup,getAnimationTypeForObject,getDefaultRenderingPipeline,getMotionBlurPostProcess,getPowerOfTwoUntil,getSSAO2RenderingPipeline,getSSRRenderingPipeline,getVLSPostProcess,guiFromAsset,isAbstractMesh,isArcRotateCamera,isBone,isCamera,isCinematicGroup,isCinematicKey,isCinematicKeyCut,isCinematicKeyEvent,isCinematicSound,isDirectionalLight,isFreeCamera,isGroundMesh,isHemisphericLight,isInstancedMesh,isMesh,isPointLight,isSpotLight,isTexture,isTransformNode,loadScene,motionBlurPostProcessCameraConfigurations,nodeFromDescendants,nodeFromScene,parseCinematic,parseCinematicKeyValue,parseDefaultRenderingPipeline,parseMotionBlurPostProcess,parseSSAO2RenderingPipeline,parseSSRRenderingPipeline,parseVLSPostProcess,particleSystemFromScene,serializeDefaultRenderingPipeline,serializeMotionBlurPostProcess,serializeSSAO2RenderingPipeline,serializeSSRRenderingPipeline,serializeVLSPostProcess,setDefaultRenderingPipelineRef,setMotionBlurPostProcessRef,setSSAO2RenderingPipelineRef,setSSRRenderingPipelineRef,setVLSPostProcessRef,soundFromScene,ssaoRenderingPipelineCameraConfigurations,ssrRenderingPipelineCameraConfigurations,visibleAsBoolean,visibleAsColor3,visibleAsColor4,visibleAsEntity,visibleAsNumber,visibleAsVector2,visibleAsVector3,vlsPostProcessCameraConfigurations});
|