@babylonjs/core 5.3.0 → 5.5.5

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 (125) hide show
  1. package/Animations/animatable.js +1 -1
  2. package/Animations/animatable.js.map +1 -1
  3. package/Behaviors/Cameras/autoRotationBehavior.d.ts +7 -0
  4. package/Behaviors/Cameras/autoRotationBehavior.js +15 -0
  5. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  6. package/Cameras/camera.d.ts +2 -1
  7. package/Cameras/camera.js +4 -1
  8. package/Cameras/camera.js.map +1 -1
  9. package/Engines/Extensions/engine.renderTarget.js +4 -2
  10. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  11. package/Engines/Processors/shaderProcessor.js +1 -1
  12. package/Engines/Processors/shaderProcessor.js.map +1 -1
  13. package/Engines/WebGPU/Extensions/engine.renderTarget.js +13 -9
  14. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  15. package/Engines/WebGPU/webgpuBundleList.d.ts +1 -1
  16. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  17. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +2 -2
  18. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +28 -17
  19. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  20. package/Engines/WebGPU/webgpuClearQuad.d.ts +1 -1
  21. package/Engines/WebGPU/webgpuClearQuad.js +3 -3
  22. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  23. package/Engines/WebGPU/webgpuRenderPassWrapper.d.ts +1 -1
  24. package/Engines/WebGPU/webgpuRenderPassWrapper.js.map +1 -1
  25. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +1 -1
  26. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  27. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -0
  28. package/Engines/WebGPU/webgpuTextureHelper.js +16 -3
  29. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  30. package/Engines/constants.d.ts +4 -0
  31. package/Engines/constants.js +4 -0
  32. package/Engines/constants.js.map +1 -1
  33. package/Engines/engine.d.ts +2 -2
  34. package/Engines/thinEngine.js +2 -2
  35. package/Engines/thinEngine.js.map +1 -1
  36. package/Engines/webgpuEngine.js +48 -32
  37. package/Engines/webgpuEngine.js.map +1 -1
  38. package/Gizmos/axisDragGizmo.js +1 -0
  39. package/Gizmos/axisDragGizmo.js.map +1 -1
  40. package/Gizmos/axisScaleGizmo.js +1 -0
  41. package/Gizmos/axisScaleGizmo.js.map +1 -1
  42. package/Layers/effectLayer.js +1 -1
  43. package/Layers/effectLayer.js.map +1 -1
  44. package/Loading/Plugins/babylonFileLoader.js +1 -1
  45. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  46. package/Materials/Background/backgroundMaterial.js +1 -1
  47. package/Materials/Background/backgroundMaterial.js.map +1 -1
  48. package/Materials/Node/Blocks/Dual/TBNBlock.d.ts +47 -0
  49. package/Materials/Node/Blocks/Dual/TBNBlock.js +154 -0
  50. package/Materials/Node/Blocks/Dual/TBNBlock.js.map +1 -0
  51. package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
  52. package/Materials/Node/Blocks/Dual/index.js +1 -0
  53. package/Materials/Node/Blocks/Dual/index.js.map +1 -1
  54. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +5 -1
  55. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +20 -1
  56. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/Input/inputBlock.js +1 -1
  58. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  59. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +4 -0
  60. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +18 -1
  61. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +4 -0
  63. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +18 -1
  64. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  65. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +2 -1
  66. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  67. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +6 -5
  68. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  69. package/Materials/PBR/pbrMaterial.d.ts +9 -9
  70. package/Materials/PBR/pbrMaterial.js.map +1 -1
  71. package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +3 -2
  72. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  73. package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +3 -2
  74. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  75. package/Materials/Textures/cubeTexture.js +3 -0
  76. package/Materials/Textures/cubeTexture.js.map +1 -1
  77. package/Materials/Textures/renderTargetTexture.d.ts +2 -1
  78. package/Materials/Textures/renderTargetTexture.js +24 -20
  79. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  80. package/Materials/Textures/textureCreationOptions.d.ts +2 -0
  81. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  82. package/Materials/materialHelper.js +4 -1
  83. package/Materials/materialHelper.js.map +1 -1
  84. package/Materials/shaderMaterial.js +1 -0
  85. package/Materials/shaderMaterial.js.map +1 -1
  86. package/Materials/standardMaterial.js +0 -3
  87. package/Materials/standardMaterial.js.map +1 -1
  88. package/Maths/math.vector.d.ts +4 -0
  89. package/Maths/math.vector.js +12 -0
  90. package/Maths/math.vector.js.map +1 -1
  91. package/Meshes/abstractMesh.d.ts +2 -2
  92. package/Meshes/abstractMesh.js.map +1 -1
  93. package/Meshes/instancedMesh.js +0 -1
  94. package/Meshes/instancedMesh.js.map +1 -1
  95. package/Meshes/subMesh.js +1 -1
  96. package/Meshes/subMesh.js.map +1 -1
  97. package/Meshes/thinInstanceMesh.js +34 -5
  98. package/Meshes/thinInstanceMesh.js.map +1 -1
  99. package/Meshes/transformNode.js +6 -6
  100. package/Meshes/transformNode.js.map +1 -1
  101. package/Misc/sceneOptimizer.d.ts +3 -2
  102. package/Misc/sceneOptimizer.js +4 -1
  103. package/Misc/sceneOptimizer.js.map +1 -1
  104. package/Physics/Plugins/oimoJSPlugin.js +1 -1
  105. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  106. package/Rendering/renderingGroup.js +14 -4
  107. package/Rendering/renderingGroup.js.map +1 -1
  108. package/Shaders/ShadersInclude/vertexColorMixing.d.ts +5 -0
  109. package/Shaders/ShadersInclude/vertexColorMixing.js +9 -0
  110. package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -0
  111. package/Shaders/color.vertex.d.ts +1 -0
  112. package/Shaders/color.vertex.js +2 -1
  113. package/Shaders/color.vertex.js.map +1 -1
  114. package/Shaders/default.vertex.d.ts +1 -0
  115. package/Shaders/default.vertex.js +2 -1
  116. package/Shaders/default.vertex.js.map +1 -1
  117. package/Shaders/pbr.vertex.d.ts +1 -0
  118. package/Shaders/pbr.vertex.js +2 -1
  119. package/Shaders/pbr.vertex.js.map +1 -1
  120. package/XR/features/WebXRControllerPointerSelection.js +1 -0
  121. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  122. package/package.json +1 -1
  123. package/scene.d.ts +3 -1
  124. package/scene.js +9 -5
  125. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sceneOptimizer.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/sceneOptimizer.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH;IAmBI;;;OAGG;IACH;IAC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,EAAE,EAAE,KAAK,CAAC,CAAC;QAElH,IAAI,SAAS,EAAE;YACX,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC;gBAC9B,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC;gBAC9B,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,SAAS,CAAC;IACrB,CAAC;IACL,qBAAC;AAAD,CAAC,AAhPD,IAgPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0\r\n ) {}\r\n}\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class TextureOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n }\r\n\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n public maximumSize: number = 1024,\r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n public step = 0.5\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n let allDone = true;\r\n for (let index = 0; index < scene.textures.length; index++) {\r\n const texture = scene.textures[index];\r\n\r\n if (!texture.canRescale || (<any>texture).getContext) {\r\n continue;\r\n }\r\n\r\n const currentSize = texture.getSize();\r\n const maxDimension = Math.max(currentSize.width, currentSize.height);\r\n\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n\r\n return allDone;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class HardwareScalingOptimization extends SceneOptimization {\r\n private _currentScale = -1;\r\n private _directionOffset = 1;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n }\r\n\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n public maximumScale: number = 2,\r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n public step: number = 0.25\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n\r\n this._currentScale += this._directionOffset * this.step;\r\n\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ShadowsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning shadows on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class PostProcessesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning post-processes on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class LensFlaresOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning lens flares on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class CustomOptimization extends SceneOptimization {\r\n /**\r\n * Callback called to apply the custom optimization.\r\n */\r\n public onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean;\r\n\r\n /**\r\n * Callback called to get custom description\r\n */\r\n public onGetDescription: () => string;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n\r\n return \"Running user defined callback\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ParticlesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning particles on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class RenderTargetsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning render targets off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class MergeMeshesOptimization extends SceneOptimization {\r\n private static _UpdateSelectionTree = false;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static get UpdateSelectionTree(): boolean {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static set UpdateSelectionTree(value: boolean) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n }\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Merging similar meshes together\";\r\n }\r\n\r\n private _canBeMerged = (abstractMesh: AbstractMesh): boolean => {\r\n if (!(abstractMesh instanceof Mesh)) {\r\n return false;\r\n }\r\n\r\n const mesh = <Mesh>abstractMesh;\r\n\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer, updateSelectionTree?: boolean): boolean {\r\n const globalPool = scene.meshes.slice(0);\r\n let globalLength = globalPool.length;\r\n\r\n for (let index = 0; index < globalLength; index++) {\r\n const currentPool = new Array<Mesh>();\r\n const current = globalPool[index];\r\n\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>current);\r\n\r\n // Find compatible meshes\r\n for (let subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n const otherMesh = globalPool[subIndex];\r\n\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>otherMesh);\r\n globalLength--;\r\n\r\n globalPool.splice(subIndex, 1);\r\n\r\n subIndex--;\r\n }\r\n\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n\r\n // Merge meshes\r\n Mesh.MergeMeshes(currentPool, undefined, true);\r\n }\r\n\r\n // Call the octree system optimization if it is defined.\r\n const sceneAsAny = scene as any;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n } else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizerOptions {\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n public optimizations = new Array<SceneOptimization>();\r\n\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checks (2000ms by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n public targetFrameRate: number = 60,\r\n /**\r\n * Defines the interval between two checks (2000ms by default)\r\n */\r\n public trackerDuration: number = 2000\r\n ) {}\r\n\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addOptimization(optimization: SceneOptimization): SceneOptimizerOptions {\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addCustomOptimization(onApply: (scene: Scene) => boolean, onGetDescription: () => string, priority: number = 0): SceneOptimizerOptions {\r\n const optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizer implements IDisposable {\r\n private _isRunning = false;\r\n private _options: SceneOptimizerOptions;\r\n private _scene: Scene;\r\n private _currentPriorityLevel = 0;\r\n private _targetFrameRate = 60;\r\n private _trackerDuration = 2000;\r\n private _currentFrameRate = 0;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _improvementMode = false;\r\n\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n public onSuccessObservable = new Observable<SceneOptimizer>();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n public onNewOptimizationAppliedObservable = new Observable<SceneOptimization>();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n public onFailureObservable = new Observable<SceneOptimizer>();\r\n\r\n /**\r\n * Gets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n public get isInImprovementMode(): boolean {\r\n return this._improvementMode;\r\n }\r\n\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n public get currentPriorityLevel(): number {\r\n return this._currentPriorityLevel;\r\n }\r\n\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n public get currentFrameRate(): number {\r\n return this._currentFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public get targetFrameRate(): number {\r\n return this._targetFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public set targetFrameRate(value: number) {\r\n this._targetFrameRate = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public get trackerDuration(): number {\r\n return this._trackerDuration;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public set trackerDuration(value: number) {\r\n this._trackerDuration = value;\r\n }\r\n\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n public get optimizations(): SceneOptimization[] {\r\n return this._options.optimizations;\r\n }\r\n\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n public constructor(scene: Scene, options?: SceneOptimizerOptions, autoGeneratePriorities = true, improvementMode = false) {\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n } else {\r\n this._options = options;\r\n }\r\n\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n\r\n if (autoGeneratePriorities) {\r\n let priority = 0;\r\n for (const optim of this._options.optimizations) {\r\n optim.priority = priority++;\r\n }\r\n }\r\n\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Stops the current optimizer\r\n */\r\n public stop() {\r\n this._isRunning = false;\r\n }\r\n\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n public reset() {\r\n this._currentPriorityLevel = 0;\r\n }\r\n\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimization while frame rate is above the target frame rate\r\n */\r\n public start() {\r\n if (this._isRunning) {\r\n return;\r\n }\r\n\r\n this._isRunning = true;\r\n\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n private _checkCurrentState() {\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n\r\n const scene = this._scene;\r\n const options = this._options;\r\n\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n\r\n if ((this._improvementMode && this._currentFrameRate <= this._targetFrameRate) || (!this._improvementMode && this._currentFrameRate >= this._targetFrameRate)) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n\r\n // Apply current level of optimizations\r\n let allDone = true;\r\n let noOptimizationApplied = true;\r\n for (let index = 0; index < options.optimizations.length; index++) {\r\n const optimization = options.optimizations[index];\r\n\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n\r\n return;\r\n }\r\n\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n public static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): SceneOptimizer {\r\n const optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(() => {\r\n onSuccess();\r\n });\r\n }\r\n\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(() => {\r\n onFailure();\r\n });\r\n }\r\n\r\n optimizer.start();\r\n\r\n return optimizer;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"sceneOptimizer.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/sceneOptimizer.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH;IAmBI;;;OAGG;IACH;IACI;;OAEG;IACI,QAAoB;QAApB,yBAAA,EAAA,YAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAC5B,CAAC;IA3BJ;;;OAGG;IACI,0CAAc,GAArB;QACI,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,iCAAK,GAAZ,UAAa,KAAY,EAAE,SAAyB;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;IAYL,wBAAC;AAAD,CAAC,AA7BD,IA6BC;;AAED;;;GAGG;AACH;IAAyC,uCAAiB;IAStD;;;;;OAKG;IACH;IACI;;OAEG;IACI,QAAoB;IAC3B;;OAEG;IACI,WAA0B;IACjC;;OAEG;IACI,IAAU;QARV,yBAAA,EAAA,YAAoB;QAIpB,4BAAA,EAAA,kBAA0B;QAI1B,qBAAA,EAAA,UAAU;QAZrB,YAcI,kBAAM,QAAQ,CAAC,SAClB;QAXU,cAAQ,GAAR,QAAQ,CAAY;QAIpB,iBAAW,GAAX,WAAW,CAAe;QAI1B,UAAI,GAAJ,IAAI,CAAM;;IAGrB,CAAC;IA7BD;;;OAGG;IACI,4CAAc,GAArB;QACI,OAAO,yCA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gBAAgB,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,gCAAO,GAAd;QACI,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,kCAAkC,CAAC,KAAK,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACtE;IACL,CAAC;IAED;;;;;;;OAOG;IACW,4BAAa,GAA3B,UAA4B,KAAY,EAAE,OAA+B,EAAE,SAAsB,EAAE,SAAsB;QACrH,IAAM,SAAS,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,IAAI,qBAAqB,CAAC,0BAA0B,EAAE,EAAE,KAAK,CAAC,CAAC;QAElH,IAAI,SAAS,EAAE;YACX,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC;gBAC9B,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC;gBAC9B,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,SAAS,CAAC;IACrB,CAAC;IACL,qBAAC;AAAD,CAAC,AApPD,IAoPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0\r\n ) {}\r\n}\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class TextureOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n }\r\n\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n public maximumSize: number = 1024,\r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n public step = 0.5\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n let allDone = true;\r\n for (let index = 0; index < scene.textures.length; index++) {\r\n const texture = scene.textures[index];\r\n\r\n if (!texture.canRescale || (<any>texture).getContext) {\r\n continue;\r\n }\r\n\r\n const currentSize = texture.getSize();\r\n const maxDimension = Math.max(currentSize.width, currentSize.height);\r\n\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n\r\n return allDone;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class HardwareScalingOptimization extends SceneOptimization {\r\n private _currentScale = -1;\r\n private _directionOffset = 1;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n }\r\n\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n public maximumScale: number = 2,\r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n public step: number = 0.25\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n\r\n this._currentScale += this._directionOffset * this.step;\r\n\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ShadowsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning shadows on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class PostProcessesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning post-processes on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class LensFlaresOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning lens flares on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class CustomOptimization extends SceneOptimization {\r\n /**\r\n * Callback called to apply the custom optimization.\r\n */\r\n public onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean;\r\n\r\n /**\r\n * Callback called to get custom description\r\n */\r\n public onGetDescription: () => string;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n\r\n return \"Running user defined callback\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ParticlesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning particles on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class RenderTargetsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning render targets off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class MergeMeshesOptimization extends SceneOptimization {\r\n private static _UpdateSelectionTree = false;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static get UpdateSelectionTree(): boolean {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static set UpdateSelectionTree(value: boolean) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n }\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Merging similar meshes together\";\r\n }\r\n\r\n private _canBeMerged = (abstractMesh: AbstractMesh): boolean => {\r\n if (!(abstractMesh instanceof Mesh)) {\r\n return false;\r\n }\r\n\r\n const mesh = <Mesh>abstractMesh;\r\n\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer, updateSelectionTree?: boolean): boolean {\r\n const globalPool = scene.meshes.slice(0);\r\n let globalLength = globalPool.length;\r\n\r\n for (let index = 0; index < globalLength; index++) {\r\n const currentPool = new Array<Mesh>();\r\n const current = globalPool[index];\r\n\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>current);\r\n\r\n // Find compatible meshes\r\n for (let subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n const otherMesh = globalPool[subIndex];\r\n\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>otherMesh);\r\n globalLength--;\r\n\r\n globalPool.splice(subIndex, 1);\r\n\r\n subIndex--;\r\n }\r\n\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n\r\n // Merge meshes\r\n Mesh.MergeMeshes(currentPool, undefined, true);\r\n }\r\n\r\n // Call the octree system optimization if it is defined.\r\n const sceneAsAny = scene as any;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n } else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizerOptions {\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n public optimizations = new Array<SceneOptimization>();\r\n\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checks (2000ms by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n public targetFrameRate: number = 60,\r\n /**\r\n * Defines the interval between two checks (2000ms by default)\r\n */\r\n public trackerDuration: number = 2000\r\n ) {}\r\n\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addOptimization(optimization: SceneOptimization): SceneOptimizerOptions {\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addCustomOptimization(onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean, onGetDescription: () => string, priority: number = 0): SceneOptimizerOptions {\r\n const optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizer implements IDisposable {\r\n private _isRunning = false;\r\n private _options: SceneOptimizerOptions;\r\n private _scene: Scene;\r\n private _currentPriorityLevel = 0;\r\n private _targetFrameRate = 60;\r\n private _trackerDuration = 2000;\r\n private _currentFrameRate = 0;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _improvementMode = false;\r\n\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n public onSuccessObservable = new Observable<SceneOptimizer>();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n public onNewOptimizationAppliedObservable = new Observable<SceneOptimization>();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n public onFailureObservable = new Observable<SceneOptimizer>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n public get isInImprovementMode(): boolean {\r\n return this._improvementMode;\r\n }\r\n\r\n public set isInImprovementMode(value: boolean) {\r\n this._improvementMode = value;\r\n }\r\n\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n public get currentPriorityLevel(): number {\r\n return this._currentPriorityLevel;\r\n }\r\n\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n public get currentFrameRate(): number {\r\n return this._currentFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public get targetFrameRate(): number {\r\n return this._targetFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public set targetFrameRate(value: number) {\r\n this._targetFrameRate = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public get trackerDuration(): number {\r\n return this._trackerDuration;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public set trackerDuration(value: number) {\r\n this._trackerDuration = value;\r\n }\r\n\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n public get optimizations(): SceneOptimization[] {\r\n return this._options.optimizations;\r\n }\r\n\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n public constructor(scene: Scene, options?: SceneOptimizerOptions, autoGeneratePriorities = true, improvementMode = false) {\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n } else {\r\n this._options = options;\r\n }\r\n\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n\r\n if (autoGeneratePriorities) {\r\n let priority = 0;\r\n for (const optim of this._options.optimizations) {\r\n optim.priority = priority++;\r\n }\r\n }\r\n\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Stops the current optimizer\r\n */\r\n public stop() {\r\n this._isRunning = false;\r\n }\r\n\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n public reset() {\r\n this._currentPriorityLevel = 0;\r\n }\r\n\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimization while frame rate is above the target frame rate\r\n */\r\n public start() {\r\n if (this._isRunning) {\r\n return;\r\n }\r\n\r\n this._isRunning = true;\r\n\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n private _checkCurrentState() {\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n\r\n const scene = this._scene;\r\n const options = this._options;\r\n\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n\r\n if ((this._improvementMode && this._currentFrameRate <= this._targetFrameRate) || (!this._improvementMode && this._currentFrameRate >= this._targetFrameRate)) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n\r\n // Apply current level of optimizations\r\n let allDone = true;\r\n let noOptimizationApplied = true;\r\n for (let index = 0; index < options.optimizations.length; index++) {\r\n const optimization = options.optimizations[index];\r\n\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n\r\n return;\r\n }\r\n\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n public static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): SceneOptimizer {\r\n const optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(() => {\r\n onSuccess();\r\n });\r\n }\r\n\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(() => {\r\n onFailure();\r\n });\r\n }\r\n\r\n optimizer.start();\r\n\r\n return optimizer;\r\n }\r\n}\r\n"]}
