@babylonjs/core 8.36.1 → 8.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.js +1 -4
- package/Animations/animationGroup.js.map +1 -1
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +0 -4
- package/AudioV2/abstractAudio/audioEngineV2.js +0 -4
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js +1 -1
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -1
- package/AudioV2/audioParameter.d.ts +5 -1
- package/AudioV2/audioParameter.js +4 -0
- package/AudioV2/audioParameter.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +0 -18
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +7 -67
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +58 -0
- package/Behaviors/Cameras/interpolatingBehavior.js +157 -0
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +17 -21
- package/Cameras/Inputs/geospatialCameraPointersInput.js +49 -71
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
- package/Cameras/Limits/geospatialLimits.d.ts +60 -0
- package/Cameras/Limits/geospatialLimits.js +89 -0
- package/Cameras/Limits/geospatialLimits.js.map +1 -0
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraMovement.d.ts +150 -0
- package/Cameras/cameraMovement.js +190 -0
- package/Cameras/cameraMovement.js.map +1 -0
- package/Cameras/geospatialCamera.d.ts +78 -49
- package/Cameras/geospatialCamera.js +210 -191
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
- package/Cameras/geospatialCameraInputsManager.js +9 -0
- package/Cameras/geospatialCameraInputsManager.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +66 -0
- package/Cameras/geospatialCameraMovement.js +199 -0
- package/Cameras/geospatialCameraMovement.js.map +1 -0
- package/Cameras/targetCamera.js +0 -4
- package/Cameras/targetCamera.js.map +1 -1
- package/Culling/ray.core.js +1 -1
- package/Culling/ray.core.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +9 -7
- package/Decorators/nodeDecorator.js +9 -7
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +14 -6
- package/Engines/Native/nativeInterfaces.js +6 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +4 -0
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
- package/FlowGraph/flowGraphMath.d.ts +25 -0
- package/FlowGraph/flowGraphMath.js +40 -0
- package/FlowGraph/flowGraphMath.js.map +1 -0
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +26 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +48 -22
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +14 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +2 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Passes/{cullPass.d.ts → objectListPass.d.ts} +8 -8
- package/FrameGraph/Passes/{cullPass.js → objectListPass.js} +9 -9
- package/FrameGraph/Passes/objectListPass.js.map +1 -0
- package/FrameGraph/Passes/renderPass.d.ts +6 -2
- package/FrameGraph/Passes/renderPass.js +14 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +2 -2
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +4 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +10 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +13 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -3
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +1 -2
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +11 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +4 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +7 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +10 -4
- package/FrameGraph/frameGraph.js +22 -9
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +2 -1
- package/FrameGraph/frameGraphRenderContext.js +22 -3
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.js +3 -3
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -1
- package/FrameGraph/index.js +1 -1
- package/FrameGraph/index.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.js +2 -1
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/floatingOriginMatrixOverrides.js +19 -0
- package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +9 -0
- package/Materials/shaderMaterial.js +39 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +5 -24
- package/Maths/math.vector.functions.js +32 -35
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +11 -11
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +15 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +8 -1
- package/Misc/copyTextureToTexture.js +16 -2
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/tools.d.ts +3 -0
- package/Misc/tools.js +43 -4
- package/Misc/tools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.d.ts +6 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js +18 -12
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -3
- package/Particles/EmitterTypes/customParticleEmitter.js +8 -6
- package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +3 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.js +7 -1
- package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +2 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +15 -4
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +66 -36
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +0 -4
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +1 -8
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +13 -9
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +36 -23
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +10 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +50 -17
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/emitters.functions.d.ts +6 -0
- package/Particles/Node/Blocks/Emitters/emitters.functions.js +13 -0
- package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.d.ts +2 -2
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +5 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +3 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +16 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +67 -14
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +3 -3
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.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 +3 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
- package/Particles/Node/Blocks/particleRandomBlock.js +40 -22
- package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +21 -9
- package/Particles/Node/Blocks/systemBlock.js +37 -22
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +7 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +6 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.d.ts +5 -5
- package/Particles/Node/nodeParticleBuildState.js +14 -5
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
- package/Particles/Node/nodeParticleSystemSet.helper.js +586 -148
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/particle.d.ts +4 -0
- package/Particles/particle.js +2 -0
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +3 -7
- package/Particles/thinParticleSystem.function.d.ts +3 -3
- package/Particles/thinParticleSystem.function.js +11 -8
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +5 -7
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/prePassRenderer.js +4 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/copyTextureToTexture.fragment.js +2 -2
- package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/copyTextureToTexture.fragment.js +3 -3
- package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/XR/webXRSessionManager.js +4 -0
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -3
- package/scene.js +8 -7
- package/scene.js.map +1 -1
- package/FrameGraph/Passes/cullPass.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.
|
|
|
5
5
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
|
|
6
6
|
import { Quaternion, Vector3, Vector4 } from "../../../../Maths/math.vector.js";
|
|
7
7
|
import { _GetClassNameOf } from "../../../utils.js";
|
|
8
|
-
import { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from "
|
|
8
|
+
import { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from "../../../flowGraphMath.js";
|
|
9
9
|
const AxisCacheName = "cachedOperationAxis";
|
|
10
10
|
const AngleCacheName = "cachedOperationAngle";
|
|
11
11
|
const CacheExecIdName = "cachedExecutionId";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphVectorMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,uCAA0C;AAC3C,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAItE,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAGvD,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAGlH,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,4BAAqD;IAC3F,YAAY,MAAqC;QAC7C,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,2DAA8B,MAAM,CAAC,CAAC;IAC9G,CAAC;IAEO,kBAAkB,CAAC,CAAkB;QACzC,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACtC,QAAQ,UAAU,EAAE,CAAC;YACjB,4CAA4B;YAC5B,4CAA4B;YAC5B,4CAA4B;YAC5B;gBACI,OAAQ,CAAa,CAAC,MAAM,EAAE,CAAC;YACnC;gBACI,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,EAAE,CA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E,CAAC;gBACT,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,YAAY;QACxB,iGAAmD;IACvD,CAAC;CACJ;AAED,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,6BAA2D;IACnH,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,+FAAgD,MAAM,CAAC,CAAC;IACnK,CAAC;CACJ","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Quaternion, Vector3, Vector4 } from \"core/Maths/math.vector\";\nimport type { Matrix, Vector2 } from \"core/Maths/math.vector\";\nimport type { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport type { FlowGraphMatrix, FlowGraphVector } from \"core/FlowGraph/utils\";\nimport { _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from \"../../../../Maths/math.vector.functions\";\nimport type { Nullable } from \"../../../../types\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\n\n/**\n * Vector length block.\n */\nexport class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), FlowGraphBlockNames.Length, config);\n }\n\n private _polymorphicLength(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n\n/**\n * Configuration for normalized vector\n */\nexport interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * If true, the block will return NaN if the input vector has a length of 0.\n * This is the expected behavior for glTF interactivity graphs.\n */\n nanOnZeroLength?: boolean;\n}\n\n/**\n * Vector normalize block.\n */\nexport class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), FlowGraphBlockNames.Normalize, config);\n }\n\n private _polymorphicNormalize(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n let normalized: FlowGraphVector;\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n normalized = a.normalizeToNew();\n if (this.config?.nanOnZeroLength) {\n const length = a.length();\n if (length === 0) {\n normalized.setAll(NaN);\n }\n }\n return normalized;\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n\n/**\n * Dot product block.\n */\nexport class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), FlowGraphBlockNames.Dot, config);\n }\n\n private _polymorphicDot(a: FlowGraphVector, b: FlowGraphVector) {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n // casting is needed because dot requires both to be the same type\n return (a as Vector3).dot(b as Vector3);\n default:\n throw new Error(`Cannot get dot product of ${a} and ${b}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n\n/**\n * Cross product block.\n */\nexport class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), FlowGraphBlockNames.Cross, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n\n/**\n * 2D rotation block.\n */\nexport class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n\nfunction TransformVector(a: FlowGraphVector, b: FlowGraphMatrix): FlowGraphVector {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return (b as FlowGraphMatrix2D).transformVector(a as Vector2);\n case FlowGraphTypes.Vector3:\n return (b as FlowGraphMatrix3D).transformVector(a as Vector3);\n case FlowGraphTypes.Vector4:\n a = a as Vector4;\n // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3],\n a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7],\n a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11],\n a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]\n );\n default:\n throw new Error(`Cannot transform value ${a}`);\n }\n}\n\n/**\n * Configuration for the transform block.\n */\nexport interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The vector type\n */\n vectorType: FlowGraphTypes;\n}\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {\n constructor(config?: IFlowGraphTransformBlockConfiguration) {\n const vectorType = config?.vectorType || FlowGraphTypes.Vector3;\n const matrixType =\n vectorType === FlowGraphTypes.Vector2 ? FlowGraphTypes.Matrix2D : vectorType === FlowGraphTypes.Vector3 ? FlowGraphTypes.Matrix3D : FlowGraphTypes.Matrix;\n super(\n getRichTypeByFlowGraphType(vectorType),\n getRichTypeByFlowGraphType(matrixType),\n getRichTypeByFlowGraphType(vectorType),\n TransformVector,\n FlowGraphBlockNames.TransformVector,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), FlowGraphBlockNames.TransformCoordinates, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /** @override */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphVectorMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,uCAA0C;AAC3C,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAItE,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAIvD,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,kCAAqC;AAEvG,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,4BAAqD;IAC3F,YAAY,MAAqC;QAC7C,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,2DAA8B,MAAM,CAAC,CAAC;IAC9G,CAAC;IAEO,kBAAkB,CAAC,CAAkB;QACzC,MAAM,UA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QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAClC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,YAAY;QACxB,iGAAmD;IACvD,CAAC;CACJ;AAED,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,6BAA2D;IACnH,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,+FAAgD,MAAM,CAAC,CAAC;IACnK,CAAC;CACJ","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Quaternion, Vector3, Vector4 } from \"core/Maths/math.vector\";\nimport type { Matrix, Vector2 } from \"core/Maths/math.vector\";\nimport type { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport type { FlowGraphMatrix, FlowGraphVector } from \"core/FlowGraph/utils\";\nimport { _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport type { Nullable } from \"../../../../types\";\nimport { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from \"core/FlowGraph/flowGraphMath\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\n\n/**\n * Vector length block.\n */\nexport class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), FlowGraphBlockNames.Length, config);\n }\n\n private _polymorphicLength(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n\n/**\n * Configuration for normalized vector\n */\nexport interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * If true, the block will return NaN if the input vector has a length of 0.\n * This is the expected behavior for glTF interactivity graphs.\n */\n nanOnZeroLength?: boolean;\n}\n\n/**\n * Vector normalize block.\n */\nexport class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), FlowGraphBlockNames.Normalize, config);\n }\n\n private _polymorphicNormalize(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n let normalized: FlowGraphVector;\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n normalized = a.normalizeToNew();\n if (this.config?.nanOnZeroLength) {\n const length = a.length();\n if (length === 0) {\n normalized.setAll(NaN);\n }\n }\n return normalized;\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n\n/**\n * Dot product block.\n */\nexport class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), FlowGraphBlockNames.Dot, config);\n }\n\n private _polymorphicDot(a: FlowGraphVector, b: FlowGraphVector) {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n // casting is needed because dot requires both to be the same type\n return (a as Vector3).dot(b as Vector3);\n default:\n throw new Error(`Cannot get dot product of ${a} and ${b}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n\n/**\n * Cross product block.\n */\nexport class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), FlowGraphBlockNames.Cross, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n\n/**\n * 2D rotation block.\n */\nexport class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n\nfunction TransformVector(a: FlowGraphVector, b: FlowGraphMatrix): FlowGraphVector {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return (b as FlowGraphMatrix2D).transformVector(a as Vector2);\n case FlowGraphTypes.Vector3:\n return (b as FlowGraphMatrix3D).transformVector(a as Vector3);\n case FlowGraphTypes.Vector4:\n a = a as Vector4;\n // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3],\n a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7],\n a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11],\n a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]\n );\n default:\n throw new Error(`Cannot transform value ${a}`);\n }\n}\n\n/**\n * Configuration for the transform block.\n */\nexport interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The vector type\n */\n vectorType: FlowGraphTypes;\n}\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {\n constructor(config?: IFlowGraphTransformBlockConfiguration) {\n const vectorType = config?.vectorType || FlowGraphTypes.Vector3;\n const matrixType =\n vectorType === FlowGraphTypes.Vector2 ? FlowGraphTypes.Matrix2D : vectorType === FlowGraphTypes.Vector3 ? FlowGraphTypes.Matrix3D : FlowGraphTypes.Matrix;\n super(\n getRichTypeByFlowGraphType(vectorType),\n getRichTypeByFlowGraphType(matrixType),\n getRichTypeByFlowGraphType(vectorType),\n TransformVector,\n FlowGraphBlockNames.TransformVector,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), FlowGraphBlockNames.TransformCoordinates, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /** @override */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IQuaternionLike } from "../Maths/math.like.js";
|
|
2
|
+
import { Quaternion, Vector3 } from "../Maths/math.vector.js";
|
|
3
|
+
import type { DeepImmutable } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the angle in radians between two quaternions
|
|
6
|
+
* @param q1 defines the first quaternion
|
|
7
|
+
* @param q2 defines the second quaternion
|
|
8
|
+
* @returns the angle in radians between the two quaternions
|
|
9
|
+
*/
|
|
10
|
+
export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a quaternion from two direction vectors
|
|
13
|
+
* @param a defines the first direction vector
|
|
14
|
+
* @param b defines the second direction vector
|
|
15
|
+
* @returns the target quaternion
|
|
16
|
+
*/
|
|
17
|
+
export declare function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a quaternion from two direction vectors
|
|
20
|
+
* @param a defines the first direction vector
|
|
21
|
+
* @param b defines the second direction vector
|
|
22
|
+
* @param result defines the target quaternion
|
|
23
|
+
* @returns the target quaternion
|
|
24
|
+
*/
|
|
25
|
+
export declare function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Clamp } from "../Maths/math.scalar.functions.js";
|
|
2
|
+
import { Quaternion, Vector3 } from "../Maths/math.vector.js";
|
|
3
|
+
import { Vector3Dot, Vector4Dot } from "../Maths/math.vector.functions.js";
|
|
4
|
+
// *** NOTE ***
|
|
5
|
+
// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to
|
|
6
|
+
// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.
|
|
7
|
+
/**
|
|
8
|
+
* Returns the angle in radians between two quaternions
|
|
9
|
+
* @param q1 defines the first quaternion
|
|
10
|
+
* @param q2 defines the second quaternion
|
|
11
|
+
* @returns the angle in radians between the two quaternions
|
|
12
|
+
*/
|
|
13
|
+
export function GetAngleBetweenQuaternions(q1, q2) {
|
|
14
|
+
return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a quaternion from two direction vectors
|
|
18
|
+
* @param a defines the first direction vector
|
|
19
|
+
* @param b defines the second direction vector
|
|
20
|
+
* @returns the target quaternion
|
|
21
|
+
*/
|
|
22
|
+
export function GetQuaternionFromDirections(a, b) {
|
|
23
|
+
const result = new Quaternion();
|
|
24
|
+
GetQuaternionFromDirectionsToRef(a, b, result);
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a quaternion from two direction vectors
|
|
29
|
+
* @param a defines the first direction vector
|
|
30
|
+
* @param b defines the second direction vector
|
|
31
|
+
* @param result defines the target quaternion
|
|
32
|
+
* @returns the target quaternion
|
|
33
|
+
*/
|
|
34
|
+
export function GetQuaternionFromDirectionsToRef(a, b, result) {
|
|
35
|
+
const axis = Vector3.Cross(a, b);
|
|
36
|
+
const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));
|
|
37
|
+
Quaternion.RotationAxisToRef(axis, angle, result);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=flowGraphMath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphMath.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphMath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAe;AACf,oGAAoG;AACpG,sGAAsG;AAEtG;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,EAAkC,EAAE,EAAkC;IAC7G,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAoB,CAAmB,EAAE,CAAmB;IACnG,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,gCAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAgD,CAAmB,EAAE,CAAmB,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import type { IQuaternionLike } from \"../Maths/math.like\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport { Vector3Dot, Vector4Dot } from \"../Maths/math.vector.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\n\r\n// *** NOTE ***\r\n// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to\r\n// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
|
|
@@ -171,7 +171,7 @@ __decorate([
|
|
|
171
171
|
editableInPropertyPage("Layer texture fixed size", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES")
|
|
172
172
|
], NodeRenderGraphGlowLayerBlock.prototype, "layerTextureFixedSize", null);
|
|
173
173
|
__decorate([
|
|
174
|
-
editableInPropertyPage("Layer texture type",
|
|
174
|
+
editableInPropertyPage("Layer texture type", 10 /* PropertyTypeForEdition.TextureType */, "PROPERTIES")
|
|
175
175
|
], NodeRenderGraphGlowLayerBlock.prototype, "layerTextureType", null);
|
|
176
176
|
__decorate([
|
|
177
177
|
editableInPropertyPage("Blur kernel size", 2 /* PropertyTypeForEdition.Int */, "PROPERTIES", { min: 1, max: 256 })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/glowLayerBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,+CAAmD;AACrF,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,oBAAoB;IAKnE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;;;;;OASG;IACH,YACI,IAAY,EACZ,UAAsB,EACtB,KA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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzD,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AAnIG;IADC,sBAAsB,CAAC,WAAW,0CAAkC,YAAY,CAAC;6DAGjF;AAUD;IADC,sBAAsB,CAAC,qBAAqB,wCAAgC,YAAY,CAAC;sEAGzF;AAUD;IADC,sBAAsB,CAAC,0BAA0B,wCAAgC,YAAY,CAAC;0EAG9F;AAUD;IADC,sBAAsB,CAAC,oBAAoB,8CAAsC,YAAY,CAAC;qEAG9F;AAUD;IADC,sBAAsB,CAAC,kBAAkB,sCAA8B,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;mEAG1G;AAQD;IADC,sBAAsB,CAAC,WAAW,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;8DAGnG;AAyEL,aAAa,CAAC,uCAAuC,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import type { Scene, NodeRenderGraphBuildState, FrameGraph, FrameGraphTextureHandle, NodeRenderGraphConnectionPoint, FrameGraphObjectRendererTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphGlowLayerTask } from \"core/FrameGraph/Tasks/Layers/glowLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the glow layer\r\n */\r\nexport class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphGlowLayerTask;\r\n\r\n public override _additionalConstructionParameters: [boolean, number, number | undefined, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphGlowLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param ldrMerge Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n ldrMerge = false,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n false,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(ldrMerge: boolean, layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const blurKernelSize = this.blurKernelSize;\r\n const intensity = this.intensity;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurKernelSize = blurKernelSize;\r\n this.intensity = intensity;\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Forces the merge step to be done in ldr (clamp values > 1). Default: false */\r\n @editableInPropertyPage(\"LDR merge\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get ldrMerge() {\r\n return this._frameGraphTask.layer.ldrMerge;\r\n }\r\n\r\n public set ldrMerge(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureRatio, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** How big is the kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur kernel size\", PropertyTypeForEdition.Int, \"PROPERTIES\", { min: 1, max: 256 })\r\n public get blurKernelSize() {\r\n return this._frameGraphTask.layer.blurKernelSize;\r\n }\r\n\r\n public set blurKernelSize(value: number) {\r\n this._frameGraphTask.layer.blurKernelSize = value;\r\n }\r\n\r\n /** The intensity of the glow */\r\n @editableInPropertyPage(\"Intensity\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 5 })\r\n public get intensity() {\r\n return this._frameGraphTask.layer.intensity;\r\n }\r\n\r\n public set intensity(value: number) {\r\n this._frameGraphTask.layer.intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphGlowLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurKernelSize = ${this.blurKernelSize};`);\r\n codes.push(`${this._codeVariableName}.intensity = ${this.intensity};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.blurKernelSize = this.blurKernelSize;\r\n serializationObject.intensity = this.intensity;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurKernelSize = serializationObject.blurKernelSize;\r\n this.intensity = serializationObject.intensity;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphGlowLayerBlock\", NodeRenderGraphGlowLayerBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"glowLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/glowLayerBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,+CAAmD;AACrF,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,oBAAoB;IAKnE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;;;;;OASG;IACH,YACI,IAAY,EACZ,UAAsB,EACtB,KAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,iBAAiB,GAAG,GAAG,EACvB,qBAA8B,EAC9B,gBAAgB,GAAG,SAAS,CAAC,yBAAyB;QAEtD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,iCAAiC,GAAG,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G,IAAI,CAAC,SAAS,CAAC;QAC/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AAnIG;IADC,sBAAsB,CAAC,WAAW,0CAAkC,YAAY,CAAC;6DAGjF;AAUD;IADC,sBAAsB,CAAC,qBAAqB,wCAAgC,YAAY,CAAC;sEAGzF;AAUD;IADC,sBAAsB,CAAC,0BAA0B,wCAAgC,YAAY,CAAC;0EAG9F;AAUD;IADC,sBAAsB,CAAC,oBAAoB,+CAAsC,YAAY,CAAC;qEAG9F;AAUD;IADC,sBAAsB,CAAC,kBAAkB,sCAA8B,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;mEAG1G;AAQD;IADC,sBAAsB,CAAC,WAAW,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;8DAGnG;AAyEL,aAAa,CAAC,uCAAuC,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import type { Scene, NodeRenderGraphBuildState, FrameGraph, FrameGraphTextureHandle, NodeRenderGraphConnectionPoint, FrameGraphObjectRendererTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphGlowLayerTask } from \"core/FrameGraph/Tasks/Layers/glowLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the glow layer\r\n */\r\nexport class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphGlowLayerTask;\r\n\r\n public override _additionalConstructionParameters: [boolean, number, number | undefined, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphGlowLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param ldrMerge Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n ldrMerge = false,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n false,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(ldrMerge: boolean, layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const blurKernelSize = this.blurKernelSize;\r\n const intensity = this.intensity;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurKernelSize = blurKernelSize;\r\n this.intensity = intensity;\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Forces the merge step to be done in ldr (clamp values > 1). Default: false */\r\n @editableInPropertyPage(\"LDR merge\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get ldrMerge() {\r\n return this._frameGraphTask.layer.ldrMerge;\r\n }\r\n\r\n public set ldrMerge(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureRatio, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** How big is the kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur kernel size\", PropertyTypeForEdition.Int, \"PROPERTIES\", { min: 1, max: 256 })\r\n public get blurKernelSize() {\r\n return this._frameGraphTask.layer.blurKernelSize;\r\n }\r\n\r\n public set blurKernelSize(value: number) {\r\n this._frameGraphTask.layer.blurKernelSize = value;\r\n }\r\n\r\n /** The intensity of the glow */\r\n @editableInPropertyPage(\"Intensity\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 5 })\r\n public get intensity() {\r\n return this._frameGraphTask.layer.intensity;\r\n }\r\n\r\n public set intensity(value: number) {\r\n this._frameGraphTask.layer.intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphGlowLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurKernelSize = ${this.blurKernelSize};`);\r\n codes.push(`${this._codeVariableName}.intensity = ${this.intensity};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.blurKernelSize = this.blurKernelSize;\r\n serializationObject.intensity = this.intensity;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurKernelSize = serializationObject.blurKernelSize;\r\n this.intensity = serializationObject.intensity;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphGlowLayerBlock\", NodeRenderGraphGlowLayerBlock);\r\n"]}
|
|
@@ -185,7 +185,7 @@ __decorate([
|
|
|
185
185
|
editableInPropertyPage("Is stroke", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
|
|
186
186
|
], NodeRenderGraphHighlightLayerBlock.prototype, "isStroke", null);
|
|
187
187
|
__decorate([
|
|
188
|
-
editableInPropertyPage("Layer texture type",
|
|
188
|
+
editableInPropertyPage("Layer texture type", 10 /* PropertyTypeForEdition.TextureType */, "PROPERTIES")
|
|
189
189
|
], NodeRenderGraphHighlightLayerBlock.prototype, "layerTextureType", null);
|
|
190
190
|
__decorate([
|
|
191
191
|
editableInPropertyPage("Blur horizontal size", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES", { min: 0, max: 4 })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlightLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,oDAAwD;AAC/F,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,oBAAoB;IAKxE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;I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AAsB,CAAC,qBAAqB,wCAAgC,YAAY,CAAC;2EAGzF;AAUD;IADC,sBAAsB,CAAC,0BAA0B,wCAAgC,YAAY,CAAC;+EAG9F;AAUD;IADC,sBAAsB,CAAC,yBAAyB,wCAAgC,YAAY,CAAC;8EAG7F;AAUD;IADC,sBAAsB,CAAC,WAAW,0CAAkC,YAAY,CAAC;kEAGjF;AAUD;IADC,sBAAsB,CAAC,oBAAoB,8CAAsC,YAAY,CAAC;0EAG9F;AAUD;IADC,sBAAsB,CAAC,sBAAsB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;4EAG9G;AAQD;IADC,sBAAsB,CAAC,oBAAoB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0EAG5G;AAyEL,aAAa,CAAC,4CAA4C,EAAE,kCAAkC,CAAC,CAAC","sourcesContent":["import type { Scene, NodeRenderGraphBuildState, FrameGraph, FrameGraphTextureHandle, NodeRenderGraphConnectionPoint, FrameGraphObjectRendererTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphHighlightLayerTask } from \"core/FrameGraph/Tasks/Layers/highlightLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the highlight layer\r\n */\r\nexport class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphHighlightLayerTask;\r\n\r\n public override _additionalConstructionParameters: [number, number | undefined, number, boolean, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphHighlightLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param blurTextureSizeRatio defines the factor to apply to the layer texture size to create the blur textures (default: 0.5)\r\n * @param isStroke should we display highlight as a solid stroke? (default: false)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n blurTextureSizeRatio = 0.5,\r\n isStroke = false,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, blurTextureSizeRatio: number, isStroke: boolean, layerTextureType: number) {\r\n const blurHorizontalSize = this.blurHorizontalSize;\r\n const blurVerticalSize = this.blurVerticalSize;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurHorizontalSize = blurHorizontalSize;\r\n this.blurVerticalSize = blurVerticalSize;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the factor to apply to the layer texture size to create the blur textures */\r\n @editableInPropertyPage(\"Blur texture size ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get blurTextureSizeRatio() {\r\n return this._frameGraphTask.layer._options.blurTextureSizeRatio;\r\n }\r\n\r\n public set blurTextureSizeRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Should we display highlight as a solid stroke? */\r\n @editableInPropertyPage(\"Is stroke\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get isStroke() {\r\n return this._frameGraphTask.layer._options.isStroke;\r\n }\r\n\r\n public set isStroke(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, value);\r\n }\r\n\r\n /** How big is the horizontal kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur horizontal size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurHorizontalSize() {\r\n return this._frameGraphTask.layer.blurHorizontalSize;\r\n }\r\n\r\n public set blurHorizontalSize(value: number) {\r\n this._frameGraphTask.layer.blurHorizontalSize = value;\r\n }\r\n\r\n /** How big is the vertical kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur vertical size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurVerticalSize() {\r\n return this._frameGraphTask.layer.blurVerticalSize;\r\n }\r\n\r\n public set blurVerticalSize(value: number) {\r\n this._frameGraphTask.layer.blurVerticalSize = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphHighlightLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurHorizontalSize = ${this.blurHorizontalSize};`);\r\n codes.push(`${this._codeVariableName}.blurVerticalSize = ${this.blurVerticalSize};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.blurHorizontalSize = this.blurHorizontalSize;\r\n serializationObject.blurVerticalSize = this.blurVerticalSize;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurHorizontalSize = serializationObject.blurHorizontalSize;\r\n this.blurVerticalSize = serializationObject.blurVerticalSize;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphHighlightLayerBlock\", NodeRenderGraphHighlightLayerBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"highlightLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,oDAAwD;AAC/F,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,oBAAoB;IAKxE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACI,IAAY,EACZ,UAAsB,EACt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D;IADC,sBAAsB,CAAC,0BAA0B,wCAAgC,YAAY,CAAC;+EAG9F;AAUD;IADC,sBAAsB,CAAC,yBAAyB,wCAAgC,YAAY,CAAC;8EAG7F;AAUD;IADC,sBAAsB,CAAC,WAAW,0CAAkC,YAAY,CAAC;kEAGjF;AAUD;IADC,sBAAsB,CAAC,oBAAoB,+CAAsC,YAAY,CAAC;0EAG9F;AAUD;IADC,sBAAsB,CAAC,sBAAsB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;4EAG9G;AAQD;IADC,sBAAsB,CAAC,oBAAoB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0EAG5G;AAyEL,aAAa,CAAC,4CAA4C,EAAE,kCAAkC,CAAC,CAAC","sourcesContent":["import type { Scene, NodeRenderGraphBuildState, FrameGraph, FrameGraphTextureHandle, NodeRenderGraphConnectionPoint, FrameGraphObjectRendererTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphHighlightLayerTask } from \"core/FrameGraph/Tasks/Layers/highlightLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the highlight layer\r\n */\r\nexport class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphHighlightLayerTask;\r\n\r\n public override _additionalConstructionParameters: [number, number | undefined, number, boolean, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphHighlightLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param blurTextureSizeRatio defines the factor to apply to the layer texture size to create the blur textures (default: 0.5)\r\n * @param isStroke should we display highlight as a solid stroke? (default: false)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n blurTextureSizeRatio = 0.5,\r\n isStroke = false,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, blurTextureSizeRatio: number, isStroke: boolean, layerTextureType: number) {\r\n const blurHorizontalSize = this.blurHorizontalSize;\r\n const blurVerticalSize = this.blurVerticalSize;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurHorizontalSize = blurHorizontalSize;\r\n this.blurVerticalSize = blurVerticalSize;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the factor to apply to the layer texture size to create the blur textures */\r\n @editableInPropertyPage(\"Blur texture size ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get blurTextureSizeRatio() {\r\n return this._frameGraphTask.layer._options.blurTextureSizeRatio;\r\n }\r\n\r\n public set blurTextureSizeRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Should we display highlight as a solid stroke? */\r\n @editableInPropertyPage(\"Is stroke\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get isStroke() {\r\n return this._frameGraphTask.layer._options.isStroke;\r\n }\r\n\r\n public set isStroke(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, value);\r\n }\r\n\r\n /** How big is the horizontal kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur horizontal size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurHorizontalSize() {\r\n return this._frameGraphTask.layer.blurHorizontalSize;\r\n }\r\n\r\n public set blurHorizontalSize(value: number) {\r\n this._frameGraphTask.layer.blurHorizontalSize = value;\r\n }\r\n\r\n /** How big is the vertical kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur vertical size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurVerticalSize() {\r\n return this._frameGraphTask.layer.blurVerticalSize;\r\n }\r\n\r\n public set blurVerticalSize(value: number) {\r\n this._frameGraphTask.layer.blurVerticalSize = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphHighlightLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurHorizontalSize = ${this.blurHorizontalSize};`);\r\n codes.push(`${this._codeVariableName}.blurVerticalSize = ${this.blurVerticalSize};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.blurHorizontalSize = this.blurHorizontalSize;\r\n serializationObject.blurVerticalSize = this.blurVerticalSize;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurHorizontalSize = serializationObject.blurHorizontalSize;\r\n this.blurVerticalSize = serializationObject.blurVerticalSize;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphHighlightLayerBlock\", NodeRenderGraphHighlightLayerBlock);\r\n"]}
|
|
@@ -7,7 +7,7 @@ interface IPostProcessLike {
|
|
|
7
7
|
outputTexture: FrameGraphTextureHandle;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Base class for post process like blocks.
|
|
11
11
|
*/
|
|
12
12
|
export declare class NodeRenderGraphBasePostProcessBlock extends NodeRenderGraphBlock {
|
|
13
13
|
protected _frameGraphTask: IPostProcessLike & FrameGraphTask;
|
|
@@ -3,7 +3,7 @@ import { NodeRenderGraphBlock } from "../../nodeRenderGraphBlock.js";
|
|
|
3
3
|
import { NodeRenderGraphBlockConnectionPointTypes } from "../../Types/nodeRenderGraphTypes.js";
|
|
4
4
|
import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Base class for post process like blocks.
|
|
7
7
|
*/
|
|
8
8
|
export class NodeRenderGraphBasePostProcessBlock extends NodeRenderGraphBlock {
|
|
9
9
|
/**
|
|
@@ -80,6 +80,6 @@ export class NodeRenderGraphBasePostProcessBlock extends NodeRenderGraphBlock {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
__decorate([
|
|
83
|
-
editableInPropertyPage("Source sampling mode",
|
|
83
|
+
editableInPropertyPage("Source sampling mode", 8 /* PropertyTypeForEdition.SamplingMode */, "BASE PROPERTIES")
|
|
84
84
|
], NodeRenderGraphBasePostProcessBlock.prototype, "sourceSamplingMode", null);
|
|
85
85
|
//# sourceMappingURL=basePostProcessBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePostProcessBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAStG;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,oBAAoB;IAGzE;;;;;OAKG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE,KAAY;QACjE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,wCAAwC,CAAC,UAAU,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,wCAAwC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAExF,IAAI,CAAC,MAAM,CAAC,0CAA0C,CAAC,wCAAwC,CAAC,uBAAuB,CAAC,CAAC;QACzH,IAAI,CAAC,MAAM,CAAC,0CAA0C,CAAC,wCAAwC,CAAC,UAAU,CAAC,CAAC;IAChH,CAAC;IAES,+BAA+B;QACrC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,wCAAwC,CAAC,YAAY,CAAC,CAAC;QAErF,IAAI,CAAC,MAAM,CAAC,qBAAqB,GAAG,GAAG,EAAE;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC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CAAC;IAC1D,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;IACrE,CAAC;CACJ;AA9DG;IADC,sBAAsB,CAAC,sBAAsB,+CAAuC,iBAAiB,CAAC;6EAGtG","sourcesContent":["import type { NodeRenderGraphConnectionPoint, Scene, NodeRenderGraphBuildState, FrameGraphTextureHandle, FrameGraph, FrameGraphTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\n\r\ninterface IPostProcessLike {\r\n sourceSamplingMode: number;\r\n sourceTexture?: FrameGraphTextureHandle;\r\n targetTexture?: FrameGraphTextureHandle;\r\n outputTexture: FrameGraphTextureHandle;\r\n}\r\n\r\n/**\r\n *
|
|
1
|
+
{"version":3,"file":"basePostProcessBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAStG;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,oBAAoB;IAGzE;;;;;OAKG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE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CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW,CAAC,KAAgC;QAC3D,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAEvD,IAAI,CAAC,eAAe,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,KAAgC,CAAC;QAClG,IAAI,CAAC,eAAe,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,KAAgC,CAAC;IACtG,CAAC;IAEkB,mBAAmB;QAClC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,yBAAyB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QACzF,OAAO,KAAK,CAAC,mBAAmB,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;IACrE,CAAC;CACJ;AA9DG;IADC,sBAAsB,CAAC,sBAAsB,+CAAuC,iBAAiB,CAAC;6EAGtG","sourcesContent":["import type { NodeRenderGraphConnectionPoint, Scene, NodeRenderGraphBuildState, FrameGraphTextureHandle, FrameGraph, FrameGraphTask } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\n\r\ninterface IPostProcessLike {\r\n sourceSamplingMode: number;\r\n sourceTexture?: FrameGraphTextureHandle;\r\n targetTexture?: FrameGraphTextureHandle;\r\n outputTexture: FrameGraphTextureHandle;\r\n}\r\n\r\n/**\r\n * Base class for post process like blocks.\r\n */\r\nexport class NodeRenderGraphBasePostProcessBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: IPostProcessLike & FrameGraphTask;\r\n\r\n /**\r\n * Create a new NodeRenderGraphBasePostProcessBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"source\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n this.source.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\r\n }\r\n\r\n protected _finalizeInputOutputRegistering() {\r\n this._addDependenciesInput();\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = () => {\r\n return this.target.isConnected ? this.target : this.source;\r\n };\r\n }\r\n\r\n /** Sampling mode used to sample from the source texture */\r\n @editableInPropertyPage(\"Source sampling mode\", PropertyTypeForEdition.SamplingMode, \"BASE PROPERTIES\")\r\n public get sourceSamplingMode() {\r\n return this._frameGraphTask.sourceSamplingMode;\r\n }\r\n\r\n public set sourceSamplingMode(value: number) {\r\n this._frameGraphTask.sourceSamplingMode = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphBasePostProcessBlock\";\r\n }\r\n\r\n /**\r\n * Gets the source input component\r\n */\r\n public get source(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the target input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.sourceTexture = this.source.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.sourceSamplingMode = ${this.sourceSamplingMode};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.sourceSamplingMode = this.sourceSamplingMode;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.sourceSamplingMode = serializationObject.sourceSamplingMode;\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FrameGraphPostProcessTask, IViewportLike } from "../../../../index.js";
|
|
2
2
|
import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Base class for post process blocks.
|
|
5
5
|
*/
|
|
6
6
|
export declare class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {
|
|
7
7
|
protected _frameGraphTask: FrameGraphPostProcessTask;
|
|
@@ -2,7 +2,7 @@ import { __decorate } from "../../../../tslib.es6.js";
|
|
|
2
2
|
import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
3
3
|
import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Base class for post process blocks.
|
|
6
6
|
*/
|
|
7
7
|
export class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {
|
|
8
8
|
constructor() {
|
|
@@ -147,6 +147,6 @@ __decorate([
|
|
|
147
147
|
editableInPropertyPage("Use full screen viewport", 0 /* PropertyTypeForEdition.Boolean */, "BASE PROPERTIES")
|
|
148
148
|
], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "useFullScreenViewport", null);
|
|
149
149
|
__decorate([
|
|
150
|
-
editableInPropertyPage("Viewport",
|
|
150
|
+
editableInPropertyPage("Viewport", 13 /* PropertyTypeForEdition.Viewport */, "BASE PROPERTIES")
|
|
151
151
|
], NodeRenderGraphBaseWithPropertiesPostProcessBlock.prototype, "viewport", null);
|
|
152
152
|
//# sourceMappingURL=baseWithPropertiesPostProcessBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseWithPropertiesPostProcessBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,iDAAkD,SAAQ,mCAAmC;IAA1G;;QAGc,wBAAmB,GAAG,KAAK,CAAC;QAC5B,2BAAsB,GAAG,IAAI,CAAC;QAC9B,cAAS,GAAkB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EA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D,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,mBAAmB,CAAC,eAAe,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,mBAAmB,CAAC,iBAAiB,CAAC;QACjE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,IAAI,IAAI,CAAC;QACvD,IAAI,mBAAmB,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACvD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;YAClE,IAAI,CAAC,sBAAsB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC;YACxE,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;CACJ;AAzIG;IADC,sBAAsB,CAAC,iBAAiB,0CAAkC,iBAAiB,CAAC;sFAG5F;AAQD;IADC,sBAAsB,CAAC,mBAAmB,0CAAkC,iBAAiB,CAAC;wFAG9F;AAQD;IADC,sBAAsB,CAAC,qBAAqB,0CAAkC,iBAAiB,CAAC;0FAGhG;AAQD;IADC,sBAAsB,CAAC,gBAAgB,0CAAkC,iBAAiB,CAAC;qFAG3F;AAQD;IADC,sBAAsB,CAAC,YAAY,0CAAkC,iBAAiB,CAAC;kFAGvF;AAkBD;IADC,sBAAsB,CAAC,+BAA+B,0CAAkC,iBAAiB,CAAC;2FAG1G;AASD;IADC,sBAAsB,CAAC,0BAA0B,0CAAkC,iBAAiB,CAAC;8FAGrG;AASD;IADC,sBAAsB,CAAC,UAAU,4CAAmC,iBAAiB,CAAC;iFAGtF","sourcesContent":["import type { FrameGraphPostProcessTask, IViewportLike } from \"core/index\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { NodeRenderGraphBasePostProcessBlock } from \"./basePostProcessBlock\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {\r\n protected override _frameGraphTask: FrameGraphPostProcessTask;\r\n\r\n protected _useCurrentViewport = false;\r\n protected _useFullScreenViewport = true;\r\n protected _viewport: IViewportLike = { x: 0, y: 0, width: 1, height: 1 };\r\n\r\n /** If true, the depth attachment will be read-only. */\r\n @editableInPropertyPage(\"Depth Read Only\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get depthReadOnly(): boolean {\r\n return this._frameGraphTask.depthReadOnly;\r\n }\r\n\r\n public set depthReadOnly(value: boolean) {\r\n this._frameGraphTask.depthReadOnly = value;\r\n }\r\n\r\n /** If true, the stencil attachment will be read-only. */\r\n @editableInPropertyPage(\"Stencil Read Only\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get stencilReadOnly(): boolean {\r\n return this._frameGraphTask.stencilReadOnly;\r\n }\r\n\r\n public set stencilReadOnly(value: boolean) {\r\n this._frameGraphTask.stencilReadOnly = value;\r\n }\r\n\r\n /** If true, color write will be disabled when applying the post process. */\r\n @editableInPropertyPage(\"Disable Color Write\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get disableColorWrite(): boolean {\r\n return this._frameGraphTask.disableColorWrite;\r\n }\r\n\r\n public set disableColorWrite(value: boolean) {\r\n this._frameGraphTask.disableColorWrite = value;\r\n }\r\n\r\n /** If true, the post process will be generated by a back face full-screen quad (CW order). */\r\n @editableInPropertyPage(\"Draw Back Face\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get drawBackFace(): boolean {\r\n return this._frameGraphTask.drawBackFace;\r\n }\r\n\r\n public set drawBackFace(value: boolean) {\r\n this._frameGraphTask.drawBackFace = value;\r\n }\r\n\r\n /** If depth testing should be enabled (default is true). */\r\n @editableInPropertyPage(\"Depth Test\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get depthTest(): boolean {\r\n return this._frameGraphTask.depthTest;\r\n }\r\n\r\n public set depthTest(value: boolean) {\r\n this._frameGraphTask.depthTest = value;\r\n }\r\n\r\n private _setViewport() {\r\n if (this._useCurrentViewport) {\r\n this._frameGraphTask.viewport = null;\r\n } else if (this._useFullScreenViewport) {\r\n this._frameGraphTask.viewport = undefined;\r\n } else {\r\n this._frameGraphTask.viewport = this._viewport;\r\n }\r\n }\r\n\r\n /** If true, the current viewport will be left unchanged. */\r\n @editableInPropertyPage(\"Use currently active viewport\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get useCurrentViewport(): boolean {\r\n return this._useCurrentViewport;\r\n }\r\n\r\n public set useCurrentViewport(value: boolean) {\r\n this._useCurrentViewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /** If true, a full screen viewport will be used. */\r\n @editableInPropertyPage(\"Use full screen viewport\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get useFullScreenViewport(): boolean {\r\n return this._useFullScreenViewport;\r\n }\r\n\r\n public set useFullScreenViewport(value: boolean) {\r\n this._useFullScreenViewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /** The viewport to use. */\r\n @editableInPropertyPage(\"Viewport\", PropertyTypeForEdition.Viewport, \"BASE PROPERTIES\")\r\n public get viewport(): IViewportLike {\r\n return this._viewport;\r\n }\r\n\r\n public set viewport(value: IViewportLike) {\r\n this._viewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphBaseWithPropertiesPostProcessBlock\";\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.depthReadOnly = ${this.depthReadOnly};`);\r\n codes.push(`${this._codeVariableName}.stencilReadOnly = ${this.stencilReadOnly};`);\r\n codes.push(`${this._codeVariableName}.disableColorWrite = ${this.disableColorWrite};`);\r\n codes.push(`${this._codeVariableName}.drawBackFace = ${this.drawBackFace};`);\r\n codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`);\r\n codes.push(`${this._codeVariableName}.viewport = ${this._useCurrentViewport ? \"null\" : this._useFullScreenViewport ? \"undefined\" : JSON.stringify(this._viewport)};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.depthReadOnly = this.depthReadOnly;\r\n serializationObject.stencilReadOnly = this.stencilReadOnly;\r\n serializationObject.disableColorWrite = this.disableColorWrite;\r\n serializationObject.drawBackFace = this.drawBackFace;\r\n serializationObject.depthTest = this.depthTest;\r\n serializationObject.useCurrentViewport = this._useCurrentViewport;\r\n serializationObject.useFullScreenViewport = this._useFullScreenViewport;\r\n serializationObject.viewport = this._viewport;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.depthReadOnly = !!serializationObject.depthReadOnly;\r\n this.stencilReadOnly = !!serializationObject.stencilReadOnly;\r\n this.disableColorWrite = !!serializationObject.disableColorWrite;\r\n this.drawBackFace = !!serializationObject.drawBackFace;\r\n this.depthTest = serializationObject.depthTest ?? true;\r\n if (serializationObject.useCurrentViewport !== undefined) {\r\n this._useCurrentViewport = serializationObject.useCurrentViewport;\r\n this._useFullScreenViewport = serializationObject.useFullScreenViewport;\r\n this._viewport = serializationObject.viewport;\r\n }\r\n this._setViewport();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"baseWithPropertiesPostProcessBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;GAEG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G;AASD;IADC,sBAAsB,CAAC,UAAU,4CAAmC,iBAAiB,CAAC;iFAGtF","sourcesContent":["import type { FrameGraphPostProcessTask, IViewportLike } from \"core/index\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { NodeRenderGraphBasePostProcessBlock } from \"./basePostProcessBlock\";\r\n\r\n/**\r\n * Base class for post process blocks.\r\n */\r\nexport class NodeRenderGraphBaseWithPropertiesPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {\r\n protected override _frameGraphTask: FrameGraphPostProcessTask;\r\n\r\n protected _useCurrentViewport = false;\r\n protected _useFullScreenViewport = true;\r\n protected _viewport: IViewportLike = { x: 0, y: 0, width: 1, height: 1 };\r\n\r\n /** If true, the depth attachment will be read-only. */\r\n @editableInPropertyPage(\"Depth Read Only\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get depthReadOnly(): boolean {\r\n return this._frameGraphTask.depthReadOnly;\r\n }\r\n\r\n public set depthReadOnly(value: boolean) {\r\n this._frameGraphTask.depthReadOnly = value;\r\n }\r\n\r\n /** If true, the stencil attachment will be read-only. */\r\n @editableInPropertyPage(\"Stencil Read Only\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get stencilReadOnly(): boolean {\r\n return this._frameGraphTask.stencilReadOnly;\r\n }\r\n\r\n public set stencilReadOnly(value: boolean) {\r\n this._frameGraphTask.stencilReadOnly = value;\r\n }\r\n\r\n /** If true, color write will be disabled when applying the post process. */\r\n @editableInPropertyPage(\"Disable Color Write\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get disableColorWrite(): boolean {\r\n return this._frameGraphTask.disableColorWrite;\r\n }\r\n\r\n public set disableColorWrite(value: boolean) {\r\n this._frameGraphTask.disableColorWrite = value;\r\n }\r\n\r\n /** If true, the post process will be generated by a back face full-screen quad (CW order). */\r\n @editableInPropertyPage(\"Draw Back Face\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get drawBackFace(): boolean {\r\n return this._frameGraphTask.drawBackFace;\r\n }\r\n\r\n public set drawBackFace(value: boolean) {\r\n this._frameGraphTask.drawBackFace = value;\r\n }\r\n\r\n /** If depth testing should be enabled (default is true). */\r\n @editableInPropertyPage(\"Depth Test\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get depthTest(): boolean {\r\n return this._frameGraphTask.depthTest;\r\n }\r\n\r\n public set depthTest(value: boolean) {\r\n this._frameGraphTask.depthTest = value;\r\n }\r\n\r\n private _setViewport() {\r\n if (this._useCurrentViewport) {\r\n this._frameGraphTask.viewport = null;\r\n } else if (this._useFullScreenViewport) {\r\n this._frameGraphTask.viewport = undefined;\r\n } else {\r\n this._frameGraphTask.viewport = this._viewport;\r\n }\r\n }\r\n\r\n /** If true, the current viewport will be left unchanged. */\r\n @editableInPropertyPage(\"Use currently active viewport\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get useCurrentViewport(): boolean {\r\n return this._useCurrentViewport;\r\n }\r\n\r\n public set useCurrentViewport(value: boolean) {\r\n this._useCurrentViewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /** If true, a full screen viewport will be used. */\r\n @editableInPropertyPage(\"Use full screen viewport\", PropertyTypeForEdition.Boolean, \"BASE PROPERTIES\")\r\n public get useFullScreenViewport(): boolean {\r\n return this._useFullScreenViewport;\r\n }\r\n\r\n public set useFullScreenViewport(value: boolean) {\r\n this._useFullScreenViewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /** The viewport to use. */\r\n @editableInPropertyPage(\"Viewport\", PropertyTypeForEdition.Viewport, \"BASE PROPERTIES\")\r\n public get viewport(): IViewportLike {\r\n return this._viewport;\r\n }\r\n\r\n public set viewport(value: IViewportLike) {\r\n this._viewport = value;\r\n this._setViewport();\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphBaseWithPropertiesPostProcessBlock\";\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.depthReadOnly = ${this.depthReadOnly};`);\r\n codes.push(`${this._codeVariableName}.stencilReadOnly = ${this.stencilReadOnly};`);\r\n codes.push(`${this._codeVariableName}.disableColorWrite = ${this.disableColorWrite};`);\r\n codes.push(`${this._codeVariableName}.drawBackFace = ${this.drawBackFace};`);\r\n codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`);\r\n codes.push(`${this._codeVariableName}.viewport = ${this._useCurrentViewport ? \"null\" : this._useFullScreenViewport ? \"undefined\" : JSON.stringify(this._viewport)};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.depthReadOnly = this.depthReadOnly;\r\n serializationObject.stencilReadOnly = this.stencilReadOnly;\r\n serializationObject.disableColorWrite = this.disableColorWrite;\r\n serializationObject.drawBackFace = this.drawBackFace;\r\n serializationObject.depthTest = this.depthTest;\r\n serializationObject.useCurrentViewport = this._useCurrentViewport;\r\n serializationObject.useFullScreenViewport = this._useFullScreenViewport;\r\n serializationObject.viewport = this._viewport;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.depthReadOnly = !!serializationObject.depthReadOnly;\r\n this.stencilReadOnly = !!serializationObject.stencilReadOnly;\r\n this.disableColorWrite = !!serializationObject.disableColorWrite;\r\n this.drawBackFace = !!serializationObject.drawBackFace;\r\n this.depthTest = serializationObject.depthTest ?? true;\r\n if (serializationObject.useCurrentViewport !== undefined) {\r\n this._useCurrentViewport = serializationObject.useCurrentViewport;\r\n this._useFullScreenViewport = serializationObject.useFullScreenViewport;\r\n this._viewport = serializationObject.viewport;\r\n }\r\n this._setViewport();\r\n }\r\n}\r\n"]}
|
|
@@ -115,7 +115,7 @@ export class NodeRenderGraphCircleOfConfusionPostProcessBlock extends NodeRender
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
__decorate([
|
|
118
|
-
editableInPropertyPage("Depth sampling mode",
|
|
118
|
+
editableInPropertyPage("Depth sampling mode", 8 /* PropertyTypeForEdition.SamplingMode */, "PROPERTIES")
|
|
119
119
|
], NodeRenderGraphCircleOfConfusionPostProcessBlock.prototype, "depthSamplingMode", null);
|
|
120
120
|
__decorate([
|
|
121
121
|
editableInPropertyPage("Lens size", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES")
|
|
@@ -50,7 +50,7 @@ export class NodeRenderGraphColorCorrectionPostProcessBlock extends NodeRenderGr
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
__decorate([
|
|
53
|
-
editableInPropertyPage("Color Table URL",
|
|
53
|
+
editableInPropertyPage("Color Table URL", 11 /* PropertyTypeForEdition.String */, "PROPERTIES")
|
|
54
54
|
], NodeRenderGraphColorCorrectionPostProcessBlock.prototype, "colorTableUrl", null);
|
|
55
55
|
RegisterClass("BABYLON.NodeRenderGraphColorCorrectionPostProcessBlock", NodeRenderGraphColorCorrectionPostProcessBlock);
|
|
56
56
|
//# sourceMappingURL=colorCorrectionPostProcessBlock.js.map
|
|
@@ -161,7 +161,7 @@ __decorate([
|
|
|
161
161
|
editableInPropertyPage("HDR", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
|
|
162
162
|
], NodeRenderGraphDepthOfFieldPostProcessBlock.prototype, "hdr", null);
|
|
163
163
|
__decorate([
|
|
164
|
-
editableInPropertyPage("Depth sampling mode",
|
|
164
|
+
editableInPropertyPage("Depth sampling mode", 8 /* PropertyTypeForEdition.SamplingMode */, "PROPERTIES")
|
|
165
165
|
], NodeRenderGraphDepthOfFieldPostProcessBlock.prototype, "depthSamplingMode", null);
|
|
166
166
|
__decorate([
|
|
167
167
|
editableInPropertyPage("Focal length", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES")
|
|
@@ -56,7 +56,7 @@ export class NodeRenderGraphFilterPostProcessBlock extends NodeRenderGraphBaseWi
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
__decorate([
|
|
59
|
-
editableInPropertyPage("Matrix",
|
|
59
|
+
editableInPropertyPage("Matrix", 12 /* PropertyTypeForEdition.Matrix */, "PROPERTIES")
|
|
60
60
|
], NodeRenderGraphFilterPostProcessBlock.prototype, "kernelMatrix", null);
|
|
61
61
|
RegisterClass("BABYLON.NodeRenderGraphFilterPostProcessBlock", NodeRenderGraphFilterPostProcessBlock);
|
|
62
62
|
//# sourceMappingURL=filterPostProcessBlock.js.map
|
|
@@ -226,7 +226,7 @@ __decorate([
|
|
|
226
226
|
editableInPropertyPage("Center Y", 1 /* PropertyTypeForEdition.Float */, "VIGNETTE", { min: 0, max: 1 })
|
|
227
227
|
], NodeRenderGraphImageProcessingPostProcessBlock.prototype, "vignetteCenterY", null);
|
|
228
228
|
__decorate([
|
|
229
|
-
editableInPropertyPage("Color",
|
|
229
|
+
editableInPropertyPage("Color", 7 /* PropertyTypeForEdition.Color4 */, "VIGNETTE")
|
|
230
230
|
], NodeRenderGraphImageProcessingPostProcessBlock.prototype, "vignetteColor", null);
|
|
231
231
|
__decorate([
|
|
232
232
|
editableInPropertyPage("Blend mode", 5 /* PropertyTypeForEdition.List */, "VIGNETTE", {
|
|
@@ -261,7 +261,7 @@ export class NodeRenderGraphSSAO2PostProcessBlock extends NodeRenderGraphBasePos
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
__decorate([
|
|
264
|
-
editableInPropertyPage("Texture type",
|
|
264
|
+
editableInPropertyPage("Texture type", 10 /* PropertyTypeForEdition.TextureType */, "TEXTURE")
|
|
265
265
|
], NodeRenderGraphSSAO2PostProcessBlock.prototype, "textureType", null);
|
|
266
266
|
__decorate([
|
|
267
267
|
editableInPropertyPage("SSAO texture ratio", 1 /* PropertyTypeForEdition.Float */, "TEXTURE", { min: 0.1, max: 1 })
|