@babylonjs/core 7.21.0 → 7.21.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 (200) hide show
  1. package/Animations/easing.d.ts +20 -20
  2. package/Animations/easing.js +10 -10
  3. package/Animations/easing.js.map +1 -1
  4. package/Buffers/buffer.nonFloatVertexBuffers.js +2 -1
  5. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
  6. package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
  7. package/Cameras/VR/vrExperienceHelper.js +1 -1
  8. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  9. package/Collisions/gpuPicker.d.ts +9 -4
  10. package/Collisions/gpuPicker.js +64 -44
  11. package/Collisions/gpuPicker.js.map +1 -1
  12. package/Collisions/index.d.ts +4 -0
  13. package/Collisions/index.js +4 -0
  14. package/Collisions/index.js.map +1 -1
  15. package/Culling/Helper/computeShaderBoundingHelper.js +0 -3
  16. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +0 -1
  18. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +0 -1
  19. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  20. package/Engines/abstractEngine.d.ts +2 -1
  21. package/Engines/abstractEngine.js +2 -2
  22. package/Engines/abstractEngine.js.map +1 -1
  23. package/Engines/nativeEngine.js +0 -3
  24. package/Engines/nativeEngine.js.map +1 -1
  25. package/Engines/thinEngine.d.ts +2 -1
  26. package/Engines/thinEngine.js +3 -2
  27. package/Engines/thinEngine.js.map +1 -1
  28. package/Engines/webgpuEngine.d.ts +3 -1
  29. package/Engines/webgpuEngine.js +6 -3
  30. package/Engines/webgpuEngine.js.map +1 -1
  31. package/Gizmos/gizmo.d.ts +2 -2
  32. package/Gizmos/gizmo.js +1 -1
  33. package/Gizmos/gizmo.js.map +1 -1
  34. package/Layers/effectLayer.d.ts +1 -1
  35. package/Layers/effectLayer.js +18 -16
  36. package/Layers/effectLayer.js.map +1 -1
  37. package/Layers/glowLayer.d.ts +1 -1
  38. package/Layers/glowLayer.js +3 -5
  39. package/Layers/glowLayer.js.map +1 -1
  40. package/Layers/highlightLayer.d.ts +1 -1
  41. package/Layers/highlightLayer.js +7 -9
  42. package/Layers/highlightLayer.js.map +1 -1
  43. package/Layers/layer.d.ts +0 -1
  44. package/Layers/layer.js +15 -17
  45. package/Layers/layer.js.map +1 -1
  46. package/Lights/Shadows/cascadedShadowGenerator.d.ts +0 -3
  47. package/Lights/Shadows/cascadedShadowGenerator.js +0 -3
  48. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  49. package/Materials/Background/backgroundMaterial.d.ts +0 -1
  50. package/Materials/Background/backgroundMaterial.js +20 -20
  51. package/Materials/Background/backgroundMaterial.js.map +1 -1
  52. package/Materials/PBR/pbrBaseMaterial.d.ts +0 -1
  53. package/Materials/PBR/pbrBaseMaterial.js +34 -39
  54. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  55. package/Materials/effect.d.ts +7 -2
  56. package/Materials/effect.js +7 -3
  57. package/Materials/effect.js.map +1 -1
  58. package/Materials/shaderMaterial.d.ts +4 -0
  59. package/Materials/shaderMaterial.js +1 -0
  60. package/Materials/shaderMaterial.js.map +1 -1
  61. package/Materials/standardMaterial.d.ts +0 -1
  62. package/Materials/standardMaterial.js +20 -20
  63. package/Materials/standardMaterial.js.map +1 -1
  64. package/Maths/math.isovector.js +6 -6
  65. package/Maths/math.isovector.js.map +1 -1
  66. package/Meshes/Builders/geodesicBuilder.js +2 -2
  67. package/Meshes/Builders/geodesicBuilder.js.map +1 -1
  68. package/Meshes/Builders/goldbergBuilder.js +2 -2
  69. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  70. package/Meshes/linesMesh.d.ts +0 -2
  71. package/Meshes/linesMesh.js +16 -20
  72. package/Meshes/linesMesh.js.map +1 -1
  73. package/Misc/assetsManager.d.ts +16 -16
  74. package/Misc/assetsManager.js +8 -8
  75. package/Misc/assetsManager.js.map +1 -1
  76. package/Misc/copyTextureToTexture.d.ts +9 -1
  77. package/Misc/copyTextureToTexture.js +23 -2
  78. package/Misc/copyTextureToTexture.js.map +1 -1
  79. package/Misc/environmentTextureTools.d.ts +0 -2
  80. package/Misc/environmentTextureTools.js +0 -2
  81. package/Misc/environmentTextureTools.js.map +1 -1
  82. package/Misc/index.d.ts +2 -0
  83. package/Misc/index.js +3 -0
  84. package/Misc/index.js.map +1 -1
  85. package/Misc/sceneOptimizer.d.ts +16 -16
  86. package/Misc/sceneOptimizer.js +8 -8
  87. package/Misc/sceneOptimizer.js.map +1 -1
  88. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +4 -4
  89. package/Particles/EmitterTypes/coneParticleEmitter.js +2 -2
  90. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  91. package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +4 -4
  92. package/Particles/EmitterTypes/cylinderParticleEmitter.js +2 -2
  93. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  94. package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +4 -4
  95. package/Particles/EmitterTypes/sphereParticleEmitter.js +2 -2
  96. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  97. package/Particles/particleSystemComponent.d.ts +0 -1
  98. package/Particles/particleSystemComponent.js +8 -2
  99. package/Particles/particleSystemComponent.js.map +1 -1
  100. package/Particles/thinParticleSystem.d.ts +0 -2
  101. package/Particles/thinParticleSystem.js +0 -2
  102. package/Particles/thinParticleSystem.js.map +1 -1
  103. package/Physics/v1/physicsJoint.js +0 -3
  104. package/Physics/v1/physicsJoint.js.map +1 -1
  105. package/Physics/v2/physicsConstraint.d.ts +14 -20
  106. package/Physics/v2/physicsConstraint.js +14 -20
  107. package/Physics/v2/physicsConstraint.js.map +1 -1
  108. package/PostProcesses/anaglyphPostProcess.d.ts +1 -2
  109. package/PostProcesses/anaglyphPostProcess.js +4 -5
  110. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  111. package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
  112. package/PostProcesses/blackAndWhitePostProcess.js +4 -4
  113. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  114. package/PostProcesses/bloomMergePostProcess.d.ts +1 -1
  115. package/PostProcesses/bloomMergePostProcess.js +4 -4
  116. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  117. package/PostProcesses/blurPostProcess.d.ts +1 -3
  118. package/PostProcesses/blurPostProcess.js +4 -6
  119. package/PostProcesses/blurPostProcess.js.map +1 -1
  120. package/PostProcesses/chromaticAberrationPostProcess.d.ts +1 -1
  121. package/PostProcesses/chromaticAberrationPostProcess.js +4 -4
  122. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  123. package/PostProcesses/circleOfConfusionPostProcess.d.ts +1 -1
  124. package/PostProcesses/circleOfConfusionPostProcess.js +4 -4
  125. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  126. package/PostProcesses/colorCorrectionPostProcess.d.ts +1 -1
  127. package/PostProcesses/colorCorrectionPostProcess.js +4 -4
  128. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  129. package/PostProcesses/convolutionPostProcess.d.ts +1 -1
  130. package/PostProcesses/convolutionPostProcess.js +4 -4
  131. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  132. package/PostProcesses/depthOfFieldMergePostProcess.d.ts +1 -1
  133. package/PostProcesses/depthOfFieldMergePostProcess.js +4 -4
  134. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  135. package/PostProcesses/displayPassPostProcess.d.ts +1 -1
  136. package/PostProcesses/displayPassPostProcess.js +10 -1
  137. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  138. package/PostProcesses/extractHighlightsPostProcess.d.ts +1 -1
  139. package/PostProcesses/extractHighlightsPostProcess.js +4 -4
  140. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  141. package/PostProcesses/filterPostProcess.d.ts +1 -1
  142. package/PostProcesses/filterPostProcess.js +10 -1
  143. package/PostProcesses/filterPostProcess.js.map +1 -1
  144. package/PostProcesses/fxaaPostProcess.d.ts +1 -1
  145. package/PostProcesses/fxaaPostProcess.js +4 -4
  146. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  147. package/PostProcesses/grainPostProcess.d.ts +1 -2
  148. package/PostProcesses/grainPostProcess.js +4 -5
  149. package/PostProcesses/grainPostProcess.js.map +1 -1
  150. package/PostProcesses/highlightsPostProcess.d.ts +1 -1
  151. package/PostProcesses/highlightsPostProcess.js +10 -1
  152. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  153. package/PostProcesses/imageProcessingPostProcess.d.ts +1 -1
  154. package/PostProcesses/imageProcessingPostProcess.js +4 -4
  155. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  156. package/PostProcesses/index.d.ts +8 -0
  157. package/PostProcesses/index.js +12 -0
  158. package/PostProcesses/index.js.map +1 -1
  159. package/PostProcesses/motionBlurPostProcess.d.ts +1 -1
  160. package/PostProcesses/motionBlurPostProcess.js +4 -4
  161. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  162. package/PostProcesses/passPostProcess.d.ts +2 -2
  163. package/PostProcesses/passPostProcess.js +8 -8
  164. package/PostProcesses/passPostProcess.js.map +1 -1
  165. package/PostProcesses/postProcess.d.ts +5 -4
  166. package/PostProcesses/postProcess.js +14 -27
  167. package/PostProcesses/postProcess.js.map +1 -1
  168. package/PostProcesses/sharpenPostProcess.d.ts +1 -1
  169. package/PostProcesses/sharpenPostProcess.js +4 -4
  170. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  171. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  172. package/PostProcesses/tonemapPostProcess.js +10 -1
  173. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  174. package/PostProcesses/vrDistortionCorrectionPostProcess.d.ts +1 -1
  175. package/PostProcesses/vrDistortionCorrectionPostProcess.js +4 -4
  176. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  177. package/ShadersWGSL/copyTextureToTexture.fragment.d.ts +6 -0
  178. package/ShadersWGSL/copyTextureToTexture.fragment.js +21 -0
  179. package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -0
  180. package/ShadersWGSL/displayPass.fragment.d.ts +5 -0
  181. package/ShadersWGSL/displayPass.fragment.js +12 -0
  182. package/ShadersWGSL/displayPass.fragment.js.map +1 -0
  183. package/ShadersWGSL/filter.fragment.d.ts +5 -0
  184. package/ShadersWGSL/filter.fragment.js +12 -0
  185. package/ShadersWGSL/filter.fragment.js.map +1 -0
  186. package/ShadersWGSL/highlights.fragment.d.ts +5 -0
  187. package/ShadersWGSL/highlights.fragment.js +12 -0
  188. package/ShadersWGSL/highlights.fragment.js.map +1 -0
  189. package/ShadersWGSL/picking.fragment.d.ts +5 -0
  190. package/ShadersWGSL/picking.fragment.js +21 -0
  191. package/ShadersWGSL/picking.fragment.js.map +1 -0
  192. package/ShadersWGSL/picking.vertex.d.ts +15 -0
  193. package/ShadersWGSL/picking.vertex.js +43 -0
  194. package/ShadersWGSL/picking.vertex.js.map +1 -0
  195. package/ShadersWGSL/tonemap.fragment.d.ts +5 -0
  196. package/ShadersWGSL/tonemap.fragment.js +29 -0
  197. package/ShadersWGSL/tonemap.fragment.js.map +1 -0
  198. package/XR/features/WebXRControllerPointerSelection.js +1 -1
  199. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  200. package/package.json +1 -1