@@ -409,7 +409,7 @@ var OimoJSPlugin = /** @class */ (function () {
409
409
  mesh.rotationQuaternion.x = body.orientation.x;
410
410
  mesh.rotationQuaternion.y = body.orientation.y;
411
411
  mesh.rotationQuaternion.z = body.orientation.z;
412
- mesh.rotationQuaternion.w = body.orientation.s;
412
+ mesh.rotationQuaternion.w = body.orientation.w;
413
413
  }
414
414
  };
415
415
  OimoJSPlugin.prototype.getRadius = function (impostor) {
@@ -1 +1 @@
1
- {"version":3,"file":"oimoJSPlugin.js","sourceRoot":"","s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Ad,UAAe,IAAa,EAAE,EAAW;QACrC,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAE7E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAhfD,IAgfC","sourcesContent":["import type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from \"../../Physics/IPhysicsEngine\";\r\nimport type { IPhysicsEnabledObject } from \"../../Physics/physicsImpostor\";\r\nimport { PhysicsImpostor } from \"../../Physics/physicsImpostor\";\r\nimport type { IMotorEnabledJoint, DistanceJointData, SpringJointData } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsJoint } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsEngine } from \"../../Physics/physicsEngine\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\n\r\ndeclare let OIMO: any;\r\n\r\n/** @hidden */\r\nexport class OimoJSPlugin implements IPhysicsEnginePlugin {\r\n public world: any;\r\n public name: string = \"OimoJSPlugin\";\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public BJSOIMO: any;\r\n private _raycastResult: PhysicsRaycastResult;\r\n private _fixedTimeStep: number = 1 / 60;\r\n\r\n constructor(private _useDeltaForWorldStep: boolean = true, iterations?: number, oimoInjection = OIMO) {\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations,\r\n });\r\n this.world.clear();\r\n this._raycastResult = new PhysicsRaycastResult();\r\n }\r\n\r\n public setGravity(gravity: Vector3) {\r\n this.world.gravity.set(gravity.x, gravity.y, gravity.z);\r\n }\r\n\r\n public setTimeStep(timeStep: number) {\r\n this.world.timeStep = timeStep;\r\n }\r\n\r\n public getTimeStep(): number {\r\n return this.world.timeStep;\r\n }\r\n\r\n private _tmpImpostorsArray: Array<PhysicsImpostor> = [];\r\n\r\n public executeStep(delta: number, impostors: Array<PhysicsImpostor>) {\r\n impostors.forEach(function (impostor) {\r\n impostor.beforeStep();\r\n });\r\n\r\n this.world.timeStep = this._useDeltaForWorldStep ? delta : this._fixedTimeStep;\r\n this.world.step();\r\n\r\n impostors.forEach((impostor) => {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n });\r\n\r\n //check for collisions\r\n let contact = this.world.contacts;\r\n\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n const mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n const collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody, point: null });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody, point: null });\r\n contact = contact.next;\r\n }\r\n }\r\n\r\n public applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n }\r\n public applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n Logger.Warn(\"Oimo doesn't support applying force. Using impule instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n }\r\n public generatePhysicsBody(impostor: PhysicsImpostor) {\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n\r\n if (impostor.isBodyInitRequired()) {\r\n const bodyConfig: any = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 0.001, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world,\r\n };\r\n\r\n const impostors = [impostor];\r\n const addToArray = (parent: IPhysicsEnabledObject) => {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n parent.getChildMeshes().forEach(function (m) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n });\r\n };\r\n addToArray(impostor.object);\r\n\r\n const checkWithEpsilon = (value: number): number => {\r\n return Math.max(value, PhysicsEngine.Epsilon);\r\n };\r\n\r\n const globalQuaternion: Quaternion = new Quaternion();\r\n\r\n impostors.forEach((i) => {\r\n if (!i.object.rotationQuaternion) {\r\n return;\r\n }\r\n //get the correct bounding box\r\n const oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion.copyFrom(oldQuaternion);\r\n\r\n i.object.rotationQuaternion.set(0, 0, 0, 1);\r\n i.object.computeWorldMatrix(true);\r\n\r\n const rot = globalQuaternion.toEulerAngles();\r\n const extendSize = i.getObjectExtendSize();\r\n\r\n // eslint-disable-next-line no-loss-of-precision\r\n const radToDeg = 57.295779513082320876;\r\n\r\n if (i === impostor) {\r\n const center = impostor.getObjectCenter();\r\n\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, this._tmpPositionVector);\r\n this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n } else {\r\n const localPosition = i.object.position.clone();\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n\r\n // bodyConfig.pos.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(rot.x * radToDeg, rot.y * radToDeg, rot.z * radToDeg);\r\n }\r\n\r\n i.object.rotationQuaternion.copyFrom(globalQuaternion);\r\n\r\n // register mesh\r\n switch (i.type) {\r\n case PhysicsImpostor.ParticleImpostor:\r\n Logger.Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsImpostor.SphereImpostor: {\r\n const radiusX = extendSize.x;\r\n const radiusY = extendSize.y;\r\n const radiusZ = extendSize.z;\r\n\r\n const size = Math.max(checkWithEpsilon(radiusX), checkWithEpsilon(radiusY), checkWithEpsilon(radiusZ)) / 2;\r\n\r\n bodyConfig.type.push(\"sphere\");\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n }\r\n case PhysicsImpostor.CylinderImpostor: {\r\n const sizeX = checkWithEpsilon(extendSize.x) / 2;\r\n const sizeY = checkWithEpsilon(extendSize.y);\r\n bodyConfig.type.push(\"cylinder\");\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n }\r\n case PhysicsImpostor.PlaneImpostor:\r\n case PhysicsImpostor.BoxImpostor:\r\n default: {\r\n const sizeX = checkWithEpsilon(extendSize.x);\r\n const sizeY = checkWithEpsilon(extendSize.y);\r\n const sizeZ = checkWithEpsilon(extendSize.z);\r\n\r\n bodyConfig.type.push(\"box\");\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n }\r\n\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n });\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion);\r\n // update with delta 0, so the body will receive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n } else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n }\r\n\r\n private _tmpPositionVector: Vector3 = Vector3.Zero();\r\n\r\n public removePhysicsBody(impostor: PhysicsImpostor) {\r\n //impostor.physicsBody.dispose();\r\n //Same as : (older oimo versions)\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n\r\n public generateJoint(impostorJoint: PhysicsImpostorJoint) {\r\n const mainBody = impostorJoint.mainImpostor.physicsBody;\r\n const connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n const jointData = impostorJoint.joint.jointData;\r\n const options = jointData.nativeParams || {};\r\n let type;\r\n const nativeJointData: any = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n\r\n //supporting older version of Oimo\r\n world: this.world,\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case PhysicsJoint.BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case PhysicsJoint.SpringJoint: {\r\n Logger.Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n const springData = <SpringJointData>jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsJoint.DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = (<DistanceJointData>jointData).maxDistance;\r\n break;\r\n case PhysicsJoint.PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case PhysicsJoint.SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case PhysicsJoint.WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case PhysicsJoint.HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n }\r\n\r\n public removeJoint(impostorJoint: PhysicsImpostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n } catch (e) {\r\n Logger.Warn(e);\r\n }\r\n }\r\n\r\n public isSupported(): boolean {\r\n return this.BJSOIMO !== undefined;\r\n }\r\n\r\n public setTransformationFromPhysicsBody(impostor: PhysicsImpostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n if (impostor.physicsBody.shapes.next) {\r\n let parent = impostor.physicsBody.shapes;\r\n while (parent.next) {\r\n parent = parent.next;\r\n }\r\n impostor.object.position.set(parent.position.x, parent.position.y, parent.position.z);\r\n } else {\r\n const pos = impostor.physicsBody.getPosition();\r\n impostor.object.position.set(pos.x, pos.y, pos.z);\r\n }\r\n //}\r\n\r\n if (impostor.object.rotationQuaternion) {\r\n const quat = impostor.physicsBody.getQuaternion();\r\n impostor.object.rotationQuaternion.set(quat.x, quat.y, quat.z, quat.w);\r\n }\r\n }\r\n }\r\n\r\n public setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion) {\r\n const body = impostor.physicsBody;\r\n // disable bidirectional for compound meshes\r\n if (impostor.physicsBody.shapes.next) {\r\n return;\r\n }\r\n body.position.set(newPosition.x, newPosition.y, newPosition.z);\r\n body.orientation.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n body.syncShapes();\r\n body.awake();\r\n }\r\n\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n\r\n public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n public getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n\r\n public setBodyMass(impostor: PhysicsImpostor, mass: number) {\r\n const staticBody: boolean = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n }\r\n\r\n public getBodyMass(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.density;\r\n }\r\n\r\n public getBodyFriction(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.friction;\r\n }\r\n\r\n public setBodyFriction(impostor: PhysicsImpostor, friction: number) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n }\r\n\r\n public getBodyRestitution(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.restitution;\r\n }\r\n\r\n public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n }\r\n\r\n public sleepBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.sleep();\r\n }\r\n\r\n public wakeUpBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.awake();\r\n }\r\n\r\n public updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n }\r\n\r\n public setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number) {\r\n if (force !== undefined) {\r\n Logger.Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n } else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n }\r\n\r\n public setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number) {\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n }\r\n\r\n public syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor) {\r\n const body = impostor.physicsBody;\r\n\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.s;\r\n }\r\n }\r\n\r\n public getRadius(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.radius;\r\n }\r\n\r\n public getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void {\r\n const shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n }\r\n\r\n public dispose() {\r\n this.world.clear();\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n this._raycastResult.reset(from, to);\r\n\r\n return this._raycastResult;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"oimoJSPlugin.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Physics/Plugins/oimoJSPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,+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AAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAhfD,IAgfC","sourcesContent":["import type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from \"../../Physics/IPhysicsEngine\";\r\nimport type { IPhysicsEnabledObject } from \"../../Physics/physicsImpostor\";\r\nimport { PhysicsImpostor } from \"../../Physics/physicsImpostor\";\r\nimport type { IMotorEnabledJoint, DistanceJointData, SpringJointData } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsJoint } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsEngine } from \"../../Physics/physicsEngine\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\n\r\ndeclare let OIMO: any;\r\n\r\n/** @hidden */\r\nexport class OimoJSPlugin implements IPhysicsEnginePlugin {\r\n public world: any;\r\n public name: string = \"OimoJSPlugin\";\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public BJSOIMO: any;\r\n private _raycastResult: PhysicsRaycastResult;\r\n private _fixedTimeStep: number = 1 / 60;\r\n\r\n constructor(private _useDeltaForWorldStep: boolean = true, iterations?: number, oimoInjection = OIMO) {\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations,\r\n });\r\n this.world.clear();\r\n this._raycastResult = new PhysicsRaycastResult();\r\n }\r\n\r\n public setGravity(gravity: Vector3) {\r\n this.world.gravity.set(gravity.x, gravity.y, gravity.z);\r\n }\r\n\r\n public setTimeStep(timeStep: number) {\r\n this.world.timeStep = timeStep;\r\n }\r\n\r\n public getTimeStep(): number {\r\n return this.world.timeStep;\r\n }\r\n\r\n private _tmpImpostorsArray: Array<PhysicsImpostor> = [];\r\n\r\n public executeStep(delta: number, impostors: Array<PhysicsImpostor>) {\r\n impostors.forEach(function (impostor) {\r\n impostor.beforeStep();\r\n });\r\n\r\n this.world.timeStep = this._useDeltaForWorldStep ? delta : this._fixedTimeStep;\r\n this.world.step();\r\n\r\n impostors.forEach((impostor) => {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n });\r\n\r\n //check for collisions\r\n let contact = this.world.contacts;\r\n\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n const mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n const collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody, point: null });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody, point: null });\r\n contact = contact.next;\r\n }\r\n }\r\n\r\n public applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n }\r\n public applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n Logger.Warn(\"Oimo doesn't support applying force. Using impule instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n }\r\n public generatePhysicsBody(impostor: PhysicsImpostor) {\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n\r\n if (impostor.isBodyInitRequired()) {\r\n const bodyConfig: any = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 0.001, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world,\r\n };\r\n\r\n const impostors = [impostor];\r\n const addToArray = (parent: IPhysicsEnabledObject) => {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n parent.getChildMeshes().forEach(function (m) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n });\r\n };\r\n addToArray(impostor.object);\r\n\r\n const checkWithEpsilon = (value: number): number => {\r\n return Math.max(value, PhysicsEngine.Epsilon);\r\n };\r\n\r\n const globalQuaternion: Quaternion = new Quaternion();\r\n\r\n impostors.forEach((i) => {\r\n if (!i.object.rotationQuaternion) {\r\n return;\r\n }\r\n //get the correct bounding box\r\n const oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion.copyFrom(oldQuaternion);\r\n\r\n i.object.rotationQuaternion.set(0, 0, 0, 1);\r\n i.object.computeWorldMatrix(true);\r\n\r\n const rot = globalQuaternion.toEulerAngles();\r\n const extendSize = i.getObjectExtendSize();\r\n\r\n // eslint-disable-next-line no-loss-of-precision\r\n const radToDeg = 57.295779513082320876;\r\n\r\n if (i === impostor) {\r\n const center = impostor.getObjectCenter();\r\n\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, this._tmpPositionVector);\r\n this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n } else {\r\n const localPosition = i.object.position.clone();\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n\r\n // bodyConfig.pos.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(rot.x * radToDeg, rot.y * radToDeg, rot.z * radToDeg);\r\n }\r\n\r\n i.object.rotationQuaternion.copyFrom(globalQuaternion);\r\n\r\n // register mesh\r\n switch (i.type) {\r\n case PhysicsImpostor.ParticleImpostor:\r\n Logger.Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsImpostor.SphereImpostor: {\r\n const radiusX = extendSize.x;\r\n const radiusY = extendSize.y;\r\n const radiusZ = extendSize.z;\r\n\r\n const size = Math.max(checkWithEpsilon(radiusX), checkWithEpsilon(radiusY), checkWithEpsilon(radiusZ)) / 2;\r\n\r\n bodyConfig.type.push(\"sphere\");\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n }\r\n case PhysicsImpostor.CylinderImpostor: {\r\n const sizeX = checkWithEpsilon(extendSize.x) / 2;\r\n const sizeY = checkWithEpsilon(extendSize.y);\r\n bodyConfig.type.push(\"cylinder\");\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n }\r\n case PhysicsImpostor.PlaneImpostor:\r\n case PhysicsImpostor.BoxImpostor:\r\n default: {\r\n const sizeX = checkWithEpsilon(extendSize.x);\r\n const sizeY = checkWithEpsilon(extendSize.y);\r\n const sizeZ = checkWithEpsilon(extendSize.z);\r\n\r\n bodyConfig.type.push(\"box\");\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n }\r\n\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n });\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion);\r\n // update with delta 0, so the body will receive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n } else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n }\r\n\r\n private _tmpPositionVector: Vector3 = Vector3.Zero();\r\n\r\n public removePhysicsBody(impostor: PhysicsImpostor) {\r\n //impostor.physicsBody.dispose();\r\n //Same as : (older oimo versions)\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n\r\n public generateJoint(impostorJoint: PhysicsImpostorJoint) {\r\n const mainBody = impostorJoint.mainImpostor.physicsBody;\r\n const connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n const jointData = impostorJoint.joint.jointData;\r\n const options = jointData.nativeParams || {};\r\n let type;\r\n const nativeJointData: any = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n\r\n //supporting older version of Oimo\r\n world: this.world,\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case PhysicsJoint.BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case PhysicsJoint.SpringJoint: {\r\n Logger.Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n const springData = <SpringJointData>jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsJoint.DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = (<DistanceJointData>jointData).maxDistance;\r\n break;\r\n case PhysicsJoint.PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case PhysicsJoint.SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case PhysicsJoint.WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case PhysicsJoint.HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n }\r\n\r\n public removeJoint(impostorJoint: PhysicsImpostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n } catch (e) {\r\n Logger.Warn(e);\r\n }\r\n }\r\n\r\n public isSupported(): boolean {\r\n return this.BJSOIMO !== undefined;\r\n }\r\n\r\n public setTransformationFromPhysicsBody(impostor: PhysicsImpostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n if (impostor.physicsBody.shapes.next) {\r\n let parent = impostor.physicsBody.shapes;\r\n while (parent.next) {\r\n parent = parent.next;\r\n }\r\n impostor.object.position.set(parent.position.x, parent.position.y, parent.position.z);\r\n } else {\r\n const pos = impostor.physicsBody.getPosition();\r\n impostor.object.position.set(pos.x, pos.y, pos.z);\r\n }\r\n //}\r\n\r\n if (impostor.object.rotationQuaternion) {\r\n const quat = impostor.physicsBody.getQuaternion();\r\n impostor.object.rotationQuaternion.set(quat.x, quat.y, quat.z, quat.w);\r\n }\r\n }\r\n }\r\n\r\n public setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion) {\r\n const body = impostor.physicsBody;\r\n // disable bidirectional for compound meshes\r\n if (impostor.physicsBody.shapes.next) {\r\n return;\r\n }\r\n body.position.set(newPosition.x, newPosition.y, newPosition.z);\r\n body.orientation.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n body.syncShapes();\r\n body.awake();\r\n }\r\n\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n\r\n public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n public getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n\r\n public setBodyMass(impostor: PhysicsImpostor, mass: number) {\r\n const staticBody: boolean = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n }\r\n\r\n public getBodyMass(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.density;\r\n }\r\n\r\n public getBodyFriction(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.friction;\r\n }\r\n\r\n public setBodyFriction(impostor: PhysicsImpostor, friction: number) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n }\r\n\r\n public getBodyRestitution(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.restitution;\r\n }\r\n\r\n public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n }\r\n\r\n public sleepBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.sleep();\r\n }\r\n\r\n public wakeUpBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.awake();\r\n }\r\n\r\n public updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n }\r\n\r\n public setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number) {\r\n if (force !== undefined) {\r\n Logger.Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n } else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n }\r\n\r\n public setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number) {\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n }\r\n\r\n public syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor) {\r\n const body = impostor.physicsBody;\r\n\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.w;\r\n }\r\n }\r\n\r\n public getRadius(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.radius;\r\n }\r\n\r\n public getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void {\r\n const shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n }\r\n\r\n public dispose() {\r\n this.world.clear();\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n this._raycastResult.reset(from, to);\r\n\r\n return this._raycastResult;\r\n }\r\n}\r\n"]}
@@ -187,17 +187,23 @@ var RenderingGroup = /** @class */ (function () {
187
187
  var subIndex = 0;
188
188
  var subMesh;
189
189
  var cameraPosition = camera ? camera.globalPosition : RenderingGroup._ZeroVector;
190
- for (; subIndex < subMeshes.length; subIndex++) {
191
- subMesh = subMeshes.data[subIndex];
192
- subMesh._alphaIndex = subMesh.getMesh().alphaIndex;
193
- subMesh._distanceToCamera = Vector3.Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);
190
+ if (transparent) {
191
+ for (; subIndex < subMeshes.length; subIndex++) {
192
+ subMesh = subMeshes.data[subIndex];
193
+ subMesh._alphaIndex = subMesh.getMesh().alphaIndex;
194
+ subMesh._distanceToCamera = Vector3.Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);
195
+ }
194
196
  }
195
197
  var sortedArray = subMeshes.data.slice(0, subMeshes.length);
196
198
  if (sortCompareFn) {
197
199
  sortedArray.sort(sortCompareFn);
198
200
  }
201
+ var scene = sortedArray[0].getMesh().getScene();
199
202
  for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {
200
203
  subMesh = sortedArray[subIndex];
204
+ if (scene._activeMeshesFrozenButKeepClipping && !subMesh.isInFrustum(scene._frustumPlanes)) {
205
+ continue;
206
+ }
201
207
  if (transparent) {
202
208
  var material = subMesh.getMaterial();
203
209
  if (material && material.needDepthPrePass) {
@@ -216,8 +222,12 @@ var RenderingGroup = /** @class */ (function () {
216
222
  * @param subMeshes The submeshes to render
217
223
  */
218
224
  RenderingGroup._RenderUnsorted = function (subMeshes) {
225
+ var scene = subMeshes.data[0].getMesh().getScene();
219
226
  for (var subIndex = 0; subIndex < subMeshes.length; subIndex++) {
220
227
  var submesh = subMeshes.data[subIndex];
228
+ if (scene._activeMeshesFrozenButKeepClipping && !submesh.isInFrustum(scene._frustumPlanes)) {
229
+ continue;
230
+ }
221
231
  submesh.render(false);
222
232
  }
223
233
  };