@onerjs/core 8.23.11 → 8.25.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/Behaviors/Meshes/index.d.ts +1 -0
- package/Behaviors/Meshes/index.js +1 -0
- package/Behaviors/Meshes/index.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.d.ts +6 -34
- package/Behaviors/Meshes/pointerDragBehavior.js +0 -12
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragEvents.d.ts +38 -0
- package/Behaviors/Meshes/pointerDragEvents.js +2 -0
- package/Behaviors/Meshes/pointerDragEvents.js.map +1 -0
- package/Buffers/storageBuffer.d.ts +6 -0
- package/Buffers/storageBuffer.js +8 -0
- package/Buffers/storageBuffer.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.d.ts +2 -1
- package/Engines/Extensions/engine.multiRender.js +12 -7
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js +5 -5
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +12 -7
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +6 -0
- package/Engines/WebGPU/webgpuDrawContext.js +9 -0
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/abstractEngine.js +3 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +4 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/engineFactory.d.ts +4 -1
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/nativeEngine.js +2 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +2 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.js +17 -0
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +7 -0
- package/Engines/webgpuEngine.js +19 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +12 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +52 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +0 -3
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +7 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +4 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +7 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +11 -2
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +6 -6
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +27 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +76 -8
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +2 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.js +0 -7
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderTarget.js +1 -1
- package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
- package/Gizmos/cameraGizmo.js +2 -2
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/lightGizmo.js +2 -2
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +7 -6
- package/Gizmos/positionGizmo.js +3 -9
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +7 -6
- package/Gizmos/rotationGizmo.js +3 -9
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +7 -6
- package/Gizmos/scaleGizmo.js +3 -9
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.d.ts +2 -0
- package/Instrumentation/sceneInstrumentation.js +58 -32
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +102 -0
- package/Lights/Clustered/clusteredLightContainer.js +487 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -0
- package/Lights/Clustered/clusteredLightingSceneComponent.d.ts +34 -0
- package/Lights/Clustered/clusteredLightingSceneComponent.js +47 -0
- package/Lights/Clustered/clusteredLightingSceneComponent.js.map +1 -0
- package/Lights/Clustered/index.d.ts +6 -0
- package/Lights/Clustered/index.js +7 -0
- package/Lights/Clustered/index.js.map +1 -0
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -0
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +10 -8
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/index.d.ts +1 -0
- package/Lights/index.js +1 -0
- package/Lights/index.js.map +1 -1
- package/Lights/light.d.ts +7 -1
- package/Lights/light.js +7 -1
- package/Lights/light.js.map +1 -1
- package/Lights/lightConstants.d.ts +4 -0
- package/Lights/lightConstants.js +4 -0
- package/Lights/lightConstants.js.map +1 -1
- package/Lights/spotLight.d.ts +6 -3
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +0 -5
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +3 -2
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +5 -0
- package/Materials/Textures/renderTargetTexture.js +9 -0
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +12 -4
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/standardMaterial.js +4 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +7 -4
- package/Materials/uniformBuffer.js +37 -15
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.d.ts +1 -1
- package/Maths/math.vector.js +2 -2
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +25 -0
- package/Meshes/abstractMesh.hotSpot.js +37 -25
- package/Meshes/abstractMesh.hotSpot.js.map +1 -1
- package/Meshes/abstractMesh.js +4 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg2.js +6 -4
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geometry.js +1 -1
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +1 -0
- package/Meshes/instancedMesh.js +3 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/linesMesh.d.ts +5 -3
- package/Meshes/linesMesh.js +27 -8
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +0 -19
- package/Meshes/mesh.js +2 -26
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +2 -2
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Misc/dumpTools.d.ts +1 -1
- package/Misc/dumpTools.js +23 -14
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/fileTools.js +8 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +16 -7
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/lazy.d.ts +16 -0
- package/Misc/lazy.js +25 -0
- package/Misc/lazy.js.map +1 -0
- package/Misc/screenshotTools.js +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +6 -3
- package/Misc/snapshotRenderingHelper.js +37 -6
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +4 -0
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +4 -0
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +17 -3
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +0 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +31 -0
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +67 -0
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +1 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +2 -2
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +3 -3
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +3 -0
- package/Particles/Node/Blocks/systemBlock.js +3 -0
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +3 -1
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +2 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +118 -61
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -0
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/particle.d.ts +8 -0
- package/Particles/particle.js +10 -0
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +2 -4
- package/Particles/particleSystem.js +2 -4
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +6 -0
- package/Particles/thinParticleSystem.function.d.ts +2 -0
- package/Particles/thinParticleSystem.function.js +3 -0
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +15 -5
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +33 -3
- package/Rendering/objectRenderer.js +164 -38
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/clusteredLightingFunctions.js +19 -0
- package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/helperFunctions.js +6 -1
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +33 -1
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightUboDeclaration.js +5 -0
- package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightVxUboDeclaration.js +2 -0
- package/Shaders/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js +20 -0
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.d.ts +7 -0
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +125 -0
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
- package/Shaders/default.fragment.js +5 -0
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +6 -0
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/lightProxy.fragment.d.ts +5 -0
- package/Shaders/lightProxy.fragment.js +13 -0
- package/Shaders/lightProxy.fragment.js.map +1 -0
- package/Shaders/lightProxy.vertex.d.ts +8 -0
- package/Shaders/lightProxy.vertex.js +19 -0
- package/Shaders/lightProxy.vertex.js.map +1 -0
- package/Shaders/pbr.fragment.d.ts +1 -0
- package/Shaders/pbr.fragment.js +4 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +6 -0
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js +24 -0
- package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js +33 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +6 -0
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +22 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +2 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +115 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentExtraDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +5 -0
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +6 -0
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/lightProxy.fragment.d.ts +5 -0
- package/ShadersWGSL/lightProxy.fragment.js +13 -0
- package/ShadersWGSL/lightProxy.fragment.js.map +1 -0
- package/ShadersWGSL/lightProxy.vertex.d.ts +7 -0
- package/ShadersWGSL/lightProxy.vertex.js +19 -0
- package/ShadersWGSL/lightProxy.vertex.js.map +1 -0
- package/ShadersWGSL/pbr.vertex.js +6 -0
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/Sprites/spriteManager.d.ts +5 -0
- package/Sprites/spriteManager.js +6 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +5 -2
- package/Sprites/spriteRenderer.js.map +1 -1
- package/States/alphaCullingState.d.ts +3 -1
- package/States/alphaCullingState.js +39 -37
- package/States/alphaCullingState.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +28 -1
- package/scene.js +198 -34
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +2 -0
- package/sceneComponent.js +2 -0
- package/sceneComponent.js.map +1 -1
|
@@ -2,6 +2,7 @@ export * from "./attachToBoxBehavior.js";
|
|
|
2
2
|
export * from "./fadeInOutBehavior.js";
|
|
3
3
|
export * from "./multiPointerScaleBehavior.js";
|
|
4
4
|
export * from "./pointerDragBehavior.js";
|
|
5
|
+
export * from "./pointerDragEvents.js";
|
|
5
6
|
export * from "./sixDofDragBehavior.js";
|
|
6
7
|
export * from "./surfaceMagnetismBehavior.js";
|
|
7
8
|
export * from "./baseSixDofDragBehavior.js";
|
|
@@ -2,6 +2,7 @@ export * from "./attachToBoxBehavior.js";
|
|
|
2
2
|
export * from "./fadeInOutBehavior.js";
|
|
3
3
|
export * from "./multiPointerScaleBehavior.js";
|
|
4
4
|
export * from "./pointerDragBehavior.js";
|
|
5
|
+
export * from "./pointerDragEvents.js";
|
|
5
6
|
export * from "./sixDofDragBehavior.js";
|
|
6
7
|
export * from "./surfaceMagnetismBehavior.js";
|
|
7
8
|
export * from "./baseSixDofDragBehavior.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./attachToBoxBehavior\";\r\nexport * from \"./fadeInOutBehavior\";\r\nexport * from \"./multiPointerScaleBehavior\";\r\nexport * from \"./pointerDragBehavior\";\r\nexport * from \"./sixDofDragBehavior\";\r\nexport * from \"./surfaceMagnetismBehavior\";\r\nexport * from \"./baseSixDofDragBehavior\";\r\nexport * from \"./followBehavior\";\r\nexport * from \"./handConstraintBehavior\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./attachToBoxBehavior\";\r\nexport * from \"./fadeInOutBehavior\";\r\nexport * from \"./multiPointerScaleBehavior\";\r\nexport * from \"./pointerDragBehavior\";\r\nexport * from \"./pointerDragEvents\";\r\nexport * from \"./sixDofDragBehavior\";\r\nexport * from \"./surfaceMagnetismBehavior\";\r\nexport * from \"./baseSixDofDragBehavior\";\r\nexport * from \"./followBehavior\";\r\nexport * from \"./handConstraintBehavior\";\r\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Behavior } from "../../Behaviors/behavior.js";
|
|
2
2
|
import { Mesh } from "../../Meshes/mesh.js";
|
|
3
3
|
import type { AbstractMesh } from "../../Meshes/abstractMesh.js";
|
|
4
|
-
import type { Nullable } from "../../types.js";
|
|
5
4
|
import { Observable } from "../../Misc/observable.js";
|
|
6
5
|
import { Vector3 } from "../../Maths/math.vector.js";
|
|
7
|
-
import type { PointerInfo } from "../../Events/pointerEvents.js";
|
|
8
6
|
import { Ray } from "../../Culling/ray.js";
|
|
7
|
+
import type { DragEvent, DragStartEndEvent } from "./pointerDragEvents.js";
|
|
9
8
|
/**
|
|
10
9
|
* A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events
|
|
11
10
|
*/
|
|
@@ -65,43 +64,16 @@ export declare class PointerDragBehavior implements Behavior<AbstractMesh> {
|
|
|
65
64
|
private _moving;
|
|
66
65
|
/**
|
|
67
66
|
* Fires each time the attached mesh is dragged with the pointer
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* * dragPlaneNormal normal of the current drag plane used during the drag
|
|
71
|
-
* * dragPlanePoint in world space where the drag intersects the drag plane
|
|
72
|
-
*
|
|
73
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
74
|
-
*/
|
|
75
|
-
onDragObservable: Observable<{
|
|
76
|
-
delta: Vector3;
|
|
77
|
-
dragPlanePoint: Vector3;
|
|
78
|
-
dragPlaneNormal: Vector3;
|
|
79
|
-
dragDistance: number;
|
|
80
|
-
pointerId: number;
|
|
81
|
-
pointerInfo: Nullable<PointerInfo>;
|
|
82
|
-
}>;
|
|
67
|
+
*/
|
|
68
|
+
onDragObservable: Observable<DragEvent>;
|
|
83
69
|
/**
|
|
84
70
|
* Fires each time a drag begins (eg. mouse down on mesh)
|
|
85
|
-
* * dragPlanePoint in world space where the drag intersects the drag plane
|
|
86
|
-
*
|
|
87
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
88
71
|
*/
|
|
89
|
-
onDragStartObservable: Observable<
|
|
90
|
-
dragPlanePoint: Vector3;
|
|
91
|
-
pointerId: number;
|
|
92
|
-
pointerInfo: Nullable<PointerInfo>;
|
|
93
|
-
}>;
|
|
72
|
+
onDragStartObservable: Observable<DragStartEndEvent>;
|
|
94
73
|
/**
|
|
95
74
|
* Fires each time a drag ends (eg. mouse release after drag)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
99
|
-
*/
|
|
100
|
-
onDragEndObservable: Observable<{
|
|
101
|
-
dragPlanePoint: Vector3;
|
|
102
|
-
pointerId: number;
|
|
103
|
-
pointerInfo: Nullable<PointerInfo>;
|
|
104
|
-
}>;
|
|
75
|
+
*/
|
|
76
|
+
onDragEndObservable: Observable<DragStartEndEvent>;
|
|
105
77
|
/**
|
|
106
78
|
* Fires each time behavior enabled state changes
|
|
107
79
|
*/
|
|
@@ -89,26 +89,14 @@ export class PointerDragBehavior {
|
|
|
89
89
|
this._moving = false;
|
|
90
90
|
/**
|
|
91
91
|
* Fires each time the attached mesh is dragged with the pointer
|
|
92
|
-
* * delta between last drag position and current drag position in world space
|
|
93
|
-
* * dragDistance along the drag axis
|
|
94
|
-
* * dragPlaneNormal normal of the current drag plane used during the drag
|
|
95
|
-
* * dragPlanePoint in world space where the drag intersects the drag plane
|
|
96
|
-
*
|
|
97
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
98
92
|
*/
|
|
99
93
|
this.onDragObservable = new Observable();
|
|
100
94
|
/**
|
|
101
95
|
* Fires each time a drag begins (eg. mouse down on mesh)
|
|
102
|
-
* * dragPlanePoint in world space where the drag intersects the drag plane
|
|
103
|
-
*
|
|
104
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
105
96
|
*/
|
|
106
97
|
this.onDragStartObservable = new Observable();
|
|
107
98
|
/**
|
|
108
99
|
* Fires each time a drag ends (eg. mouse release after drag)
|
|
109
|
-
* * dragPlanePoint in world space where the drag intersects the drag plane
|
|
110
|
-
*
|
|
111
|
-
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
112
100
|
*/
|
|
113
101
|
this.onDragEndObservable = new Observable();
|
|
114
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointerDragBehavior.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/pointerDragBehavior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE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AAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;;AA5lBc,+BAAW,GAAG,CAAC,CAAC,AAAL,CAAM","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from \"../../Misc/pivotTools\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { CreatePlane } from \"../../Meshes/Builders/planeBuilder\";\r\n\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nexport class PointerDragBehavior implements Behavior<AbstractMesh> {\r\n private static _AnyMouseId = -2;\r\n /**\r\n * Abstract mesh the behavior is set on\r\n */\r\n public attachedNode: AbstractMesh;\r\n protected _dragPlane: Mesh;\r\n private _scene: Scene;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private static _PlaneScene: Scene;\r\n private _useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n private _activeDragButton: number = -1;\r\n private _activePointerInfo: Nullable<PointerInfo>;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n public maxDragAngle = 0;\r\n /**\r\n * Butttons that can be used to initiate a drag\r\n */\r\n public dragButtons = [0, 1, 2];\r\n /**\r\n * @internal\r\n */\r\n public _useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * Get or set the currentDraggingPointerId\r\n * @deprecated Please use currentDraggingPointerId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get currentDraggingPointerID(): number {\r\n return this.currentDraggingPointerId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set currentDraggingPointerID(currentDraggingPointerId: number) {\r\n this.currentDraggingPointerId = currentDraggingPointerId;\r\n }\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n public currentDraggingPointerId = -1;\r\n /**\r\n * The last position where the pointer hit the drag plane in world space\r\n */\r\n public lastDragPosition: Vector3;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n public dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n public dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n public updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n private _debugMode = false;\r\n private _moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n * * delta between last drag position and current drag position in world space\r\n * * dragDistance along the drag axis\r\n * * dragPlaneNormal normal of the current drag plane used during the drag\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n *\r\n * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)\r\n */\r\n public onDragObservable = new Observable<{\r\n delta: Vector3;\r\n dragPlanePoint: Vector3;\r\n dragPlaneNormal: Vector3;\r\n dragDistance: number;\r\n pointerId: number;\r\n pointerInfo: Nullable<PointerInfo>;\r\n }>();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n *\r\n * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)\r\n */\r\n public onDragStartObservable = new Observable<{ dragPlanePoint: Vector3; pointerId: number; pointerInfo: Nullable<PointerInfo> }>();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n *\r\n * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)\r\n */\r\n public onDragEndObservable = new Observable<{ dragPlanePoint: Vector3; pointerId: number; pointerInfo: Nullable<PointerInfo> }>();\r\n /**\r\n * Fires each time behavior enabled state changes\r\n */\r\n public onEnabledObservable = new Observable<boolean>();\r\n\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n public moveAttached = true;\r\n\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n public set enabled(value: boolean) {\r\n if (value != this._enabled) {\r\n this.onEnabledObservable.notifyObservers(value);\r\n }\r\n this._enabled = value;\r\n }\r\n\r\n public get enabled() {\r\n return this._enabled;\r\n }\r\n private _enabled = true;\r\n\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n public startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n public detachCameraControls = true;\r\n\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n public useObjectOrientationForDragging = true;\r\n\r\n /**\r\n * Normally a drag is canceled when the user presses another button on the same pointer. If this is set to true,\r\n * the drag will continue even if another button is pressed on the same pointer.\r\n */\r\n public allowOtherButtonsDuringDrag = false;\r\n\r\n private _options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 };\r\n\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n public get options(): { dragAxis?: Vector3; dragPlaneNormal?: Vector3 } {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n public set options(options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options;\r\n }\r\n\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n * @param options.dragAxis\r\n * @param options.dragPlaneNormal\r\n */\r\n constructor(options?: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options ? options : {};\r\n\r\n let optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved.\r\n * In the case of rotation gizmo, target contains the angle.\r\n * @param target destination position or desired angle delta\r\n * @returns boolean for whether or not it is valid to move\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public validateDrag = (target: Vector3) => {\r\n return true;\r\n };\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"PointerDrag\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _alternatePickedPoint = new Vector3(0, 0, 0);\r\n private _worldDragAxis = new Vector3(0, 0, 0);\r\n private _targetPosition = new Vector3(0, 0, 0);\r\n private _attachedToElement: boolean = false;\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n public attach(ownerNode: AbstractMesh, predicate?: (m: AbstractMesh) => boolean): void {\r\n this._scene = ownerNode.getScene();\r\n ownerNode.isNearGrabbable = true;\r\n this.attachedNode = ownerNode;\r\n\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._PlaneScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._PlaneScene = this._scene;\r\n } else {\r\n PointerDragBehavior._PlaneScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._PlaneScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(() => {\r\n PointerDragBehavior._PlaneScene.dispose();\r\n (<any>PointerDragBehavior._PlaneScene) = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = CreatePlane(\r\n \"pointerDragPlane\",\r\n { size: this._debugMode ? 1 : 10000, updatable: false, sideOrientation: Mesh.DOUBLESIDE },\r\n PointerDragBehavior._PlaneScene\r\n );\r\n\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n\r\n const pickPredicate = predicate\r\n ? predicate\r\n : (m: AbstractMesh) => {\r\n return this.attachedNode == m || m.isDescendantOf(this.attachedNode);\r\n };\r\n\r\n this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo) => {\r\n if (!this.enabled) {\r\n // If behavior is disabled before releaseDrag is ever called, call it now.\r\n if (this._attachedToElement) {\r\n this.releaseDrag();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // If we are dragging and the user presses another button on the same pointer, end the drag. Otherwise,\r\n // tracking when the drag should end becomes very complex.\r\n // gizmo.ts has similar behavior.\r\n if (\r\n this.dragging &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n pointerInfo.event.button !== -1 &&\r\n pointerInfo.event.button !== this._activeDragButton &&\r\n !this.allowOtherButtonsDuringDrag\r\n ) {\r\n this.releaseDrag();\r\n return;\r\n }\r\n\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n !this.dragging &&\r\n pointerInfo.pickInfo &&\r\n pointerInfo.pickInfo.hit &&\r\n pointerInfo.pickInfo.pickedMesh &&\r\n pointerInfo.pickInfo.pickedPoint &&\r\n pointerInfo.pickInfo.ray &&\r\n pickPredicate(pointerInfo.pickInfo.pickedMesh)\r\n ) {\r\n if (this._activeDragButton === -1 && this.dragButtons.indexOf(pointerInfo.event.button) !== -1) {\r\n this._activeDragButton = pointerInfo.event.button;\r\n this._activePointerInfo = pointerInfo;\r\n this._startDrag((<IPointerEvent>pointerInfo.event).pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n (this._activeDragButton === pointerInfo.event.button || this._activeDragButton === -1)\r\n ) {\r\n this.releaseDrag();\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n const pointerId = (<IPointerEvent>pointerInfo.event).pointerId;\r\n\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (this.currentDraggingPointerId === PointerDragBehavior._AnyMouseId && pointerId !== PointerDragBehavior._AnyMouseId) {\r\n const evt = <IPointerEvent>pointerInfo.event;\r\n const isMouseEvent = evt.pointerType === \"mouse\" || (!this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (this._lastPointerRay[this.currentDraggingPointerId]) {\r\n this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerId];\r\n delete this._lastPointerRay[this.currentDraggingPointerId];\r\n }\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!this._lastPointerRay[pointerId]) {\r\n this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n\r\n if (this.currentDraggingPointerId == pointerId && this.dragging) {\r\n this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (this._moving && this.moveAttached) {\r\n let needMatrixUpdate = false;\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n this._targetPosition.subtractToRef(this.attachedNode.absolutePosition, this._tmpVector);\r\n this._tmpVector.scaleInPlace(this.dragDeltaRatio);\r\n this.attachedNode.getAbsolutePosition().addToRef(this._tmpVector, this._tmpVector);\r\n if (this.validateDrag(this._tmpVector)) {\r\n this.attachedNode.setAbsolutePosition(this._tmpVector);\r\n needMatrixUpdate = true;\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n if (needMatrixUpdate) {\r\n this.attachedNode.computeWorldMatrix();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Force release the drag action by code.\r\n */\r\n public releaseDrag() {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n }\r\n\r\n this.currentDraggingPointerId = -1;\r\n this._activeDragButton = -1;\r\n this._activePointerInfo = null;\r\n this._moving = false;\r\n\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n const arcRotateCamera = this._scene.activeCamera as ArcRotateCamera;\r\n arcRotateCamera.attachControl(\r\n arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true,\r\n arcRotateCamera._useCtrlForPanning,\r\n arcRotateCamera._panningMouseButton\r\n );\r\n } else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n }\r\n\r\n private _startDragRay = new Ray(new Vector3(), new Vector3());\r\n private _lastPointerRay: { [key: number]: Ray } = {};\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n public startDrag(pointerId: number = PointerDragBehavior._AnyMouseId, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n\r\n let lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseId) {\r\n lastRay = this._lastPointerRay[<any>Object.keys(this._lastPointerRay)[0]];\r\n }\r\n\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n }\r\n\r\n protected _startDrag(pointerId: number, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n } else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n\r\n const pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerId = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n } else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n } else {\r\n this.releaseDrag();\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n\r\n private _dragDelta = new Vector3();\r\n protected _moveDrag(ray: Ray) {\r\n this._moving = true;\r\n const pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n\r\n if (pickedPoint) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n let dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis)\r\n : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n\r\n this._worldDragAxis.normalize();\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n } else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({\r\n dragDistance: dragLength,\r\n delta: this._dragDelta,\r\n dragPlanePoint: pickedPoint,\r\n dragPlaneNormal: this._dragPlane.forward,\r\n pointerId: this.currentDraggingPointerId,\r\n pointerInfo: this._activePointerInfo,\r\n });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n }\r\n\r\n private _pickWithRayOnDragPlane(ray: Nullable<Ray>) {\r\n if (!ray) {\r\n return null;\r\n }\r\n\r\n // Calculate angle between plane normal and ray\r\n let angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n this.attachedNode.absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n const dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition);\r\n return this._alternatePickedPoint;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n // use an infinite plane instead of ray picking a mesh that must be updated every frame\r\n const planeNormal = this._dragPlane.forward;\r\n const planePosition = this._dragPlane.position;\r\n const dotProduct = ray.direction.dot(planeNormal);\r\n if (Math.abs(dotProduct) < Epsilon) {\r\n // Ray and plane are parallel, no intersection\r\n return null;\r\n }\r\n\r\n planePosition.subtractToRef(ray.origin, TmpVectors.Vector3[0]);\r\n const t = TmpVectors.Vector3[0].dot(planeNormal) / dotProduct;\r\n // Ensure the intersection point is in front of the ray (t must be positive)\r\n if (t < 0) {\r\n // Intersection point is behind the ray\r\n return null;\r\n }\r\n\r\n // Calculate the intersection point using the parameter t\r\n ray.direction.scaleToRef(t, TmpVectors.Vector3[0]);\r\n const intersectionPoint = ray.origin.add(TmpVectors.Vector3[0]);\r\n return intersectionPoint;\r\n }\r\n\r\n // Variables to avoid instantiation in the below method\r\n private _pointA = new Vector3(0, 0, 0);\r\n private _pointC = new Vector3(0, 0, 0);\r\n private _localAxis = new Vector3(0, 0, 0);\r\n private _lookAt = new Vector3(0, 0, 0);\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n private _updateDragPlanePosition(ray: Ray, dragPlanePosition: Vector3) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragAxis);\r\n\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n } else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n } else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendicular to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else {\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis);\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(this._pointA.add(this._localAxis));\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n this._dragPlane.computeWorldMatrix(true);\r\n }\r\n\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._lastPointerRay = {};\r\n if (this.attachedNode) {\r\n this.attachedNode.isNearGrabbable = false;\r\n }\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n if (this._dragPlane) {\r\n this._dragPlane.dispose();\r\n }\r\n this.releaseDrag();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"point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C1B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,KAAK,CAAC;QAC9C,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;;AAzkBc,+BAAW,GAAG,CAAC,CAAC,AAAL,CAAM","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from \"../../Misc/pivotTools\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { CreatePlane } from \"../../Meshes/Builders/planeBuilder\";\r\n\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport type { DragEvent, DragStartEndEvent } from \"./pointerDragEvents\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nexport class PointerDragBehavior implements Behavior<AbstractMesh> {\r\n private static _AnyMouseId = -2;\r\n /**\r\n * Abstract mesh the behavior is set on\r\n */\r\n public attachedNode: AbstractMesh;\r\n protected _dragPlane: Mesh;\r\n private _scene: Scene;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private static _PlaneScene: Scene;\r\n private _useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n private _activeDragButton: number = -1;\r\n private _activePointerInfo: Nullable<PointerInfo>;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n public maxDragAngle = 0;\r\n /**\r\n * Butttons that can be used to initiate a drag\r\n */\r\n public dragButtons = [0, 1, 2];\r\n /**\r\n * @internal\r\n */\r\n public _useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * Get or set the currentDraggingPointerId\r\n * @deprecated Please use currentDraggingPointerId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get currentDraggingPointerID(): number {\r\n return this.currentDraggingPointerId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set currentDraggingPointerID(currentDraggingPointerId: number) {\r\n this.currentDraggingPointerId = currentDraggingPointerId;\r\n }\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n public currentDraggingPointerId = -1;\r\n /**\r\n * The last position where the pointer hit the drag plane in world space\r\n */\r\n public lastDragPosition: Vector3;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n public dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n public dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n public updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n private _debugMode = false;\r\n private _moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n */\r\n public onDragObservable = new Observable<DragEvent>();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n public onDragStartObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n public onDragEndObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time behavior enabled state changes\r\n */\r\n public onEnabledObservable = new Observable<boolean>();\r\n\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n public moveAttached = true;\r\n\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n public set enabled(value: boolean) {\r\n if (value != this._enabled) {\r\n this.onEnabledObservable.notifyObservers(value);\r\n }\r\n this._enabled = value;\r\n }\r\n\r\n public get enabled() {\r\n return this._enabled;\r\n }\r\n private _enabled = true;\r\n\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n public startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n public detachCameraControls = true;\r\n\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n public useObjectOrientationForDragging = true;\r\n\r\n /**\r\n * Normally a drag is canceled when the user presses another button on the same pointer. If this is set to true,\r\n * the drag will continue even if another button is pressed on the same pointer.\r\n */\r\n public allowOtherButtonsDuringDrag = false;\r\n\r\n private _options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 };\r\n\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n public get options(): { dragAxis?: Vector3; dragPlaneNormal?: Vector3 } {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n public set options(options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options;\r\n }\r\n\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n * @param options.dragAxis\r\n * @param options.dragPlaneNormal\r\n */\r\n constructor(options?: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options ? options : {};\r\n\r\n let optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved.\r\n * In the case of rotation gizmo, target contains the angle.\r\n * @param target destination position or desired angle delta\r\n * @returns boolean for whether or not it is valid to move\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public validateDrag = (target: Vector3) => {\r\n return true;\r\n };\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"PointerDrag\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _alternatePickedPoint = new Vector3(0, 0, 0);\r\n private _worldDragAxis = new Vector3(0, 0, 0);\r\n private _targetPosition = new Vector3(0, 0, 0);\r\n private _attachedToElement: boolean = false;\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n public attach(ownerNode: AbstractMesh, predicate?: (m: AbstractMesh) => boolean): void {\r\n this._scene = ownerNode.getScene();\r\n ownerNode.isNearGrabbable = true;\r\n this.attachedNode = ownerNode;\r\n\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._PlaneScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._PlaneScene = this._scene;\r\n } else {\r\n PointerDragBehavior._PlaneScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._PlaneScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(() => {\r\n PointerDragBehavior._PlaneScene.dispose();\r\n (<any>PointerDragBehavior._PlaneScene) = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = CreatePlane(\r\n \"pointerDragPlane\",\r\n { size: this._debugMode ? 1 : 10000, updatable: false, sideOrientation: Mesh.DOUBLESIDE },\r\n PointerDragBehavior._PlaneScene\r\n );\r\n\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n\r\n const pickPredicate = predicate\r\n ? predicate\r\n : (m: AbstractMesh) => {\r\n return this.attachedNode == m || m.isDescendantOf(this.attachedNode);\r\n };\r\n\r\n this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo) => {\r\n if (!this.enabled) {\r\n // If behavior is disabled before releaseDrag is ever called, call it now.\r\n if (this._attachedToElement) {\r\n this.releaseDrag();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // If we are dragging and the user presses another button on the same pointer, end the drag. Otherwise,\r\n // tracking when the drag should end becomes very complex.\r\n // gizmo.ts has similar behavior.\r\n if (\r\n this.dragging &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n pointerInfo.event.button !== -1 &&\r\n pointerInfo.event.button !== this._activeDragButton &&\r\n !this.allowOtherButtonsDuringDrag\r\n ) {\r\n this.releaseDrag();\r\n return;\r\n }\r\n\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n !this.dragging &&\r\n pointerInfo.pickInfo &&\r\n pointerInfo.pickInfo.hit &&\r\n pointerInfo.pickInfo.pickedMesh &&\r\n pointerInfo.pickInfo.pickedPoint &&\r\n pointerInfo.pickInfo.ray &&\r\n pickPredicate(pointerInfo.pickInfo.pickedMesh)\r\n ) {\r\n if (this._activeDragButton === -1 && this.dragButtons.indexOf(pointerInfo.event.button) !== -1) {\r\n this._activeDragButton = pointerInfo.event.button;\r\n this._activePointerInfo = pointerInfo;\r\n this._startDrag((<IPointerEvent>pointerInfo.event).pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n (this._activeDragButton === pointerInfo.event.button || this._activeDragButton === -1)\r\n ) {\r\n this.releaseDrag();\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n const pointerId = (<IPointerEvent>pointerInfo.event).pointerId;\r\n\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (this.currentDraggingPointerId === PointerDragBehavior._AnyMouseId && pointerId !== PointerDragBehavior._AnyMouseId) {\r\n const evt = <IPointerEvent>pointerInfo.event;\r\n const isMouseEvent = evt.pointerType === \"mouse\" || (!this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (this._lastPointerRay[this.currentDraggingPointerId]) {\r\n this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerId];\r\n delete this._lastPointerRay[this.currentDraggingPointerId];\r\n }\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!this._lastPointerRay[pointerId]) {\r\n this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n\r\n if (this.currentDraggingPointerId == pointerId && this.dragging) {\r\n this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (this._moving && this.moveAttached) {\r\n let needMatrixUpdate = false;\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n this._targetPosition.subtractToRef(this.attachedNode.absolutePosition, this._tmpVector);\r\n this._tmpVector.scaleInPlace(this.dragDeltaRatio);\r\n this.attachedNode.getAbsolutePosition().addToRef(this._tmpVector, this._tmpVector);\r\n if (this.validateDrag(this._tmpVector)) {\r\n this.attachedNode.setAbsolutePosition(this._tmpVector);\r\n needMatrixUpdate = true;\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n if (needMatrixUpdate) {\r\n this.attachedNode.computeWorldMatrix();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Force release the drag action by code.\r\n */\r\n public releaseDrag() {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n }\r\n\r\n this.currentDraggingPointerId = -1;\r\n this._activeDragButton = -1;\r\n this._activePointerInfo = null;\r\n this._moving = false;\r\n\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n const arcRotateCamera = this._scene.activeCamera as ArcRotateCamera;\r\n arcRotateCamera.attachControl(\r\n arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true,\r\n arcRotateCamera._useCtrlForPanning,\r\n arcRotateCamera._panningMouseButton\r\n );\r\n } else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n }\r\n\r\n private _startDragRay = new Ray(new Vector3(), new Vector3());\r\n private _lastPointerRay: { [key: number]: Ray } = {};\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n public startDrag(pointerId: number = PointerDragBehavior._AnyMouseId, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n\r\n let lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseId) {\r\n lastRay = this._lastPointerRay[<any>Object.keys(this._lastPointerRay)[0]];\r\n }\r\n\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n }\r\n\r\n protected _startDrag(pointerId: number, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n } else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n\r\n const pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerId = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n } else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n } else {\r\n this.releaseDrag();\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n\r\n private _dragDelta = new Vector3();\r\n protected _moveDrag(ray: Ray) {\r\n this._moving = true;\r\n const pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n\r\n if (pickedPoint) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n let dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis)\r\n : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n\r\n this._worldDragAxis.normalize();\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n } else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({\r\n dragDistance: dragLength,\r\n delta: this._dragDelta,\r\n dragPlanePoint: pickedPoint,\r\n dragPlaneNormal: this._dragPlane.forward,\r\n pointerId: this.currentDraggingPointerId,\r\n pointerInfo: this._activePointerInfo,\r\n });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n }\r\n\r\n private _pickWithRayOnDragPlane(ray: Nullable<Ray>) {\r\n if (!ray) {\r\n return null;\r\n }\r\n\r\n // Calculate angle between plane normal and ray\r\n let angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n this.attachedNode.absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n const dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition);\r\n return this._alternatePickedPoint;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n // use an infinite plane instead of ray picking a mesh that must be updated every frame\r\n const planeNormal = this._dragPlane.forward;\r\n const planePosition = this._dragPlane.position;\r\n const dotProduct = ray.direction.dot(planeNormal);\r\n if (Math.abs(dotProduct) < Epsilon) {\r\n // Ray and plane are parallel, no intersection\r\n return null;\r\n }\r\n\r\n planePosition.subtractToRef(ray.origin, TmpVectors.Vector3[0]);\r\n const t = TmpVectors.Vector3[0].dot(planeNormal) / dotProduct;\r\n // Ensure the intersection point is in front of the ray (t must be positive)\r\n if (t < 0) {\r\n // Intersection point is behind the ray\r\n return null;\r\n }\r\n\r\n // Calculate the intersection point using the parameter t\r\n ray.direction.scaleToRef(t, TmpVectors.Vector3[0]);\r\n const intersectionPoint = ray.origin.add(TmpVectors.Vector3[0]);\r\n return intersectionPoint;\r\n }\r\n\r\n // Variables to avoid instantiation in the below method\r\n private _pointA = new Vector3(0, 0, 0);\r\n private _pointC = new Vector3(0, 0, 0);\r\n private _localAxis = new Vector3(0, 0, 0);\r\n private _lookAt = new Vector3(0, 0, 0);\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n private _updateDragPlanePosition(ray: Ray, dragPlanePosition: Vector3) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragAxis);\r\n\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n } else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n } else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendicular to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else {\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis);\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(this._pointA.add(this._localAxis));\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n this._dragPlane.computeWorldMatrix(true);\r\n }\r\n\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._lastPointerRay = {};\r\n if (this.attachedNode) {\r\n this.attachedNode.isNearGrabbable = false;\r\n }\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n if (this._dragPlane) {\r\n this._dragPlane.dispose();\r\n }\r\n this.releaseDrag();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PointerInfo } from "../../Events/pointerEvents.js";
|
|
2
|
+
import type { Vector3 } from "../../Maths/math.vector.js";
|
|
3
|
+
import type { Nullable } from "../../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Event type for drag move events
|
|
6
|
+
*/
|
|
7
|
+
export type DragEvent = {
|
|
8
|
+
/**
|
|
9
|
+
* Delta between last drag position and current drag position in world space
|
|
10
|
+
*/
|
|
11
|
+
delta: Vector3;
|
|
12
|
+
/**
|
|
13
|
+
* Point in world space where the drag intersects the drag plane
|
|
14
|
+
*
|
|
15
|
+
* (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
|
|
16
|
+
*/
|
|
17
|
+
dragPlanePoint: Vector3;
|
|
18
|
+
/**
|
|
19
|
+
* Normal of the current drag plane used during the drag
|
|
20
|
+
*/
|
|
21
|
+
dragPlaneNormal: Vector3;
|
|
22
|
+
/**
|
|
23
|
+
* Distance along the drag axis
|
|
24
|
+
*/
|
|
25
|
+
dragDistance: number;
|
|
26
|
+
/**
|
|
27
|
+
* Pointer id to use
|
|
28
|
+
*/
|
|
29
|
+
pointerId: number;
|
|
30
|
+
/**
|
|
31
|
+
* Pointer info for the event (if any)
|
|
32
|
+
*/
|
|
33
|
+
pointerInfo: Nullable<PointerInfo>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Event type for drag start and end events
|
|
37
|
+
*/
|
|
38
|
+
export type DragStartEndEvent = Pick<DragEvent, "dragPlanePoint" | "pointerId" | "pointerInfo">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointerDragEvents.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/pointerDragEvents.ts"],"names":[],"mappings":"","sourcesContent":["import type { PointerInfo } from \"core/Events/pointerEvents\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Event type for drag move events\r\n */\r\nexport type DragEvent = {\r\n /**\r\n * Delta between last drag position and current drag position in world space\r\n */\r\n delta: Vector3;\r\n /**\r\n * Point in world space where the drag intersects the drag plane\r\n *\r\n * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)\r\n */\r\n dragPlanePoint: Vector3;\r\n /**\r\n * Normal of the current drag plane used during the drag\r\n */\r\n dragPlaneNormal: Vector3;\r\n /**\r\n * Distance along the drag axis\r\n */\r\n dragDistance: number;\r\n /**\r\n * Pointer id to use\r\n */\r\n pointerId: number;\r\n /**\r\n * Pointer info for the event (if any)\r\n */\r\n pointerInfo: Nullable<PointerInfo>;\r\n};\r\n\r\n/**\r\n * Event type for drag start and end events\r\n */\r\nexport type DragStartEndEvent = Pick<DragEvent, \"dragPlanePoint\" | \"pointerId\" | \"pointerInfo\">;\r\n"]}
|
|
@@ -26,6 +26,12 @@ export declare class StorageBuffer {
|
|
|
26
26
|
* @returns underlying native buffer
|
|
27
27
|
*/
|
|
28
28
|
getBuffer(): DataBuffer;
|
|
29
|
+
/**
|
|
30
|
+
* Clears the storage buffer to zeros
|
|
31
|
+
* @param byteOffset the byte offset to start clearing (optional)
|
|
32
|
+
* @param byteLength the byte length to clear (optional)
|
|
33
|
+
*/
|
|
34
|
+
clear(byteOffset?: number, byteLength?: number): void;
|
|
29
35
|
/**
|
|
30
36
|
* Updates the storage buffer
|
|
31
37
|
* @param data the data used to update the storage buffer
|
package/Buffers/storageBuffer.js
CHANGED
|
@@ -32,6 +32,14 @@ export class StorageBuffer {
|
|
|
32
32
|
getBuffer() {
|
|
33
33
|
return this._buffer;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Clears the storage buffer to zeros
|
|
37
|
+
* @param byteOffset the byte offset to start clearing (optional)
|
|
38
|
+
* @param byteLength the byte length to clear (optional)
|
|
39
|
+
*/
|
|
40
|
+
clear(byteOffset, byteLength) {
|
|
41
|
+
this._engine.clearStorageBuffer(this._buffer, byteOffset, byteLength);
|
|
42
|
+
}
|
|
35
43
|
/**
|
|
36
44
|
* Updates the storage buffer
|
|
37
45
|
* @param data the data used to update the storage buffer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageBuffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/storageBuffer.ts"],"names":[],"mappings":"AAGA,OAAO,EAA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IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjG,CAAC;IAED;;OAEG;IACI,OAAO;QACV,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QACpD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,cAAc,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClE,cAAc,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAW,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport type { DataArray } from \"../types\";\r\nimport type { WebGPUEngine } from \"core/Engines/webgpuEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\n/**\r\n * This class is a small wrapper around a native buffer that can be read and/or written\r\n */\r\nexport class StorageBuffer {\r\n private _engine: WebGPUEngine;\r\n private _buffer: DataBuffer;\r\n private _bufferSize: number;\r\n private _creationFlags: number;\r\n private _label?: string;\r\n\r\n /**\r\n * Creates a new storage buffer instance\r\n * @param engine The engine the buffer will be created inside\r\n * @param size The size of the buffer in bytes\r\n * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added.\r\n * @param label defines the label of the buffer (for debug purpose)\r\n */\r\n constructor(engine: WebGPUEngine, size: number, creationFlags = Constants.BUFFER_CREATIONFLAG_READWRITE, label?: string) {\r\n this._engine = engine;\r\n this._label = label;\r\n this._engine._storageBuffers.push(this);\r\n this._create(size, creationFlags);\r\n }\r\n\r\n private _create(size: number, creationFlags: number): void {\r\n this._bufferSize = size;\r\n this._creationFlags = creationFlags;\r\n this._buffer = this._engine.createStorageBuffer(size, creationFlags, this._label);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this._create(this._bufferSize, this._creationFlags);\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): DataBuffer {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * Updates the storage buffer\r\n * @param data the data used to update the storage buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n public update(data: DataArray, byteOffset?: number, byteLength?: number): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n this._engine.updateStorageBuffer(this._buffer, data, byteOffset, byteLength);\r\n }\r\n\r\n /**\r\n * Reads data from the storage buffer\r\n * @param offset The offset in the storage buffer to start reading from (default: 0)\r\n * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)\r\n * @param buffer The buffer to write the data we have read from the storage buffer to (optional)\r\n * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately. This can speed up data retrieval, at the cost of a small perf penalty (default: false).\r\n * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async read(offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView> {\r\n return await this._engine.readFromStorageBuffer(this._buffer, offset, size, buffer, noDelay);\r\n }\r\n\r\n /**\r\n * Disposes the storage buffer\r\n */\r\n public dispose(): void {\r\n const storageBuffers = this._engine._storageBuffers;\r\n const index = storageBuffers.indexOf(this);\r\n\r\n if (index !== -1) {\r\n storageBuffers[index] = storageBuffers[storageBuffers.length - 1];\r\n storageBuffers.pop();\r\n }\r\n\r\n this._engine._releaseBuffer(this._buffer);\r\n this._buffer = null as any;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"storageBuffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Buffers/storageBuffer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,aAAa;IAOtB;;;;;;OAMG;IACH,YAAY,MAAoB,EAAE,IAAY,EAAE,aAAa,GAAG,SAAS,CAAC,6BAA6B,EAAE,KAAc;QACnH,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtC,CAAC;IAEO,OAAO,CAAC,IAAY,EAAE,aAAqB;QAC/C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAmB,EAAE,UAAmB;QACjD,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,IAAe,EAAE,UAAmB,EAAE,UAAmB;QACnE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;OAOG;IACH,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,MAAe,EAAE,IAAa,EAAE,MAAwB,EAAE,OAAiB;QACzF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjG,CAAC;IAED;;OAEG;IACI,OAAO;QACV,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QACpD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,cAAc,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClE,cAAc,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAW,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport type { DataArray } from \"../types\";\r\nimport type { WebGPUEngine } from \"core/Engines/webgpuEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\n/**\r\n * This class is a small wrapper around a native buffer that can be read and/or written\r\n */\r\nexport class StorageBuffer {\r\n private _engine: WebGPUEngine;\r\n private _buffer: DataBuffer;\r\n private _bufferSize: number;\r\n private _creationFlags: number;\r\n private _label?: string;\r\n\r\n /**\r\n * Creates a new storage buffer instance\r\n * @param engine The engine the buffer will be created inside\r\n * @param size The size of the buffer in bytes\r\n * @param creationFlags flags to use when creating the buffer (see Constants.BUFFER_CREATIONFLAG_XXX). The BUFFER_CREATIONFLAG_STORAGE flag will be automatically added.\r\n * @param label defines the label of the buffer (for debug purpose)\r\n */\r\n constructor(engine: WebGPUEngine, size: number, creationFlags = Constants.BUFFER_CREATIONFLAG_READWRITE, label?: string) {\r\n this._engine = engine;\r\n this._label = label;\r\n this._engine._storageBuffers.push(this);\r\n this._create(size, creationFlags);\r\n }\r\n\r\n private _create(size: number, creationFlags: number): void {\r\n this._bufferSize = size;\r\n this._creationFlags = creationFlags;\r\n this._buffer = this._engine.createStorageBuffer(size, creationFlags, this._label);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this._create(this._bufferSize, this._creationFlags);\r\n }\r\n\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n public getBuffer(): DataBuffer {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * Clears the storage buffer to zeros\r\n * @param byteOffset the byte offset to start clearing (optional)\r\n * @param byteLength the byte length to clear (optional)\r\n */\r\n public clear(byteOffset?: number, byteLength?: number): void {\r\n this._engine.clearStorageBuffer(this._buffer, byteOffset, byteLength);\r\n }\r\n\r\n /**\r\n * Updates the storage buffer\r\n * @param data the data used to update the storage buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n public update(data: DataArray, byteOffset?: number, byteLength?: number): void {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n\r\n this._engine.updateStorageBuffer(this._buffer, data, byteOffset, byteLength);\r\n }\r\n\r\n /**\r\n * Reads data from the storage buffer\r\n * @param offset The offset in the storage buffer to start reading from (default: 0)\r\n * @param size The number of bytes to read from the storage buffer (default: capacity of the buffer)\r\n * @param buffer The buffer to write the data we have read from the storage buffer to (optional)\r\n * @param noDelay If true, a call to flushFramebuffer will be issued so that the data can be read back immediately. This can speed up data retrieval, at the cost of a small perf penalty (default: false).\r\n * @returns If not undefined, returns the (promise) buffer (as provided by the 4th parameter) filled with the data, else it returns a (promise) Uint8Array with the data read from the storage buffer\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async read(offset?: number, size?: number, buffer?: ArrayBufferView, noDelay?: boolean): Promise<ArrayBufferView> {\r\n return await this._engine.readFromStorageBuffer(this._buffer, offset, size, buffer, noDelay);\r\n }\r\n\r\n /**\r\n * Disposes the storage buffer\r\n */\r\n public dispose(): void {\r\n const storageBuffers = this._engine._storageBuffers;\r\n const index = storageBuffers.indexOf(this);\r\n\r\n if (index !== -1) {\r\n storageBuffers[index] = storageBuffers[storageBuffers.length - 1];\r\n storageBuffers.pop();\r\n }\r\n\r\n this._engine._releaseBuffer(this._buffer);\r\n this._buffer = null as any;\r\n }\r\n}\r\n"]}
|
|
@@ -49,9 +49,10 @@ declare module "../../Engines/abstractEngine.js" {
|
|
|
49
49
|
/**
|
|
50
50
|
* Creates a layout object to draw/clear on specific textures in a MRT
|
|
51
51
|
* @param textureStatus textureStatus[i] indicates if the i-th is active
|
|
52
|
+
* @param backBufferLayout if true, the layout will be built to account for the back buffer only, and textureStatus won't be used
|
|
52
53
|
* @returns A layout to be fed to the engine, calling `bindAttachments`.
|
|
53
54
|
*/
|
|
54
|
-
buildTextureLayout(textureStatus: boolean[]): number[];
|
|
55
|
+
buildTextureLayout(textureStatus: boolean[], backBufferLayout?: boolean): number[];
|
|
55
56
|
/**
|
|
56
57
|
* Restores the webgl state to only draw on the main color attachment
|
|
57
58
|
* when the frame buffer associated is the canvas frame buffer
|
|
@@ -10,15 +10,20 @@ ThinEngine.prototype.restoreSingleAttachmentForRenderTarget = function () {
|
|
|
10
10
|
const gl = this._gl;
|
|
11
11
|
this.bindAttachments([gl.COLOR_ATTACHMENT0]);
|
|
12
12
|
};
|
|
13
|
-
ThinEngine.prototype.buildTextureLayout = function (textureStatus) {
|
|
13
|
+
ThinEngine.prototype.buildTextureLayout = function (textureStatus, backBufferLayout = false) {
|
|
14
14
|
const gl = this._gl;
|
|
15
15
|
const result = [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
if (backBufferLayout) {
|
|
17
|
+
result.push(gl.BACK);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
for (let i = 0; i < textureStatus.length; i++) {
|
|
21
|
+
if (textureStatus[i]) {
|
|
22
|
+
result.push(gl["COLOR_ATTACHMENT" + i]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
result.push(gl.NONE);
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
return result;
|