@babylonjs/core 7.38.0 → 7.39.1

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 (61) hide show
  1. package/Cameras/targetCamera.js +6 -0
  2. package/Cameras/targetCamera.js.map +1 -1
  3. package/Engines/abstractEngine.js +2 -2
  4. package/Engines/abstractEngine.js.map +1 -1
  5. package/Lights/spotLight.d.ts +7 -0
  6. package/Lights/spotLight.js +27 -0
  7. package/Lights/spotLight.js.map +1 -1
  8. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  9. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  10. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
  11. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  12. package/Materials/Textures/Loaders/exrTextureLoader.d.ts +1 -0
  13. package/Materials/Textures/Loaders/exrTextureLoader.js +1 -0
  14. package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
  15. package/Materials/Textures/Loaders/hdrTextureLoader.d.ts +1 -0
  16. package/Materials/Textures/Loaders/hdrTextureLoader.js +2 -1
  17. package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
  18. package/Materials/Textures/Loaders/iesTextureLoader.js +1 -1
  19. package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -1
  20. package/Materials/material.d.ts +1 -4
  21. package/Materials/material.js +26 -23
  22. package/Materials/material.js.map +1 -1
  23. package/Materials/materialHelper.functions.d.ts +2 -1
  24. package/Materials/materialHelper.functions.js +6 -2
  25. package/Materials/materialHelper.functions.js.map +1 -1
  26. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +5 -3
  27. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +13 -14
  28. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  29. package/Meshes/abstractMesh.js +7 -0
  30. package/Meshes/abstractMesh.js.map +1 -1
  31. package/Physics/v2/characterController.d.ts +327 -0
  32. package/Physics/v2/characterController.js +1236 -0
  33. package/Physics/v2/characterController.js.map +1 -0
  34. package/Physics/v2/index.d.ts +1 -0
  35. package/Physics/v2/index.js +1 -0
  36. package/Physics/v2/index.js.map +1 -1
  37. package/Rendering/objectRenderer.js +8 -0
  38. package/Rendering/objectRenderer.js.map +1 -1
  39. package/Shaders/ShadersInclude/lightFragment.js +28 -4
  40. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  41. package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
  42. package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
  43. package/Shaders/ShadersInclude/lightUboDeclaration.js +3 -0
  44. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  45. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +20 -3
  46. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  47. package/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js +2 -0
  48. package/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -1
  49. package/ShadersWGSL/ShadersInclude/fogVertex.js +4 -0
  50. package/ShadersWGSL/ShadersInclude/fogVertex.js.map +1 -1
  51. package/ShadersWGSL/ShadersInclude/lightFragment.js +28 -4
  52. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  53. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +3 -0
  54. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  55. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +16 -3
  56. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  57. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js +2 -0
  58. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -1
  59. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
  60. package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1,327 @@
