babylonjs-editor-tools 0.0.9 → 0.0.10

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