@babylonjs/core 7.32.4 → 7.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/Decorators/nodeDecorator.d.ts +4 -0
  2. package/Decorators/nodeDecorator.js.map +1 -1
  3. package/Engines/abstractEngine.js +2 -2
  4. package/Engines/abstractEngine.js.map +1 -1
  5. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  6. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -0
  7. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  8. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +16 -0
  9. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +40 -7
  10. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  11. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -4
  12. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  13. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -1
  14. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  15. package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
  16. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  17. package/Materials/Node/Blocks/PBR/refractionBlock.js +3 -3
  18. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  19. package/Materials/Node/Blocks/PBR/sheenBlock.js +2 -2
  20. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  21. package/Materials/Node/Blocks/clampBlock.js +2 -2
  22. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  23. package/Materials/Node/Blocks/cloudBlock.js +1 -1
  24. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  25. package/Materials/Node/Blocks/conditionalBlock.js +19 -0
  26. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  27. package/Materials/Node/Blocks/curveBlock.js +37 -0
  28. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  29. package/Materials/Node/Blocks/loopBlock.js +1 -1
  30. package/Materials/Node/Blocks/loopBlock.js.map +1 -1
  31. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +1 -0
  32. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  33. package/Materials/Node/Blocks/transformBlock.d.ts +6 -0
  34. package/Materials/Node/Blocks/transformBlock.js +16 -1
  35. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  36. package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
  37. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  38. package/Materials/Node/Blocks/trigonometryBlock.js +29 -0
  39. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  40. package/Materials/Node/Blocks/waveBlock.js +13 -0
  41. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  42. package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -1
  43. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  44. package/Materials/Node/nodeMaterial.js.map +1 -1
  45. package/Materials/effectRenderer.d.ts +1 -1
  46. package/Materials/effectRenderer.js +2 -2
  47. package/Materials/effectRenderer.js.map +1 -1
  48. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -1
  49. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  50. package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
  51. package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
  52. package/Meshes/Node/Blocks/Set/latticeBlock.js +4 -4
  53. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  54. package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -1
  55. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  56. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -1
  57. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  58. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -1
  59. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  60. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -1
  61. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  62. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -1
  63. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  64. package/Meshes/Node/Blocks/Set/setUVsBlock.js +2 -1
  65. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  66. package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -1
  67. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -1
  69. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  70. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -1
  71. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  72. package/Meshes/Node/Blocks/Sources/discBlock.js +1 -1
  73. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -1
  75. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -1
  77. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -1
  79. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  80. package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -1
  81. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  82. package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -1
  83. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  84. package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -1
  85. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  86. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  87. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  88. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -1
  89. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  90. package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +5 -0
  91. package/Meshes/Node/Blocks/booleanGeometryBlock.js +43 -13
  92. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  93. package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -1
  94. package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
  95. package/Meshes/Node/Blocks/conditionBlock.js +1 -0
  96. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  97. package/Meshes/Node/Blocks/geometryClampBlock.js +2 -2
  98. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  99. package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -1
  100. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  101. package/Meshes/Node/Blocks/geometryCurveBlock.js +1 -0
  102. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  103. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
  104. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  105. package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -1
  106. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  107. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +1 -0
  108. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  109. package/Meshes/Node/Blocks/mappingBlock.js +1 -0
  110. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  111. package/Meshes/Node/Blocks/mathBlock.js +1 -0
  112. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  113. package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -1
  114. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  115. package/Meshes/Node/Blocks/randomBlock.js +1 -0
  116. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  117. package/Meshes/Node/nodeGeometry.js.map +1 -1
  118. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
  119. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  120. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +12 -12
  121. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  122. package/Shaders/iblShadowAccumulation.fragment.js +2 -1
  123. package/Shaders/iblShadowAccumulation.fragment.js.map +1 -1
  124. package/ShadersWGSL/iblShadowAccumulation.fragment.js +2 -1
  125. package/ShadersWGSL/iblShadowAccumulation.fragment.js.map +1 -1
  126. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"randomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/randomBlock.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,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IACxB,WAAW;IACX,uDAAI,CAAA;IACJ,aAAa;IACb,2DAAM,CAAA;IACN,iBAAiB;IACjB,mEAAU,CAAA;IACV,WAAW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tB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AAlKU;IATN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;YAC/C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE;YACnD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,CAAC,UAAU,EAAE;YAC3D,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;SAClD;KACJ,CAAC;6CACsC;AAoK5C,aAAa,CAAC,qBAAqB,EAAE,WAAW,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 { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum RandomBlockLocks {\r\n /** None */\r\n None,\r\n /** LoopID */\r\n LoopID,\r\n /** InstanceID */\r\n InstanceID,\r\n /** Once */\r\n Once,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n private _currentLockId = -1;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific duration\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"None\", value: RandomBlockLocks.None },\r\n { label: \"LoopID\", value: RandomBlockLocks.LoopID },\r\n { label: \"InstanceID\", value: RandomBlockLocks.InstanceID },\r\n { label: \"Once\", value: RandomBlockLocks.Once },\r\n ],\r\n })\r\n public lockMode = RandomBlockLocks.None;\r\n\r\n /**\r\n * Create a new RandomBlock\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(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\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 \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\r\n return this._inputs[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 public override autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n this._currentLockId = -1;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n if (this.lockMode === RandomBlockLocks.None || !func) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case RandomBlockLocks.InstanceID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.InstanceID, true) || 0;\r\n break;\r\n case RandomBlockLocks.LoopID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.LoopID, true) || 0;\r\n break;\r\n case RandomBlockLocks.Once:\r\n lockId = state.buildId || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId || this.lockMode === RandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.lockMode = BABYLON.RandomBlockLocks.${RandomBlockLocks[this.lockMode]};\\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.lockMode = this.lockMode;\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.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
