@babylonjs/core 5.45.0 → 5.45.2

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.
Files changed (55) hide show
  1. package/Engines/thinEngine.js +2 -2
  2. package/Engines/thinEngine.js.map +1 -1
  3. package/Inputs/scene.inputManager.js +12 -1
  4. package/Inputs/scene.inputManager.js.map +1 -1
  5. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +7 -0
  6. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
  7. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  8. package/Materials/Textures/texture.d.ts +2 -2
  9. package/Materials/Textures/texture.js +2 -2
  10. package/Materials/Textures/texture.js.map +1 -1
  11. package/Materials/Textures/videoTexture.d.ts +1 -0
  12. package/Materials/Textures/videoTexture.js +19 -8
  13. package/Materials/Textures/videoTexture.js.map +1 -1
  14. package/Materials/clipPlaneMaterialHelper.js +22 -19
  15. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  16. package/Misc/khronosTextureContainer2.js +3 -5
  17. package/Misc/khronosTextureContainer2.js.map +1 -1
  18. package/Physics/index.d.ts +1 -0
  19. package/Physics/index.js +1 -0
  20. package/Physics/index.js.map +1 -1
  21. package/Physics/physicsHelper.d.ts +452 -1
  22. package/Physics/physicsHelper.js +877 -2
  23. package/Physics/physicsHelper.js.map +1 -1
  24. package/Physics/v1/index.d.ts +0 -1
  25. package/Physics/v1/index.js +0 -1
  26. package/Physics/v1/index.js.map +1 -1
  27. package/Physics/v2/IPhysicsEnginePlugin.d.ts +8 -1
  28. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  29. package/Physics/v2/index.d.ts +1 -0
  30. package/Physics/v2/index.js +1 -0
  31. package/Physics/v2/index.js.map +1 -1
  32. package/Physics/v2/physicsAggregate.d.ts +39 -19
  33. package/Physics/v2/physicsAggregate.js +61 -5
  34. package/Physics/v2/physicsAggregate.js.map +1 -1
  35. package/Physics/v2/physicsBody.d.ts +37 -1
  36. package/Physics/v2/physicsBody.js +71 -1
  37. package/Physics/v2/physicsBody.js.map +1 -1
  38. package/Physics/v2/physicsEngine.d.ts +7 -2
  39. package/Physics/v2/physicsEngine.js +9 -2
  40. package/Physics/v2/physicsEngine.js.map +1 -1
  41. package/Physics/v2/physicsShape.d.ts +30 -44
  42. package/Physics/v2/physicsShape.js +30 -44
  43. package/Physics/v2/physicsShape.js.map +1 -1
  44. package/Shaders/ShadersInclude/bumpFragment.js +1 -0
  45. package/Shaders/ShadersInclude/bumpFragment.js.map +1 -1
  46. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +4 -1
  47. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  48. package/Shaders/sprites.fragment.js +1 -1
  49. package/Shaders/sprites.fragment.js.map +1 -1
  50. package/assetContainer.js +1 -1
  51. package/assetContainer.js.map +1 -1
  52. package/package.json +1 -1
  53. package/Physics/v1/physicsHelper.d.ts +0 -411
  54. package/Physics/v1/physicsHelper.js +0 -709
  55. package/Physics/v1/physicsHelper.js.map +0 -1
