@babylonjs/core 6.49.0 → 7.1.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 (121) hide show
  1. package/Animations/runtimeAnimation.js +10 -3
  2. package/Animations/runtimeAnimation.js.map +1 -1
  3. package/Compute/computeEffect.d.ts +24 -2
  4. package/Compute/computeEffect.js +5 -9
  5. package/Compute/computeEffect.js.map +1 -1
  6. package/Compute/computeShader.d.ts +4 -4
  7. package/Compute/computeShader.js +1 -1
  8. package/Compute/computeShader.js.map +1 -1
  9. package/Engines/Extensions/engine.computeShader.d.ts +7 -2
  10. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  11. package/Engines/Extensions/engine.multiRender.js +1 -1
  12. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  13. package/Engines/Extensions/engine.renderTarget.js +12 -2
  14. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  15. package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -1
  16. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  17. package/Engines/WebGPU/Extensions/engine.multiRender.js +1 -1
  18. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  19. package/Engines/WebGPU/Extensions/engine.renderTarget.js +5 -2
  20. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  21. package/Engines/WebGPU/webgpuClearQuad.d.ts +2 -2
  22. package/Engines/WebGPU/webgpuClearQuad.js +8 -3
  23. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  24. package/Engines/WebGPU/webgpuHardwareTexture.js +1 -0
  25. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  26. package/Engines/WebGPU/webgpuShaderProcessor.js +15 -0
  27. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  28. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -1
  29. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  30. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  31. package/Engines/WebGPU/webgpuTextureManager.js +6 -6
  32. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  33. package/Engines/nativeEngine.d.ts +1 -0
  34. package/Engines/nativeEngine.js.map +1 -1
  35. package/Engines/nullEngine.d.ts +1 -0
  36. package/Engines/nullEngine.js.map +1 -1
  37. package/Engines/renderTargetWrapper.d.ts +8 -0
  38. package/Engines/renderTargetWrapper.js +14 -1
  39. package/Engines/renderTargetWrapper.js.map +1 -1
  40. package/Engines/thinEngine.d.ts +6 -7
  41. package/Engines/thinEngine.js +25 -11
  42. package/Engines/thinEngine.js.map +1 -1
  43. package/Engines/webgpuEngine.d.ts +5 -2
  44. package/Engines/webgpuEngine.js +19 -8
  45. package/Engines/webgpuEngine.js.map +1 -1
  46. package/Materials/Node/Blocks/Dual/textureBlock.js +5 -0
  47. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  48. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +2 -0
  49. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  50. package/Materials/Node/Blocks/addBlock.d.ts +2 -15
  51. package/Materials/Node/Blocks/addBlock.js +4 -32
  52. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  53. package/Materials/Node/Blocks/baseMathBlock.d.ts +26 -0
  54. package/Materials/Node/Blocks/baseMathBlock.js +84 -0
  55. package/Materials/Node/Blocks/baseMathBlock.js.map +1 -0
  56. package/Materials/Node/Blocks/divideBlock.d.ts +2 -15
  57. package/Materials/Node/Blocks/divideBlock.js +4 -32
  58. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  59. package/Materials/Node/Blocks/multiplyBlock.d.ts +2 -15
  60. package/Materials/Node/Blocks/multiplyBlock.js +4 -32
  61. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/subtractBlock.d.ts +2 -15
  63. package/Materials/Node/Blocks/subtractBlock.js +4 -32
  64. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  65. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +4 -0
  66. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +7 -0
  67. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  68. package/Materials/Node/nodeMaterialBuildState.js +1 -1
  69. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  70. package/Materials/Textures/renderTargetTexture.d.ts +6 -23
  71. package/Materials/Textures/renderTargetTexture.js +10 -6
  72. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  73. package/Materials/Textures/texture.d.ts +5 -2
  74. package/Materials/Textures/texture.js +10 -5
  75. package/Materials/Textures/texture.js.map +1 -1
  76. package/Materials/Textures/textureCreationOptions.d.ts +1 -0
  77. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  78. package/Materials/effect.d.ts +37 -2
  79. package/Materials/effect.js +10 -14
  80. package/Materials/effect.js.map +1 -1
  81. package/Materials/shaderMaterial.d.ts +5 -9
  82. package/Materials/shaderMaterial.js +2 -6
  83. package/Materials/shaderMaterial.js.map +1 -1
  84. package/Meshes/Builders/ribbonBuilder.js +32 -28
  85. package/Meshes/Builders/ribbonBuilder.js.map +1 -1
  86. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +4 -3
  87. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  88. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  89. package/Meshes/GreasedLine/greasedLineMesh.d.ts +0 -2
  90. package/Meshes/GreasedLine/greasedLineMesh.js +85 -77
  91. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  92. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +9 -3
  93. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  94. package/Meshes/Node/Blocks/mathBlock.d.ts +6 -0
  95. package/Meshes/Node/Blocks/mathBlock.js +95 -23
  96. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  97. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +4 -0
  98. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -0
  99. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  100. package/Misc/greasedLineTools.d.ts +6 -0
  101. package/Misc/greasedLineTools.js +21 -0
  102. package/Misc/greasedLineTools.js.map +1 -1
  103. package/Rendering/reflectiveShadowMap.js +1 -1
  104. package/Rendering/reflectiveShadowMap.js.map +1 -1
  105. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
  106. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  107. package/Shaders/ShadersInclude/pbrDebug.js +2 -0
  108. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  109. package/ShadersWGSL/clearQuad.fragment.js +11 -0
  110. package/ShadersWGSL/clearQuad.fragment.js.map +1 -0
  111. package/ShadersWGSL/clearQuad.vertex.js +22 -0
  112. package/ShadersWGSL/clearQuad.vertex.js.map +1 -0
  113. package/node.js +1 -6
  114. package/node.js.map +1 -1
  115. package/package.json +1 -1
  116. package/Shaders/clearQuad.fragment.js +0 -10
  117. package/Shaders/clearQuad.fragment.js.map +0 -1
  118. package/Shaders/clearQuad.vertex.js +0 -19
  119. package/Shaders/clearQuad.vertex.js.map +0 -1
  120. /package/{Shaders → ShadersWGSL}/clearQuad.fragment.d.ts +0 -0
  121. /package/{Shaders → ShadersWGSL}/clearQuad.vertex.d.ts +0 -0
