@babylonjs/core 7.32.3 → 7.32.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Decorators/nodeDecorator.d.ts +4 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +2 -2
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.js +19 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +37 -0
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.js +1 -1
- package/Materials/Node/Blocks/loopBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +1 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.d.ts +6 -0
- package/Materials/Node/Blocks/transformBlock.js +16 -1
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +29 -0
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.js +13 -0
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js +4 -4
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +2 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +5 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +43 -13
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +1 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +1 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +1 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Misc/webRequest.d.ts +4 -0
- package/Misc/webRequest.js +6 -0
- package/Misc/webRequest.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +35 -11
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +131 -117
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +60 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +166 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +97 -56
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +356 -308
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.d.ts +20 -6
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js +67 -35
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +9 -4
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +84 -66
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +31 -6
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +108 -60
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +15 -0
- package/Rendering/geometryBufferRenderer.js +48 -5
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js +2 -4
- package/Shaders/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/instancesVertex.js +3 -6
- package/Shaders/ShadersInclude/instancesVertex.js.map +1 -1
- package/Shaders/geometry.fragment.js +5 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.js +3 -3
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/iblShadowAccumulation.fragment.js +7 -11
- package/Shaders/iblShadowAccumulation.fragment.js.map +1 -1
- package/Shaders/iblShadowGBufferDebug.fragment.js +2 -3
- package/Shaders/iblShadowGBufferDebug.fragment.js.map +1 -1
- package/Shaders/iblShadowSpatialBlur.fragment.js +5 -5
- package/Shaders/iblShadowSpatialBlur.fragment.js.map +1 -1
- package/Shaders/iblShadowVoxelTracing.fragment.js +31 -32
- package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/Shaders/iblShadowsCombine.fragment.js +2 -2
- package/Shaders/iblShadowsCombine.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +2 -4
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.js +3 -6
- package/ShadersWGSL/ShadersInclude/instancesVertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +7 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +3 -3
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/iblShadowAccumulation.fragment.js +5 -10
- package/ShadersWGSL/iblShadowAccumulation.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js +2 -3
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowSpatialBlur.fragment.js +5 -5
- package/ShadersWGSL/iblShadowSpatialBlur.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +45 -33
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowsCombine.fragment.js +6 -2
- package/ShadersWGSL/iblShadowsCombine.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphereBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/sphereBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,sBAAsB,E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B;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAxJU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;oDAC1F;AA0JnC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { CreateSphereVertexData } from \"core/Meshes/Builders/sphereBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate sphere geometry data\r\n */\r\nexport class SphereBlock extends NodeGeometryBlock {\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\", { notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new SphereBlock\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(\"segments\", NodeGeometryBlockConnectionPointTypes.Int, true, 32);\r\n this.registerInput(\"diameter\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"diameterX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"diameterY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"diameterZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"arc\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"slice\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"SphereBlock\";\r\n }\r\n\r\n /**\r\n * Gets the segments input component\r\n */\r\n public get segments(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the diameter input component\r\n */\r\n public get diameter(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the diameterX input component\r\n */\r\n public get diameterX(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the diameterY input component\r\n */\r\n public get diameterY(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the diameterZ input component\r\n */\r\n public get diameterZ(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the arc input component\r\n */\r\n public get arc(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the slice input component\r\n */\r\n public get slice(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.diameter.isConnected) {\r\n const diameterInput = new GeometryInputBlock(\"Diameter\");\r\n diameterInput.value = 1;\r\n diameterInput.output.connectTo(this.diameter);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n dedupTopBottomIndices?: boolean;\r\n } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.segments = this.segments.getConnectedValue(state);\r\n options.diameter = this.diameter.getConnectedValue(state);\r\n options.diameterX = this.diameterX.getConnectedValue(state);\r\n options.diameterY = this.diameterY.getConnectedValue(state);\r\n options.diameterZ = this.diameterZ.getConnectedValue(state);\r\n options.arc = this.arc.getConnectedValue(state);\r\n options.slice = this.slice.getConnectedValue(state);\r\n\r\n // Append vertex data from the plane builder\r\n return CreateSphereVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\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\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.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SphereBlock\", SphereBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"sphereBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/sphereBlock.ts"],"names":[],"mappings":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;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAxJU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;oDAC1G;AA0JnC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { CreateSphereVertexData } from \"core/Meshes/Builders/sphereBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate sphere geometry data\r\n */\r\nexport class SphereBlock extends NodeGeometryBlock {\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 = false;\r\n\r\n /**\r\n * Create a new SphereBlock\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(\"segments\", NodeGeometryBlockConnectionPointTypes.Int, true, 32);\r\n this.registerInput(\"diameter\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"diameterX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"diameterY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"diameterZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"arc\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"slice\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"SphereBlock\";\r\n }\r\n\r\n /**\r\n * Gets the segments input component\r\n */\r\n public get segments(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the diameter input component\r\n */\r\n public get diameter(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the diameterX input component\r\n */\r\n public get diameterX(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the diameterY input component\r\n */\r\n public get diameterY(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the diameterZ input component\r\n */\r\n public get diameterZ(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the arc input component\r\n */\r\n public get arc(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the slice input component\r\n */\r\n public get slice(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.diameter.isConnected) {\r\n const diameterInput = new GeometryInputBlock(\"Diameter\");\r\n diameterInput.value = 1;\r\n diameterInput.output.connectTo(this.diameter);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: {\r\n segments?: number;\r\n diameter?: number;\r\n diameterX?: number;\r\n diameterY?: number;\r\n diameterZ?: number;\r\n arc?: number;\r\n slice?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n dedupTopBottomIndices?: boolean;\r\n } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.segments = this.segments.getConnectedValue(state);\r\n options.diameter = this.diameter.getConnectedValue(state);\r\n options.diameterX = this.diameterX.getConnectedValue(state);\r\n options.diameterY = this.diameterY.getConnectedValue(state);\r\n options.diameterZ = this.diameterZ.getConnectedValue(state);\r\n options.arc = this.arc.getConnectedValue(state);\r\n options.slice = this.slice.getConnectedValue(state);\r\n\r\n // Append vertex data from the plane builder\r\n return CreateSphereVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\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\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.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SphereBlock\", SphereBlock);\r\n"]}
|
|
@@ -102,7 +102,7 @@ export class TorusBlock extends NodeGeometryBlock {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
__decorate([
|
|
105
|
-
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
|
|
105
|
+
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
106
106
|
], TorusBlock.prototype, "evaluateContext", void 0);
|
|
107
107
|
RegisterClass("BABYLON.TorusBlock", TorusBlock);
|
|
108
108
|
//# sourceMappingURL=torusBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"torusBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/torusBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,0CAA0C;AAC1E,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEtG;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAQ7C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,q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AC,CAAC;gBAClC,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC,CAAC;SACL;IACL,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AA/GU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDAC1G;AAiHnC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { CreateTorusVertexData } from \"core/Meshes/Builders/torusBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate torus geometry data\r\n */\r\nexport class TorusBlock extends NodeGeometryBlock {\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 = false;\r\n\r\n /**\r\n * Create a new TorusBlock\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(\"diameter\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"thickness\", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5);\r\n this.registerInput(\"tessellation\", NodeGeometryBlockConnectionPointTypes.Int, true, 16);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"TorusBlock\";\r\n }\r\n\r\n /**\r\n * Gets the diameter input component\r\n */\r\n public get diameter(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the thickness input component\r\n */\r\n public get thickness(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the tessellation input component\r\n */\r\n public get tessellation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.diameter.isConnected) {\r\n const diameterInput = new GeometryInputBlock(\"Diameter\");\r\n diameterInput.value = 1;\r\n diameterInput.output.connectTo(this.diameter);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: {\r\n diameter?: number;\r\n thickness?: number;\r\n tessellation?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.thickness = this.thickness.getConnectedValue(state);\r\n options.diameter = this.diameter.getConnectedValue(state);\r\n options.tessellation = this.tessellation.getConnectedValue(state);\r\n\r\n // Append vertex data from the plane builder\r\n return CreateTorusVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\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\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.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.TorusBlock\", TorusBlock);\r\n"]}
|
|
@@ -169,7 +169,7 @@ export class GeometryTextureBlock extends NodeGeometryBlock {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
__decorate([
|
|
172
|
-
editableInPropertyPage("Serialize cached data", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
|
|
172
|
+
editableInPropertyPage("Serialize cached data", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
173
173
|
], GeometryTextureBlock.prototype, "serializedCachedData", void 0);
|
|
174
174
|
RegisterClass("BABYLON.GeometryTextureBlock", GeometryTextureBlock);
|
|
175
175
|
//# sourceMappingURL=geometryTextureBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryTextureBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Textures/geometryTextureBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,YAAY,EAAE,yCAA+B;AACtD,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAC/F;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAWvD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApCR,UAAK,GAA2B,IAAI,CAAC;QAI7C;;WAEG;QAEI,yBAAoB,GAAG,KAAK,CAAC;QA8BhC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEO,sBAAsB,CAAC,GAAW;QACtC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAA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AAC,IAAI,EAAE;YAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;YACxD,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;SACpC;aAAM;YACH,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;SAC1E;IACL,CAAC;CACJ;AAtLU;IADN,sBAAsB,CAAC,uBAAuB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kEAC1F;AAwLxC,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryTextureData } from \"../../Interfaces/nodeGeometryTextureData\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n/**\r\n * Block used to load texture data\r\n */\r\nexport class GeometryTextureBlock extends NodeGeometryBlock {\r\n private _data: Nullable<Float32Array> = null;\r\n private _width: number;\r\n private _height: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block should serialize its cached data\r\n */\r\n @editableInPropertyPage(\"Serialize cached data\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public serializedCachedData = false;\r\n\r\n /**\r\n * Gets the texture data\r\n */\r\n public get textureData() {\r\n return this._data;\r\n }\r\n\r\n /**\r\n * Gets the texture width\r\n */\r\n public get textureWidth() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Gets the texture height\r\n */\r\n public get textureHeight() {\r\n return this._height;\r\n }\r\n\r\n /**\r\n * Creates a new GeometryTextureBlock\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.registerOutput(\"texture\", 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 \"GeometryTextureBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture component\r\n */\r\n public get texture(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _prepareImgToLoadAsync(url: string) {\r\n return new Promise<void>((resolve, reject) => {\r\n const img = new Image();\r\n const canvas = document.createElement(\"canvas\");\r\n const ctx = canvas.getContext(\"2d\");\r\n\r\n img.onload = () => {\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n\r\n ctx!.drawImage(img, 0, 0);\r\n\r\n const imageData = ctx!.getImageData(0, 0, img.width, img.height);\r\n const pixels = imageData.data;\r\n const floatArray = new Float32Array(pixels.length);\r\n\r\n for (let i = 0; i < pixels.length; i++) {\r\n floatArray[i] = pixels[i] / 255.0;\r\n }\r\n\r\n this._data = floatArray;\r\n this._width = img.width;\r\n this._height = img.height;\r\n resolve();\r\n };\r\n\r\n img.onerror = () => {\r\n this._data = null;\r\n reject();\r\n };\r\n\r\n img.src = url;\r\n });\r\n }\r\n\r\n /**\r\n * Remove stored data\r\n */\r\n public cleanData() {\r\n this._data = null;\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param imageFile defines the file to load data from\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public loadTextureFromFileAsync(imageFile: File) {\r\n return this._prepareImgToLoadAsync(URL.createObjectURL(imageFile));\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param url defines the url to load data from\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public loadTextureFromUrlAsync(url: string) {\r\n return this._prepareImgToLoadAsync(url);\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param texture defines the source texture\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public extractFromTextureAsync(texture: Texture) {\r\n return new Promise<void>((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n texture.onLoadObservable.addOnce(() => {\r\n return this.extractFromTextureAsync(texture).then(resolve).catch(reject);\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n .then(async (data) => {\r\n const floatArray = new Float32Array(data.length);\r\n\r\n for (let i = 0; i < data.length; i++) {\r\n floatArray[i] = data[i] / 255.0;\r\n }\r\n this._data = floatArray;\r\n this._width = size.width;\r\n this._height = size.height;\r\n resolve();\r\n })\r\n .catch(reject);\r\n });\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this._data) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n const textureData: INodeGeometryTextureData = {\r\n data: this._data,\r\n width: this._width,\r\n height: this._height,\r\n };\r\n\r\n this.texture._storedValue = textureData;\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.width = this._width;\r\n serializationObject.height = this._height;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n if (this._data && this.serializedCachedData) {\r\n serializationObject.data = Array.from(this._data);\r\n }\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._width = serializationObject.width;\r\n this._height = serializationObject.height;\r\n if (serializationObject.data) {\r\n this._data = new Float32Array(serializationObject.data);\r\n this.serializedCachedData = true;\r\n } else {\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTextureBlock\", GeometryTextureBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryTextureBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Textures/geometryTextureBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,YAAY,EAAE,yCAA+B;AACtD,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAC/F;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAWvD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApCR,UAAK,GAA2B,IAAI,CAAC;QAI7C;;WAEG;QAEI,yBAAoB,GAAG,KAAK,CAAC;QA8BhC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEO,sBAAsB,CAAC,GAAW;QACtC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ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,GAAG,IAAI,CAAC;SACpC;aAAM;YACH,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;SAC1E;IACL,CAAC;CACJ;AAtLU;IADN,sBAAsB,CAAC,uBAAuB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kEAC1G;AAwLxC,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryTextureData } from \"../../Interfaces/nodeGeometryTextureData\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n/**\r\n * Block used to load texture data\r\n */\r\nexport class GeometryTextureBlock extends NodeGeometryBlock {\r\n private _data: Nullable<Float32Array> = null;\r\n private _width: number;\r\n private _height: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block should serialize its cached data\r\n */\r\n @editableInPropertyPage(\"Serialize cached data\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public serializedCachedData = false;\r\n\r\n /**\r\n * Gets the texture data\r\n */\r\n public get textureData() {\r\n return this._data;\r\n }\r\n\r\n /**\r\n * Gets the texture width\r\n */\r\n public get textureWidth() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Gets the texture height\r\n */\r\n public get textureHeight() {\r\n return this._height;\r\n }\r\n\r\n /**\r\n * Creates a new GeometryTextureBlock\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.registerOutput(\"texture\", 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 \"GeometryTextureBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture component\r\n */\r\n public get texture(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _prepareImgToLoadAsync(url: string) {\r\n return new Promise<void>((resolve, reject) => {\r\n const img = new Image();\r\n const canvas = document.createElement(\"canvas\");\r\n const ctx = canvas.getContext(\"2d\");\r\n\r\n img.onload = () => {\r\n canvas.width = img.width;\r\n canvas.height = img.height;\r\n\r\n ctx!.drawImage(img, 0, 0);\r\n\r\n const imageData = ctx!.getImageData(0, 0, img.width, img.height);\r\n const pixels = imageData.data;\r\n const floatArray = new Float32Array(pixels.length);\r\n\r\n for (let i = 0; i < pixels.length; i++) {\r\n floatArray[i] = pixels[i] / 255.0;\r\n }\r\n\r\n this._data = floatArray;\r\n this._width = img.width;\r\n this._height = img.height;\r\n resolve();\r\n };\r\n\r\n img.onerror = () => {\r\n this._data = null;\r\n reject();\r\n };\r\n\r\n img.src = url;\r\n });\r\n }\r\n\r\n /**\r\n * Remove stored data\r\n */\r\n public cleanData() {\r\n this._data = null;\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param imageFile defines the file to load data from\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public loadTextureFromFileAsync(imageFile: File) {\r\n return this._prepareImgToLoadAsync(URL.createObjectURL(imageFile));\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param url defines the url to load data from\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public loadTextureFromUrlAsync(url: string) {\r\n return this._prepareImgToLoadAsync(url);\r\n }\r\n\r\n /**\r\n * Load the texture data\r\n * @param texture defines the source texture\r\n * @returns a promise fulfilled when image data is loaded\r\n */\r\n public extractFromTextureAsync(texture: Texture) {\r\n return new Promise<void>((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n texture.onLoadObservable.addOnce(() => {\r\n return this.extractFromTextureAsync(texture).then(resolve).catch(reject);\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n .then(async (data) => {\r\n const floatArray = new Float32Array(data.length);\r\n\r\n for (let i = 0; i < data.length; i++) {\r\n floatArray[i] = data[i] / 255.0;\r\n }\r\n this._data = floatArray;\r\n this._width = size.width;\r\n this._height = size.height;\r\n resolve();\r\n })\r\n .catch(reject);\r\n });\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this._data) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n const textureData: INodeGeometryTextureData = {\r\n data: this._data,\r\n width: this._width,\r\n height: this._height,\r\n };\r\n\r\n this.texture._storedValue = textureData;\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.width = this._width;\r\n serializationObject.height = this._height;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n if (this._data && this.serializedCachedData) {\r\n serializationObject.data = Array.from(this._data);\r\n }\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._width = serializationObject.width;\r\n this._height = serializationObject.height;\r\n if (serializationObject.data) {\r\n this._data = new Float32Array(serializationObject.data);\r\n this.serializedCachedData = true;\r\n } else {\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTextureBlock\", GeometryTextureBlock);\r\n"]}
|
|
@@ -150,7 +150,7 @@ export class GeometryTextureFetchBlock extends NodeGeometryBlock {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
__decorate([
|
|
153
|
-
editableInPropertyPage("Clamp Coordinates", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
|
|
153
|
+
editableInPropertyPage("Clamp Coordinates", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
154
154
|
], GeometryTextureFetchBlock.prototype, "clampCoordinates", void 0);
|
|
155
155
|
RegisterClass("BABYLON.GeometryTextureFetchBlock", GeometryTextureFetchBlock);
|
|
156
156
|
//# sourceMappingURL=geometryTextureFetchBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryTextureFetchBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAgB,yCAA+B;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAG/F;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAO5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAXhB;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QACjF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;Q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AAK,EAAE,EAAE;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAY,CAAC;YACrC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC;IACN,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,uBAAuB,IAAI,CAAC,gBAAgB,KAAK,CAAC;QAC5H,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAE7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC;IACjE,CAAC;CACJ;AAtKU;IADN,sBAAsB,CAAC,mBAAmB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mEAC3F;AAwKnC,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { Vector4, type Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryTextureData } from \"../../Interfaces/nodeGeometryTextureData\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to fetch a color from texture data\r\n */\r\nexport class GeometryTextureFetchBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating if coordinates should be clamped between 0 and 1\r\n */\r\n @editableInPropertyPage(\"Clamp Coordinates\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public clampCoordinates = true;\r\n\r\n /**\r\n * Creates a new GeometryTextureFetchBlock\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(\"texture\", NodeGeometryBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"coordinates\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"rgba\", NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this.registerOutput(\"rgb\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"r\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"g\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"b\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"a\", NodeGeometryBlockConnectionPointTypes.Float);\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 \"GeometryTextureFetchBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture component\r\n */\r\n public get texture(): NodeGeometryConnectionPoint {\r\n return this.inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the coordinates component\r\n */\r\n public get coordinates(): NodeGeometryConnectionPoint {\r\n return this.inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the rgba component\r\n */\r\n public get rgba(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb component\r\n */\r\n public get rgb(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the r component\r\n */\r\n public get r(): NodeGeometryConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the g component\r\n */\r\n public get g(): NodeGeometryConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the b component\r\n */\r\n public get b(): NodeGeometryConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the a component\r\n */\r\n public get a(): NodeGeometryConnectionPoint {\r\n return this._outputs[5];\r\n }\r\n\r\n private _repeatClamp(num: number) {\r\n if (num >= 0) {\r\n return num % 1;\r\n } else {\r\n return 1 - (Math.abs(num) % 1);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const textureData = this.texture.getConnectedValue(state) as INodeGeometryTextureData;\r\n if (!textureData || !textureData.data) {\r\n return null;\r\n }\r\n\r\n const uv = this.coordinates.getConnectedValue(state) as Vector2;\r\n\r\n if (!uv) {\r\n return null;\r\n }\r\n\r\n const u = this.clampCoordinates ? Math.max(0, Math.min(uv.x, 1.0)) : this._repeatClamp(uv.x);\r\n const v = this.clampCoordinates ? Math.max(0, Math.min(uv.y, 1.0)) : this._repeatClamp(uv.y);\r\n\r\n const x = Math.floor(u * (textureData.width - 1));\r\n const y = Math.floor(v * (textureData.height - 1));\r\n const index = x + textureData.width * y;\r\n\r\n return Vector4.FromArray(textureData.data, index * 4);\r\n };\r\n\r\n this.rgba._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n\r\n this.rgb._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.toVector3() : null;\r\n };\r\n\r\n this.r._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.x : null;\r\n };\r\n\r\n this.g._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.y : null;\r\n };\r\n\r\n this.b._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.z : null;\r\n };\r\n\r\n this.a._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.w : null;\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.clampCoordinates = ${this.clampCoordinates};\\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.clampCoordinates = this.clampCoordinates;\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.clampCoordinates = serializationObject.clampCoordinates;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTextureFetchBlock\", GeometryTextureFetchBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryTextureFetchBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAgB,yCAA+B;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAG/F;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAO5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAXhB;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QACjF,IA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AO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC;QAEF,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAY,CAAC;YACrC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC;IACN,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,uBAAuB,IAAI,CAAC,gBAAgB,KAAK,CAAC;QAC5H,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAE7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC;IACjE,CAAC;CACJ;AAtKU;IADN,sBAAsB,CAAC,mBAAmB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mEAC3G;AAwKnC,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { Vector4, type Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { INodeGeometryTextureData } from \"../../Interfaces/nodeGeometryTextureData\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to fetch a color from texture data\r\n */\r\nexport class GeometryTextureFetchBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating if coordinates should be clamped between 0 and 1\r\n */\r\n @editableInPropertyPage(\"Clamp Coordinates\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public clampCoordinates = true;\r\n\r\n /**\r\n * Creates a new GeometryTextureFetchBlock\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(\"texture\", NodeGeometryBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"coordinates\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"rgba\", NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this.registerOutput(\"rgb\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"r\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"g\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"b\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"a\", NodeGeometryBlockConnectionPointTypes.Float);\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 \"GeometryTextureFetchBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture component\r\n */\r\n public get texture(): NodeGeometryConnectionPoint {\r\n return this.inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the coordinates component\r\n */\r\n public get coordinates(): NodeGeometryConnectionPoint {\r\n return this.inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the rgba component\r\n */\r\n public get rgba(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb component\r\n */\r\n public get rgb(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the r component\r\n */\r\n public get r(): NodeGeometryConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the g component\r\n */\r\n public get g(): NodeGeometryConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the b component\r\n */\r\n public get b(): NodeGeometryConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the a component\r\n */\r\n public get a(): NodeGeometryConnectionPoint {\r\n return this._outputs[5];\r\n }\r\n\r\n private _repeatClamp(num: number) {\r\n if (num >= 0) {\r\n return num % 1;\r\n } else {\r\n return 1 - (Math.abs(num) % 1);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const textureData = this.texture.getConnectedValue(state) as INodeGeometryTextureData;\r\n if (!textureData || !textureData.data) {\r\n return null;\r\n }\r\n\r\n const uv = this.coordinates.getConnectedValue(state) as Vector2;\r\n\r\n if (!uv) {\r\n return null;\r\n }\r\n\r\n const u = this.clampCoordinates ? Math.max(0, Math.min(uv.x, 1.0)) : this._repeatClamp(uv.x);\r\n const v = this.clampCoordinates ? Math.max(0, Math.min(uv.y, 1.0)) : this._repeatClamp(uv.y);\r\n\r\n const x = Math.floor(u * (textureData.width - 1));\r\n const y = Math.floor(v * (textureData.height - 1));\r\n const index = x + textureData.width * y;\r\n\r\n return Vector4.FromArray(textureData.data, index * 4);\r\n };\r\n\r\n this.rgba._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n\r\n this.rgb._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.toVector3() : null;\r\n };\r\n\r\n this.r._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.x : null;\r\n };\r\n\r\n this.g._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.y : null;\r\n };\r\n\r\n this.b._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.z : null;\r\n };\r\n\r\n this.a._storedFunction = (state) => {\r\n const color = func(state) as Vector4;\r\n return color ? color.w : null;\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.clampCoordinates = ${this.clampCoordinates};\\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.clampCoordinates = this.clampCoordinates;\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.clampCoordinates = serializationObject.clampCoordinates;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTextureFetchBlock\", GeometryTextureFetchBlock);\r\n"]}
|
|
@@ -26,6 +26,11 @@ export declare class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
26
26
|
* Gets or sets the operation applied by the block
|
|
27
27
|
*/
|
|
28
28
|
operation: BooleanGeometryOperations;
|
|
29
|
+
/**
|
|
30
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
31
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
32
|
+
*/
|
|
33
|
+
useOldCSGEngine: boolean;
|
|
29
34
|
private _csg2LoadingPromise;
|
|
30
35
|
/**
|
|
31
36
|
* @internal
|
|
@@ -4,6 +4,7 @@ import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
|
4
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
5
|
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
6
|
import { CSG2, InitializeCSG2Async, IsCSG2Ready } from "../../csg2.js";
|
|
7
|
+
import { CSG } from "../../csg.js";
|
|
7
8
|
/**
|
|
8
9
|
* Operations supported by the boolean block
|
|
9
10
|
*/
|
|
@@ -47,6 +48,11 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
47
48
|
* Gets or sets the operation applied by the block
|
|
48
49
|
*/
|
|
49
50
|
this.operation = BooleanGeometryOperations.Intersect;
|
|
51
|
+
/**
|
|
52
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
53
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
54
|
+
*/
|
|
55
|
+
this.useOldCSGEngine = false;
|
|
50
56
|
this.registerInput("geometry0", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
51
57
|
this.registerInput("geometry1", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
52
58
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
@@ -103,19 +109,36 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
103
109
|
if (!vertexData1.colors && vertexData0.colors) {
|
|
104
110
|
vertexData1.colors = new Array(vertexCount * 4);
|
|
105
111
|
}
|
|
106
|
-
const CSG0 = CSG2.FromVertexData(vertexData0);
|
|
107
|
-
const CSG1 = CSG2.FromVertexData(vertexData1);
|
|
108
112
|
let boolCSG;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
if (this.useOldCSGEngine) {
|
|
114
|
+
const CSG0 = CSG.FromVertexData(vertexData0);
|
|
115
|
+
const CSG1 = CSG.FromVertexData(vertexData1);
|
|
116
|
+
switch (this.operation) {
|
|
117
|
+
case BooleanGeometryOperations.Intersect:
|
|
118
|
+
boolCSG = CSG0.intersect(CSG1);
|
|
119
|
+
break;
|
|
120
|
+
case BooleanGeometryOperations.Subtract:
|
|
121
|
+
boolCSG = CSG0.subtract(CSG1);
|
|
122
|
+
break;
|
|
123
|
+
case BooleanGeometryOperations.Union:
|
|
124
|
+
boolCSG = CSG0.union(CSG1);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const CSG0 = CSG2.FromVertexData(vertexData0);
|
|
130
|
+
const CSG1 = CSG2.FromVertexData(vertexData1);
|
|
131
|
+
switch (this.operation) {
|
|
132
|
+
case BooleanGeometryOperations.Intersect:
|
|
133
|
+
boolCSG = CSG0.intersect(CSG1);
|
|
134
|
+
break;
|
|
135
|
+
case BooleanGeometryOperations.Subtract:
|
|
136
|
+
boolCSG = CSG0.subtract(CSG1);
|
|
137
|
+
break;
|
|
138
|
+
case BooleanGeometryOperations.Union:
|
|
139
|
+
boolCSG = CSG0.add(CSG1);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
119
142
|
}
|
|
120
143
|
return boolCSG.toVertexData();
|
|
121
144
|
};
|
|
@@ -130,6 +153,7 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
130
153
|
_dumpPropertiesCode() {
|
|
131
154
|
let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
|
|
132
155
|
codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\n`;
|
|
156
|
+
codeString += `${this._codeVariableName}.useOldCSGEngine = ${this.useOldCSGEngine ? "true" : "false"};\n`;
|
|
133
157
|
return codeString;
|
|
134
158
|
}
|
|
135
159
|
/**
|
|
@@ -140,6 +164,7 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
140
164
|
const serializationObject = super.serialize();
|
|
141
165
|
serializationObject.evaluateContext = this.evaluateContext;
|
|
142
166
|
serializationObject.operation = this.operation;
|
|
167
|
+
serializationObject.useOldCSGEngine = this.useOldCSGEngine;
|
|
143
168
|
return serializationObject;
|
|
144
169
|
}
|
|
145
170
|
_deserialize(serializationObject) {
|
|
@@ -148,14 +173,16 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
148
173
|
if (serializationObject.operation) {
|
|
149
174
|
this.operation = serializationObject.operation;
|
|
150
175
|
}
|
|
176
|
+
this.useOldCSGEngine = !!serializationObject.useOldCSGEngine;
|
|
151
177
|
}
|
|
152
178
|
}
|
|
153
179
|
__decorate([
|
|
154
|
-
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
|
|
180
|
+
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
155
181
|
], BooleanGeometryBlock.prototype, "evaluateContext", void 0);
|
|
156
182
|
__decorate([
|
|
157
183
|
editableInPropertyPage("Operation", 4 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
158
184
|
notifiers: { rebuild: true },
|
|
185
|
+
embedded: true,
|
|
159
186
|
options: [
|
|
160
187
|
{ label: "Intersect", value: BooleanGeometryOperations.Intersect },
|
|
161
188
|
{ label: "Subtract", value: BooleanGeometryOperations.Subtract },
|
|
@@ -163,5 +190,8 @@ __decorate([
|
|
|
163
190
|
],
|
|
164
191
|
})
|
|
165
192
|
], BooleanGeometryBlock.prototype, "operation", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
editableInPropertyPage("Use old CSG engine", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
195
|
+
], BooleanGeometryBlock.prototype, "useOldCSGEngine", void 0);
|
|
166
196
|
RegisterClass("BABYLON.BooleanGeometryBlock", BooleanGeometryBlock);
|
|
167
197
|
//# sourceMappingURL=booleanGeometryBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booleanGeomet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B,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE;SAC7D;KACJ,CAAC;uDACqD;AAmJ3D,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,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 { VertexData } from \"../../mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { CSG2, InitializeCSG2Async, IsCSG2Ready } from \"core/Meshes/csg2\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Operations supported by the boolean block\r\n */\r\nexport enum BooleanGeometryOperations {\r\n /** Intersect */\r\n Intersect,\r\n /** Subtract */\r\n Subtract,\r\n /** Union */\r\n Union,\r\n}\r\n\r\n/**\r\n * Block used to apply a boolean operation between 2 geometries\r\n */\r\nexport class BooleanGeometryBlock extends NodeGeometryBlock {\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\", { notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Intersect\", value: BooleanGeometryOperations.Intersect },\r\n { label: \"Subtract\", value: BooleanGeometryOperations.Subtract },\r\n { label: \"Union\", value: BooleanGeometryOperations.Union },\r\n ],\r\n })\r\n public operation = BooleanGeometryOperations.Intersect;\r\n\r\n private _csg2LoadingPromise: Promise<void>;\r\n /**\r\n * @internal\r\n */\r\n public override get _isReadyState(): Nullable<Promise<void>> {\r\n if (IsCSG2Ready()) {\r\n return null;\r\n }\r\n\r\n if (!this._csg2LoadingPromise) {\r\n this._csg2LoadingPromise = InitializeCSG2Async();\r\n }\r\n\r\n return this._csg2LoadingPromise;\r\n }\r\n\r\n /**\r\n * Create a new BooleanGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"BooleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): 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 protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexData0 = this.geometry0.getConnectedValue(state) as VertexData;\r\n const vertexData1 = this.geometry1.getConnectedValue(state) as VertexData;\r\n\r\n if (!vertexData0 || !vertexData1) {\r\n return null;\r\n }\r\n\r\n const vertexCount = vertexData0.positions!.length / 3;\r\n // Ensure that all the fields are filled to avoid problems later on in the graph\r\n if (!vertexData0.normals && vertexData1.normals) {\r\n vertexData0.normals = new Array<number>(vertexData0.positions!.length);\r\n }\r\n if (!vertexData1.normals && vertexData0.normals) {\r\n vertexData1.normals = new Array<number>(vertexData1.positions!.length);\r\n }\r\n if (!vertexData0.uvs && vertexData1.uvs) {\r\n vertexData0.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData1.uvs && vertexData0.uvs) {\r\n vertexData1.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData0.colors && vertexData1.colors) {\r\n vertexData0.colors = new Array<number>(vertexCount * 4);\r\n }\r\n if (!vertexData1.colors && vertexData0.colors) {\r\n vertexData1.colors = new Array<number>(vertexCount * 4);\r\n }\r\n\r\n const CSG0 = CSG2.FromVertexData(vertexData0);\r\n const CSG1 = CSG2.FromVertexData(vertexData1);\r\n\r\n let boolCSG: CSG2;\r\n\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.add(CSG1);\r\n break;\r\n }\r\n\r\n return boolCSG.toVertexData();\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 codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\\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.operation = this.operation;\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.evaluateContext = serializationObject.evaluateContext;\r\n if (serializationObject.operation) {\r\n this.operation = serializationObject.operation;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BooleanGeometryBlock\", BooleanGeometryBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"booleanGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/booleanGeometryBlock.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;AAGlG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,sBAAyB;AAE1E,OAAO,EAAE,GAAG,EAAE,qBAAwB;AAEtC;;GAEG;AACH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACjC,gBAAgB;IAChB,mFAAS,CAAA;IACT,eAAe;IACf,iFAAQ,CAAA;IACR,YAAY;IACZ,2EAAK,CAAA;AACT,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IA8BvD;;OAEG;IACH,IAAoB,aAAa;QAC7B,IAAI,WAAW,EAAE,EAAE;YACf,OAAO,IAAI,CAAC;SACf;QAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC3B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;SACpD;QAED,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH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AAK,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE;SAC7D;KACJ,CAAC;uDACqD;AAOhD;IADN,sBAAsB,CAAC,oBAAoB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;6DAC5G;AAsKnC,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,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 { VertexData } from \"../../mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { CSG2, InitializeCSG2Async, IsCSG2Ready } from \"core/Meshes/csg2\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { CSG } from \"core/Meshes/csg\";\r\n\r\n/**\r\n * Operations supported by the boolean block\r\n */\r\nexport enum BooleanGeometryOperations {\r\n /** Intersect */\r\n Intersect,\r\n /** Subtract */\r\n Subtract,\r\n /** Union */\r\n Union,\r\n}\r\n\r\n/**\r\n * Block used to apply a boolean operation between 2 geometries\r\n */\r\nexport class BooleanGeometryBlock extends NodeGeometryBlock {\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 = false;\r\n\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Intersect\", value: BooleanGeometryOperations.Intersect },\r\n { label: \"Subtract\", value: BooleanGeometryOperations.Subtract },\r\n { label: \"Union\", value: BooleanGeometryOperations.Union },\r\n ],\r\n })\r\n public operation = BooleanGeometryOperations.Intersect;\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(\"Use old CSG engine\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public useOldCSGEngine = false;\r\n\r\n private _csg2LoadingPromise: Promise<void>;\r\n /**\r\n * @internal\r\n */\r\n public override get _isReadyState(): Nullable<Promise<void>> {\r\n if (IsCSG2Ready()) {\r\n return null;\r\n }\r\n\r\n if (!this._csg2LoadingPromise) {\r\n this._csg2LoadingPromise = InitializeCSG2Async();\r\n }\r\n\r\n return this._csg2LoadingPromise;\r\n }\r\n\r\n /**\r\n * Create a new BooleanGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"BooleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): 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 protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexData0 = this.geometry0.getConnectedValue(state) as VertexData;\r\n const vertexData1 = this.geometry1.getConnectedValue(state) as VertexData;\r\n\r\n if (!vertexData0 || !vertexData1) {\r\n return null;\r\n }\r\n\r\n const vertexCount = vertexData0.positions!.length / 3;\r\n // Ensure that all the fields are filled to avoid problems later on in the graph\r\n if (!vertexData0.normals && vertexData1.normals) {\r\n vertexData0.normals = new Array<number>(vertexData0.positions!.length);\r\n }\r\n if (!vertexData1.normals && vertexData0.normals) {\r\n vertexData1.normals = new Array<number>(vertexData1.positions!.length);\r\n }\r\n if (!vertexData0.uvs && vertexData1.uvs) {\r\n vertexData0.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData1.uvs && vertexData0.uvs) {\r\n vertexData1.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData0.colors && vertexData1.colors) {\r\n vertexData0.colors = new Array<number>(vertexCount * 4);\r\n }\r\n if (!vertexData1.colors && vertexData0.colors) {\r\n vertexData1.colors = new Array<number>(vertexCount * 4);\r\n }\r\n\r\n let boolCSG: CSG | CSG2;\r\n\r\n if (this.useOldCSGEngine) {\r\n const CSG0 = CSG.FromVertexData(vertexData0);\r\n const CSG1 = CSG.FromVertexData(vertexData1);\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.union(CSG1);\r\n break;\r\n }\r\n } else {\r\n const CSG0 = CSG2.FromVertexData(vertexData0);\r\n const CSG1 = CSG2.FromVertexData(vertexData1);\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.add(CSG1);\r\n break;\r\n }\r\n }\r\n\r\n return boolCSG.toVertexData();\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 codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\\n`;\r\n codeString += `${this._codeVariableName}.useOldCSGEngine = ${this.useOldCSGEngine ? \"true\" : \"false\"};\\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.operation = this.operation;\r\n serializationObject.useOldCSGEngine = this.useOldCSGEngine;\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.evaluateContext = serializationObject.evaluateContext;\r\n if (serializationObject.operation) {\r\n this.operation = serializationObject.operation;\r\n }\r\n\r\n this.useOldCSGEngine = !!serializationObject.useOldCSGEngine;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BooleanGeometryBlock\", BooleanGeometryBlock);\r\n"]}
|
|
@@ -81,7 +81,7 @@ export class CleanGeometryBlock extends NodeGeometryBlock {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
__decorate([
|
|
84
|
-
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
|
|
84
|
+
editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
85
85
|
], CleanGeometryBlock.prototype, "evaluateContext", void 0);
|
|
86
86
|
RegisterClass("BABYLON.CleanGeometryBlock", CleanGeometryBlock);
|
|
87
87
|
//# sourceMappingURL=cleanGeometryBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/cleanGeometryBlock.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,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,EAAE,eAAe,EAAE,yCAAkC;AAE5D;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAQrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS1B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAA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Ae,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AApFU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC3G;AAsFlC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport type { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { FixFlippedFaces } from \"core/Maths/math.functions\";\r\n\r\n/**\r\n * Block used to clean a geometry\r\n */\r\nexport class CleanGeometryBlock extends NodeGeometryBlock {\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 * Creates a new CleanGeometryBlock\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.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"CleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry 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 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(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n\r\n const vertexData = (this.geometry.getConnectedValue(state) as VertexData).clone();\r\n\r\n if (!vertexData.positions || !vertexData.indices || !vertexData.normals) {\r\n return vertexData;\r\n }\r\n\r\n const indices = vertexData.indices;\r\n const positions = vertexData.positions;\r\n\r\n FixFlippedFaces(positions, indices);\r\n\r\n return 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 return super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\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\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.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CleanGeometryBlock\", CleanGeometryBlock);\r\n"]}
|
|
@@ -160,6 +160,7 @@ export class ConditionBlock extends NodeGeometryBlock {
|
|
|
160
160
|
__decorate([
|
|
161
161
|
editableInPropertyPage("Test", 4 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
162
162
|
notifiers: { rebuild: true },
|
|
163
|
+
embedded: true,
|
|
163
164
|
options: [
|
|
164
165
|
{ label: "Equal", value: ConditionBlockTests.Equal },
|
|
165
166
|
{ label: "NotEqual", value: ConditionBlockTests.NotEqual },
|
|
@@ -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,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;IAoBjD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAxBhB;;WAEG;QAeI,SAAI,GAAG,mBAAmB,CAA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AY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;IACzC,CAAC;CACJ;AA7IU;IAdN,sBAAsB,CAAC,MAAM,uCAA+B,UAAU,EAAE;QACrE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,OAAO,EAAE,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;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 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,EAA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,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;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"]}
|
|
@@ -108,10 +108,10 @@ export class GeometryClampBlock extends NodeGeometryBlock {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
__decorate([
|
|
111
|
-
editableInPropertyPage("Minimum", 1 /* PropertyTypeForEdition.Float
|
|
111
|
+
editableInPropertyPage("Minimum", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })
|
|
112
112
|
], GeometryClampBlock.prototype, "minimum", void 0);
|
|
113
113
|
__decorate([
|
|
114
|
-
editableInPropertyPage("Maximum", 1 /* PropertyTypeForEdition.Float
|
|
114
|
+
editableInPropertyPage("Maximum", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })
|
|
115
115
|
], GeometryClampBlock.prototype, "maximum", void 0);
|
|
116
116
|
RegisterClass("BABYLON.GeometryClampBlock", GeometryClampBlock);
|
|
117
117
|
//# sourceMappingURL=geometryClampBlock.js.map
|