1
+ {"version":3,"file":"randomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/randomBlock.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,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IACxB,WAAW;IACX,uDAAI,CAAA;IACJ,aAAa;IACb,2DAAM,CAAA;IACN,iBAAiB;IACjB,mEAAU,CAAA;IACV,WAAW;IACX,uDAAI,CAAA;AACR,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAED;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAiB9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QArBR,mBAAc,GAAG,CAAC,CAAC,CAAC;QAC5B;;WAEG;QAWI,aAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC;QASpC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAE5E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAA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OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;YAC/C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE;YACnD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,CAAC,UAAU,EAAE;YAC3D,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE;SAClD;KACJ,CAAC;6CACsC;AAoK5C,aAAa,CAAC,qBAAqB,EAAE,WAAW,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 { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum RandomBlockLocks {\r\n /** None */\r\n None,\r\n /** LoopID */\r\n LoopID,\r\n /** InstanceID */\r\n InstanceID,\r\n /** Once */\r\n Once,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n private _currentLockId = -1;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific duration\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: RandomBlockLocks.None },\r\n { label: \"LoopID\", value: RandomBlockLocks.LoopID },\r\n { label: \"InstanceID\", value: RandomBlockLocks.InstanceID },\r\n { label: \"Once\", value: RandomBlockLocks.Once },\r\n ],\r\n })\r\n public lockMode = RandomBlockLocks.None;\r\n\r\n /**\r\n * Create a new RandomBlock\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(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\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 \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeGeometryConnectionPoint {\r\n return this._inputs[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 public override autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n this._currentLockId = -1;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n if (this.lockMode === RandomBlockLocks.None || !func) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case RandomBlockLocks.InstanceID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.InstanceID, true) || 0;\r\n break;\r\n case RandomBlockLocks.LoopID:\r\n lockId = state.getContextualValue(NodeGeometryContextualSources.LoopID, true) || 0;\r\n break;\r\n case RandomBlockLocks.Once:\r\n lockId = state.buildId || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId || this.lockMode === RandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.lockMode = BABYLON.RandomBlockLocks.${RandomBlockLocks[this.lockMode]};\\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.lockMode = this.lockMode;\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.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,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BAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAnqBc,8BAAiB,GAAW,CAAC,AAAZ,CAAa;AAM7C,gDAAgD;AAClC,sBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,uBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAuDzC;IADN,SAAS,EAAE;0CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Gets the vertex data. This needs to be done after build() was called.\r\n * This is used to access vertexData when creating a mesh is not required.\r\n */\r\n public get vertexData() {\r\n return this._vertexData;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Check async states\r\n const promises: Promise<void>[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block._isReadyState) {\r\n promises.push(block._isReadyState);\r\n }\r\n }\r\n\r\n if (promises.length) {\r\n Promise.all(promises).then(() => {\r\n this.build(verbose, updateBuildId, autoConfigure);\r\n });\r\n return;\r\n }\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n try {\r\n this.outputBlock.build(state);\r\n } finally {\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,KAAK,E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sBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,uBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAuDzC;IADN,SAAS,EAAE;0CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Gets the vertex data. This needs to be done after build() was called.\r\n * This is used to access vertexData when creating a mesh is not required.\r\n */\r\n public get vertexData() {\r\n return this._vertexData;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Check async states\r\n const promises: Promise<void>[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block._isReadyState) {\r\n promises.push(block._isReadyState);\r\n }\r\n }\r\n\r\n if (promises.length) {\r\n Promise.all(promises).then(() => {\r\n this.build(verbose, updateBuildId, autoConfigure);\r\n });\r\n return;\r\n }\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n try {\r\n this.outputBlock.build(state);\r\n } finally {\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
@@ -229,7 +229,7 @@ export class _IblShadowsAccumulationPass {
229
229
  }
230
230
  _setOutputTextureBindings() {
231
231
  const remenance = this._isMoving ? this.remenance : 0.99;
232
- this._accumulationParams.set(remenance, this.reset ? 1.0 : 0.0, 0.0, 0.0);
232
+ this._accumulationParams.set(remenance, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);
233
233
  this._outputTexture.setTexture("spatialBlurSampler", this._renderPipeline._getSpatialBlurTexture());
234
234
  this._outputTexture.setVector4("accumulationParameters", this._accumulationParams);
235
235
  this._outputTexture.setTexture("oldAccumulationSampler", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);
@@ -1 +1 @@
1
- {"version":3,"file":"iblShadowsAccumulationPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsAccumulationPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kEAA8D;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IAmBpC;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAOD;;;OAGG;IACI,cAAc;QACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAA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;QACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;CACJ","sourcesContent":["import { Constants } from \"../../Engines/constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { PostProcess } from \"../../PostProcesses/postProcess\";\r\nimport type { PostProcessOptions } from \"../../PostProcesses/postProcess\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IProceduralTextureCreationOptions } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * This should not be instanciated directly, as it is part of a scene component\r\n * @internal\r\n */\r\nexport class _IblShadowsAccumulationPass {\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _renderPipeline: IblShadowsRenderPipeline;\r\n\r\n // First, render the accumulation pass with both position buffers, motion buffer, shadow buffer, and the previous accumulation buffer\r\n private _outputTexture: ProceduralTexture;\r\n private _oldAccumulationCopy: ProceduralTexture;\r\n private _oldPositionCopy: ProceduralTexture;\r\n private _accumulationParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /** Enable the debug view for this pass */\r\n public debugEnabled: boolean = false;\r\n\r\n /**\r\n * Is the effect enabled\r\n */\r\n public enabled: boolean = true;\r\n\r\n /**\r\n * Returns the output texture of the pass.\r\n * @returns The output texture.\r\n */\r\n public getOutputTexture(): ProceduralTexture {\r\n return this._outputTexture;\r\n }\r\n\r\n /**\r\n * Observable that triggers when the accumulation texture is ready\r\n */\r\n public onReadyObservable: Observable<void> = new Observable<void>();\r\n\r\n /**\r\n * Gets the debug pass post process\r\n * @returns The post process\r\n */\r\n public getDebugPassPP(): PostProcess {\r\n if (!this._debugPassPP) {\r\n this._createDebugPass();\r\n }\r\n return this._debugPassPP;\r\n }\r\n\r\n private _debugPassName: string = \"Shadow Accumulation Debug Pass\";\r\n\r\n /**\r\n * Gets the name of the debug pass\r\n * @returns The name of the debug pass\r\n */\r\n public get debugPassName(): string {\r\n return this._debugPassName;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public get remenance(): number {\r\n return this._remenance;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public set remenance(value: number) {\r\n this._remenance = value;\r\n }\r\n private _remenance: number = 0.9;\r\n\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public get reset(): boolean {\r\n return this._reset;\r\n }\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public set reset(value: boolean) {\r\n this._reset = value;\r\n }\r\n private _reset: boolean = true;\r\n\r\n /**\r\n * Tell the pass that the camera is moving. This will cause the accumulation\r\n * rate to change.\r\n */\r\n public set isMoving(value: boolean) {\r\n this._isMoving = value;\r\n }\r\n private _isMoving: boolean = false;\r\n\r\n private _debugPassPP: PostProcess;\r\n private _debugSizeParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /**\r\n * Sets params that control the position and scaling of the debug display on the screen.\r\n * @param x Screen X offset of the debug display (0-1)\r\n * @param y Screen Y offset of the debug display (0-1)\r\n * @param widthScale X scale of the debug display (0-1)\r\n * @param heightScale Y scale of the debug display (0-1)\r\n */\r\n public setDebugDisplayParams(x: number, y: number, widthScale: number, heightScale: number) {\r\n this._debugSizeParams.set(x, y, widthScale, heightScale);\r\n }\r\n\r\n /**\r\n * Creates the debug post process effect for this pass\r\n */\r\n private _createDebugPass() {\r\n if (!this._debugPassPP) {\r\n const isWebGPU = this._engine.isWebGPU;\r\n const debugOptions: PostProcessOptions = {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n textureFormat: Constants.TEXTUREFORMAT_RGBA,\r\n textureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n uniforms: [\"sizeParams\"],\r\n samplers: [\"debugSampler\"],\r\n engine: this._engine,\r\n reusable: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializations: (useWebGPU: boolean, list: Promise<any>[]) => {\r\n if (useWebGPU) {\r\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment\"));\r\n } else {\r\n list.push(import(\"../../Shaders/iblShadowDebug.fragment\"));\r\n }\r\n },\r\n };\r\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\r\n this._debugPassPP.autoClear = false;\r\n this._debugPassPP.onApplyObservable.add((effect) => {\r\n // update the caustic texture with what we just rendered.\r\n effect.setTexture(\"debugSampler\", this._outputTexture);\r\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates the accumulation pass\r\n * @param scene Scene to attach to\r\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\r\n * @returns The accumulation pass\r\n */\r\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._renderPipeline = iblShadowsRenderPipeline;\r\n this._createTextures();\r\n }\r\n\r\n private _createTextures() {\r\n const isWebGPU = this._engine.isWebGPU;\r\n\r\n const outputTextureOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment\")]);\r\n }\r\n },\r\n };\r\n this._outputTexture = new ProceduralTexture(\r\n \"shadowAccumulationPass\",\r\n {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n },\r\n \"iblShadowAccumulation\",\r\n this._scene,\r\n outputTextureOptions\r\n );\r\n this._outputTexture.refreshRate = -1;\r\n this._outputTexture.autoClear = false;\r\n this._outputTexture.onGeneratedObservable.addOnce(() => {\r\n this.onReadyObservable.notifyObservers();\r\n });\r\n\r\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\r\n this._setOutputTextureBindings();\r\n\r\n let counter = 0;\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n counter = 0;\r\n });\r\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\r\n if (++counter == 2) {\r\n if (this.enabled && this._outputTexture.isReady()) {\r\n this._setOutputTextureBindings();\r\n this._outputTexture.render();\r\n }\r\n }\r\n });\r\n\r\n // Create the accumulation texture for the previous frame.\r\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\r\n const accumulationOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldAccumulationCopy = new ProceduralTexture(\r\n \"oldAccumulationRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n accumulationOptions,\r\n false\r\n );\r\n\r\n this._oldAccumulationCopy.autoClear = false;\r\n this._oldAccumulationCopy.refreshRate = 1;\r\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\r\n this._setAccumulationCopyBindings();\r\n\r\n // Create the local position texture for the previous frame.\r\n // We'll copy the previous local position texture to this texture at the start of every frame.\r\n const localPositionOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldPositionCopy = new ProceduralTexture(\r\n \"oldLocalPositionRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n localPositionOptions,\r\n false\r\n );\r\n this._updatePositionCopy();\r\n this._oldPositionCopy.autoClear = false;\r\n this._oldPositionCopy.refreshRate = 1;\r\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\r\n }\r\n\r\n private _setOutputTextureBindings() {\r\n const remenance = this._isMoving ? this.remenance : 0.99;\r\n this._accumulationParams.set(remenance, this.reset ? 1.0 : 0.0, 0.0, 0.0);\r\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\r\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\r\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\r\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\r\n\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n if (!geometryBufferRenderer) {\r\n return;\r\n }\r\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\r\n\r\n this.reset = false;\r\n this._isMoving = false;\r\n }\r\n\r\n private _updatePositionCopy() {\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n const index = geometryBufferRenderer!.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer!.getGBuffer().textures[index]);\r\n }\r\n\r\n private _setAccumulationCopyBindings() {\r\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\r\n }\r\n\r\n /**\r\n * Called by render pipeline when canvas resized.\r\n * @param scaleFactor The factor by which to scale the canvas size.\r\n */\r\n public resize(scaleFactor: number = 1.0) {\r\n const newSize = {\r\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\r\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor)),\r\n };\r\n this._outputTexture.resize(newSize, false);\r\n this._oldAccumulationCopy.resize(newSize, false);\r\n this._oldPositionCopy.resize({ width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, false);\r\n this.reset = true;\r\n }\r\n\r\n private _disposeTextures() {\r\n this._oldAccumulationCopy.dispose();\r\n this._oldPositionCopy.dispose();\r\n this._outputTexture.dispose();\r\n }\r\n\r\n /**\r\n * Checks if the pass is ready\r\n * @returns true if the pass is ready\r\n */\r\n public isReady() {\r\n return (\r\n this._oldAccumulationCopy &&\r\n this._oldAccumulationCopy.isReady() &&\r\n this._oldPositionCopy &&\r\n this._oldPositionCopy.isReady() &&\r\n this._outputTexture.isReady() &&\r\n !(this._debugPassPP && !this._debugPassPP.isReady())\r\n );\r\n }\r\n\r\n /**\r\n * Disposes the associated resources\r\n */\r\n public dispose() {\r\n this._disposeTextures();\r\n if (this._debugPassPP) {\r\n this._debugPassPP.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"iblShadowsAccumulationPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsAccumulationPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kEAA8D;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IAmBpC;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAOD;;;OAGG;IACI,cAAc;QACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3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gB,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;CACJ","sourcesContent":["import { Constants } from \"../../Engines/constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { PostProcess } from \"../../PostProcesses/postProcess\";\r\nimport type { PostProcessOptions } from \"../../PostProcesses/postProcess\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IProceduralTextureCreationOptions } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * This should not be instanciated directly, as it is part of a scene component\r\n * @internal\r\n */\r\nexport class _IblShadowsAccumulationPass {\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _renderPipeline: IblShadowsRenderPipeline;\r\n\r\n // First, render the accumulation pass with both position buffers, motion buffer, shadow buffer, and the previous accumulation buffer\r\n private _outputTexture: ProceduralTexture;\r\n private _oldAccumulationCopy: ProceduralTexture;\r\n private _oldPositionCopy: ProceduralTexture;\r\n private _accumulationParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /** Enable the debug view for this pass */\r\n public debugEnabled: boolean = false;\r\n\r\n /**\r\n * Is the effect enabled\r\n */\r\n public enabled: boolean = true;\r\n\r\n /**\r\n * Returns the output texture of the pass.\r\n * @returns The output texture.\r\n */\r\n public getOutputTexture(): ProceduralTexture {\r\n return this._outputTexture;\r\n }\r\n\r\n /**\r\n * Observable that triggers when the accumulation texture is ready\r\n */\r\n public onReadyObservable: Observable<void> = new Observable<void>();\r\n\r\n /**\r\n * Gets the debug pass post process\r\n * @returns The post process\r\n */\r\n public getDebugPassPP(): PostProcess {\r\n if (!this._debugPassPP) {\r\n this._createDebugPass();\r\n }\r\n return this._debugPassPP;\r\n }\r\n\r\n private _debugPassName: string = \"Shadow Accumulation Debug Pass\";\r\n\r\n /**\r\n * Gets the name of the debug pass\r\n * @returns The name of the debug pass\r\n */\r\n public get debugPassName(): string {\r\n return this._debugPassName;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public get remenance(): number {\r\n return this._remenance;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public set remenance(value: number) {\r\n this._remenance = value;\r\n }\r\n private _remenance: number = 0.9;\r\n\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public get reset(): boolean {\r\n return this._reset;\r\n }\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public set reset(value: boolean) {\r\n this._reset = value;\r\n }\r\n private _reset: boolean = true;\r\n\r\n /**\r\n * Tell the pass that the camera is moving. This will cause the accumulation\r\n * rate to change.\r\n */\r\n public set isMoving(value: boolean) {\r\n this._isMoving = value;\r\n }\r\n private _isMoving: boolean = false;\r\n\r\n private _debugPassPP: PostProcess;\r\n private _debugSizeParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /**\r\n * Sets params that control the position and scaling of the debug display on the screen.\r\n * @param x Screen X offset of the debug display (0-1)\r\n * @param y Screen Y offset of the debug display (0-1)\r\n * @param widthScale X scale of the debug display (0-1)\r\n * @param heightScale Y scale of the debug display (0-1)\r\n */\r\n public setDebugDisplayParams(x: number, y: number, widthScale: number, heightScale: number) {\r\n this._debugSizeParams.set(x, y, widthScale, heightScale);\r\n }\r\n\r\n /**\r\n * Creates the debug post process effect for this pass\r\n */\r\n private _createDebugPass() {\r\n if (!this._debugPassPP) {\r\n const isWebGPU = this._engine.isWebGPU;\r\n const debugOptions: PostProcessOptions = {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n textureFormat: Constants.TEXTUREFORMAT_RGBA,\r\n textureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n uniforms: [\"sizeParams\"],\r\n samplers: [\"debugSampler\"],\r\n engine: this._engine,\r\n reusable: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializations: (useWebGPU: boolean, list: Promise<any>[]) => {\r\n if (useWebGPU) {\r\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment\"));\r\n } else {\r\n list.push(import(\"../../Shaders/iblShadowDebug.fragment\"));\r\n }\r\n },\r\n };\r\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\r\n this._debugPassPP.autoClear = false;\r\n this._debugPassPP.onApplyObservable.add((effect) => {\r\n // update the caustic texture with what we just rendered.\r\n effect.setTexture(\"debugSampler\", this._outputTexture);\r\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates the accumulation pass\r\n * @param scene Scene to attach to\r\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\r\n * @returns The accumulation pass\r\n */\r\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._renderPipeline = iblShadowsRenderPipeline;\r\n this._createTextures();\r\n }\r\n\r\n private _createTextures() {\r\n const isWebGPU = this._engine.isWebGPU;\r\n\r\n const outputTextureOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment\")]);\r\n }\r\n },\r\n };\r\n this._outputTexture = new ProceduralTexture(\r\n \"shadowAccumulationPass\",\r\n {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n },\r\n \"iblShadowAccumulation\",\r\n this._scene,\r\n outputTextureOptions\r\n );\r\n this._outputTexture.refreshRate = -1;\r\n this._outputTexture.autoClear = false;\r\n this._outputTexture.onGeneratedObservable.addOnce(() => {\r\n this.onReadyObservable.notifyObservers();\r\n });\r\n\r\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\r\n this._setOutputTextureBindings();\r\n\r\n let counter = 0;\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n counter = 0;\r\n });\r\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\r\n if (++counter == 2) {\r\n if (this.enabled && this._outputTexture.isReady()) {\r\n this._setOutputTextureBindings();\r\n this._outputTexture.render();\r\n }\r\n }\r\n });\r\n\r\n // Create the accumulation texture for the previous frame.\r\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\r\n const accumulationOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldAccumulationCopy = new ProceduralTexture(\r\n \"oldAccumulationRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n accumulationOptions,\r\n false\r\n );\r\n\r\n this._oldAccumulationCopy.autoClear = false;\r\n this._oldAccumulationCopy.refreshRate = 1;\r\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\r\n this._setAccumulationCopyBindings();\r\n\r\n // Create the local position texture for the previous frame.\r\n // We'll copy the previous local position texture to this texture at the start of every frame.\r\n const localPositionOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldPositionCopy = new ProceduralTexture(\r\n \"oldLocalPositionRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n localPositionOptions,\r\n false\r\n );\r\n this._updatePositionCopy();\r\n this._oldPositionCopy.autoClear = false;\r\n this._oldPositionCopy.refreshRate = 1;\r\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\r\n }\r\n\r\n private _setOutputTextureBindings() {\r\n const remenance = this._isMoving ? this.remenance : 0.99;\r\n this._accumulationParams.set(remenance, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);\r\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\r\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\r\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\r\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\r\n\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n if (!geometryBufferRenderer) {\r\n return;\r\n }\r\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\r\n\r\n this.reset = false;\r\n this._isMoving = false;\r\n }\r\n\r\n private _updatePositionCopy() {\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n const index = geometryBufferRenderer!.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer!.getGBuffer().textures[index]);\r\n }\r\n\r\n private _setAccumulationCopyBindings() {\r\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\r\n }\r\n\r\n /**\r\n * Called by render pipeline when canvas resized.\r\n * @param scaleFactor The factor by which to scale the canvas size.\r\n */\r\n public resize(scaleFactor: number = 1.0) {\r\n const newSize = {\r\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\r\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor)),\r\n };\r\n this._outputTexture.resize(newSize, false);\r\n this._oldAccumulationCopy.resize(newSize, false);\r\n this._oldPositionCopy.resize({ width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, false);\r\n this.reset = true;\r\n }\r\n\r\n private _disposeTextures() {\r\n this._oldAccumulationCopy.dispose();\r\n this._oldPositionCopy.dispose();\r\n this._outputTexture.dispose();\r\n }\r\n\r\n /**\r\n * Checks if the pass is ready\r\n * @returns true if the pass is ready\r\n */\r\n public isReady() {\r\n return (\r\n this._oldAccumulationCopy &&\r\n this._oldAccumulationCopy.isReady() &&\r\n this._oldPositionCopy &&\r\n this._oldPositionCopy.isReady() &&\r\n this._outputTexture.isReady() &&\r\n !(this._debugPassPP && !this._debugPassPP.isReady())\r\n );\r\n }\r\n\r\n /**\r\n * Disposes the associated resources\r\n */\r\n public dispose() {\r\n this._disposeTextures();\r\n if (this._debugPassPP) {\r\n this._debugPassPP.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -13,56 +13,56 @@ interface IblShadowsSettings {
13
13
  * shadows but are more expensive to compute and require more memory.
14
14
  * The resolution is calculated as 2 to the power of this number.
15
15
  */
16
- resolutionExp: number;
16
+ resolutionExp?: number;
17
17
  /**
18
18
  * The number of different directions to sample during the voxel tracing pass. Higher
19
19
  * values will result in better quality, more stable shadows but are more expensive to compute.
20
20
  */
21
- sampleDirections: number;
21
+ sampleDirections?: number;
22
22
  /**
23
23
  * How dark the shadows are. 1.0 is full opacity, 0.0 is no shadows.
24
24
  */
25
- shadowOpacity: number;
25
+ shadowOpacity?: number;
26
26
  /**
27
27
  * How long the shadows remain in the scene. 0.0 is no persistence, 1.0 is full persistence.
28
28
  */
29
- shadowRemenance: number;
29
+ shadowRemenance?: number;
30
30
  /**
31
31
  * Render the voxel grid from 3 different axis. This will result in better quality shadows with fewer
32
32
  * bits of missing geometry.
33
33
  */
34
- triPlanarVoxelization: boolean;
34
+ triPlanarVoxelization?: boolean;
35
35
  /**
36
36
  * A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows
37
37
  * to increase performance. Should be a value between 0 and 1.
38
38
  */
39
- shadowRenderSizeFactor: number;
39
+ shadowRenderSizeFactor?: number;
40
40
  /**
41
41
  * Separate control for the opacity of the voxel shadows.
42
42
  */
43
- voxelShadowOpacity: number;
43
+ voxelShadowOpacity?: number;
44
44
  /**
45
45
  * Include screen-space shadows in the IBL shadow pipeline. This adds sharp shadows to small details
46
46
  * but only applies close to a shadow-casting object.
47
47
  */
48
- ssShadowsEnabled: boolean;
48
+ ssShadowsEnabled?: boolean;
49
49
  /**
50
50
  * The number of samples used in the screen space shadow pass.
51
51
  */
52
- ssShadowSampleCount: number;
52
+ ssShadowSampleCount?: number;
53
53
  /**
54
54
  * The stride of the screen-space shadow pass. This controls the distance between samples.
55
55
  */
56
- ssShadowStride: number;
56
+ ssShadowStride?: number;
57
57
  /**
58
58
  * The maximum distance a shadow can be cast in screen space. This should usually be kept small
59
59
  * as screenspace shadows are mostly useful for small details.
60
60
  */
61
- ssShadowDistanceScale: number;
61
+ ssShadowDistanceScale?: number;
62
62
  /**
63
63
  * Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
64
64
  */
65
- ssShadowThicknessScale: number;
65
+ ssShadowThicknessScale?: number;
66
66
  }
67
67
  /**
68
68
  * Voxel-based shadow rendering for IBL's.