@@ -1,10 +1,9 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock";
2
1
  import type { NodeMaterialBuildState } from "../nodeMaterialBuildState";
3
- import type { NodeMaterialConnectionPoint } from "../nodeMaterialBlockConnectionPoint";
2
+ import { BaseMathBlock } from "./baseMathBlock";
4
3
  /**
5
4
  * Block used to add 2 vectors
6
5
  */
7
- export declare class AddBlock extends NodeMaterialBlock {
6
+ export declare class AddBlock extends BaseMathBlock {
8
7
  /**
9
8
  * Creates a new AddBlock
10
9
  * @param name defines the block name
@@ -15,17 +14,5 @@ export declare class AddBlock extends NodeMaterialBlock {
15
14
  * @returns the class name
16
15
  */
17
16
  getClassName(): string;
18
- /**
19
- * Gets the left operand input component
20
- */
21
- get left(): NodeMaterialConnectionPoint;
22
- /**
23
- * Gets the right operand input component
24
- */
25
- get right(): NodeMaterialConnectionPoint;
26
- /**
27
- * Gets the output component
28
- */
29
- get output(): NodeMaterialConnectionPoint;
30
17
  protected _buildBlock(state: NodeMaterialBuildState): this;
31
18
  }
@@ -1,24 +1,15 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock.js";
2
- import { NodeMaterialBlockConnectionPointTypes } from "../Enums/nodeMaterialBlockConnectionPointTypes.js";
3
- import { NodeMaterialBlockTargets } from "../Enums/nodeMaterialBlockTargets.js";
4
1
  import { RegisterClass } from "../../../Misc/typeStore.js";
2
+ import { BaseMathBlock } from "./baseMathBlock.js";
5
3
  /**
6
4
  * Block used to add 2 vectors
7
5
  */
8
- export class AddBlock extends NodeMaterialBlock {
6
+ export class AddBlock extends BaseMathBlock {
9
7
  /**
10
8
  * Creates a new AddBlock
11
9
  * @param name defines the block name
12
10
  */
13
11
  constructor(name) {
14
- super(name, NodeMaterialBlockTargets.Neutral);
15
- this.registerInput("left", NodeMaterialBlockConnectionPointTypes.AutoDetect);
16
- this.registerInput("right", NodeMaterialBlockConnectionPointTypes.AutoDetect);
17
- this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.BasedOnInput);
18
- this._outputs[0]._typeConnectionSource = this._inputs[0];
19
- this._linkConnectionTypes(0, 1, true);
20
- this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
21
- this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
12
+ super(name);
22
13
  }
23
14
  /**
24
15
  * Gets the current class name
@@ -27,28 +18,9 @@ export class AddBlock extends NodeMaterialBlock {
27
18
  getClassName() {
28
19
  return "AddBlock";
29
20
  }
30
- /**
31
- * Gets the left operand input component
32
- */
33
- get left() {
34
- return this._inputs[0];
35
- }
36
- /**
37
- * Gets the right operand input component
38
- */
39
- get right() {
40
- return this._inputs[1];
41
- }
42
- /**
43
- * Gets the output component
44
- */
45
- get output() {
46
- return this._outputs[0];
47
- }
48
21
  _buildBlock(state) {
49
22
  super._buildBlock(state);
50
- const output = this._outputs[0];
51
- state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} + ${this.right.associatedVariableName};\n`;
23
+ state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} + ${this.right.associatedVariableName};\n`;
52
24
  return this;
53
25
  }
54
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"addBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/addBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IAC3C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,KAAK,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,KAAK,CAAC,CAAC;IACnG,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEhC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAEnJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Block used to add 2 vectors\r\n */\r\nexport class AddBlock extends NodeMaterialBlock {\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"left\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1, true);\r\n\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"AddBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n\r\n state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} + ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AddBlock\", AddBlock);\r\n"]}
1
+ {"version":3,"file":"addBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/addBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,aAAa;IACvC;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAExJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { BaseMathBlock } from \"./baseMathBlock\";\r\n\r\n/**\r\n * Block used to add 2 vectors\r\n */\r\nexport class AddBlock extends BaseMathBlock {\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"AddBlock\";\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} + ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AddBlock\", AddBlock);\r\n"]}
@@ -0,0 +1,26 @@
1
+ import { NodeMaterialBlock } from "../nodeMaterialBlock";
2
+ import type { NodeMaterialConnectionPoint } from "../nodeMaterialBlockConnectionPoint";
3
+ /**
4
+ * Block used to perform a mathematical operation on 2 values
5
+ */
6
+ export declare class BaseMathBlock extends NodeMaterialBlock {
7
+ private readonly _connectionObservers;
8
+ protected constructor(name: string);
9
+ /**
10
+ * Gets the left operand input component
11
+ */
12
+ get left(): NodeMaterialConnectionPoint;
13
+ /**
14
+ * Gets the right operand input component
15
+ */
16
+ get right(): NodeMaterialConnectionPoint;
17
+ /**
18
+ * Gets the output component
19
+ */
20
+ get output(): NodeMaterialConnectionPoint;
21
+ private _updateInputOutputTypes;
22
+ /**
23
+ * Release resources
24
+ */
25
+ dispose(): void;
26
+ }
@@ -0,0 +1,84 @@
1
+ import { NodeMaterialBlockTargets } from "../Enums/nodeMaterialBlockTargets.js";
2
+ import { NodeMaterialBlock } from "../nodeMaterialBlock.js";
3
+ import { NodeMaterialBlockConnectionPointTypes } from "../Enums/nodeMaterialBlockConnectionPointTypes.js";
4
+ /**
5
+ * Block used to perform a mathematical operation on 2 values
6
+ */
7
+ export class BaseMathBlock extends NodeMaterialBlock {
8
+ constructor(name) {
9
+ super(name, NodeMaterialBlockTargets.Neutral);
10
+ this.registerInput("left", NodeMaterialBlockConnectionPointTypes.AutoDetect);
11
+ this.registerInput("right", NodeMaterialBlockConnectionPointTypes.AutoDetect);
12
+ this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.BasedOnInput);
13
+ this.output._typeConnectionSource = this.left;
14
+ this._linkConnectionTypes(0, 1, true);
15
+ this.left.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
16
+ this.right.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
17
+ this._connectionObservers = [
18
+ this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
19
+ this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
20
+ this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),
21
+ this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
22
+ ];
23
+ }
24
+ /**
25
+ * Gets the left operand input component
26
+ */
27
+ get left() {
28
+ return this._inputs[0];
29
+ }
30
+ /**
31
+ * Gets the right operand input component
32
+ */
33
+ get right() {
34
+ return this._inputs[1];
35
+ }
36
+ /**
37
+ * Gets the output component
38
+ */
39
+ get output() {
40
+ return this._outputs[0];
41
+ }
42
+ _updateInputOutputTypes() {
43
+ // First update the output type with the initial assumption that we'll base it on the left input.
44
+ this.output._typeConnectionSource = this.left;
45
+ if (this.left.isConnected && this.right.isConnected) {
46
+ // Both inputs are connected, so we need to determine the output type based on the input types.
47
+ if (this.left.type === NodeMaterialBlockConnectionPointTypes.Int ||
48
+ (this.left.type === NodeMaterialBlockConnectionPointTypes.Float && this.right.type !== NodeMaterialBlockConnectionPointTypes.Int)) {
49
+ this.output._typeConnectionSource = this.right;
50
+ }
51
+ }
52
+ else if (this.left.isConnected !== this.right.isConnected) {
53
+ // Only one input is connected, so we need to determine the output type based on the connected input.
54
+ this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;
55
+ }
56
+ // Next update the accepted connection point types for the inputs based on the current input connection state.
57
+ if (this.left.isConnected || this.right.isConnected) {
58
+ for (const [first, second] of [
59
+ [this.left, this.right],
60
+ [this.right, this.left],
61
+ ]) {
62
+ // Always allow Ints and Floats.
63
+ first.acceptedConnectionPointTypes = [NodeMaterialBlockConnectionPointTypes.Int, NodeMaterialBlockConnectionPointTypes.Float];
64
+ if (second.isConnected) {
65
+ // The same types as the connected input are always allowed.
66
+ first.acceptedConnectionPointTypes.push(second.type);
67
+ // If the other input is a scalar, then we also allow Vector/Color/Matrix types.
68
+ if (second.type === NodeMaterialBlockConnectionPointTypes.Int || second.type === NodeMaterialBlockConnectionPointTypes.Float) {
69
+ first.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector2, NodeMaterialBlockConnectionPointTypes.Vector3, NodeMaterialBlockConnectionPointTypes.Vector4, NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockConnectionPointTypes.Matrix);
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ /**
76
+ * Release resources
77
+ */
78
+ dispose() {
79
+ super.dispose();
80
+ this._connectionObservers.forEach((observer) => observer.remove());
81
+ this._connectionObservers.length = 0;
82
+ }
83
+ }
84
+ //# sourceMappingURL=baseMathBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/baseMathBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAGhD,YAAsB,IAAY;QAC9B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,MAAM,CAAC,qBAAqB,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9C,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,IAAI,CAAC,4BAA4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CAAqC,CAAC,MAAM,EAC5C,qCAAqC,CAAC,MAAM,EAC5C,qCAAqC,CAAC,MAAM,CAC/C,CAAC;qBACL;iBACJ;aACJ;SACJ;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets\";\r\nimport { NodeMaterialBlock } from \"../nodeMaterialBlock\";\r\nimport type { NodeMaterialConnectionPoint } from \"../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Block used to perform a mathematical operation on 2 values\r\n */\r\nexport class BaseMathBlock extends NodeMaterialBlock {\r\n private readonly _connectionObservers: Observer<NodeMaterialConnectionPoint>[];\r\n\r\n protected constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"left\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n this._linkConnectionTypes(0, 1, true);\r\n\r\n this.left.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n this.right.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n if (this.left.isConnected && this.right.isConnected) {\r\n // Both inputs are connected, so we need to determine the output type based on the input types.\r\n if (\r\n this.left.type === NodeMaterialBlockConnectionPointTypes.Int ||\r\n (this.left.type === NodeMaterialBlockConnectionPointTypes.Float && this.right.type !== NodeMaterialBlockConnectionPointTypes.Int)\r\n ) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n } else if (this.left.isConnected !== this.right.isConnected) {\r\n // Only one input is connected, so we need to determine the output type based on the connected input.\r\n this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;\r\n }\r\n\r\n // Next update the accepted connection point types for the inputs based on the current input connection state.\r\n if (this.left.isConnected || this.right.isConnected) {\r\n for (const [first, second] of [\r\n [this.left, this.right],\r\n [this.right, this.left],\r\n ]) {\r\n // Always allow Ints and Floats.\r\n first.acceptedConnectionPointTypes = [NodeMaterialBlockConnectionPointTypes.Int, NodeMaterialBlockConnectionPointTypes.Float];\r\n\r\n if (second.isConnected) {\r\n // The same types as the connected input are always allowed.\r\n first.acceptedConnectionPointTypes.push(second.type);\r\n\r\n // If the other input is a scalar, then we also allow Vector/Color/Matrix types.\r\n if (second.type === NodeMaterialBlockConnectionPointTypes.Int || second.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n first.acceptedConnectionPointTypes.push(\r\n NodeMaterialBlockConnectionPointTypes.Vector2,\r\n NodeMaterialBlockConnectionPointTypes.Vector3,\r\n NodeMaterialBlockConnectionPointTypes.Vector4,\r\n NodeMaterialBlockConnectionPointTypes.Color3,\r\n NodeMaterialBlockConnectionPointTypes.Color4,\r\n NodeMaterialBlockConnectionPointTypes.Matrix\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose(): void {\r\n super.dispose();\r\n this._connectionObservers.forEach((observer) => observer.remove());\r\n this._connectionObservers.length = 0;\r\n }\r\n}\r\n"]}
@@ -1,10 +1,9 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock";
2
1
  import type { NodeMaterialBuildState } from "../nodeMaterialBuildState";
3
- import type { NodeMaterialConnectionPoint } from "../nodeMaterialBlockConnectionPoint";
2
+ import { BaseMathBlock } from "./baseMathBlock";
4
3
  /**
5
4
  * Block used to divide 2 vectors
6
5
  */
7
- export declare class DivideBlock extends NodeMaterialBlock {
6
+ export declare class DivideBlock extends BaseMathBlock {
8
7
  /**
9
8
  * Creates a new DivideBlock
10
9
  * @param name defines the block name
@@ -15,17 +14,5 @@ export declare class DivideBlock extends NodeMaterialBlock {
15
14
  * @returns the class name
16
15
  */
17
16
  getClassName(): string;
18
- /**
19
- * Gets the left operand input component
20
- */
21
- get left(): NodeMaterialConnectionPoint;
22
- /**
23
- * Gets the right operand input component
24
- */
25
- get right(): NodeMaterialConnectionPoint;
26
- /**
27
- * Gets the output component
28
- */
29
- get output(): NodeMaterialConnectionPoint;
30
17
  protected _buildBlock(state: NodeMaterialBuildState): this;
31
18
  }
@@ -1,24 +1,15 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock.js";
2
- import { NodeMaterialBlockConnectionPointTypes } from "../Enums/nodeMaterialBlockConnectionPointTypes.js";
3
- import { NodeMaterialBlockTargets } from "../Enums/nodeMaterialBlockTargets.js";
4
1
  import { RegisterClass } from "../../../Misc/typeStore.js";
2
+ import { BaseMathBlock } from "./baseMathBlock.js";
5
3
  /**
6
4
  * Block used to divide 2 vectors
7
5
  */
8
- export class DivideBlock extends NodeMaterialBlock {
6
+ export class DivideBlock extends BaseMathBlock {
9
7
  /**
10
8
  * Creates a new DivideBlock
11
9
  * @param name defines the block name
12
10
  */
13
11
  constructor(name) {
14
- super(name, NodeMaterialBlockTargets.Neutral);
15
- this.registerInput("left", NodeMaterialBlockConnectionPointTypes.AutoDetect);
16
- this.registerInput("right", NodeMaterialBlockConnectionPointTypes.AutoDetect);
17
- this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.BasedOnInput);
18
- this._outputs[0]._typeConnectionSource = this._inputs[0];
19
- this._linkConnectionTypes(0, 1, true);
20
- this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
21
- this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
12
+ super(name);
22
13
  }
23
14
  /**
24
15
  * Gets the current class name
@@ -27,28 +18,9 @@ export class DivideBlock extends NodeMaterialBlock {
27
18
  getClassName() {
28
19
  return "DivideBlock";
29
20
  }
30
- /**
31
- * Gets the left operand input component
32
- */
33
- get left() {
34
- return this._inputs[0];
35
- }
36
- /**
37
- * Gets the right operand input component
38
- */
39
- get right() {
40
- return this._inputs[1];
41
- }
42
- /**
43
- * Gets the output component
44
- */
45
- get output() {
46
- return this._outputs[0];
47
- }
48
21
  _buildBlock(state) {
49
22
  super._buildBlock(state);
50
- const output = this._outputs[0];
51
- state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} / ${this.right.associatedVariableName};\n`;
23
+ state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} / ${this.right.associatedVariableName};\n`;
52
24
  return this;
53
25
  }
54
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"divideBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/divideBlock.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AC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEhC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAEnJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Block used to divide 2 vectors\r\n */\r\nexport class DivideBlock extends NodeMaterialBlock {\r\n /**\r\n * Creates a new DivideBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"left\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1, true);\r\n\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"DivideBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n\r\n state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} / ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DivideBlock\", DivideBlock);\r\n"]}
1
+ {"version":3,"file":"divideBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/divideBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,aAAa;IAC1C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,aAAa,CAAC;IACzB,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAExJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { BaseMathBlock } from \"./baseMathBlock\";\r\n\r\n/**\r\n * Block used to divide 2 vectors\r\n */\r\nexport class DivideBlock extends BaseMathBlock {\r\n /**\r\n * Creates a new DivideBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"DivideBlock\";\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} / ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DivideBlock\", DivideBlock);\r\n"]}
@@ -1,10 +1,9 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock";
2
1
  import type { NodeMaterialBuildState } from "../nodeMaterialBuildState";