1
+ import { Vector3, Matrix } from "../../Maths/math.vector";
2
+ import type { Scene } from "../../scene";
3
+ import type { DeepImmutableObject } from "../../types";
4
+ import type { PhysicsBody } from "./physicsBody";
5
+ import { type PhysicsShape } from "./physicsShape";
6
+ /**
7
+ * Shape properties for the character controller
8
+ */
9
+ export interface CharacterShapeOptions {
10
+ /**
11
+ * optional shape used for collision detection
12
+ */
13
+ shape?: PhysicsShape;
14
+ /**
15
+ * capsule height for the capsule shape if no shape is provided
16
+ */
17
+ capsuleHeight?: number;
18
+ /**
19
+ * capsule radius for the capsule shape if no shape is provided
20
+ */
21
+ capsuleRadius?: number;
22
+ }
23
+ /**
24
+ * State of the character on the surface
25
+ */
26
+ export declare enum CharacterSupportedState {
27
+ UNSUPPORTED = 0,
28
+ SLIDING = 1,
29
+ SUPPORTED = 2
30
+ }
31
+ /**
32
+ * Surface information computed by checkSupport method
33
+ */
34
+ export interface CharacterSurfaceInfo {
35
+ /**
36
+ * Indicates whether the surface is dynamic.
37
+ * A dynamic surface is one that can change its properties over time,
38
+ * such as moving platforms or surfaces that can be affected by external forces.
39
+ */
40
+ isSurfaceDynamic: boolean;
41
+ /**
42
+ * The supported state of the character on the surface.
43
+ */
44
+ supportedState: CharacterSupportedState;
45
+ /**
46
+ * The average normal vector of the surface.
47
+ * This vector is perpendicular to the surface and points outwards.
48
+ */
49
+ averageSurfaceNormal: Vector3;
50
+ /**
51
+ * The average velocity of the surface.
52
+ * This vector represents the speed and direction in which the surface is moving.
53
+ */
54
+ averageSurfaceVelocity: Vector3;
55
+ /**
56
+ * The average angular velocity of the surface.
57
+ */
58
+ averageAngularSurfaceVelocity: Vector3;
59
+ }
60
+ /** @internal */
61
+ interface Contact {
62
+ /** @internal */
63
+ position: Vector3;
64
+ /** @internal */
65
+ normal: Vector3;
66
+ /** @internal */
67
+ distance: number;
68
+ /** @internal */
69
+ fraction: number;
70
+ /** @internal */
71
+ bodyB: {
72
+ body: PhysicsBody;
73
+ index: number;
74
+ };
75
+ /** @internal */
76
+ allowedPenetration: number;
77
+ }
78
+ /** @internal */
79
+ interface SurfaceConstraintInfo {
80
+ /** @internal */
81
+ planeNormal: Vector3;
82
+ /** @internal */
83
+ planeDistance: number;
84
+ /** @internal */
85
+ velocity: Vector3;
86
+ /** @internal */
87
+ angularVelocity: Vector3;
88
+ /** @internal */
89
+ staticFriction: number;
90
+ /** @internal */
91
+ extraUpStaticFriction: number;
92
+ /** @internal */
93
+ extraDownStaticFriction: number;
94
+ /** @internal */
95
+ dynamicFriction: number;
96
+ /** @internal */
97
+ priority: number;
98
+ }
99
+ /** @internal */
100
+ declare enum SurfaceConstraintInteractionStatus {
101
+ OK = 0,
102
+ FAILURE_3D = 1,
103
+ FAILURE_2D = 2
104
+ }
105
+ /** @internal */
106
+ interface SurfaceConstraintInteraction {
107
+ /** @internal */
108
+ touched: boolean;
109
+ /** @internal */
110
+ stopped: boolean;
111
+ /** @internal */
112
+ surfaceTime: number;
113
+ /** @internal */
114
+ penaltyDistance: number;
115
+ /** @internal */
116
+ status: SurfaceConstraintInteractionStatus;
117
+ }
118
+ /** @internal */
119
+ declare class SimplexSolverOutput {
120
+ /** @internal */
121
+ position: Vector3;
122
+ /** @internal */
123
+ velocity: Vector3;
124
+ /** @internal */
125
+ deltaTime: number;
126
+ /** @internal */
127
+ planeInteractions: SurfaceConstraintInteraction[];
128
+ }
129
+ /** @internal */
130
+ declare class SimplexSolverActivePlanes {
131
+ /** @internal */
132
+ index: number;
133
+ /** @internal */
134
+ constraint: SurfaceConstraintInfo;
135
+ /** @internal */
136
+ interaction: SurfaceConstraintInteraction;
137
+ /** @internal */
138
+ copyFrom(other: SimplexSolverActivePlanes): void;
139
+ }
140
+ /** @internal */
141
+ declare class SimplexSolverInfo {
142
+ /** @internal */
143
+ supportPlanes: Array<SimplexSolverActivePlanes>;
144
+ /** @internal */
145
+ numSupportPlanes: number;
146
+ /** @internal */
147
+ currentTime: number;
148
+ /** @internal */
149
+ inputConstraints: SurfaceConstraintInfo[];
150
+ /** @internal */
151
+ outputInteractions: SurfaceConstraintInteraction[];
152
+ /** @internal */
153
+ getOutput(constraint: SurfaceConstraintInfo): SurfaceConstraintInteraction;
154
+ }
155
+ /**
156
+ * Character controller using physics
157
+ */
158
+ export declare class PhysicsCharacterController {
159
+ private _position;
160
+ private _orientation;
161
+ private _velocity;
162
+ private _lastVelocity;
163
+ private _shape;
164
+ private _manifold;
165
+ private _lastDisplacement;
166
+ private _contactAngleSensitivity;
167
+ private _lastInvDeltaTime;
168
+ private _scene;
169
+ private _tmpMatrix;
170
+ private _tmpVecs;
171
+ /**
172
+ * minimum distance to make contact
173
+ * default 0.05
174
+ */
175
+ keepDistance: number;
176
+ /**
177
+ * maximum distance to keep contact
178
+ * default 0.1
179
+ */
180
+ keepContactTolerance: number;
181
+ /**
182
+ * maximum number of raycast per integration starp
183
+ * default 10
184
+ */
185
+ maxCastIterations: number;
186
+ /**
187
+ * speed when recovery from penetration
188
+ * default 1.0
189
+ */
190
+ penetrationRecoverySpeed: number;
191
+ /**
192
+ * friction with static surfaces
193
+ * default 0
194
+ */
195
+ staticFriction: number;
196
+ /**
197
+ * friction with dynamic surfaces
198
+ * default 1
199
+ */
200
+ dynamicFriction: number;
201
+ /**
202
+ * cosine value of slop angle that can be climbed
203
+ * computed as `Math.cos(Math.PI * (angleInDegree / 180.0));`
204
+ * default 0.5 (value for a 60deg angle)
205
+ */
206
+ maxSlopeCosine: number;
207
+ /**
208
+ * character maximum speed
209
+ * default 10
210
+ */
211
+ maxCharacterSpeedForSolver: number;
212
+ /**
213
+ * up vector
214
+ */
215
+ up: Vector3;
216
+ /**
217
+ * Strength when pushing other bodies
218
+ * default 1e38
219
+ */
220
+ characterStrength: number;
221
+ /**
222
+ * character mass
223
+ * default 0
224
+ */
225
+ characterMass: number;
226
+ private _startCollector;
227
+ private _castCollector;
228
+ /**
229
+ * instanciate a new characterController
230
+ * @param position Initial position
231
+ * @param characterShapeOptions character physics shape options
232
+ * @param scene Scene
233
+ */
234
+ constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene);
235
+ /**
236
+ * Character position
237
+ * @returns Character position
238
+ */
239
+ getPosition(): Vector3;
240
+ /**
241
+ * Character velocity
242
+ * @returns Character velocity vector
243
+ */
244
+ getVelocity(): Vector3;
245
+ /**
246
+ * Set velocity vector
247
+ * @param velocity vector
248
+ */
249
+ setVelocity(velocity: Vector3): void;
250
+ protected _validateManifold(): void;
251
+ private _getPointVelocityToRef;
252
+ protected _compareContacts(contactA: Contact, contactB: Contact): number;
253
+ protected _findContact(referenceContact: Contact, contactList: Contact[], threshold: number): number;
254
+ _updateManifold(startCollector: any, castCollector: any, castPath: Vector3): number;
255
+ protected _createSurfaceConstraint(contact: Contact, timeTravelled: number): SurfaceConstraintInfo;
256
+ protected _addMaxSlopePlane(maxSlopeCos: number, up: Vector3, index: number, constraints: SurfaceConstraintInfo[], allowedPenetration: number): boolean;
257
+ protected _resolveConstraintPenetration(constraint: SurfaceConstraintInfo, penetrationRecoverySpeed: number): void;
258
+ protected _createConstraintsFromManifold(dt: number, timeTravelled: number): SurfaceConstraintInfo[];
259
+ protected _simplexSolverSortInfo(info: SimplexSolverInfo): void;
260
+ protected _simplexSolverSolve1d(info: SimplexSolverInfo, sci: SurfaceConstraintInfo, velocityIn: Vector3, velocityOut: Vector3): void;
261
+ protected _simplexSolverSolveTest1d(sci: SurfaceConstraintInfo, velocityIn: Vector3): boolean;
262
+ protected _simplexSolverSolve2d(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, sci0: SurfaceConstraintInfo, sci1: SurfaceConstraintInfo, velocityIn: Vector3, velocityOut: Vector3): void;
263
+ protected _simplexSolverSolve3d(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, sci0: SurfaceConstraintInfo, sci1: SurfaceConstraintInfo, sci2: SurfaceConstraintInfo, allowResort: boolean, velocityIn: Vector3, velocityOut: Vector3): void;
264
+ protected _simplexSolverExamineActivePlanes(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, velocityIn: Vector3, velocityOut: Vector3): void;
265
+ _simplexSolverSolve(constraints: SurfaceConstraintInfo[], velocity: Vector3, deltaTime: number, minDeltaTime: number, up: Vector3, maxSurfaceVelocity: Vector3): SimplexSolverOutput;
266
+ /**
267
+ * Compute a CharacterSurfaceInfo from current state and a direction
268
+ * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
269
+ * @param direction direction to check, usually gravity direction
270
+ * @returns a CharacterSurfaceInfo object
271
+ */
272
+ checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo;
273
+ /**
274
+ * Compute a CharacterSurfaceInfo from current state and a direction
275
+ * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
276
+ * @param direction direction to check, usually gravity direction
277
+ * @param surfaceInfo output for surface info
278
+ */
279
+ checkSupportToRef(deltaTime: number, direction: Vector3, surfaceInfo: CharacterSurfaceInfo): void;
280
+ protected _castWithCollectors(startPos: Vector3, endPos: Vector3, castCollector: any, startCollector?: any): void;
281
+ protected _resolveContacts(deltaTime: number, gravity: Vector3): void;
282
+ protected _getInverseInertiaWorld(body: {
283
+ body: PhysicsBody;
284
+ index: number;
285
+ }): DeepImmutableObject<Matrix>;
286
+ protected _getComWorldToRef(body: {
287
+ body: PhysicsBody;
288
+ index: number;
289
+ }, result: Vector3): void;
290
+ protected _getInvMass(body: {
291
+ body: PhysicsBody;
292
+ index: number;
293
+ }): number;
294
+ /**
295
+ * Update internal state. Must be called once per frame
296
+ * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
297
+ * @param surfaceInfo surface information returned by checkSupport
298
+ * @param gravity gravity applied to the character. Can be different that world gravity
299
+ */
300
+ integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3): void;
301
+ /**
302
+ * Helper function to calculate velocity based on surface informations and current velocity state and target
303
+ * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
304
+ * @param forwardWorld character forward in world coordinates
305
+ * @param surfaceNormal surface normal direction
306
+ * @param currentVelocity current velocity
307
+ * @param surfaceVelocity velocity induced by the surface
308
+ * @param desiredVelocity desired character velocity
309
+ * @param upWorld up vector in world space
310
+ * @param result resulting velocity vector
311
+ * @returns boolean true if result has been computed
312
+ */
313
+ calculateMovementToRef(deltaTime: number, forwardWorld: Vector3, surfaceNormal: Vector3, currentVelocity: Vector3, surfaceVelocity: Vector3, desiredVelocity: Vector3, upWorld: Vector3, result: Vector3): boolean;
314
+ /**
315
+ * Helper function to calculate velocity based on surface informations and current velocity state and target
316
+ * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
317
+ * @param forwardWorld character forward in world coordinates
318
+ * @param surfaceNormal surface normal direction
319
+ * @param currentVelocity current velocity
320
+ * @param surfaceVelocity velocity induced by the surface
321
+ * @param desiredVelocity desired character velocity
322
+ * @param upWorld up vector in world space
323
+ * @returns a new velocity vector
324
+ */
325
+ calculateMovement(deltaTime: number, forwardWorld: Vector3, surfaceNormal: Vector3, currentVelocity: Vector3, surfaceVelocity: Vector3, desiredVelocity: Vector3, upWorld: Vector3): Vector3;
326
+ }
327
+ export {};