@babylonjs/core 5.1.0 → 5.4.0
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.
- package/Audio/audioSceneComponent.d.ts +2 -0
- package/Audio/audioSceneComponent.js +9 -7
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +7 -0
- package/Behaviors/Cameras/autoRotationBehavior.js +15 -0
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +1 -0
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/skeleton.js +2 -0
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +5 -0
- package/Cameras/arcRotateCamera.js +5 -0
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +7 -2
- package/Cameras/camera.js +11 -8
- package/Cameras/camera.js.map +1 -1
- package/Debug/debugLayer.d.ts +5 -0
- package/Debug/debugLayer.js +24 -0
- package/Debug/debugLayer.js.map +1 -1
- package/DeviceInput/Helpers/eventFactory.js +14 -3
- package/DeviceInput/Helpers/eventFactory.js.map +1 -1
- package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
- package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
- package/DeviceInput/InputDevices/nativeDeviceInputSystem.js +2 -8
- package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +1 -1
- package/Engines/Processors/shaderCodeCursor.js +5 -0
- package/Engines/Processors/shaderCodeCursor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -2
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -0
- package/Engines/WebGPU/webgpuTextureHelper.js +16 -3
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/constants.d.ts +29 -1
- package/Engines/constants.js +29 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +3 -3
- package/Engines/engine.js +2 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +7 -8
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +4 -0
- package/Engines/webgpuEngine.js +16 -5
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +3 -2
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +11 -11
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/gizmo.d.ts +5 -0
- package/Gizmos/gizmo.js +11 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +3 -3
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +7 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +9 -0
- package/Lights/Shadows/shadowGenerator.js +25 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +10 -8
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +4 -0
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +19 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +54 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +135 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +4 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +42 -24
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/PBR/index.d.ts +1 -0
- package/Materials/PBR/index.js +1 -0
- package/Materials/PBR/index.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +5 -0
- package/Materials/PBR/pbrBaseMaterial.js +2 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +102 -0
- package/Materials/PBR/pbrIridescenceConfiguration.js +257 -0
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -0
- package/Materials/Textures/Loaders/ktxTextureLoader.js +31 -0
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +3 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +12 -12
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/materialFlags.d.ts +6 -0
- package/Materials/materialFlags.js +18 -0
- package/Materials/materialFlags.js.map +1 -1
- package/Materials/materialHelper.js +1 -1
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginFactoryExport.d.ts +6 -0
- package/Materials/materialPluginFactoryExport.js +12 -0
- package/Materials/materialPluginFactoryExport.js.map +1 -1
- package/Materials/shaderMaterial.js +1 -0
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +2 -1
- package/Materials/uniformBuffer.js +2 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.d.ts +4 -0
- package/Maths/math.vector.js +10 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js +5 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/mesh.js +11 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +2 -1
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/khronosTextureContainer.js +1 -1
- package/Misc/khronosTextureContainer.js.map +1 -1
- package/Misc/screenshotTools.js +6 -6
- package/Misc/screenshotTools.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.js +1 -1
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/physicsImpostor.js +1 -1
- package/Physics/physicsImpostor.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +6 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +4 -4
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/renderingGroup.js +8 -0
- package/Rendering/renderingGroup.js.map +1 -1
- package/Shaders/ShadersInclude/boundingBoxRendererUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/boundingBoxRendererUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +1 -1
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockIridescence.d.ts +5 -0
- package/Shaders/ShadersInclude/pbrBlockIridescence.js +9 -0
- package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -0
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/pbr.fragment.d.ts +1 -0
- package/Shaders/pbr.fragment.js +2 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +1 -1
- package/Shaders/pbr.vertex.js.map +1 -1
- package/Shaders/spriteMap.fragment.js +1 -1
- package/Shaders/spriteMap.fragment.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +1 -0
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRImageTracking.d.ts +0 -5
- package/XR/features/WebXRImageTracking.js +5 -8
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/native/nativeXRFrame.d.ts +2 -1
- package/XR/native/nativeXRFrame.js +5 -1
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +7 -1
- package/scene.js +11 -3
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshotTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/screenshotTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAA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,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,GAAG,IAAI,CAAC;KAChB;IAED,iIAAiI;IACjI,8JAA8J;IAC9J,0IAA0I;IAC1I,uEAAuE;IACvE,IAAI,KAAK,EAAE;QACP,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC7B;IACD,IAAI,MAAM,EAAE;QACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC/B;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC3B;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,kBAAA;IAEhB;;;;;;;;;;;;;;OAcG;IACH,qBAAqB,uBAAA;IAErB;;;;;;;;;;;OAWG;IACH,+BAA+B,iCAAA;IAE/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iCAAiC,mCAAA;IAEjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,sCAAsC,wCAAA;CACzC,CAAC;AAEF;;;;;GAKG;AACH,IAAM,eAAe,GAAG;IACpB,+BAA+B;IAC/B,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC1C,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACpD,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;IAC5E,KAAK,CAAC,sCAAsC,GAAG,sCAAsC,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\nimport type { IScreenshotSize } from \"./interfaces/screenshotSize\";\r\n\r\ndeclare type Engine = import(\"../Engines/engine\").Engine;\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\nexport function CreateScreenshot(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n forceDownload = false\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n\r\n const renderContext = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n\r\n const ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n let newWidth = width;\r\n let newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n\r\n const offsetX = Math.max(0, width - newWidth) / 2;\r\n const offsetY = Math.max(0, height - newHeight) / 2;\r\n\r\n engine.onEndFrameObservable.addOnce(() => {\r\n const renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n\r\n if (forceDownload) {\r\n Tools.EncodeScreenshotCanvasData(undefined, mimeType);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else {\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType: string = \"image/png\"): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotWithResizeAsync(engine: Engine, camera: Camera, width: number, height: number, mimeType: string = \"image/png\"): Promise<void> {\r\n return new Promise((resolve) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n { width: width, height: height },\r\n () => {\r\n resolve();\r\n },\r\n mimeType,\r\n true\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\nexport function CreateScreenshotUsingRenderTarget(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false,\r\n enableStencilBuffer: boolean = false\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n const targetTextureSize = { width, height };\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n const scene = camera.getScene();\r\n let previousCamera: Nullable<Camera> = null;\r\n const previousCameras = scene.activeCameras;\r\n\r\n scene.activeCameras = null;\r\n\r\n if (scene.activeCamera !== camera) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n scene.render(); // make sure the scene is ready to be rendered in the RTT with the right list of active meshes (which depends on the camera, that may have been changed above)\r\n\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n const texture = new RenderTargetTexture(\r\n \"screenShot\",\r\n targetTextureSize,\r\n scene,\r\n false,\r\n false,\r\n Constants.TEXTURETYPE_UNSIGNED_INT,\r\n false,\r\n Texture.NEAREST_SAMPLINGMODE,\r\n undefined,\r\n enableStencilBuffer,\r\n undefined,\r\n undefined,\r\n undefined,\r\n samples\r\n );\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n\r\n engine.onEndFrameObservable.addOnce(() => {\r\n texture.readPixels(undefined, undefined, undefined, false)!.then((data) => {\r\n Tools.DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true);\r\n texture.dispose();\r\n });\r\n });\r\n\r\n const renderToTexture = () => {\r\n // render the RTT\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n\r\n // re-render the scene after the camera has been reset to the original camera to avoid a flicker that could occur\r\n // if the camera used for the RTT rendering stays in effect for the next frame (and if that camera was different from the original camera)\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n scene.activeCameras = previousCameras;\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n scene.render();\r\n };\r\n\r\n if (antialiasing) {\r\n const fxaaPostProcess = new FxaaPostProcess(\"antialiasing\", 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = () => {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n } else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotUsingRenderTargetAsync(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType,\r\n samples,\r\n antialiasing,\r\n fileName,\r\n renderSprites\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Gets height and width for screenshot size\r\n * @param engine\r\n * @param camera\r\n * @param size\r\n * @private\r\n */\r\nfunction _GetScreenshotSize(engine: Engine, camera: Camera, size: IScreenshotSize | number): { height: number; width: number } {\r\n let height = 0;\r\n let width = 0;\r\n\r\n //If a size value defined as object\r\n if (typeof size === \"object\") {\r\n const precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n } else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n\r\n return { height: height | 0, width: width | 0 };\r\n}\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nexport const ScreenshotTools = {\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\n CreateScreenshot,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotAsync,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotWithResizeAsync,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\n CreateScreenshotUsingRenderTarget,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotUsingRenderTargetAsync,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @hidden\r\n */\r\nconst initSideEffects = () => {\r\n // References the dependencies.\r\n Tools.CreateScreenshot = CreateScreenshot;\r\n Tools.CreateScreenshotAsync = CreateScreenshotAsync;\r\n Tools.CreateScreenshotUsingRenderTarget = CreateScreenshotUsingRenderTarget;\r\n Tools.CreateScreenshotUsingRenderTargetAsync = CreateScreenshotUsingRenderTargetAsync;\r\n};\r\n\r\ninitSideEffects();\r\n"]}
|
|
1
|
+
{"version":3,"file":"screenshotTools.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/screenshotTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKhC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAAc,EACd,MAAc,EACd,IAA8B,EAC9B,eAAwC,EACxC,QAA8B,EAC9B,aAAqB;IADrB,yBAAA,EAAA,sBAA8B;IAC9B,8BAAA,EAAA,qBAAqB;IAEf,IAAA,KAAoB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAA1D,MAAM,YAAA,EAAE,KAAK,WAA6C,CAAC;IAEnE,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE;QACpB,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC3C,OAAO;KACV;IAED,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE;QAC1B,KAAK,CAAC,iBAAiB,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;KAC9D;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAK,GAAG,KAAK,CAAC;IACtC,KAAK,CAAC,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC;IAExC,IAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/D,IAAM,K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gB,GAAG,gBAAgB,CAAC;IAC1C,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACpD,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;IAC5E,KAAK,CAAC,sCAAsC,GAAG,sCAAsC,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\nimport type { IScreenshotSize } from \"./interfaces/screenshotSize\";\r\n\r\ndeclare type Engine = import(\"../Engines/engine\").Engine;\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\nexport function CreateScreenshot(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n forceDownload = false\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n\r\n const renderContext = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n\r\n const ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n let newWidth = width;\r\n let newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n\r\n const offsetX = Math.max(0, width - newWidth) / 2;\r\n const offsetY = Math.max(0, height - newHeight) / 2;\r\n\r\n engine.onEndFrameObservable.addOnce(() => {\r\n const renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n\r\n if (forceDownload) {\r\n Tools.EncodeScreenshotCanvasData(undefined, mimeType);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else {\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType: string = \"image/png\"): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotWithResizeAsync(engine: Engine, camera: Camera, width: number, height: number, mimeType: string = \"image/png\"): Promise<void> {\r\n return new Promise((resolve) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n { width: width, height: height },\r\n () => {\r\n resolve();\r\n },\r\n mimeType,\r\n true\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\nexport function CreateScreenshotUsingRenderTarget(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false,\r\n enableStencilBuffer: boolean = false\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n const targetTextureSize = { width, height };\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n const scene = camera.getScene();\r\n let previousCamera: Nullable<Camera> = null;\r\n const previousCameras = scene.activeCameras;\r\n\r\n scene.activeCameras = null;\r\n\r\n if (scene.activeCamera !== camera) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n scene.render(); // make sure the scene is ready to be rendered in the RTT with the right list of active meshes (which depends on the camera, that may have been changed above)\r\n\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n const texture = new RenderTargetTexture(\r\n \"screenShot\",\r\n targetTextureSize,\r\n scene,\r\n false,\r\n false,\r\n Constants.TEXTURETYPE_UNSIGNED_INT,\r\n false,\r\n Texture.NEAREST_SAMPLINGMODE,\r\n undefined,\r\n enableStencilBuffer,\r\n undefined,\r\n undefined,\r\n undefined,\r\n samples\r\n );\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n\r\n const renderToTexture = () => {\r\n engine.onEndFrameObservable.addOnce(() => {\r\n texture.readPixels(undefined, undefined, undefined, false)!.then((data) => {\r\n Tools.DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true);\r\n texture.dispose();\r\n });\r\n });\r\n\r\n // render the RTT\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n\r\n // re-render the scene after the camera has been reset to the original camera to avoid a flicker that could occur\r\n // if the camera used for the RTT rendering stays in effect for the next frame (and if that camera was different from the original camera)\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n scene.activeCameras = previousCameras;\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n scene.render();\r\n };\r\n\r\n if (antialiasing) {\r\n const fxaaPostProcess = new FxaaPostProcess(\"antialiasing\", 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = () => {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n } else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotUsingRenderTargetAsync(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType,\r\n samples,\r\n antialiasing,\r\n fileName,\r\n renderSprites\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Gets height and width for screenshot size\r\n * @param engine\r\n * @param camera\r\n * @param size\r\n * @private\r\n */\r\nfunction _GetScreenshotSize(engine: Engine, camera: Camera, size: IScreenshotSize | number): { height: number; width: number } {\r\n let height = 0;\r\n let width = 0;\r\n\r\n //If a size value defined as object\r\n if (typeof size === \"object\") {\r\n const precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n } else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n\r\n return { height: height | 0, width: width | 0 };\r\n}\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nexport const ScreenshotTools = {\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\n CreateScreenshot,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotAsync,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotWithResizeAsync,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\n CreateScreenshotUsingRenderTarget,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotUsingRenderTargetAsync,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @hidden\r\n */\r\nconst initSideEffects = () => {\r\n // References the dependencies.\r\n Tools.CreateScreenshot = CreateScreenshot;\r\n Tools.CreateScreenshotAsync = CreateScreenshotAsync;\r\n Tools.CreateScreenshotUsingRenderTarget = CreateScreenshotUsingRenderTarget;\r\n Tools.CreateScreenshotUsingRenderTargetAsync = CreateScreenshotUsingRenderTargetAsync;\r\n};\r\n\r\ninitSideEffects();\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.
|
|
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":"","sources":["../../../../../../lts/core/generated/Physics/Plugins/oimoJSPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAy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AAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;SAClD;IACL,CAAC;IAEM,gCAAS,GAAhB,UAAiB,QAAyB;QACtC,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9C,CAAC;IAEM,sCAAe,GAAtB,UAAuB,QAAyB,EAAE,MAAe;QAC7D,IAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1C,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,8BAAO,GAAd;QACI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,8BAAO,GAAd,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,+BAA+B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,cAAc;AACd;IAQI,sBAAoB,qBAAqC,EAAE,UAAmB,EAAE,aAAoB;QAAhF,sCAAA,E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,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;SAClD;IACL,CAAC;IAEM,gCAAS,GAAhB,UAAiB,QAAyB;QACtC,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9C,CAAC;IAEM,sCAAe,GAAtB,UAAuB,QAAyB,EAAE,MAAe;QAC7D,IAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1C,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,8BAAO,GAAd;QACI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,8BAAO,GAAd,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.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"]}
|
|
@@ -411,7 +411,7 @@ var PhysicsImpostor = /** @class */ (function () {
|
|
|
411
411
|
* @returns boolean specifying if body initialization is required
|
|
412
412
|
*/
|
|
413
413
|
PhysicsImpostor.prototype.isBodyInitRequired = function () {
|
|
414
|
-
return this._bodyUpdateRequired || (!this._physicsBody && !this._parent);
|
|
414
|
+
return this._bodyUpdateRequired || (!this._physicsBody && (!this._parent || !!this._options.ignoreParent));
|
|
415
415
|
};
|
|
416
416
|
/**
|
|
417
417
|
* Sets the updated scaling
|