@babylonjs/core 7.35.2 → 7.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/Extensions/engine.multiRender.js +71 -32
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.d.ts +8 -8
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -13
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +9 -9
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +6 -0
- package/Engines/WebGPU/webgpuConstants.js +6 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +18 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +8 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +12 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +17 -1
- package/Engines/constants.js +17 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +31 -1
- package/Engines/engine.js +17 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +2 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -2
- package/Engines/nullEngine.js +3 -2
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +33 -1
- package/Engines/renderTargetWrapper.js +64 -4
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +13 -1
- package/Engines/thinEngine.functions.d.ts +4 -0
- package/Engines/thinEngine.functions.js +17 -0
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +151 -32
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +2 -0
- package/Engines/thinWebGPUEngine.js +7 -0
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +12 -3
- package/Engines/webgpuEngine.js +40 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
- package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Passes/renderPass.d.ts +10 -10
- package/FrameGraph/Passes/renderPass.js +10 -10
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +11 -74
- package/FrameGraph/frameGraph.js +12 -126
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
- package/FrameGraph/frameGraphRenderContext.js +55 -43
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
- package/FrameGraph/frameGraphRenderTarget.js +67 -0
- package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
- package/FrameGraph/frameGraphTask.d.ts +4 -3
- package/FrameGraph/frameGraphTask.js +41 -8
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
- package/FrameGraph/frameGraphTextureManager.js +312 -130
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +28 -13
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +1 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
- package/Materials/Node/Blocks/conditionalBlock.js +13 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +20 -0
- package/Materials/Textures/internalTexture.js +48 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +5 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +2 -2
- package/Materials/Textures/rawCubeTexture.js +2 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
- package/Materials/Textures/rawTexture2DArray.js +1 -1
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +1 -1
- package/Materials/Textures/rawTexture3D.js +1 -1
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +6 -6
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/drawWrapper.d.ts +6 -1
- package/Materials/drawWrapper.js +18 -2
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +6 -1
- package/Materials/effect.functions.d.ts +5 -0
- package/Materials/effect.functions.js +19 -0
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +22 -20
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +12 -4
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Maths/math.color.d.ts +16 -0
- package/Maths/math.color.js +16 -0
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.d.ts +32 -0
- package/Maths/math.vector.js +32 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +3 -1
- package/Meshes/Compression/dracoCompression.js +5 -2
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js +15 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
- package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
- package/Meshes/Node/nodeGeometryBlock.js +2 -1
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +5 -3
- package/Meshes/abstractMesh.js +9 -7
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +5 -3
- package/Meshes/subMesh.js +9 -7
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/dds.d.ts +1 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/observable.d.ts +1 -3
- package/Misc/observable.js +9 -7
- package/Misc/observable.js.map +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +3 -0
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/highlightsPostProcess.d.ts +1 -1
- package/PostProcesses/highlightsPostProcess.js +1 -1
- package/PostProcesses/highlightsPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +1 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +1 -1
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +4 -3
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -116,11 +116,13 @@ export class LatticeBlock extends NodeGeometryBlock {
|
|
|
116
116
|
const positions = this._vertexData.positions;
|
|
117
117
|
const boundingInfo = extractMinAndMax(positions, 0, positions.length / 3);
|
|
118
118
|
// Building the lattice
|
|
119
|
+
const size = boundingInfo.maximum.subtract(boundingInfo.minimum);
|
|
119
120
|
this._lattice = new Lattice({
|
|
120
121
|
resolutionX: this.resolutionX,
|
|
121
122
|
resolutionY: this.resolutionY,
|
|
122
123
|
resolutionZ: this.resolutionZ,
|
|
123
|
-
size:
|
|
124
|
+
size: size,
|
|
125
|
+
position: boundingInfo.minimum.add(size.scale(0.5)),
|
|
124
126
|
});
|
|
125
127
|
for (this._currentIndexX = 0; this._currentIndexX < this.resolutionX; this._currentIndexX++) {
|
|
126
128
|
for (this._currentIndexY = 0; this._currentIndexY < this.resolutionY; this._currentIndexY++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latticeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/latticeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAIrG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,4BAA4B;AAC9C,OAAO,EAAE,gBAAgB,EAAE,4CAAkC;AAE7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAkC/C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAjCR,kBAAa,GAAG,IAAI,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D,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC;QACvD,CAAC;IACL,CAAC;CACJ;AAnMU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC3G;AAMvB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAMhB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAMhB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAmL3B,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { Lattice } from \"core/Meshes/lattice\";\r\nimport { extractMinAndMax } from \"core/Maths/math.functions\";\r\n\r\n/**\r\n * Block used to apply Lattice on geometry\r\n */\r\nexport class LatticeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _vertexData: VertexData;\r\n private _currentIndexX: number;\r\n private _currentIndexY: number;\r\n private _currentIndexZ: number;\r\n private _lattice: Lattice;\r\n private _indexVector3 = new Vector3();\r\n private _currentControl = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Resolution on x axis\r\n */\r\n @editableInPropertyPage(\"resolutionX\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionX = 3;\r\n\r\n /**\r\n * Resolution on y axis\r\n */\r\n @editableInPropertyPage(\"resolutionY\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionY = 3;\r\n\r\n /**\r\n * Resolution on z axis\r\n */\r\n @editableInPropertyPage(\"resolutionZ\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionZ = 3;\r\n\r\n /**\r\n * Create a new LatticeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"controls\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndexX + this.resolutionX * (this._currentIndexY + this.resolutionY * this._currentIndexZ);\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this.getExecutionIndex();\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"LatticeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the controls input component\r\n */\r\n public get controls(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * In this case it will be the current position in the lattice\r\n * @returns the current position in the lattice\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._indexVector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual normals\r\n * In this case it will be the current control point being processed\r\n * @returns the current control point being processed\r\n */\r\n public getOverrideNormalsContextualValue() {\r\n return this._currentControl;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n\r\n if (this._vertexData) {\r\n this._vertexData = this._vertexData.clone(); // Preserve source data\r\n }\r\n\r\n if (!this._vertexData || !this._vertexData.positions) {\r\n state.restoreExecutionContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n const positions = this._vertexData.positions;\r\n const boundingInfo = extractMinAndMax(positions!, 0, positions!.length / 3);\r\n\r\n // Building the lattice\r\n this._lattice = new Lattice({\r\n resolutionX: this.resolutionX,\r\n resolutionY: this.resolutionY,\r\n resolutionZ: this.resolutionZ,\r\n size: boundingInfo.maximum.subtract(boundingInfo.minimum),\r\n });\r\n\r\n for (this._currentIndexX = 0; this._currentIndexX < this.resolutionX; this._currentIndexX++) {\r\n for (this._currentIndexY = 0; this._currentIndexY < this.resolutionY; this._currentIndexY++) {\r\n for (this._currentIndexZ = 0; this._currentIndexZ < this.resolutionZ; this._currentIndexZ++) {\r\n this._indexVector3.set(this._currentIndexX, this._currentIndexY, this._currentIndexZ);\r\n const latticeControl = this._lattice.data[this._currentIndexX][this._currentIndexY][this._currentIndexZ];\r\n this._currentControl.copyFrom(latticeControl);\r\n const tempVector3 = this.controls.getConnectedValue(state) as Vector3;\r\n\r\n if (tempVector3) {\r\n latticeControl.set(tempVector3.x, tempVector3.y, tempVector3.z);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Apply lattice\r\n this._lattice.deform(positions);\r\n\r\n // Storage\r\n state.restoreExecutionContext();\r\n return this._vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n\r\n codeString += `${this._codeVariableName}.resolutionX = ${this.resolutionX};\\n`;\r\n codeString += `${this._codeVariableName}.resolutionY = ${this.resolutionY};\\n`;\r\n codeString += `${this._codeVariableName}.resolutionZ = ${this.resolutionZ};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.resolutionX = this.resolutionX;\r\n serializationObject.resolutionY = this.resolutionY;\r\n serializationObject.resolutionZ = this.resolutionZ;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n this.resolutionX = serializationObject.resolutionX;\r\n this.resolutionY = serializationObject.resolutionY;\r\n this.resolutionZ = serializationObject.resolutionZ;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.LatticeBlock\", LatticeBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"latticeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/latticeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAIrG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,4BAA4B;AAC9C,OAAO,EAAE,gBAAgB,EAAE,4CAAkC;AAE7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAkC/C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAjCR,kBAAa,GAAG,IAAI,OAAO,EAAE,CAAC;QAC9B,oBAAe,GAAG,IAAI,OAAO,EAAE,CAAC;QAExC;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAE9B;;WAEG;QAEI,gBAAW,GAAG,CAAC,CAAC;QAEvB;;WAEG;QAEI,gBAAW,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AC;QACvD,CAAC;IACL,CAAC;CACJ;AArMU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC3G;AAMvB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAMhB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAMhB;IADN,sBAAsB,CAAC,aAAa,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iDAC1H;AAqL3B,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { Lattice } from \"core/Meshes/lattice\";\r\nimport { extractMinAndMax } from \"core/Maths/math.functions\";\r\n\r\n/**\r\n * Block used to apply Lattice on geometry\r\n */\r\nexport class LatticeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _vertexData: VertexData;\r\n private _currentIndexX: number;\r\n private _currentIndexY: number;\r\n private _currentIndexZ: number;\r\n private _lattice: Lattice;\r\n private _indexVector3 = new Vector3();\r\n private _currentControl = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Resolution on x axis\r\n */\r\n @editableInPropertyPage(\"resolutionX\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionX = 3;\r\n\r\n /**\r\n * Resolution on y axis\r\n */\r\n @editableInPropertyPage(\"resolutionY\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionY = 3;\r\n\r\n /**\r\n * Resolution on z axis\r\n */\r\n @editableInPropertyPage(\"resolutionZ\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 1, max: 10 })\r\n public resolutionZ = 3;\r\n\r\n /**\r\n * Create a new LatticeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"controls\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndexX + this.resolutionX * (this._currentIndexY + this.resolutionY * this._currentIndexZ);\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this.getExecutionIndex();\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"LatticeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the controls input component\r\n */\r\n public get controls(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * In this case it will be the current position in the lattice\r\n * @returns the current position in the lattice\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._indexVector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual normals\r\n * In this case it will be the current control point being processed\r\n * @returns the current control point being processed\r\n */\r\n public getOverrideNormalsContextualValue() {\r\n return this._currentControl;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n\r\n if (this._vertexData) {\r\n this._vertexData = this._vertexData.clone(); // Preserve source data\r\n }\r\n\r\n if (!this._vertexData || !this._vertexData.positions) {\r\n state.restoreExecutionContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n const positions = this._vertexData.positions;\r\n const boundingInfo = extractMinAndMax(positions!, 0, positions!.length / 3);\r\n\r\n // Building the lattice\r\n const size = boundingInfo.maximum.subtract(boundingInfo.minimum);\r\n this._lattice = new Lattice({\r\n resolutionX: this.resolutionX,\r\n resolutionY: this.resolutionY,\r\n resolutionZ: this.resolutionZ,\r\n size: size,\r\n position: boundingInfo.minimum.add(size.scale(0.5)),\r\n });\r\n\r\n for (this._currentIndexX = 0; this._currentIndexX < this.resolutionX; this._currentIndexX++) {\r\n for (this._currentIndexY = 0; this._currentIndexY < this.resolutionY; this._currentIndexY++) {\r\n for (this._currentIndexZ = 0; this._currentIndexZ < this.resolutionZ; this._currentIndexZ++) {\r\n this._indexVector3.set(this._currentIndexX, this._currentIndexY, this._currentIndexZ);\r\n const latticeControl = this._lattice.data[this._currentIndexX][this._currentIndexY][this._currentIndexZ];\r\n this._currentControl.copyFrom(latticeControl);\r\n const tempVector3 = this.controls.getConnectedValue(state) as Vector3;\r\n\r\n if (tempVector3) {\r\n latticeControl.set(tempVector3.x, tempVector3.y, tempVector3.z);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Apply lattice\r\n this._lattice.deform(positions);\r\n\r\n // Storage\r\n state.restoreExecutionContext();\r\n return this._vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n\r\n codeString += `${this._codeVariableName}.resolutionX = ${this.resolutionX};\\n`;\r\n codeString += `${this._codeVariableName}.resolutionY = ${this.resolutionY};\\n`;\r\n codeString += `${this._codeVariableName}.resolutionZ = ${this.resolutionZ};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.resolutionX = this.resolutionX;\r\n serializationObject.resolutionY = this.resolutionY;\r\n serializationObject.resolutionZ = this.resolutionZ;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n this.resolutionX = serializationObject.resolutionX;\r\n this.resolutionY = serializationObject.resolutionY;\r\n this.resolutionZ = serializationObject.resolutionZ;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.LatticeBlock\", LatticeBlock);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
2
|
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
import type { NodeGeometry } from "../nodeGeometry";
|
|
3
4
|
/**
|
|
4
5
|
* Conditions supported by the condition block
|
|
5
6
|
*/
|
|
@@ -61,6 +62,7 @@ export declare class ConditionBlock extends NodeGeometryBlock {
|
|
|
61
62
|
* Gets the output component
|
|
62
63
|
*/
|
|
63
64
|
get output(): NodeGeometryConnectionPoint;
|
|
65
|
+
autoConfigure(nodeGeometry: NodeGeometry): void;
|
|
64
66
|
protected _buildBlock(): void;
|
|
65
67
|
protected _dumpPropertiesCode(): string;
|
|
66
68
|
/**
|
|
@@ -5,6 +5,7 @@ import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConn
|
|
|
5
5
|
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
6
|
import { WithinEpsilon } from "../../../Maths/math.scalar.functions.js";
|
|
7
7
|
import { Epsilon } from "../../../Maths/math.constants.js";
|
|
8
|
+
import { GeometryInputBlock } from "./geometryInputBlock.js";
|
|
8
9
|
/**
|
|
9
10
|
* Conditions supported by the condition block
|
|
10
11
|
*/
|
|
@@ -91,6 +92,20 @@ export class ConditionBlock extends NodeGeometryBlock {
|
|
|
91
92
|
get output() {
|
|
92
93
|
return this._outputs[0];
|
|
93
94
|
}
|
|
95
|
+
autoConfigure(nodeGeometry) {
|
|
96
|
+
if (!this.ifTrue.isConnected) {
|
|
97
|
+
const minInput = nodeGeometry.getBlockByPredicate((b) => b.isInput && b.value === 1 && b.name === "True") ||
|
|
98
|
+
new GeometryInputBlock("True");
|
|
99
|
+
minInput.value = 1;
|
|
100
|
+
minInput.output.connectTo(this.ifTrue);
|
|
101
|
+
}
|
|
102
|
+
if (!this.ifFalse.isConnected) {
|
|
103
|
+
const maxInput = nodeGeometry.getBlockByPredicate((b) => b.isInput && b.value === 0 && b.name === "False") ||
|
|
104
|
+
new GeometryInputBlock("False");
|
|
105
|
+
maxInput.value = 0;
|
|
106
|
+
maxInput.output.connectTo(this.ifFalse);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
94
109
|
_buildBlock() {
|
|
95
110
|
if (!this.left.isConnected) {
|
|
96
111
|
this.output._storedFunction = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditionBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/conditionBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;GAEG;AACH,MAAM,CAAN,IAAY,mBAmBX;AAnBD,WAAY,mBAAmB;IAC3B,YAAY;IACZ,+DAAK,CAAA;IACL,eAAe;IACf,qEAAQ,C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,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,EAAE,EAAE;YAC9C,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;SACnD;KACJ,CAAC;4CACsC;AA+I5C,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\n\r\n/**\r\n * Conditions supported by the condition block\r\n */\r\nexport enum ConditionBlockTests {\r\n /** Equal */\r\n Equal,\r\n /** NotEqual */\r\n NotEqual,\r\n /** LessThan */\r\n LessThan,\r\n /** GreaterThan */\r\n GreaterThan,\r\n /** LessOrEqual */\r\n LessOrEqual,\r\n /** GreaterOrEqual */\r\n GreaterOrEqual,\r\n /** Logical Exclusive OR */\r\n Xor,\r\n /** Logical Or */\r\n Or,\r\n /** Logical And */\r\n And,\r\n}\r\n\r\n/**\r\n * Block used to evaluate a condition and return a true or false value\r\n */\r\nexport class ConditionBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the test used by the block\r\n */\r\n @editableInPropertyPage(\"Test\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Equal\", value: ConditionBlockTests.Equal },\r\n { label: \"NotEqual\", value: ConditionBlockTests.NotEqual },\r\n { label: \"LessThan\", value: ConditionBlockTests.LessThan },\r\n { label: \"GreaterThan\", value: ConditionBlockTests.GreaterThan },\r\n { label: \"LessOrEqual\", value: ConditionBlockTests.LessOrEqual },\r\n { label: \"GreaterOrEqual\", value: ConditionBlockTests.GreaterOrEqual },\r\n { label: \"Xor\", value: ConditionBlockTests.Xor },\r\n { label: \"Or\", value: ConditionBlockTests.Or },\r\n { label: \"And\", value: ConditionBlockTests.And },\r\n ],\r\n })\r\n public test = ConditionBlockTests.Equal;\r\n\r\n /**\r\n * Create a new ConditionBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"ifTrue\", NodeGeometryBlockConnectionPointTypes.AutoDetect, true, 1);\r\n this.registerInput(\"ifFalse\", NodeGeometryBlockConnectionPointTypes.AutoDetect, true, 0);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[2];\r\n this._outputs[0]._defaultConnectionPointType = NodeGeometryBlockConnectionPointTypes.Float;\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Int);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Int);\r\n this._linkConnectionTypes(2, 3);\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 \"ConditionBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the ifTrue input component\r\n */\r\n public get ifTrue(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the ifFalse input component\r\n */\r\n public get ifFalse(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.left.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const left = this.left.getConnectedValue(state) as number;\r\n const right = this.right.getConnectedValue(state) as number;\r\n let condition = false;\r\n\r\n switch (this.test) {\r\n case ConditionBlockTests.Equal:\r\n condition = WithinEpsilon(left, right, Epsilon);\r\n break;\r\n case ConditionBlockTests.NotEqual:\r\n condition = left !== right;\r\n break;\r\n case ConditionBlockTests.LessThan:\r\n condition = left < right;\r\n break;\r\n case ConditionBlockTests.GreaterThan:\r\n condition = left > right;\r\n break;\r\n case ConditionBlockTests.LessOrEqual:\r\n condition = left <= right;\r\n break;\r\n case ConditionBlockTests.GreaterOrEqual:\r\n condition = left >= right;\r\n break;\r\n case ConditionBlockTests.Xor:\r\n condition = (!!left && !right) || (!left && !!right);\r\n break;\r\n case ConditionBlockTests.Or:\r\n condition = !!left || !!right;\r\n break;\r\n case ConditionBlockTests.And:\r\n condition = !!left && !!right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n if (func(state)) {\r\n return this.ifTrue.getConnectedValue(state);\r\n }\r\n\r\n return this.ifFalse.getConnectedValue(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.test = BABYLON.ConditionBlockTests.${ConditionBlockTests[this.test]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.test = this.test;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.test = serializationObject.test;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConditionBlock\", ConditionBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"conditionBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/conditionBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;GAEG;AACH,MAAM,CAAN,IAAY,mBAmBX;AAnBD,WAAY,mBAAmB;IAC3B,YAAY;IACZ,+DAAK,CAAA;IACL,eAAe;IACf,qEAAQ,CAAA;IACR,eAAe;IACf,qEAAQ,CAAA;IACR,kBAAkB;IAClB,2EAAW,CAAA;IACX,kBAAkB;IAClB,2EAAW,CAAA;IACX,qBAAqB;IACrB,iFAAc,CAAA;IACd,2BAA2B;IAC3B,2DAAG,CAAA;IACH,iBAAiB;IACjB,yDAAE,CAAA;IACF,kBAAkB;IAClB,2DAAG,CAAA;AACP,CAAC,EAnBW,mBAAmB,KAAnB,mBAAmB,QAmB9B;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAqBjD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QA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,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE;YACpD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,CAAC,WAAW,EAAE;YAChE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,CAAC,WAAW,EAAE;YAChE,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,mBAAmB,CAAC,cAAc,EAAE;YACtE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,EAAE,EAAE;YAC9C,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;SACnD;KACJ,CAAC;4CACsC;AAiK5C,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\nimport { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport type { NodeGeometry } from \"../nodeGeometry\";\r\n\r\n/**\r\n * Conditions supported by the condition block\r\n */\r\nexport enum ConditionBlockTests {\r\n /** Equal */\r\n Equal,\r\n /** NotEqual */\r\n NotEqual,\r\n /** LessThan */\r\n LessThan,\r\n /** GreaterThan */\r\n GreaterThan,\r\n /** LessOrEqual */\r\n LessOrEqual,\r\n /** GreaterOrEqual */\r\n GreaterOrEqual,\r\n /** Logical Exclusive OR */\r\n Xor,\r\n /** Logical Or */\r\n Or,\r\n /** Logical And */\r\n And,\r\n}\r\n\r\n/**\r\n * Block used to evaluate a condition and return a true or false value\r\n */\r\nexport class ConditionBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the test used by the block\r\n */\r\n @editableInPropertyPage(\"Test\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Equal\", value: ConditionBlockTests.Equal },\r\n { label: \"NotEqual\", value: ConditionBlockTests.NotEqual },\r\n { label: \"LessThan\", value: ConditionBlockTests.LessThan },\r\n { label: \"GreaterThan\", value: ConditionBlockTests.GreaterThan },\r\n { label: \"LessOrEqual\", value: ConditionBlockTests.LessOrEqual },\r\n { label: \"GreaterOrEqual\", value: ConditionBlockTests.GreaterOrEqual },\r\n { label: \"Xor\", value: ConditionBlockTests.Xor },\r\n { label: \"Or\", value: ConditionBlockTests.Or },\r\n { label: \"And\", value: ConditionBlockTests.And },\r\n ],\r\n })\r\n public test = ConditionBlockTests.Equal;\r\n\r\n /**\r\n * Create a new ConditionBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"ifTrue\", NodeGeometryBlockConnectionPointTypes.AutoDetect, true, 1);\r\n this.registerInput(\"ifFalse\", NodeGeometryBlockConnectionPointTypes.AutoDetect, true, 0);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[2];\r\n this._outputs[0]._defaultConnectionPointType = NodeGeometryBlockConnectionPointTypes.Float;\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Int);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Int);\r\n this._linkConnectionTypes(2, 3);\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 \"ConditionBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the ifTrue input component\r\n */\r\n public get ifTrue(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the ifFalse input component\r\n */\r\n public get ifFalse(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure(nodeGeometry: NodeGeometry) {\r\n if (!this.ifTrue.isConnected) {\r\n const minInput =\r\n (nodeGeometry.getBlockByPredicate((b) => b.isInput && (b as GeometryInputBlock).value === 1 && b.name === \"True\") as GeometryInputBlock) ||\r\n new GeometryInputBlock(\"True\");\r\n minInput.value = 1;\r\n minInput.output.connectTo(this.ifTrue);\r\n }\r\n\r\n if (!this.ifFalse.isConnected) {\r\n const maxInput =\r\n (nodeGeometry.getBlockByPredicate((b) => b.isInput && (b as GeometryInputBlock).value === 0 && b.name === \"False\") as GeometryInputBlock) ||\r\n new GeometryInputBlock(\"False\");\r\n maxInput.value = 0;\r\n maxInput.output.connectTo(this.ifFalse);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.left.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const left = this.left.getConnectedValue(state) as number;\r\n const right = this.right.getConnectedValue(state) as number;\r\n let condition = false;\r\n\r\n switch (this.test) {\r\n case ConditionBlockTests.Equal:\r\n condition = WithinEpsilon(left, right, Epsilon);\r\n break;\r\n case ConditionBlockTests.NotEqual:\r\n condition = left !== right;\r\n break;\r\n case ConditionBlockTests.LessThan:\r\n condition = left < right;\r\n break;\r\n case ConditionBlockTests.GreaterThan:\r\n condition = left > right;\r\n break;\r\n case ConditionBlockTests.LessOrEqual:\r\n condition = left <= right;\r\n break;\r\n case ConditionBlockTests.GreaterOrEqual:\r\n condition = left >= right;\r\n break;\r\n case ConditionBlockTests.Xor:\r\n condition = (!!left && !right) || (!left && !!right);\r\n break;\r\n case ConditionBlockTests.Or:\r\n condition = !!left || !!right;\r\n break;\r\n case ConditionBlockTests.And:\r\n condition = !!left && !!right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n if (func(state)) {\r\n return this.ifTrue.getConnectedValue(state);\r\n }\r\n\r\n return this.ifFalse.getConnectedValue(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.test = BABYLON.ConditionBlockTests.${ConditionBlockTests[this.test]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.test = this.test;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.test = serializationObject.test;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConditionBlock\", ConditionBlock);\r\n"]}
|
|
@@ -5,9 +5,11 @@ import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnection
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class GeometryClampBlock extends NodeGeometryBlock {
|
|
7
7
|
/** Gets or sets the minimum range */
|
|
8
|
-
minimum: number;
|
|
8
|
+
get minimum(): number;
|
|
9
|
+
set minimum(value: number);
|
|
9
10
|
/** Gets or sets the maximum range */
|
|
10
|
-
maximum: number;
|
|
11
|
+
get maximum(): number;
|
|
12
|
+
set maximum(value: number);
|
|
11
13
|
/**
|
|
12
14
|
* Creates a new GeometryClampBlock
|
|
13
15
|
* @param name defines the block name
|
|
@@ -35,7 +37,5 @@ export declare class GeometryClampBlock extends NodeGeometryBlock {
|
|
|
35
37
|
*/
|
|
36
38
|
get output(): NodeGeometryConnectionPoint;
|
|
37
39
|
protected _buildBlock(): this | undefined;
|
|
38
|
-
protected _dumpPropertiesCode(): string;
|
|
39
|
-
serialize(): any;
|
|
40
40
|
_deserialize(serializationObject: any): void;
|
|
41
41
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "../../../tslib.es6.js";
|
|
2
1
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
-
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
4
2
|
import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
5
3
|
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
6
4
|
import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
@@ -8,19 +6,29 @@ import { Vector2, Vector3, Vector4 } from "../../../Maths/math.vector.js";
|
|
|
8
6
|
* Block used to clamp a float
|
|
9
7
|
*/
|
|
10
8
|
export class GeometryClampBlock extends NodeGeometryBlock {
|
|
9
|
+
/** Gets or sets the minimum range */
|
|
10
|
+
get minimum() {
|
|
11
|
+
return this.min.value;
|
|
12
|
+
}
|
|
13
|
+
set minimum(value) {
|
|
14
|
+
this.min.value = value;
|
|
15
|
+
}
|
|
16
|
+
/** Gets or sets the maximum range */
|
|
17
|
+
get maximum() {
|
|
18
|
+
return this.max.value;
|
|
19
|
+
}
|
|
20
|
+
set maximum(value) {
|
|
21
|
+
this.max.value = value;
|
|
22
|
+
}
|
|
11
23
|
/**
|
|
12
24
|
* Creates a new GeometryClampBlock
|
|
13
25
|
* @param name defines the block name
|
|
14
26
|
*/
|
|
15
27
|
constructor(name) {
|
|
16
28
|
super(name);
|
|
17
|
-
/** Gets or sets the minimum range */
|
|
18
|
-
this.minimum = 0.0;
|
|
19
|
-
/** Gets or sets the maximum range */
|
|
20
|
-
this.maximum = 1.0;
|
|
21
29
|
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
22
|
-
this.registerInput("min", NodeGeometryBlockConnectionPointTypes.Float, true);
|
|
23
|
-
this.registerInput("max", NodeGeometryBlockConnectionPointTypes.Float, true);
|
|
30
|
+
this.registerInput("min", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
31
|
+
this.registerInput("max", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
24
32
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
25
33
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
26
34
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
@@ -90,28 +98,11 @@ export class GeometryClampBlock extends NodeGeometryBlock {
|
|
|
90
98
|
};
|
|
91
99
|
return this;
|
|
92
100
|
}
|
|
93
|
-
_dumpPropertiesCode() {
|
|
94
|
-
let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.minimum = ${this.minimum};\n`;
|
|
95
|
-
codeString += `${this._codeVariableName}.maximum = ${this.maximum};\n`;
|
|
96
|
-
return codeString;
|
|
97
|
-
}
|
|
98
|
-
serialize() {
|
|
99
|
-
const serializationObject = super.serialize();
|
|
100
|
-
serializationObject.minimum = this.minimum;
|
|
101
|
-
serializationObject.maximum = this.maximum;
|
|
102
|
-
return serializationObject;
|
|
103
|
-
}
|
|
104
101
|
_deserialize(serializationObject) {
|
|
105
102
|
super._deserialize(serializationObject);
|
|
106
103
|
this.minimum = serializationObject.minimum;
|
|
107
104
|
this.maximum = serializationObject.maximum;
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
|
-
__decorate([
|
|
111
|
-
editableInPropertyPage("Minimum", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })
|
|
112
|
-
], GeometryClampBlock.prototype, "minimum", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
editableInPropertyPage("Maximum", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })
|
|
115
|
-
], GeometryClampBlock.prototype, "maximum", void 0);
|
|
116
107
|
RegisterClass("BABYLON.GeometryClampBlock", GeometryClampBlock);
|
|
117
108
|
//# sourceMappingURL=geometryClampBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryClampBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryClampBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geometryClampBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryClampBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAEnE;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD,qCAAqC;IACrC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,CAAC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AAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Block used to clamp a float\r\n */\r\nexport class GeometryClampBlock extends NodeGeometryBlock {\r\n /** Gets or sets the minimum range */\r\n public get minimum() {\r\n return this.min.value;\r\n }\r\n\r\n public set minimum(value: number) {\r\n this.min.value = value;\r\n }\r\n\r\n /** Gets or sets the maximum range */\r\n public get maximum() {\r\n return this.max.value;\r\n }\r\n\r\n public set maximum(value: number) {\r\n this.max.value = value;\r\n }\r\n\r\n /**\r\n * Creates a new GeometryClampBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"min\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"GeometryClampBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (value: number, min: number, max: number) => {\r\n return Math.max(min, Math.min(value, max));\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const min = this.min.isConnected ? this.min.getConnectedValue(state) : this.minimum;\r\n const max = this.max.isConnected ? this.max.getConnectedValue(state) : this.maximum;\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(value, min, max);\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func!(value.x, min, max), func!(value.y, min, max));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func!(value.x, min, max), func!(value.y, min, max), func!(value.z, min, max));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n return new Vector4(func!(value.x, min, max), func!(value.y, min, max), func!(value.z, min, max), func!(value.w, min, max));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.minimum = serializationObject.minimum;\r\n this.maximum = serializationObject.maximum;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryClampBlock\", GeometryClampBlock);\r\n"]}
|
|
@@ -14,7 +14,7 @@ export class GeometryLerpBlock extends NodeGeometryBlock {
|
|
|
14
14
|
super(name);
|
|
15
15
|
this.registerInput("left", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
16
|
this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
-
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
+
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);
|
|
18
18
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
19
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
20
|
this._linkConnectionTypes(0, 1);
|
|
@@ -54,7 +54,7 @@ export class GeometryLerpBlock extends NodeGeometryBlock {
|
|
|
54
54
|
return this._outputs[0];
|
|
55
55
|
}
|
|
56
56
|
_buildBlock() {
|
|
57
|
-
if (!this.left.isConnected || !this.right.isConnected
|
|
57
|
+
if (!this.left.isConnected || !this.right.isConnected) {
|
|
58
58
|
this.output._storedFunction = null;
|
|
59
59
|
this.output._storedValue = null;
|
|
60
60
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryLerpBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryLerpBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE;;GAEG;AACH,M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O,CAAC,CAAC,CAAC;oBACjD,OAAO,IAAI,OAAO,CAAC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/J,CAAC;YACL,CAAC;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\n/**\r\n * Block used to lerp between 2 values\r\n */\r\nexport class GeometryLerpBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryLerpBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"GeometryLerpBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n public get gradient(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.left.isConnected || !this.right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (gradient: number, left: number, right: number) => {\r\n return (1 - gradient) * left + gradient * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n const gradient = this.gradient.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(gradient, left, right);\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z));\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n return new Vector4(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z), func!(gradient, left.w, right.w));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryLerpBlock\", GeometryLerpBlock);\r\n"]}
|
|
@@ -14,7 +14,7 @@ export class GeometryNLerpBlock extends NodeGeometryBlock {
|
|
|
14
14
|
super(name);
|
|
15
15
|
this.registerInput("left", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
16
|
this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
17
|
-
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
+
this.registerInput("gradient", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);
|
|
18
18
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
19
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
20
|
this._linkConnectionTypes(0, 1);
|
|
@@ -54,7 +54,7 @@ export class GeometryNLerpBlock extends NodeGeometryBlock {
|
|
|
54
54
|
return this._outputs[0];
|
|
55
55
|
}
|
|
56
56
|
_buildBlock() {
|
|
57
|
-
if (!this.left.isConnected || !this.right.isConnected
|
|
57
|
+
if (!this.left.isConnected || !this.right.isConnected) {
|
|
58
58
|
this.output._storedFunction = null;
|
|
59
59
|
this.output._storedValue = null;
|
|
60
60
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryNLerpBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryNLerpBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAA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AQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;oBACjI,MAAM,CAAC,SAAS,EAAE,CAAC;oBAEnB,OAAO,MAAM,CAAC;gBAClB,CAAC;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC,CAAC;oBACjD,MAAM,MAAM,GAAG,IAAI,OAAO,CACtB,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAChC,IAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CACnC,CAAC;oBACF,MAAM,CAAC,SAAS,EAAE,CAAC;oBAEnB,OAAO,MAAM,CAAC;gBAClB,CAAC;YACL,CAAC;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to normalize lerp between 2 values\r\n */\r\nexport class GeometryNLerpBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryNLerpBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"gradient\", NodeGeometryBlockConnectionPointTypes.Float, true, 0, 0, 1);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"GeometryNLerpBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n public get gradient(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.left.isConnected || !this.right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (gradient: number, left: number, right: number) => {\r\n return (1 - gradient) * left + gradient * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n const gradient = this.gradient.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n return func!(gradient, left, right); // NLerp is really lerp in that case\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n const result = new Vector2(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n const result = new Vector3(func!(gradient, left.x, right.x), func!(gradient, left.y, right.y), func!(gradient, left.z, right.z));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n const result = new Vector4(\r\n func!(gradient, left.x, right.x),\r\n func!(gradient, left.y, right.y),\r\n func!(gradient, left.z, right.z),\r\n func!(gradient, left.w, right.w)\r\n );\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryNLerpBlock\", GeometryNLerpBlock);\r\n"]}
|
|
@@ -13,7 +13,7 @@ export class GeometryReplaceColorBlock extends NodeGeometryBlock {
|
|
|
13
13
|
super(name);
|
|
14
14
|
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
15
15
|
this.registerInput("reference", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
-
this.registerInput("distance", NodeGeometryBlockConnectionPointTypes.Float);
|
|
16
|
+
this.registerInput("distance", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
17
17
|
this.registerInput("replacement", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
18
18
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
19
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
@@ -64,7 +64,7 @@ export class GeometryReplaceColorBlock extends NodeGeometryBlock {
|
|
|
64
64
|
return this._outputs[0];
|
|
65
65
|
}
|
|
66
66
|
_buildBlock() {
|
|
67
|
-
if (!this.value.isConnected || !this.reference.isConnected || !this.
|
|
67
|
+
if (!this.value.isConnected || !this.reference.isConnected || !this.replacement.isConnected) {
|
|
68
68
|
this.output._storedFunction = null;
|
|
69
69
|
this.output._storedValue = null;
|
|
70
70
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryReplaceColorBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryReplaceColorBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAC5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"geometryReplaceColorBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryReplaceColorBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAC5D;;;OAGG;IACH,YAA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,KAAK,CAAC,CAAC;YACxD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAE9D,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;gBAChD,OAAO,WAAW,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACJ,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to replace a color by another one\r\n */\r\nexport class GeometryReplaceColorBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryReplaceColorBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"reference\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"distance\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"replacement\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n this._linkConnectionTypes(0, 3);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[3].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\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 \"GeometryReplaceColorBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the reference input component\r\n */\r\n public get reference(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the distance input component\r\n */\r\n public get distance(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the replacement input component\r\n */\r\n public get replacement(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.value.isConnected || !this.reference.isConnected || !this.replacement.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const reference = this.reference.getConnectedValue(state);\r\n const distance = this.distance.getConnectedValue(state);\r\n const replacement = this.replacement.getConnectedValue(state);\r\n\r\n if (value.subtract(reference).length() < distance) {\r\n return replacement;\r\n } else {\r\n return value;\r\n }\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryReplaceColorBlock\", GeometryReplaceColorBlock);\r\n"]}
|
|
@@ -13,7 +13,7 @@ export class GeometryRotate2dBlock extends NodeGeometryBlock {
|
|
|
13
13
|
constructor(name) {
|
|
14
14
|
super(name);
|
|
15
15
|
this.registerInput("input", NodeGeometryBlockConnectionPointTypes.Vector2);
|
|
16
|
-
this.registerInput("angle", NodeGeometryBlockConnectionPointTypes.Float);
|
|
16
|
+
this.registerInput("angle", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
17
17
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Vector2);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -42,7 +42,7 @@ export class GeometryRotate2dBlock extends NodeGeometryBlock {
|
|
|
42
42
|
return this._outputs[0];
|
|
43
43
|
}
|
|
44
44
|
_buildBlock() {
|
|
45
|
-
if (!this.
|
|
45
|
+
if (!this.input.isConnected) {
|
|
46
46
|
this.output._storedFunction = null;
|
|
47
47
|
this.output._storedValue = null;
|
|
48
48
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryRotate2dBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryRotate2dBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IACxD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"geometryRotate2dBlock.js","sourceRoot":"","sources":["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C,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAY,CAAC;YAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrI,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n\r\n/**\r\n * Block used to rotate a 2d vector by a given angle\r\n */\r\nexport class GeometryRotate2dBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryRotate2dBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerInput(\"angle\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Vector2);\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 \"GeometryRotate2dBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input vector\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the input angle\r\n */\r\n public get angle(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n const input = this.input.getConnectedValue(state) as Vector2;\r\n const angle = this.angle.getConnectedValue(state);\r\n return new Vector2(Math.cos(angle) * input.x - Math.sin(angle) * input.y, Math.sin(angle) * input.x + Math.cos(angle) * input.y);\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryRotate2dBlock\", GeometryRotate2dBlock);\r\n"]}
|
|
@@ -13,8 +13,8 @@ export class GeometrySmoothStepBlock extends NodeGeometryBlock {
|
|
|
13
13
|
constructor(name) {
|
|
14
14
|
super(name);
|
|
15
15
|
this.registerInput("value", NodeGeometryBlockConnectionPointTypes.AutoDetect);
|
|
16
|
-
this.registerInput("edge0", NodeGeometryBlockConnectionPointTypes.Float);
|
|
17
|
-
this.registerInput("edge1", NodeGeometryBlockConnectionPointTypes.Float);
|
|
16
|
+
this.registerInput("edge0", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
17
|
+
this.registerInput("edge1", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
18
18
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
19
19
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
20
20
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
|
|
@@ -53,7 +53,7 @@ export class GeometrySmoothStepBlock extends NodeGeometryBlock {
|
|
|
53
53
|
return this._outputs[0];
|
|
54
54
|
}
|
|
55
55
|
_buildBlock() {
|
|
56
|
-
if (!this.value.isConnected
|
|
56
|
+
if (!this.value.isConnected) {
|
|
57
57
|
this.output._storedFunction = null;
|
|
58
58
|
this.output._storedValue = null;
|
|
59
59
|
return;
|