@@ -1 +1,452 @@
1
- export * from "./v1/physicsHelper";
1
+ import type { Nullable } from "../types";
2
+ import { Vector3 } from "../Maths/math.vector";
3
+ import type { Mesh } from "../Meshes/mesh";
4
+ import type { Scene } from "../scene";
5
+ import type { PhysicsImpostor } from "./v1/physicsImpostor";
6
+ import type { PhysicsBody } from "./v2/physicsBody";
7
+ /**
8
+ * A helper for physics simulations
9
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
10
+ */
11
+ export declare class PhysicsHelper {
12
+ private _scene;
13
+ private _physicsEngine;
14
+ private _hitData;
15
+ /**
16
+ * Initializes the Physics helper
17
+ * @param scene Babylon.js scene
18
+ */
19
+ constructor(scene: Scene);
20
+ /**
21
+ * Applies a radial explosion impulse
22
+ * @param origin the origin of the explosion
23
+ * @param radiusOrEventOptions the radius or the options of radial explosion
24
+ * @param strength the explosion strength
25
+ * @param falloff possible options: Constant & Linear. Defaults to Constant
26
+ * @returns A physics radial explosion event, or null
27
+ */
28
+ applyRadialExplosionImpulse(origin: Vector3, radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions, strength?: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsRadialExplosionEvent>;
29
+ /**
30
+ * Applies a radial explosion force
31
+ * @param origin the origin of the explosion
32
+ * @param radiusOrEventOptions the radius or the options of radial explosion
33
+ * @param strength the explosion strength
34
+ * @param falloff possible options: Constant & Linear. Defaults to Constant
35
+ * @returns A physics radial explosion event, or null
36
+ */
37
+ applyRadialExplosionForce(origin: Vector3, radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions, strength?: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsRadialExplosionEvent>;
38
+ /**
39
+ * Creates a gravitational field
40
+ * @param origin the origin of the gravitational field
41
+ * @param radiusOrEventOptions the radius or the options of radial gravitational field
42
+ * @param strength the gravitational field strength
43
+ * @param falloff possible options: Constant & Linear. Defaults to Constant
44
+ * @returns A physics gravitational field event, or null
45
+ */
46
+ gravitationalField(origin: Vector3, radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions, strength?: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsGravitationalFieldEvent>;
47
+ /**
48
+ * Creates a physics updraft event
49
+ * @param origin the origin of the updraft
50
+ * @param radiusOrEventOptions the radius or the options of the updraft
51
+ * @param strength the strength of the updraft
52
+ * @param height the height of the updraft
53
+ * @param updraftMode possible options: Center & Perpendicular. Defaults to Center
54
+ * @returns A physics updraft event, or null
55
+ */
56
+ updraft(origin: Vector3, radiusOrEventOptions: number | PhysicsUpdraftEventOptions, strength?: number, height?: number, updraftMode?: PhysicsUpdraftMode): Nullable<PhysicsUpdraftEvent>;
57
+ /**
58
+ * Creates a physics vortex event
59
+ * @param origin the of the vortex
60
+ * @param radiusOrEventOptions the radius or the options of the vortex
61
+ * @param strength the strength of the vortex
62
+ * @param height the height of the vortex
63
+ * @returns a Physics vortex event, or null
64
+ * A physics vortex event or null
65
+ */
66
+ vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent>;
67
+ private _copyPhysicsHitData;
68
+ }
69
+ /**
70
+ * Represents a physics radial explosion event
71
+ */
72
+ declare class PhysicsRadialExplosionEvent {
73
+ private _scene;
74
+ private _options;
75
+ private _sphere;
76
+ private _dataFetched;
77
+ /**
78
+ * Initializes a radial explosion event
79
+ * @param _scene BabylonJS scene
80
+ * @param _options The options for the vortex event
81
+ */
82
+ constructor(_scene: Scene, _options: PhysicsRadialExplosionEventOptions);
83
+ /**
84
+ * Returns the data related to the radial explosion event (sphere).
85
+ * @returns The radial explosion event data
86
+ */
87
+ getData(): PhysicsRadialExplosionEventData;
88
+ private _getHitData;
89
+ /**
90
+ * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.
91
+ * @param body A physics body
92
+ * @param origin the origin of the explosion
93
+ * @returns A physics force and contact point, or null
94
+ */
95
+ getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData): boolean;
96
+ /**
97
+ * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.
98
+ * @param impostor A physics imposter
99
+ * @param origin the origin of the explosion
100
+ * @returns A physics force and contact point, or null
101
+ */
102
+ getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean;
103
+ /**
104
+ * Triggers affected impostors callbacks
105
+ * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)
106
+ */
107
+ triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>): void;
108
+ /**
109
+ * Triggers affected bodies callbacks
110
+ * @param affectedBodiesWithData defines the list of affected bodies (including associated data)
111
+ */
112
+ triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>): void;
113
+ /**
114
+ * Disposes the sphere.
115
+ * @param force Specifies if the sphere should be disposed by force
116
+ */
117
+ dispose(force?: boolean): void;
118
+ /*** Helpers ***/
119
+ private _prepareSphere;
120
+ private _intersectsWithSphere;
121
+ }
122
+ /**
123
+ * Represents a gravitational field event
124
+ */
125
+ declare class PhysicsGravitationalFieldEvent {
126
+ private _physicsHelper;
127
+ private _scene;
128
+ private _origin;
129
+ private _options;
130
+ private _tickCallback;
131
+ private _sphere;
132
+ private _dataFetched;
133
+ /**
134
+ * Initializes the physics gravitational field event
135
+ * @param _physicsHelper A physics helper
136
+ * @param _scene BabylonJS scene
137
+ * @param _origin The origin position of the gravitational field event
138
+ * @param _options The options for the vortex event
139
+ */
140
+ constructor(_physicsHelper: PhysicsHelper, _scene: Scene, _origin: Vector3, _options: PhysicsRadialExplosionEventOptions);
141
+ /**
142
+ * Returns the data related to the gravitational field event (sphere).
143
+ * @returns A gravitational field event
144
+ */
145
+ getData(): PhysicsGravitationalFieldEventData;
146
+ /**
147
+ * Enables the gravitational field.
148
+ */
149
+ enable(): void;
150
+ /**
151
+ * Disables the gravitational field.
152
+ */
153
+ disable(): void;
154
+ /**
155
+ * Disposes the sphere.
156
+ * @param force The force to dispose from the gravitational field event
157
+ */
158
+ dispose(force?: boolean): void;
159
+ private _tick;
160
+ }
161
+ /**
162
+ * Represents a physics updraft event
163
+ */
164
+ declare class PhysicsUpdraftEvent {
165
+ private _scene;
166
+ private _origin;
167
+ private _options;
168
+ private _physicsEngine;
169
+ private _originTop;
170
+ private _originDirection;
171
+ private _tickCallback;
172
+ private _cylinder;
173
+ private _cylinderPosition;
174
+ private _dataFetched;
175
+ private static hitData;
176
+ /**
177
+ * Initializes the physics updraft event
178
+ * @param _scene BabylonJS scene
179
+ * @param _origin The origin position of the updraft
180
+ * @param _options The options for the updraft event
181
+ */
182
+ constructor(_scene: Scene, _origin: Vector3, _options: PhysicsUpdraftEventOptions);
183
+ /**
184
+ * Returns the data related to the updraft event (cylinder).
185
+ * @returns A physics updraft event
186
+ */
187
+ getData(): PhysicsUpdraftEventData;
188
+ /**
189
+ * Enables the updraft.
190
+ */
191
+ enable(): void;
192
+ /**
193
+ * Disables the updraft.
194
+ */
195
+ disable(): void;
196
+ /**
197
+ * Disposes the cylinder.
198
+ * @param force Specifies if the updraft should be disposed by force
199
+ */
200
+ dispose(force?: boolean): void;
201
+ private _getHitData;
202
+ private _getBodyHitData;
203
+ private _getImpostorHitData;
204
+ private _tick;
205
+ /*** Helpers ***/
206
+ private _prepareCylinder;
207
+ private _intersectsWithCylinder;
208
+ }
209
+ /**
210
+ * Represents a physics vortex event
211
+ */
212
+ declare class PhysicsVortexEvent {
213
+ private _scene;
214
+ private _origin;
215
+ private _options;
216
+ private _physicsEngine;
217
+ private _originTop;
218
+ private _tickCallback;
219
+ private _cylinder;
220
+ private _cylinderPosition;
221
+ private _dataFetched;
222
+ private static originOnPlane;
223
+ private static hitData;
224
+ /**
225
+ * Initializes the physics vortex event
226
+ * @param _scene The BabylonJS scene
227
+ * @param _origin The origin position of the vortex
228
+ * @param _options The options for the vortex event
229
+ */
230
+ constructor(_scene: Scene, _origin: Vector3, _options: PhysicsVortexEventOptions);
231
+ /**
232
+ * Returns the data related to the vortex event (cylinder).
233
+ * @returns The physics vortex event data
234
+ */
235
+ getData(): PhysicsVortexEventData;
236
+ /**
237
+ * Enables the vortex.
238
+ */
239
+ enable(): void;
240
+ /**
241
+ * Disables the cortex.
242
+ */
243
+ disable(): void;
244
+ /**
245
+ * Disposes the sphere.
246
+ * @param force
247
+ */
248
+ dispose(force?: boolean): void;
249
+ private _getHitData;
250
+ private _getBodyHitData;
251
+ private _getImpostorHitData;
252
+ private _tick;
253
+ /*** Helpers ***/
254
+ private _prepareCylinder;
255
+ private _intersectsWithCylinder;
256
+ }
257
+ /**
258
+ * Options fot the radial explosion event
259
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
260
+ */
261
+ export declare class PhysicsRadialExplosionEventOptions {
262
+ /**
263
+ * The radius of the sphere for the radial explosion.
264
+ */
265
+ radius: number;
266
+ /**
267
+ * The strength of the explosion.
268
+ */
269
+ strength: number;
270
+ /**
271
+ * The strength of the force in correspondence to the distance of the affected object
272
+ */
273
+ falloff: PhysicsRadialImpulseFalloff;
274
+ /**
275
+ * Sphere options for the radial explosion.
276
+ */
277
+ sphere: {
278
+ segments: number;
279
+ diameter: number;
280
+ };
281
+ /**
282
+ * Sphere options for the radial explosion.
283
+ */
284
+ affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;
285
+ /**
286
+ * Sphere options for the radial explosion.
287
+ */
288
+ affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;
289
+ }
290
+ /**
291
+ * Options fot the updraft event
292
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
293
+ */
294
+ export declare class PhysicsUpdraftEventOptions {
295
+ /**
296
+ * The radius of the cylinder for the vortex
297
+ */
298
+ radius: number;
299
+ /**
300
+ * The strength of the updraft.
301
+ */
302
+ strength: number;
303
+ /**
304
+ * The height of the cylinder for the updraft.
305
+ */
306
+ height: number;
307
+ /**
308
+ * The mode for the the updraft.
309
+ */
310
+ updraftMode: PhysicsUpdraftMode;
311
+ }
312
+ /**
313
+ * Options fot the vortex event
314
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
315
+ */
316
+ export declare class PhysicsVortexEventOptions {
317
+ /**
318
+ * The radius of the cylinder for the vortex
319
+ */
320
+ radius: number;
321
+ /**
322
+ * The strength of the vortex.
323
+ */
324
+ strength: number;
325
+ /**
326
+ * The height of the cylinder for the vortex.
327
+ */
328
+ height: number;
329
+ /**
330
+ * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1
331
+ */
332
+ centripetalForceThreshold: number;
333
+ /**
334
+ * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.
335
+ */
336
+ centripetalForceMultiplier: number;
337
+ /**
338
+ * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.
339
+ */
340
+ centrifugalForceMultiplier: number;
341
+ /**
342
+ * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.
343
+ */
344
+ updraftForceMultiplier: number;
345
+ }
346
+ /**
347
+ * The strength of the force in correspondence to the distance of the affected object
348
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
349
+ */
350
+ export declare enum PhysicsRadialImpulseFalloff {
351
+ /** Defines that impulse is constant in strength across it's whole radius */
352
+ Constant = 0,
353
+ /** Defines that impulse gets weaker if it's further from the origin */
354
+ Linear = 1
355
+ }
356
+ /**
357
+ * The strength of the force in correspondence to the distance of the affected object
358
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
359
+ */
360
+ export declare enum PhysicsUpdraftMode {
361
+ /** Defines that the upstream forces will pull towards the top center of the cylinder */
362
+ Center = 0,
363
+ /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */
364
+ Perpendicular = 1
365
+ }
366
+ /**
367
+ * Interface for a physics hit data
368
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
369
+ */
370
+ export interface PhysicsHitData {
371
+ /**
372
+ * The force applied at the contact point
373
+ */
374
+ force: Vector3;
375
+ /**
376
+ * The contact point
377
+ */
378
+ contactPoint: Vector3;
379
+ /**
380
+ * The distance from the origin to the contact point
381
+ */
382
+ distanceFromOrigin: number;
383
+ }
384
+ /**
385
+ * Interface for radial explosion event data
386
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
387
+ */
388
+ export interface PhysicsRadialExplosionEventData {
389
+ /**
390
+ * A sphere used for the radial explosion event
391
+ */
392
+ sphere: Mesh;
393
+ }
394
+ /**
395
+ * Interface for gravitational field event data
396
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
397
+ */
398
+ export interface PhysicsGravitationalFieldEventData {
399
+ /**
400
+ * A sphere mesh used for the gravitational field event
401
+ */
402
+ sphere: Mesh;
403
+ }
404
+ /**
405
+ * Interface for updraft event data
406
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
407
+ */
408
+ export interface PhysicsUpdraftEventData {
409
+ /**
410
+ * A cylinder used for the updraft event
411
+ */
412
+ cylinder: Mesh;
413
+ }
414
+ /**
415
+ * Interface for vortex event data
416
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
417
+ */
418
+ export interface PhysicsVortexEventData {
419
+ /**
420
+ * A cylinder used for the vortex event
421
+ */
422
+ cylinder: Mesh;
423
+ }
424
+ /**
425
+ * Interface for an affected physics impostor
426
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
427
+ */
428
+ export interface PhysicsAffectedImpostorWithData {
429
+ /**
430
+ * The impostor affected by the effect
431
+ */
432
+ impostor: PhysicsImpostor;
433
+ /**
434
+ * The data about the hit/force from the explosion
435
+ */
436
+ hitData: PhysicsHitData;
437
+ }
438
+ /**
439
+ * Interface for an affected physics body
440
+ * @see
441
+ */
442
+ export interface PhysicsAffectedBodyWithData {
443
+ /**
444
+ * The impostor affected by the effect
445
+ */
446
+ body: PhysicsBody;
447
+ /**
448
+ * The data about the hit/force from the explosion
449
+ */
450
+ hitData: PhysicsHitData;
451
+ }
452
+ export {};