3
- import type { NodeMaterialConnectionPoint } from "../nodeMaterialBlockConnectionPoint";
2
+ import { BaseMathBlock } from "./baseMathBlock";
4
3
  /**
5
4
  * Block used to multiply 2 values
6
5
  */
7
- export declare class MultiplyBlock extends NodeMaterialBlock {
6
+ export declare class MultiplyBlock extends BaseMathBlock {
8
7
  /**
9
8
  * Creates a new MultiplyBlock
10
9
  * @param name defines the block name
@@ -15,17 +14,5 @@ export declare class MultiplyBlock extends NodeMaterialBlock {
15
14
  * @returns the class name
16
15
  */
17
16
  getClassName(): string;
18
- /**
19
- * Gets the left operand input component
20
- */
21
- get left(): NodeMaterialConnectionPoint;
22
- /**
23
- * Gets the right operand input component
24
- */
25
- get right(): NodeMaterialConnectionPoint;
26
- /**
27
- * Gets the output component
28
- */
29
- get output(): NodeMaterialConnectionPoint;
30
17
  protected _buildBlock(state: NodeMaterialBuildState): this;
31
18
  }
@@ -1,24 +1,15 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock.js";
2
- import { NodeMaterialBlockConnectionPointTypes } from "../Enums/nodeMaterialBlockConnectionPointTypes.js";
3
- import { NodeMaterialBlockTargets } from "../Enums/nodeMaterialBlockTargets.js";
4
1
  import { RegisterClass } from "../../../Misc/typeStore.js";
2
+ import { BaseMathBlock } from "./baseMathBlock.js";
5
3
  /**
6
4
  * Block used to multiply 2 values
7
5
  */
8
- export class MultiplyBlock extends NodeMaterialBlock {
6
+ export class MultiplyBlock extends BaseMathBlock {
9
7
  /**
10
8
  * Creates a new MultiplyBlock
11
9
  * @param name defines the block name
12
10
  */
13
11
  constructor(name) {
14
- super(name, NodeMaterialBlockTargets.Neutral);
15
- this.registerInput("left", NodeMaterialBlockConnectionPointTypes.AutoDetect);
16
- this.registerInput("right", NodeMaterialBlockConnectionPointTypes.AutoDetect);
17
- this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.BasedOnInput);
18
- this._outputs[0]._typeConnectionSource = this._inputs[0];
19
- this._linkConnectionTypes(0, 1, true);
20
- this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
21
- this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
12
+ super(name);
22
13
  }
23
14
  /**
24
15
  * Gets the current class name
@@ -27,28 +18,9 @@ export class MultiplyBlock extends NodeMaterialBlock {
27
18
  getClassName() {
28
19
  return "MultiplyBlock";
29
20
  }
30
- /**
31
- * Gets the left operand input component
32
- */
33
- get left() {
34
- return this._inputs[0];
35
- }
36
- /**
37
- * Gets the right operand input component
38
- */
39
- get right() {
40
- return this._inputs[1];
41
- }
42
- /**
43
- * Gets the output component
44
- */
45
- get output() {
46
- return this._outputs[0];
47
- }
48
21
  _buildBlock(state) {
49
22
  super._buildBlock(state);
50
- const output = this._outputs[0];
51
- state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} * ${this.right.associatedVariableName};\n`;
23
+ state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} * ${this.right.associatedVariableName};\n`;
52
24
  return this;
53
25
  }
54
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multiplyBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/multiplyBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,KAAK,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,KAAK,CAAC,CAAC;IACnG,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEhC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAEnJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Block used to multiply 2 values\r\n */\r\nexport class MultiplyBlock extends NodeMaterialBlock {\r\n /**\r\n * Creates a new MultiplyBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"left\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1, true);\r\n\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"MultiplyBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n\r\n state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} * ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MultiplyBlock\", MultiplyBlock);\r\n"]}
1
+ {"version":3,"file":"multiplyBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/multiplyBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC5C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,eAAe,CAAC;IAC3B,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAExJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { BaseMathBlock } from \"./baseMathBlock\";\r\n\r\n/**\r\n * Block used to multiply 2 values\r\n */\r\nexport class MultiplyBlock extends BaseMathBlock {\r\n /**\r\n * Creates a new MultiplyBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"MultiplyBlock\";\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} * ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MultiplyBlock\", MultiplyBlock);\r\n"]}
@@ -1,10 +1,9 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock";
2
1
  import type { NodeMaterialBuildState } from "../nodeMaterialBuildState";
3
- import type { NodeMaterialConnectionPoint } from "../nodeMaterialBlockConnectionPoint";
2
+ import { BaseMathBlock } from "./baseMathBlock";
4
3
  /**
5
4
  * Block used to subtract 2 vectors
6
5
  */
7
- export declare class SubtractBlock extends NodeMaterialBlock {
6
+ export declare class SubtractBlock extends BaseMathBlock {
8
7
  /**
9
8
  * Creates a new SubtractBlock
10
9
  * @param name defines the block name
@@ -15,17 +14,5 @@ export declare class SubtractBlock extends NodeMaterialBlock {
15
14
  * @returns the class name
16
15
  */
17
16
  getClassName(): string;
18
- /**
19
- * Gets the left operand input component
20
- */
21
- get left(): NodeMaterialConnectionPoint;
22
- /**
23
- * Gets the right operand input component
24
- */
25
- get right(): NodeMaterialConnectionPoint;
26
- /**
27
- * Gets the output component
28
- */
29
- get output(): NodeMaterialConnectionPoint;
30
17
  protected _buildBlock(state: NodeMaterialBuildState): this;
31
18
  }
@@ -1,24 +1,15 @@
1
- import { NodeMaterialBlock } from "../nodeMaterialBlock.js";
2
- import { NodeMaterialBlockConnectionPointTypes } from "../Enums/nodeMaterialBlockConnectionPointTypes.js";
3
- import { NodeMaterialBlockTargets } from "../Enums/nodeMaterialBlockTargets.js";
4
1
  import { RegisterClass } from "../../../Misc/typeStore.js";
2
+ import { BaseMathBlock } from "./baseMathBlock.js";
5
3
  /**
6
4
  * Block used to subtract 2 vectors
7
5
  */
8
- export class SubtractBlock extends NodeMaterialBlock {
6
+ export class SubtractBlock extends BaseMathBlock {
9
7
  /**
10
8
  * Creates a new SubtractBlock
11
9
  * @param name defines the block name
12
10
  */
13
11
  constructor(name) {
14
- super(name, NodeMaterialBlockTargets.Neutral);
15
- this.registerInput("left", NodeMaterialBlockConnectionPointTypes.AutoDetect);
16
- this.registerInput("right", NodeMaterialBlockConnectionPointTypes.AutoDetect);
17
- this.registerOutput("output", NodeMaterialBlockConnectionPointTypes.BasedOnInput);
18
- this._outputs[0]._typeConnectionSource = this._inputs[0];
19
- this._linkConnectionTypes(0, 1, true);
20
- this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
21
- this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
12
+ super(name);
22
13
  }
23
14
  /**
24
15
  * Gets the current class name
@@ -27,28 +18,9 @@ export class SubtractBlock extends NodeMaterialBlock {
27
18
  getClassName() {
28
19
  return "SubtractBlock";
29
20
  }
30
- /**
31
- * Gets the left operand input component
32
- */
33
- get left() {
34
- return this._inputs[0];
35
- }
36
- /**
37
- * Gets the right operand input component
38
- */
39
- get right() {
40
- return this._inputs[1];
41
- }
42
- /**
43
- * Gets the output component
44
- */
45
- get output() {
46
- return this._outputs[0];
47
- }
48
21
  _buildBlock(state) {
49
22
  super._buildBlock(state);
50
- const output = this._outputs[0];
51
- state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} - ${this.right.associatedVariableName};\n`;
23
+ state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} - ${this.right.associatedVariableName};\n`;
52
24
  return this;
53
25
  }
54
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"subtractBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/subtractBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,C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CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAEnJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\n/**\r\n * Block used to subtract 2 vectors\r\n */\r\nexport class SubtractBlock extends NodeMaterialBlock {\r\n /**\r\n * Creates a new SubtractBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"left\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1, true);\r\n\r\n this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n this._inputs[1].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"SubtractBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n\r\n state.compilationString += this._declareOutput(output, state) + ` = ${this.left.associatedVariableName} - ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SubtractBlock\", SubtractBlock);\r\n"]}
1
+ {"version":3,"file":"subtractBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Node/Blocks/subtractBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC5C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,eAAe,CAAC;IAC3B,CAAC;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC;QAExJ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import type { NodeMaterialBuildState } from \"../nodeMaterialBuildState\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { BaseMathBlock } from \"./baseMathBlock\";\r\n\r\n/**\r\n * Block used to subtract 2 vectors\r\n */\r\nexport class SubtractBlock extends BaseMathBlock {\r\n /**\r\n * Creates a new SubtractBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"SubtractBlock\";\r\n }\r\n\r\n protected _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n state.compilationString += this._declareOutput(this.output, state) + ` = ${this.left.associatedVariableName} - ${this.right.associatedVariableName};\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SubtractBlock\", SubtractBlock);\r\n"]}
@@ -71,6 +71,10 @@ export declare class NodeMaterialConnectionPoint {
71
71
  * Observable triggered when this point is connected
72
72
  */
73
73
  onConnectionObservable: Observable<NodeMaterialConnectionPoint>;
74
+ /**
75
+ * Observable triggered when this point is disconnected
76
+ */
77
+ onDisconnectionObservable: Observable<NodeMaterialConnectionPoint>;
74
78
  /**
75
79
  * Gets or sets the associated variable name in the shader
76
80
  */
@@ -291,6 +291,10 @@ export class NodeMaterialConnectionPoint {
291
291
  * Observable triggered when this point is connected
292
292
  */
293
293
  this.onConnectionObservable = new Observable();
294
+ /**
295
+ * Observable triggered when this point is disconnected
296
+ */
297
+ this.onDisconnectionObservable = new Observable();
294
298
  /**
295
299
  * Gets or sets a boolean indicating that this connection point is exposed on a frame
296
300
  */
@@ -402,6 +406,8 @@ export class NodeMaterialConnectionPoint {
402
406
  endpoint._connectedPoint = null;
403
407
  this._enforceAssociatedVariableName = false;
404
408
  endpoint._enforceAssociatedVariableName = false;
409
+ this.onDisconnectionObservable.notifyObservers(endpoint);
410
+ endpoint.onDisconnectionObservable.notifyObservers(this);
405
411
  return this;
406
412
  }
407
413
  /**
@@ -444,6 +450,7 @@ export class NodeMaterialConnectionPoint {
444
450
  */
445
451
  dispose() {
446
452
  this.onConnectionObservable.clear();
453
+ this.onDisconnectionObservable.clear();
447
454
  }
448
455
  }
449
456
  //# sourceMappingURL=nodeMaterialBlockConnectionPoint.js.map