@@ -32,9 +32,6 @@ export class PhysicsJoint {
32
32
  * Sets the physics joint
33
33
  */
34
34
  set physicsJoint(newJoint) {
35
- if (this._physicsJoint) {
36
- //remove from the world
37
- }
38
35
  this._physicsJoint = newJoint;
39
36
  }
40
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"physicsJoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v1/physicsJoint.ts"],"names":[],"mappings":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E,UAAmB;QAC5D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAC9C;;;OAGG;IACH,YAAY,SAA2B;QACnC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACa,QAAQ,CAAC,WAAoB,EAAE,QAAiB,EAAE,aAAqB,CAAC;QACpF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;OAMG;IACa,QAAQ,CAAC,UAAkB,EAAE,UAAmB,EAAE,aAAqB,CAAC;QACpF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;CACJ","sourcesContent":["import type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\n/**\r\n * Interface for Physics-Joint data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface PhysicsJointData {\r\n //Important for some engines, optional!\r\n /**\r\n * The main pivot of the joint\r\n */\r\n mainPivot?: Vector3;\r\n /**\r\n * The connected pivot of the joint\r\n */\r\n connectedPivot?: Vector3;\r\n /**\r\n * The main axis of the joint\r\n */\r\n mainAxis?: Vector3;\r\n /**\r\n * The connected axis of the joint\r\n */\r\n connectedAxis?: Vector3;\r\n /**\r\n * The collision of the joint\r\n */\r\n collision?: boolean;\r\n /**\r\n * Native Oimo/Cannon/Energy data\r\n */\r\n nativeParams?: any;\r\n}\r\n\r\n/**\r\n * This is a holder class for the physics joint created by the physics plugin\r\n * It holds a set of functions to control the underlying joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsJoint {\r\n private _physicsJoint: any;\r\n protected _physicsPlugin: IPhysicsEnginePlugin;\r\n\r\n /**\r\n * Initializes the physics joint\r\n * @param type The type of the physics joint\r\n * @param jointData The data for the physics joint\r\n */\r\n constructor(\r\n /**\r\n * The type of the physics joint\r\n */\r\n public type: number,\r\n /**\r\n * The data for the physics joint\r\n */\r\n public jointData: PhysicsJointData\r\n ) {\r\n jointData.nativeParams = jointData.nativeParams || {};\r\n }\r\n\r\n /**\r\n * Gets the physics joint\r\n */\r\n public get physicsJoint(): any {\r\n return this._physicsJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics joint\r\n */\r\n public set physicsJoint(newJoint: any) {\r\n if (this._physicsJoint) {\r\n //remove from the world\r\n }\r\n\r\n this._physicsJoint = newJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics plugin\r\n */\r\n public set physicsPlugin(physicsPlugin: IPhysicsEnginePlugin) {\r\n this._physicsPlugin = physicsPlugin;\r\n }\r\n\r\n /**\r\n * Execute a function that is physics-plugin specific.\r\n * @param {Function} func the function that will be executed.\r\n * It accepts two parameters: the physics world and the physics joint\r\n */\r\n public executeNativeFunction(func: (world: any, physicsJoint: any) => void) {\r\n func(this._physicsPlugin.world, this._physicsJoint);\r\n }\r\n\r\n //TODO check if the native joints are the same\r\n\r\n //Joint Types\r\n /**\r\n * Distance-Joint type\r\n */\r\n public static DistanceJoint = 0;\r\n /**\r\n * Hinge-Joint type\r\n */\r\n public static HingeJoint = 1;\r\n /**\r\n * Ball-and-Socket joint type\r\n */\r\n public static BallAndSocketJoint = 2;\r\n /**\r\n * Wheel-Joint type\r\n */\r\n public static WheelJoint = 3;\r\n /**\r\n * Slider-Joint type\r\n */\r\n public static SliderJoint = 4;\r\n //OIMO\r\n /**\r\n * Prismatic-Joint type\r\n */\r\n public static PrismaticJoint = 5;\r\n //\r\n /**\r\n * Universal-Joint type\r\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\r\n */\r\n public static UniversalJoint = 6;\r\n /**\r\n * Hinge-Joint 2 type\r\n */\r\n public static Hinge2Joint = PhysicsJoint.WheelJoint;\r\n //Cannon\r\n /**\r\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\r\n */\r\n public static PointToPointJoint = 8;\r\n //Cannon only at the moment\r\n /**\r\n * Spring-Joint type\r\n */\r\n public static SpringJoint = 9;\r\n /**\r\n * Lock-Joint type\r\n */\r\n public static LockJoint = 10;\r\n}\r\n\r\n/**\r\n * A class representing a physics distance joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class DistanceJoint extends PhysicsJoint {\r\n /**\r\n *\r\n * @param jointData The data for the Distance-Joint\r\n */\r\n constructor(jointData: DistanceJointData) {\r\n super(PhysicsJoint.DistanceJoint, jointData);\r\n }\r\n\r\n /**\r\n * Update the predefined distance.\r\n * @param maxDistance The maximum preferred distance\r\n * @param minDistance The minimum preferred distance\r\n */\r\n public updateDistance(maxDistance: number, minDistance?: number) {\r\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Motor-Enabled Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {\r\n /**\r\n * Initializes the Motor-Enabled Joint\r\n * @param type The type of the joint\r\n * @param jointData The physical joint data for the joint\r\n */\r\n constructor(type: number, jointData: PhysicsJointData) {\r\n super(type, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param force the force to apply\r\n * @param maxForce max force for this motor.\r\n */\r\n public setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a single physics Hinge-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class HingeJoint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge-Joint\r\n * @param jointData The joint data for the Hinge-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.HingeJoint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} force the force to apply\r\n * @param {number} maxForce max force for this motor.\r\n */\r\n public override setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public override setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a dual hinge physics joint (same as wheel joint)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class Hinge2Joint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge2-Joint\r\n * @param jointData The joint data for the Hinge2-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.Hinge2Joint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param targetSpeed the speed the motor is to reach\r\n * @param maxForce max force for this motor.\r\n * @param motorIndex motor's index, 0 or 1.\r\n */\r\n public override setMotor(targetSpeed?: number, maxForce?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\r\n }\r\n\r\n /**\r\n * Set the motor limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit the upper limit\r\n * @param lowerLimit lower limit\r\n * @param motorIndex the motor's index, 0 or 1.\r\n */\r\n public override setLimit(upperLimit: number, lowerLimit?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\r\n }\r\n}\r\n\r\n/**\r\n * Interface for a motor enabled joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IMotorEnabledJoint {\r\n /**\r\n * Physics joint\r\n */\r\n physicsJoint: any;\r\n /**\r\n * Sets the motor of the motor-enabled joint\r\n * @param force The force of the motor\r\n * @param maxForce The maximum force of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setMotor(force?: number, maxForce?: number, motorIndex?: number): void;\r\n /**\r\n * Sets the limit of the motor\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;\r\n}\r\n\r\n/**\r\n * Joint data for a Distance-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface DistanceJointData extends PhysicsJointData {\r\n /**\r\n * Max distance the 2 joint objects can be apart\r\n */\r\n maxDistance: number;\r\n //Oimo - minDistance\r\n //Cannon - maxForce\r\n}\r\n\r\n/**\r\n * Joint data from a spring joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface SpringJointData extends PhysicsJointData {\r\n /**\r\n * Length of the spring\r\n */\r\n length: number;\r\n /**\r\n * Stiffness of the spring\r\n */\r\n stiffness: number;\r\n /**\r\n * Damping of the spring\r\n */\r\n damping: number;\r\n /** this callback will be called when applying the force to the impostors. */\r\n forceApplicationCallback: () => void;\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsJoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v1/physicsJoint.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAIrB;;;;OAIG;IACH;IACI;;OAEG;IACI,IAAY;IACnB;;OAEG;IACI,SAA2B;QAJ3B,SAAI,GAAJ,IAAI,CAAQ;QAIZ,cAAS,GAAT,SAAS,CAAkB;QAElC,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,QAAa;QACjC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAW,aAAa,CAAC,aAAmC;QACxD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAAC,IAA6C;QACtE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC;;AAED,8CAA8C;AAE9C,aAAa;AACb;;GAEG;AACW,0BAAa,GAAG,CAAC,CAAC;AAChC;;GAEG;AACW,uBAAU,GAAG,CAAC,CAAC;AAC7B;;GAEG;AACW,+BAAkB,GAAG,CAAC,CAAC;AACrC;;GAEG;AACW,uBAAU,GAAG,CAAC,CAAC;AAC7B;;GAEG;AACW,wBAAW,GAAG,CAAC,CAAC;AAC9B,MAAM;AACN;;GAEG;AACW,2BAAc,GAAG,CAAC,CAAC;AACjC,EAAE;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G;IACa,QAAQ,CAAC,KAAc,EAAE,QAAiB;QACtD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACa,QAAQ,CAAC,UAAkB,EAAE,UAAmB;QAC5D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAC9C;;;OAGG;IACH,YAAY,SAA2B;QACnC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACa,QAAQ,CAAC,WAAoB,EAAE,QAAiB,EAAE,aAAqB,CAAC;QACpF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;OAMG;IACa,QAAQ,CAAC,UAAkB,EAAE,UAAmB,EAAE,aAAqB,CAAC;QACpF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;CACJ","sourcesContent":["import type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\n/**\r\n * Interface for Physics-Joint data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface PhysicsJointData {\r\n //Important for some engines, optional!\r\n /**\r\n * The main pivot of the joint\r\n */\r\n mainPivot?: Vector3;\r\n /**\r\n * The connected pivot of the joint\r\n */\r\n connectedPivot?: Vector3;\r\n /**\r\n * The main axis of the joint\r\n */\r\n mainAxis?: Vector3;\r\n /**\r\n * The connected axis of the joint\r\n */\r\n connectedAxis?: Vector3;\r\n /**\r\n * The collision of the joint\r\n */\r\n collision?: boolean;\r\n /**\r\n * Native Oimo/Cannon/Energy data\r\n */\r\n nativeParams?: any;\r\n}\r\n\r\n/**\r\n * This is a holder class for the physics joint created by the physics plugin\r\n * It holds a set of functions to control the underlying joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsJoint {\r\n private _physicsJoint: any;\r\n protected _physicsPlugin: IPhysicsEnginePlugin;\r\n\r\n /**\r\n * Initializes the physics joint\r\n * @param type The type of the physics joint\r\n * @param jointData The data for the physics joint\r\n */\r\n constructor(\r\n /**\r\n * The type of the physics joint\r\n */\r\n public type: number,\r\n /**\r\n * The data for the physics joint\r\n */\r\n public jointData: PhysicsJointData\r\n ) {\r\n jointData.nativeParams = jointData.nativeParams || {};\r\n }\r\n\r\n /**\r\n * Gets the physics joint\r\n */\r\n public get physicsJoint(): any {\r\n return this._physicsJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics joint\r\n */\r\n public set physicsJoint(newJoint: any) {\r\n this._physicsJoint = newJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics plugin\r\n */\r\n public set physicsPlugin(physicsPlugin: IPhysicsEnginePlugin) {\r\n this._physicsPlugin = physicsPlugin;\r\n }\r\n\r\n /**\r\n * Execute a function that is physics-plugin specific.\r\n * @param {Function} func the function that will be executed.\r\n * It accepts two parameters: the physics world and the physics joint\r\n */\r\n public executeNativeFunction(func: (world: any, physicsJoint: any) => void) {\r\n func(this._physicsPlugin.world, this._physicsJoint);\r\n }\r\n\r\n //TODO check if the native joints are the same\r\n\r\n //Joint Types\r\n /**\r\n * Distance-Joint type\r\n */\r\n public static DistanceJoint = 0;\r\n /**\r\n * Hinge-Joint type\r\n */\r\n public static HingeJoint = 1;\r\n /**\r\n * Ball-and-Socket joint type\r\n */\r\n public static BallAndSocketJoint = 2;\r\n /**\r\n * Wheel-Joint type\r\n */\r\n public static WheelJoint = 3;\r\n /**\r\n * Slider-Joint type\r\n */\r\n public static SliderJoint = 4;\r\n //OIMO\r\n /**\r\n * Prismatic-Joint type\r\n */\r\n public static PrismaticJoint = 5;\r\n //\r\n /**\r\n * Universal-Joint type\r\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\r\n */\r\n public static UniversalJoint = 6;\r\n /**\r\n * Hinge-Joint 2 type\r\n */\r\n public static Hinge2Joint = PhysicsJoint.WheelJoint;\r\n //Cannon\r\n /**\r\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\r\n */\r\n public static PointToPointJoint = 8;\r\n //Cannon only at the moment\r\n /**\r\n * Spring-Joint type\r\n */\r\n public static SpringJoint = 9;\r\n /**\r\n * Lock-Joint type\r\n */\r\n public static LockJoint = 10;\r\n}\r\n\r\n/**\r\n * A class representing a physics distance joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class DistanceJoint extends PhysicsJoint {\r\n /**\r\n *\r\n * @param jointData The data for the Distance-Joint\r\n */\r\n constructor(jointData: DistanceJointData) {\r\n super(PhysicsJoint.DistanceJoint, jointData);\r\n }\r\n\r\n /**\r\n * Update the predefined distance.\r\n * @param maxDistance The maximum preferred distance\r\n * @param minDistance The minimum preferred distance\r\n */\r\n public updateDistance(maxDistance: number, minDistance?: number) {\r\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Motor-Enabled Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {\r\n /**\r\n * Initializes the Motor-Enabled Joint\r\n * @param type The type of the joint\r\n * @param jointData The physical joint data for the joint\r\n */\r\n constructor(type: number, jointData: PhysicsJointData) {\r\n super(type, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param force the force to apply\r\n * @param maxForce max force for this motor.\r\n */\r\n public setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a single physics Hinge-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class HingeJoint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge-Joint\r\n * @param jointData The joint data for the Hinge-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.HingeJoint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} force the force to apply\r\n * @param {number} maxForce max force for this motor.\r\n */\r\n public override setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public override setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a dual hinge physics joint (same as wheel joint)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class Hinge2Joint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge2-Joint\r\n * @param jointData The joint data for the Hinge2-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.Hinge2Joint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param targetSpeed the speed the motor is to reach\r\n * @param maxForce max force for this motor.\r\n * @param motorIndex motor's index, 0 or 1.\r\n */\r\n public override setMotor(targetSpeed?: number, maxForce?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\r\n }\r\n\r\n /**\r\n * Set the motor limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit the upper limit\r\n * @param lowerLimit lower limit\r\n * @param motorIndex the motor's index, 0 or 1.\r\n */\r\n public override setLimit(upperLimit: number, lowerLimit?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\r\n }\r\n}\r\n\r\n/**\r\n * Interface for a motor enabled joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IMotorEnabledJoint {\r\n /**\r\n * Physics joint\r\n */\r\n physicsJoint: any;\r\n /**\r\n * Sets the motor of the motor-enabled joint\r\n * @param force The force of the motor\r\n * @param maxForce The maximum force of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setMotor(force?: number, maxForce?: number, motorIndex?: number): void;\r\n /**\r\n * Sets the limit of the motor\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;\r\n}\r\n\r\n/**\r\n * Joint data for a Distance-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface DistanceJointData extends PhysicsJointData {\r\n /**\r\n * Max distance the 2 joint objects can be apart\r\n */\r\n maxDistance: number;\r\n //Oimo - minDistance\r\n //Cannon - maxForce\r\n}\r\n\r\n/**\r\n * Joint data from a spring joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface SpringJointData extends PhysicsJointData {\r\n /**\r\n * Length of the spring\r\n */\r\n length: number;\r\n /**\r\n * Stiffness of the spring\r\n */\r\n stiffness: number;\r\n /**\r\n * Damping of the spring\r\n */\r\n damping: number;\r\n /** this callback will be called when applying the force to the impostors. */\r\n forceApplicationCallback: () => void;\r\n}\r\n"]}
@@ -233,29 +233,27 @@ export declare class Physics6DoFConstraint extends PhysicsConstraint {
233
233
  }
234
234
  /**
235
235
  * Represents a Ball and Socket Constraint, used to simulate a joint
236
- *
236
+ * This class is useful for simulating a joint between two bodies in a physics engine.
237
+ * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.
237
238
  * @param pivotA - The first pivot, defined locally in the first body frame
238
239
  * @param pivotB - The second pivot, defined locally in the second body frame
239
240
  * @param axisA - The axis of the first body
240
241
  * @param axisB - The axis of the second body
241
242
  * @param scene - The scene the constraint is applied to
242
243
  * @returns The Ball and Socket Constraint
243
- *
244
- * This class is useful for simulating a joint between two bodies in a physics engine.
245
- * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.
246
244
  */
247
245
  export declare class BallAndSocketConstraint extends PhysicsConstraint {
248
246
  constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
249
247
  }
250
248
  /**
251
249
  * Creates a distance constraint.
252
- * @param maxDistance distance between bodies
253
- * @param scene The scene the constraint belongs to
254
- * @returns DistanceConstraint
255
250
  *
256
251
  * This code is useful for creating a distance constraint in a physics engine.
257
252
  * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.
258
253
  * The scene is used to add the constraint to the physics engine.
254
+ * @param maxDistance distance between bodies
255
+ * @param scene The scene the constraint belongs to
256
+ * @returns DistanceConstraint
259
257
  */
260
258
  export declare class DistanceConstraint extends PhysicsConstraint {
261
259
  constructor(maxDistance: number, scene: Scene);
@@ -263,13 +261,12 @@ export declare class DistanceConstraint extends PhysicsConstraint {
263
261
  /**
264
262
  * Creates a HingeConstraint, which is a type of PhysicsConstraint.
265
263
  *
264
+ * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.
265
+ * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.
266
266
  * @param pivotA - The first pivot point, in world space.
267
267
  * @param pivotB - The second pivot point, in world space.
268
268
  * @param scene - The scene the constraint is used in.
269
269
  * @returns The new HingeConstraint.
270
- *
271
- * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.
272
- * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.
273
270
  */
274
271
  export declare class HingeConstraint extends PhysicsConstraint {
275
272
  constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
@@ -277,16 +274,15 @@ export declare class HingeConstraint extends PhysicsConstraint {
277
274
  /**
278
275
  * Creates a SliderConstraint, which is a type of PhysicsConstraint.
279
276
  *
277
+ * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.
278
+ * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.
279
+ * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.
280
280
  * @param pivotA - The first pivot of the constraint, in world space.
281
281
  * @param pivotB - The second pivot of the constraint, in world space.
282
282
  * @param axisA - The first axis of the constraint, in world space.
283
283
  * @param axisB - The second axis of the constraint, in world space.
284
284
  * @param scene - The scene the constraint belongs to.
285
285
  * @returns The created SliderConstraint.
286
- *
287
- * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.
288
- * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.
289
- * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.
290
286
  */
291
287
  export declare class SliderConstraint extends PhysicsConstraint {
292
288
  constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
@@ -294,15 +290,14 @@ export declare class SliderConstraint extends PhysicsConstraint {
294
290
  /**
295
291
  * Creates a LockConstraint, which is a type of PhysicsConstraint.
296
292
  *
293
+ * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.
294
+ * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.
297
295
  * @param pivotA - The first pivot of the constraint in local space.
298
296
  * @param pivotB - The second pivot of the constraint in local space.
299
297
  * @param axisA - The first axis of the constraint in local space.
300
298
  * @param axisB - The second axis of the constraint in local space.
301
299
  * @param scene - The scene the constraint belongs to.
302
300
  * @returns The created LockConstraint.
303
- *
304
- * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.
305
- * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.
306
301
  */
307
302
  export declare class LockConstraint extends PhysicsConstraint {
308
303
  constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
@@ -310,15 +305,14 @@ export declare class LockConstraint extends PhysicsConstraint {
310
305
  /**
311
306
  * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.
312
307
  *
308
+ * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.
309
+ * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.
313
310
  * @param pivotA - The first pivot of the constraint in local space.
314
311
  * @param pivotB - The second pivot of the constraint in local space.
315
312
  * @param axisA - The first axis of the constraint in local space.
316
313
  * @param axisB - The second axis of the constraint in local space.
317
314
  * @param scene - The scene the constraint belongs to.
318
315
  * @returns The created LockConstraint.
319
- *
320
- * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.
321
- * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.
322
316
  */
323
317
  export declare class PrismaticConstraint extends PhysicsConstraint {
324
318
  constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene);
@@ -256,16 +256,14 @@ export class Physics6DoFConstraint extends PhysicsConstraint {
256
256
  }
257
257
  /**
258
258
  * Represents a Ball and Socket Constraint, used to simulate a joint
259
- *
259
+ * This class is useful for simulating a joint between two bodies in a physics engine.
260
+ * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.
260
261
  * @param pivotA - The first pivot, defined locally in the first body frame
261
262
  * @param pivotB - The second pivot, defined locally in the second body frame
262
263
  * @param axisA - The axis of the first body
263
264
  * @param axisB - The axis of the second body
264
265
  * @param scene - The scene the constraint is applied to
265
266
  * @returns The Ball and Socket Constraint
266
- *
267
- * This class is useful for simulating a joint between two bodies in a physics engine.
268
- * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.
269
267
  */
270
268
  export class BallAndSocketConstraint extends PhysicsConstraint {
271
269
  constructor(pivotA, pivotB, axisA, axisB, scene) {
@@ -274,13 +272,13 @@ export class BallAndSocketConstraint extends PhysicsConstraint {
274
272
  }
275
273
  /**
276
274
  * Creates a distance constraint.
277
- * @param maxDistance distance between bodies
278
- * @param scene The scene the constraint belongs to
279
- * @returns DistanceConstraint
280
275
  *
281
276
  * This code is useful for creating a distance constraint in a physics engine.
282
277
  * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.
283
278
  * The scene is used to add the constraint to the physics engine.
279
+ * @param maxDistance distance between bodies
280
+ * @param scene The scene the constraint belongs to
281
+ * @returns DistanceConstraint
284
282
  */
285
283
  export class DistanceConstraint extends PhysicsConstraint {
286
284
  constructor(maxDistance, scene) {
@@ -290,13 +288,12 @@ export class DistanceConstraint extends PhysicsConstraint {
290
288
  /**
291
289
  * Creates a HingeConstraint, which is a type of PhysicsConstraint.
292
290
  *
291
+ * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.
292
+ * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.
293
293
  * @param pivotA - The first pivot point, in world space.
294
294
  * @param pivotB - The second pivot point, in world space.
295
295
  * @param scene - The scene the constraint is used in.
296
296
  * @returns The new HingeConstraint.
297
- *
298
- * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.
299
- * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.
300
297
  */
301
298
  export class HingeConstraint extends PhysicsConstraint {
302
299
  constructor(pivotA, pivotB, axisA, axisB, scene) {
@@ -306,16 +303,15 @@ export class HingeConstraint extends PhysicsConstraint {
306
303
  /**
307
304
  * Creates a SliderConstraint, which is a type of PhysicsConstraint.
308
305
  *
306
+ * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.
307
+ * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.
308
+ * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.
309
309
  * @param pivotA - The first pivot of the constraint, in world space.
310
310
  * @param pivotB - The second pivot of the constraint, in world space.
311
311
  * @param axisA - The first axis of the constraint, in world space.
312
312
  * @param axisB - The second axis of the constraint, in world space.
313
313
  * @param scene - The scene the constraint belongs to.
314
314
  * @returns The created SliderConstraint.
315
- *
316
- * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.
317
- * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.
318
- * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.
319
315
  */
320
316
  export class SliderConstraint extends PhysicsConstraint {
321
317
  constructor(pivotA, pivotB, axisA, axisB, scene) {
@@ -325,15 +321,14 @@ export class SliderConstraint extends PhysicsConstraint {
325
321
  /**
326
322
  * Creates a LockConstraint, which is a type of PhysicsConstraint.
327
323
  *
324
+ * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.
325
+ * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.
328
326
  * @param pivotA - The first pivot of the constraint in local space.
329
327
  * @param pivotB - The second pivot of the constraint in local space.
330
328
  * @param axisA - The first axis of the constraint in local space.
331
329
  * @param axisB - The second axis of the constraint in local space.
332
330
  * @param scene - The scene the constraint belongs to.
333
331
  * @returns The created LockConstraint.
334
- *
335
- * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.
336
- * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.
337
332
  */
338
333
  export class LockConstraint extends PhysicsConstraint {
339
334
  constructor(pivotA, pivotB, axisA, axisB, scene) {
@@ -343,15 +338,14 @@ export class LockConstraint extends PhysicsConstraint {
343
338
  /**
344
339
  * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.
345
340
  *
341
+ * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.
342
+ * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.
346
343
  * @param pivotA - The first pivot of the constraint in local space.
347
344
  * @param pivotB - The second pivot of the constraint in local space.
348
345
  * @param axisA - The first axis of the constraint in local space.
349
346
  * @param axisB - The second axis of the constraint in local space.
350
347
  * @param scene - The scene the constraint belongs to.
351
348
  * @returns The created LockConstraint.
352
- *
353
- * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.
354
- * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.
355
349
  */
356
350
  export class PrismaticConstraint extends PhysicsConstraint {
357
351
  constructor(pivotA, pivotB, axisA, axisB, scene) {
@@ -1 +1 @@
1
- {"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAiB1B;;;;;;;;OAQG;IACH,YAAY,IAA2B,EAAE,OAAoC,EAAE,KAAY;QAzB3F;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAuBhC,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,C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EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7G,CAAC;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,0CAAkC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAClH,CAAC;CACJ;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,gBAAiB,SAAQ,qBAAqB;IACvD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,WAAmB,EAAE,WAAmB,EAAE,SAAiB,EAAE,OAAe,EAAE,KAAY;QACpK,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,+CAAuC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACxK,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsConstraintParameters, PhysicsConstraintAxisLimitMode, PhysicsConstraintMotorType, ConstrainedBodyPair } from \"./IPhysicsEnginePlugin\";\r\nimport { PhysicsConstraintAxis, PhysicsConstraintType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n protected _options: PhysicsConstraintParameters;\r\n protected _type: PhysicsConstraintType;\r\n /**\r\n * @internal\r\n * The internal options that were used to init the constraint\r\n */\r\n public _initOptions?: PhysicsConstraintParameters;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: PhysicsConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n throw new Error(\"Missing scene parameter for constraint constructor.\");\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._options = options;\r\n this._type = type;\r\n }\r\n\r\n /**\r\n * Gets the type of the constraint.\r\n *\r\n * @returns The type of the constraint.\r\n *\r\n */\r\n public get type(): PhysicsConstraintType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Retrieves the options of the physics constraint.\r\n *\r\n * @returns The physics constraint parameters.\r\n *\r\n */\r\n public get options(): PhysicsConstraintParameters {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Enable/disable the constraint\r\n * @param isEnabled value for the constraint\r\n */\r\n public set isEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if constraint is enabled\r\n */\r\n public get isEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n * Enables or disables collisions for the physics engine.\r\n *\r\n * @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.\r\n *\r\n */\r\n public set isCollisionsEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n * Gets whether collisions are enabled for this physics object.\r\n *\r\n * @returns `true` if collisions are enabled, `false` otherwise.\r\n *\r\n */\r\n public get isCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n * Gets all bodies that are using this constraint\r\n * @returns\r\n */\r\n public getBodiesUsingConstraint(): ConstrainedBodyPair[] {\r\n return this._physicsPlugin.getBodiesUsingConstraint(this);\r\n }\r\n\r\n /**\r\n * Disposes the constraint from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n * This describes a single limit used by Physics6DoFConstraint\r\n */\r\nexport class Physics6DoFLimit {\r\n /**\r\n * The axis ID to limit\r\n */\r\n axis: PhysicsConstraintAxis;\r\n /**\r\n * An optional minimum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n minLimit?: number;\r\n /**\r\n * An optional maximum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n maxLimit?: number;\r\n /**\r\n * The stiffness of the constraint.\r\n */\r\n stiffness?: number;\r\n /**\r\n * A constraint parameter that specifies damping.\r\n */\r\n damping?: number;\r\n}\r\n\r\n/**\r\n * A generic constraint, which can be used to build more complex constraints than those specified\r\n * in PhysicsConstraintType. The axis and pivot options in PhysicsConstraintParameters define the space\r\n * the constraint operates in. This constraint contains a set of limits, which restrict the\r\n * relative movement of the bodies in that coordinate system\r\n */\r\nexport class Physics6DoFConstraint extends PhysicsConstraint {\r\n /**\r\n * The collection of limits which this constraint will apply\r\n */\r\n public limits: Physics6DoFLimit[];\r\n\r\n constructor(constraintParams: PhysicsConstraintParameters, limits: Physics6DoFLimit[], scene: Scene) {\r\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene);\r\n this.limits = limits;\r\n }\r\n\r\n /**\r\n * Sets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine to set the friction for.\r\n * @param friction - The friction to set for the given axis.\r\n *\r\n */\r\n public setAxisFriction(axis: PhysicsConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n * Gets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The friction of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisFriction(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the limit mode for the given axis of the constraint.\r\n * @param axis The axis to set the limit mode for.\r\n * @param limitMode The limit mode to set.\r\n *\r\n * This method is useful for setting the limit mode for a given axis of the constraint. This is important for\r\n * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,\r\n * the engine can be configured to either stop the motion of the objects, or to allow them to continue\r\n * moving beyond the constraint.\r\n */\r\n public setAxisMode(axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n\r\n /**\r\n * Gets the limit mode of the given axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The limit mode of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMode(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode> {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the minimum limit of a given axis of a constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param minLimit - The minimum limit of the axis.\r\n *\r\n */\r\n public setAxisMinLimit(axis: PhysicsConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n * Gets the minimum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The minimum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMinLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum limit of the given axis for the physics engine.\r\n * @param axis - The axis to set the limit for.\r\n * @param limit - The maximum limit of the axis.\r\n *\r\n * This method is useful for setting the maximum limit of the given axis for the physics engine,\r\n * which can be used to control the movement of the physics object. This helps to ensure that the\r\n * physics object does not move beyond the given limit.\r\n */\r\n public setAxisMaxLimit(axis: PhysicsConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n * Gets the maximum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The maximum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMaxLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the motor type of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param motorType - The type of motor to use.\r\n */\r\n public setAxisMotorType(axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n * Gets the motor type of the specified axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The motor type of the specified axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorType(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType> {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the target velocity of the motor associated with the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param target - The target velocity of the motor.\r\n *\r\n * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.\r\n */\r\n public setAxisMotorTarget(axis: PhysicsConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n * Gets the target velocity of the motor associated to the given constraint axis.\r\n * @param axis - The constraint axis associated to the motor.\r\n * @returns The target velocity of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorTarget(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param maxForce - The maximum force of the motor.\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: PhysicsConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n * Gets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @returns The maximum force of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Ball and Socket Constraint, used to simulate a joint\r\n *\r\n * @param pivotA - The first pivot, defined locally in the first body frame\r\n * @param pivotB - The second pivot, defined locally in the second body frame\r\n * @param axisA - The axis of the first body\r\n * @param axisB - The axis of the second body\r\n * @param scene - The scene the constraint is applied to\r\n * @returns The Ball and Socket Constraint\r\n *\r\n * This class is useful for simulating a joint between two bodies in a physics engine.\r\n * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.\r\n */\r\nexport class BallAndSocketConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a distance constraint.\r\n * @param maxDistance distance between bodies\r\n * @param scene The scene the constraint belongs to\r\n * @returns DistanceConstraint\r\n *\r\n * This code is useful for creating a distance constraint in a physics engine.\r\n * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.\r\n * The scene is used to add the constraint to the physics engine.\r\n */\r\nexport class DistanceConstraint extends PhysicsConstraint {\r\n constructor(maxDistance: number, scene: Scene) {\r\n super(PhysicsConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a HingeConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot point, in world space.\r\n * @param pivotB - The second pivot point, in world space.\r\n * @param scene - The scene the constraint is used in.\r\n * @returns The new HingeConstraint.\r\n *\r\n * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.\r\n * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.\r\n */\r\nexport class HingeConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SliderConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint, in world space.\r\n * @param pivotB - The second pivot of the constraint, in world space.\r\n * @param axisA - The first axis of the constraint, in world space.\r\n * @param axisB - The second axis of the constraint, in world space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SliderConstraint.\r\n *\r\n * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.\r\n * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.\r\n * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.\r\n */\r\nexport class SliderConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a LockConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.\r\n */\r\nexport class LockConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.\r\n */\r\nexport class PrismaticConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SpringConstraint, which is a type of Physics6DoFConstraint. This constraint applies a force at the ends which is proportional\r\n * to the distance between ends, and a stiffness and damping factor. The force is calculated as (stiffness * positionError) - (damping * velocity)\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param minDistance - The minimum distance between the two pivots.\r\n * @param maxDistance - The maximum distance between the two pivots.\r\n * @param stiffness - The stiffness of the spring.\r\n * @param damping - The damping of the spring.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SpringConstraint.\r\n */\r\nexport class SpringConstraint extends Physics6DoFConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, minDistance: number, maxDistance: number, stiffness: number, damping: number, scene: Scene) {\r\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAiB1B;;;;;;;;OAQG;IACH,YAAY,IAA2B,EAAE,OAAoC,EAAE,KAAY;QAzB3F;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,iBAAiB;IACjD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,qCAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7G,CAAC;CACJ;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,0CAAkC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAClH,CAAC;CACJ;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,gBAAiB,SAAQ,qBAAqB;IACvD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,WAAmB,EAAE,WAAmB,EAAE,SAAiB,EAAE,OAAe,EAAE,KAAY;QACpK,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,+CAAuC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACxK,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsConstraintParameters, PhysicsConstraintAxisLimitMode, PhysicsConstraintMotorType, ConstrainedBodyPair } from \"./IPhysicsEnginePlugin\";\r\nimport { PhysicsConstraintAxis, PhysicsConstraintType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n protected _options: PhysicsConstraintParameters;\r\n protected _type: PhysicsConstraintType;\r\n /**\r\n * @internal\r\n * The internal options that were used to init the constraint\r\n */\r\n public _initOptions?: PhysicsConstraintParameters;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: PhysicsConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n throw new Error(\"Missing scene parameter for constraint constructor.\");\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._options = options;\r\n this._type = type;\r\n }\r\n\r\n /**\r\n * Gets the type of the constraint.\r\n *\r\n * @returns The type of the constraint.\r\n *\r\n */\r\n public get type(): PhysicsConstraintType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Retrieves the options of the physics constraint.\r\n *\r\n * @returns The physics constraint parameters.\r\n *\r\n */\r\n public get options(): PhysicsConstraintParameters {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Enable/disable the constraint\r\n * @param isEnabled value for the constraint\r\n */\r\n public set isEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if constraint is enabled\r\n */\r\n public get isEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n * Enables or disables collisions for the physics engine.\r\n *\r\n * @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.\r\n *\r\n */\r\n public set isCollisionsEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n * Gets whether collisions are enabled for this physics object.\r\n *\r\n * @returns `true` if collisions are enabled, `false` otherwise.\r\n *\r\n */\r\n public get isCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n * Gets all bodies that are using this constraint\r\n * @returns\r\n */\r\n public getBodiesUsingConstraint(): ConstrainedBodyPair[] {\r\n return this._physicsPlugin.getBodiesUsingConstraint(this);\r\n }\r\n\r\n /**\r\n * Disposes the constraint from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n * This describes a single limit used by Physics6DoFConstraint\r\n */\r\nexport class Physics6DoFLimit {\r\n /**\r\n * The axis ID to limit\r\n */\r\n axis: PhysicsConstraintAxis;\r\n /**\r\n * An optional minimum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n minLimit?: number;\r\n /**\r\n * An optional maximum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n maxLimit?: number;\r\n /**\r\n * The stiffness of the constraint.\r\n */\r\n stiffness?: number;\r\n /**\r\n * A constraint parameter that specifies damping.\r\n */\r\n damping?: number;\r\n}\r\n\r\n/**\r\n * A generic constraint, which can be used to build more complex constraints than those specified\r\n * in PhysicsConstraintType. The axis and pivot options in PhysicsConstraintParameters define the space\r\n * the constraint operates in. This constraint contains a set of limits, which restrict the\r\n * relative movement of the bodies in that coordinate system\r\n */\r\nexport class Physics6DoFConstraint extends PhysicsConstraint {\r\n /**\r\n * The collection of limits which this constraint will apply\r\n */\r\n public limits: Physics6DoFLimit[];\r\n\r\n constructor(constraintParams: PhysicsConstraintParameters, limits: Physics6DoFLimit[], scene: Scene) {\r\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene);\r\n this.limits = limits;\r\n }\r\n\r\n /**\r\n * Sets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine to set the friction for.\r\n * @param friction - The friction to set for the given axis.\r\n *\r\n */\r\n public setAxisFriction(axis: PhysicsConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n * Gets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The friction of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisFriction(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the limit mode for the given axis of the constraint.\r\n * @param axis The axis to set the limit mode for.\r\n * @param limitMode The limit mode to set.\r\n *\r\n * This method is useful for setting the limit mode for a given axis of the constraint. This is important for\r\n * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,\r\n * the engine can be configured to either stop the motion of the objects, or to allow them to continue\r\n * moving beyond the constraint.\r\n */\r\n public setAxisMode(axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n\r\n /**\r\n * Gets the limit mode of the given axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The limit mode of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMode(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode> {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the minimum limit of a given axis of a constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param minLimit - The minimum limit of the axis.\r\n *\r\n */\r\n public setAxisMinLimit(axis: PhysicsConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n * Gets the minimum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The minimum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMinLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum limit of the given axis for the physics engine.\r\n * @param axis - The axis to set the limit for.\r\n * @param limit - The maximum limit of the axis.\r\n *\r\n * This method is useful for setting the maximum limit of the given axis for the physics engine,\r\n * which can be used to control the movement of the physics object. This helps to ensure that the\r\n * physics object does not move beyond the given limit.\r\n */\r\n public setAxisMaxLimit(axis: PhysicsConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n * Gets the maximum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The maximum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMaxLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the motor type of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param motorType - The type of motor to use.\r\n */\r\n public setAxisMotorType(axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n * Gets the motor type of the specified axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The motor type of the specified axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorType(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType> {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the target velocity of the motor associated with the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param target - The target velocity of the motor.\r\n *\r\n * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.\r\n */\r\n public setAxisMotorTarget(axis: PhysicsConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n * Gets the target velocity of the motor associated to the given constraint axis.\r\n * @param axis - The constraint axis associated to the motor.\r\n * @returns The target velocity of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorTarget(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param maxForce - The maximum force of the motor.\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: PhysicsConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n * Gets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @returns The maximum force of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Ball and Socket Constraint, used to simulate a joint\r\n * This class is useful for simulating a joint between two bodies in a physics engine.\r\n * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.\r\n * @param pivotA - The first pivot, defined locally in the first body frame\r\n * @param pivotB - The second pivot, defined locally in the second body frame\r\n * @param axisA - The axis of the first body\r\n * @param axisB - The axis of the second body\r\n * @param scene - The scene the constraint is applied to\r\n * @returns The Ball and Socket Constraint\r\n */\r\nexport class BallAndSocketConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a distance constraint.\r\n *\r\n * This code is useful for creating a distance constraint in a physics engine.\r\n * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.\r\n * The scene is used to add the constraint to the physics engine.\r\n * @param maxDistance distance between bodies\r\n * @param scene The scene the constraint belongs to\r\n * @returns DistanceConstraint\r\n */\r\nexport class DistanceConstraint extends PhysicsConstraint {\r\n constructor(maxDistance: number, scene: Scene) {\r\n super(PhysicsConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a HingeConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.\r\n * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.\r\n * @param pivotA - The first pivot point, in world space.\r\n * @param pivotB - The second pivot point, in world space.\r\n * @param scene - The scene the constraint is used in.\r\n * @returns The new HingeConstraint.\r\n */\r\nexport class HingeConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SliderConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.\r\n * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.\r\n * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.\r\n * @param pivotA - The first pivot of the constraint, in world space.\r\n * @param pivotB - The second pivot of the constraint, in world space.\r\n * @param axisA - The first axis of the constraint, in world space.\r\n * @param axisB - The second axis of the constraint, in world space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SliderConstraint.\r\n */\r\nexport class SliderConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a LockConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n */\r\nexport class LockConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n */\r\nexport class PrismaticConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SpringConstraint, which is a type of Physics6DoFConstraint. This constraint applies a force at the ends which is proportional\r\n * to the distance between ends, and a stiffness and damping factor. The force is calculated as (stiffness * positionError) - (damping * velocity)\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param minDistance - The minimum distance between the two pivots.\r\n * @param maxDistance - The maximum distance between the two pivots.\r\n * @param stiffness - The stiffness of the spring.\r\n * @param damping - The damping of the spring.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SpringConstraint.\r\n */\r\nexport class SpringConstraint extends Physics6DoFConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, minDistance: number, maxDistance: number, stiffness: number, damping: number, scene: Scene) {\r\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\r\n }\r\n}\r\n"]}
@@ -2,7 +2,6 @@ import type { Engine } from "../Engines/engine";
2
2
  import type { PostProcessOptions } from "./postProcess";
3
3
  import { PostProcess } from "./postProcess";
4
4
  import type { Camera } from "../Cameras/camera";
5
- import "../Shaders/anaglyph.fragment";
6
5
  /**
7
6
  * Postprocess used to generate anaglyphic rendering
8
7
  */
@@ -23,5 +22,5 @@ export declare class AnaglyphPostProcess extends PostProcess {
23
22
  * @param reusable defines if the postprocess will be reused multiple times per frame
24
23
  */
25
24
  constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
26
- protected _initShaderSourceAsync(useWebGPU: boolean): Promise<void>;
25
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
27
26
  }
@@ -1,5 +1,4 @@
1
1
  import { PostProcess } from "./postProcess.js";
2
- import "../Shaders/anaglyph.fragment.js";
3
2
  import { RegisterClass } from "../Misc/typeStore.js";
4
3
  /**
5
4
  * Postprocess used to generate anaglyphic rendering
@@ -28,15 +27,15 @@ export class AnaglyphPostProcess extends PostProcess {
28
27
  effect.setTextureFromPostProcess("leftSampler", this._passedProcess);
29
28
  });
30
29
  }
31
- async _initShaderSourceAsync(useWebGPU) {
30
+ _gatherImports(useWebGPU, list) {
32
31
  if (useWebGPU) {
33
32
  this._webGPUReady = true;
34
- await import("../ShadersWGSL/anaglyph.fragment.js");
33
+ list.push(import("../ShadersWGSL/anaglyph.fragment.js"));
35
34
  }
36
35
  else {
37
- await import("../Shaders/anaglyph.fragment.js");
36
+ list.push(import("../Shaders/anaglyph.fragment.js"));
38
37
  }
39
- super._initShaderSourceAsync(useWebGPU);
38
+ super._gatherImports(useWebGPU, list);
40
39
  }
41
40
  }
42
41
  RegisterClass("BABYLON.AnaglyphPostProcess", AnaglyphPostProcess);
@@ -1 +1 @@
1
- {"version":3,"file":"anaglyphPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/anaglyphPostProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAGhD;;;OAGG;IACa,YAAY;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,IAAY,EAAE,OAAoC,EAAE,UAAoB,EAAE,YAAqB,EAAE,MAAe,EAAE,QAAkB;QAC5I,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvG,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;QAEpD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,yBAAyB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IAEkB,KAAK,CAAC,sBAAsB,CAAC,SAAkB;QAC9D,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;SACpD;aAAM;YACH,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;SAChD;QAED,KAAK,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\n\r\nimport \"../Shaders/anaglyph.fragment\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * Postprocess used to generate anaglyphic rendering\r\n */\r\nexport class AnaglyphPostProcess extends PostProcess {\r\n private _passedProcess: Nullable<PostProcess>;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"AnaglyphPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"AnaglyphPostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a new AnaglyphPostProcess\r\n * @param name defines postprocess name\r\n * @param options defines creation options or target ratio scale\r\n * @param rigCameras defines cameras using this postprocess\r\n * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param engine defines hosting engine\r\n * @param reusable defines if the postprocess will be reused multiple times per frame\r\n */\r\n constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean) {\r\n super(name, \"anaglyph\", null, [\"leftSampler\"], options, rigCameras[1], samplingMode, engine, reusable);\r\n this._passedProcess = rigCameras[0]._rigPostProcess;\r\n\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setTextureFromPostProcess(\"leftSampler\", this._passedProcess);\r\n });\r\n }\r\n\r\n protected override async _initShaderSourceAsync(useWebGPU: boolean) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n await import(\"../ShadersWGSL/anaglyph.fragment\");\r\n } else {\r\n await import(\"../Shaders/anaglyph.fragment\");\r\n }\r\n\r\n super._initShaderSourceAsync(useWebGPU);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AnaglyphPostProcess\", AnaglyphPostProcess);\r\n"]}
1
+ {"version":3,"file":"anaglyphPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/anaglyphPostProcess.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAGhD;;;OAGG;IACa,YAAY;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,IAAY,EAAE,OAAoC,EAAE,UAAoB,EAAE,YAAqB,EAAE,MAAe,EAAE,QAAkB;QAC5I,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvG,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;QAEpD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,yBAAyB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IAEkB,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC;SACzD;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAAC;SACrD;QAED,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * Postprocess used to generate anaglyphic rendering\r\n */\r\nexport class AnaglyphPostProcess extends PostProcess {\r\n private _passedProcess: Nullable<PostProcess>;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"AnaglyphPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"AnaglyphPostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a new AnaglyphPostProcess\r\n * @param name defines postprocess name\r\n * @param options defines creation options or target ratio scale\r\n * @param rigCameras defines cameras using this postprocess\r\n * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param engine defines hosting engine\r\n * @param reusable defines if the postprocess will be reused multiple times per frame\r\n */\r\n constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean) {\r\n super(name, \"anaglyph\", null, [\"leftSampler\"], options, rigCameras[1], samplingMode, engine, reusable);\r\n this._passedProcess = rigCameras[0]._rigPostProcess;\r\n\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setTextureFromPostProcess(\"leftSampler\", this._passedProcess);\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/anaglyph.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/anaglyph.fragment\"));\r\n }\r\n\r\n super._gatherImports(useWebGPU, list);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AnaglyphPostProcess\", AnaglyphPostProcess);\r\n"]}
@@ -28,7 +28,7 @@ export declare class BlackAndWhitePostProcess extends PostProcess {
28
28
  * @param reusable If the post process can be reused on the same frame. (default: false)
29
29
  */
30
30
  constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean);
31
- protected _initShaderSourceAsync(useWebGPU: boolean): Promise<void>;
31
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
32
32
  /**
33
33
  * @internal
34
34
  */
@@ -34,15 +34,15 @@ export class BlackAndWhitePostProcess extends PostProcess {
34
34
  effect.setFloat("degree", this.degree);
35
35
  });
36
36
  }
37
- async _initShaderSourceAsync(useWebGPU) {
37
+ _gatherImports(useWebGPU, list) {
38
38
  if (useWebGPU) {
39
39
  this._webGPUReady = true;
40
- await import("../ShadersWGSL/blackAndWhite.fragment.js");
40
+ list.push(import("../ShadersWGSL/blackAndWhite.fragment.js"));
41
41
  }
42
42
  else {
43
- await import("../Shaders/blackAndWhite.fragment.js");
43
+ list.push(import("../Shaders/blackAndWhite.fragment.js"));
44
44
  }
45
- super._initShaderSourceAsync(useWebGPU);
45
+ super._gatherImports(useWebGPU, list);
46
46
  }
47
47
  /**
48
48
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"blackAndWhitePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/blackAndWhitePostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAKvE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAOrD;;;OAGG;IACa,YAAY;QACxB,OAAO,0BAA0B,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,IAAY,EAAE,OAAoC,EAAE,MAAwB,EAAE,YAAqB,EAAE,MAAuB,EAAE,QAAkB;QACxJ,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAzBpG;;WAEG;QAEI,WAAM,GAAG,CAAC,CAAC;QAuBd,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC;IAEkB,KAAK,CAAC,sBAAsB,CAAC,SAAkB;QAC9D,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,MAAM,MAAM,CAAC,uCAAuC,CAAC,CAAC;SACzD;aAAM;YACH,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;SACrD;QAED,KAAK,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,MAAM,CAAU,MAAM,CAAC,iBAAsB,EAAE,YAAoB,EAAE,KAAY,EAAE,OAAe;QACrG,OAAO,mBAAmB,CAAC,KAAK,CAC5B,GAAG,EAAE;YACD,OAAO,IAAI,wBAAwB,CAC/B,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,OAAO,EACzB,YAAY,EACZ,iBAAiB,CAAC,wBAAwB,EAC1C,KAAK,CAAC,SAAS,EAAE,EACjB,iBAAiB,CAAC,QAAQ,CAC7B,CAAC;QACN,CAAC,EACD,iBAAiB,EACjB,KAAK,EACL,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AA3DU;IADN,SAAS,EAAE;wDACM;AA6DtB,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport type { Nullable } from \"../types\";\r\n\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Post process used to render in black and white\r\n */\r\nexport class BlackAndWhitePostProcess extends PostProcess {\r\n /**\r\n * Linear about to convert he result to black and white (default: 1)\r\n */\r\n @serialize()\r\n public degree = 1;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"BlackAndWhitePostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"BlackAndWhitePostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a black and white post process\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#black-and-white\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean) {\r\n super(name, \"blackAndWhite\", [\"degree\"], null, options, camera, samplingMode, engine, reusable);\r\n\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setFloat(\"degree\", this.degree);\r\n });\r\n }\r\n\r\n protected override async _initShaderSourceAsync(useWebGPU: boolean) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n await import(\"../ShadersWGSL/blackAndWhite.fragment\");\r\n } else {\r\n await import(\"../Shaders/blackAndWhite.fragment\");\r\n }\r\n\r\n super._initShaderSourceAsync(useWebGPU);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static override _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<BlackAndWhitePostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new BlackAndWhitePostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n scene.getEngine(),\r\n parsedPostProcess.reusable\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BlackAndWhitePostProcess\", BlackAndWhitePostProcess);\r\n"]}
1
+ {"version":3,"file":"blackAndWhitePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/blackAndWhitePostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAKvE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAOrD;;;OAGG;IACa,YAAY;QACxB,OAAO,0BAA0B,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,IAAY,EAAE,OAAoC,EAAE,MAAwB,EAAE,YAAqB,EAAE,MAAuB,EAAE,QAAkB;QACxJ,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAzBpG;;WAEG;QAEI,WAAM,GAAG,CAAC,CAAC;QAuBd,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC;IAEkB,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC,CAAC;SAC9D;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC,CAAC;SAC1D;QAED,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,MAAM,CAAU,MAAM,CAAC,iBAAsB,EAAE,YAAoB,EAAE,KAAY,EAAE,OAAe;QACrG,OAAO,mBAAmB,CAAC,KAAK,CAC5B,GAAG,EAAE;YACD,OAAO,IAAI,wBAAwB,CAC/B,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,OAAO,EACzB,YAAY,EACZ,iBAAiB,CAAC,wBAAwB,EAC1C,KAAK,CAAC,SAAS,EAAE,EACjB,iBAAiB,CAAC,QAAQ,CAC7B,CAAC;QACN,CAAC,EACD,iBAAiB,EACjB,KAAK,EACL,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AA3DU;IADN,SAAS,EAAE;wDACM;AA6DtB,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport type { Nullable } from \"../types\";\r\n\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Post process used to render in black and white\r\n */\r\nexport class BlackAndWhitePostProcess extends PostProcess {\r\n /**\r\n * Linear about to convert he result to black and white (default: 1)\r\n */\r\n @serialize()\r\n public degree = 1;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"BlackAndWhitePostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"BlackAndWhitePostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a black and white post process\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#black-and-white\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean) {\r\n super(name, \"blackAndWhite\", [\"degree\"], null, options, camera, samplingMode, engine, reusable);\r\n\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setFloat(\"degree\", this.degree);\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/blackAndWhite.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/blackAndWhite.fragment\"));\r\n }\r\n\r\n super._gatherImports(useWebGPU, list);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static override _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<BlackAndWhitePostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new BlackAndWhitePostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n scene.getEngine(),\r\n parsedPostProcess.reusable\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BlackAndWhitePostProcess\", BlackAndWhitePostProcess);\r\n"]}
@@ -31,5 +31,5 @@ export declare class BloomMergePostProcess extends PostProcess {
31
31
  constructor(name: string, originalFromInput: PostProcess, blurred: PostProcess,
32
32
  /** Weight of the bloom to be added to the original input. */
33
33
  weight: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number, blockCompilation?: boolean);
34
- protected _initShaderSourceAsync(useWebGPU: boolean): Promise<void>;
34
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
35
35
  }
@@ -45,15 +45,15 @@ export class BloomMergePostProcess extends PostProcess {
45
45
  this.updateEffect();
46
46
  }
47
47
  }
48
- async _initShaderSourceAsync(useWebGPU) {
48
+ _gatherImports(useWebGPU, list) {
49
49
  if (useWebGPU) {
50
50
  this._webGPUReady = true;
51
- await import("../ShadersWGSL/bloomMerge.fragment.js");
51
+ list.push(import("../ShadersWGSL/bloomMerge.fragment.js"));
52
52
  }
53
53
  else {
54
- await import("../Shaders/bloomMerge.fragment.js");
54
+ list.push(import("../Shaders/bloomMerge.fragment.js"));
55
55
  }
56
- super._initShaderSourceAsync(useWebGPU);
56
+ super._gatherImports(useWebGPU, list);
57
57
  }
58
58
  }
59
59
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"bloomMergePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/bloomMergePostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IAKlD;;;OAGG;IACa,YAAY;QACxB,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,IAAY,EACZ,iBAA8B,EAC9B,OAAoB;IACpB,6DAA6D;IAC7D,MAAc,EACd,OAAoC,EACpC,MAAwB,EACxB,YAAqB,EACrB,MAAuB,EACvB,QAAkB,EAClB,cAAsB,SAAS,CAAC,wBAAwB,EACxD,gBAAgB,GAAG,KAAK;QAExB,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAxCzJ,6DAA6D;QAEtD,WAAM,GAAG,CAAC,CAAC;QAuCd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC;QAC1C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;YACtE,MAAM,CAAC,+BAA+B,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7D,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAEkB,KAAK,CAAC,sBAAsB,CAAC,SAAkB;QAC9D,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAC;SACtD;aAAM;YACH,MAAM,MAAM,CAAC,gCAAgC,CAAC,CAAC;SAClD;QAED,KAAK,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ;AA9DU;IADN,SAAS,EAAE;qDACM;AAgEtB,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\n\r\n/**\r\n * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nexport class BloomMergePostProcess extends PostProcess {\r\n /** Weight of the bloom to be added to the original input. */\r\n @serialize()\r\n public weight = 1;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"BloomMergePostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"BloomMergePostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a new instance of @see BloomMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param blurred Blurred highlights post process which's output will be used.\r\n * @param weight Weight of the bloom to be added to the original input.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n constructor(\r\n name: string,\r\n originalFromInput: PostProcess,\r\n blurred: PostProcess,\r\n /** Weight of the bloom to be added to the original input. */\r\n weight: number,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n blockCompilation = false\r\n ) {\r\n super(name, \"bloomMerge\", [\"bloomWeight\"], [\"bloomBlur\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);\r\n this.weight = weight;\r\n this.externalTextureSamplerBinding = true;\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"bloomBlur\", blurred);\r\n effect.setFloat(\"bloomWeight\", this.weight);\r\n });\r\n\r\n if (!blockCompilation) {\r\n this.updateEffect();\r\n }\r\n }\r\n\r\n protected override async _initShaderSourceAsync(useWebGPU: boolean) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n await import(\"../ShadersWGSL/bloomMerge.fragment\");\r\n } else {\r\n await import(\"../Shaders/bloomMerge.fragment\");\r\n }\r\n\r\n super._initShaderSourceAsync(useWebGPU);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BloomMergePostProcess\", BloomMergePostProcess);\r\n"]}
1
+ {"version":3,"file":"bloomMergePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/bloomMergePostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IAKlD;;;OAGG;IACa,YAAY;QACxB,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,IAAY,EACZ,iBAA8B,EAC9B,OAAoB;IACpB,6DAA6D;IAC7D,MAAc,EACd,OAAoC,EACpC,MAAwB,EACxB,YAAqB,EACrB,MAAuB,EACvB,QAAkB,EAClB,cAAsB,SAAS,CAAC,wBAAwB,EACxD,gBAAgB,GAAG,KAAK;QAExB,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAxCzJ,6DAA6D;QAEtD,WAAM,GAAG,CAAC,CAAC;QAuCd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC;QAC1C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC1C,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;YACtE,MAAM,CAAC,+BAA+B,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7D,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAEkB,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAC,CAAC;SAC3D;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC,CAAC;SACvD;QAED,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ;AA9DU;IADN,SAAS,EAAE;qDACM;AAgEtB,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\n\r\n/**\r\n * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nexport class BloomMergePostProcess extends PostProcess {\r\n /** Weight of the bloom to be added to the original input. */\r\n @serialize()\r\n public weight = 1;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"BloomMergePostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"BloomMergePostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a new instance of @see BloomMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param blurred Blurred highlights post process which's output will be used.\r\n * @param weight Weight of the bloom to be added to the original input.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n constructor(\r\n name: string,\r\n originalFromInput: PostProcess,\r\n blurred: PostProcess,\r\n /** Weight of the bloom to be added to the original input. */\r\n weight: number,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n blockCompilation = false\r\n ) {\r\n super(name, \"bloomMerge\", [\"bloomWeight\"], [\"bloomBlur\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);\r\n this.weight = weight;\r\n this.externalTextureSamplerBinding = true;\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"bloomBlur\", blurred);\r\n effect.setFloat(\"bloomWeight\", this.weight);\r\n });\r\n\r\n if (!blockCompilation) {\r\n this.updateEffect();\r\n }\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/bloomMerge.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/bloomMerge.fragment\"));\r\n }\r\n\r\n super._gatherImports(useWebGPU, list);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BloomMergePostProcess\", BloomMergePostProcess);\r\n"]}