text: import { __extends } from "tslib";
  import { NodeMaterialBlock } from '../nodeMaterialBlock';
  import { NodeMaterialBlockConnectionPointTypes } from '../Enums/nodeMaterialBlockConnectionPointTypes';
  import { NodeMaterialBlockTargets } from '../Enums/nodeMaterialBlockTargets';
  import { _TypeStore } from '../../../Misc/typeStore';
  /**
   * Block used to create a Vector2/3/4 out of individual inputs (one for each component)
   */
  var VectorMergerBlock = /** @class */ (function (_super) {
      __extends(VectorMergerBlock, _super);
      /**
       * Create a new VectorMergerBlock
       * @param name defines the block name
       */
      function VectorMergerBlock(name) {
          var _this = _super.call(this, name, NodeMaterialBlockTargets.Neutral) || this;
          _this.registerInput("xyz ", NodeMaterialBlockConnectionPointTypes.Vector3, true);
          _this.registerInput("xy ", NodeMaterialBlockConnectionPointTypes.Vector2, true);
          _this.registerInput("x", NodeMaterialBlockConnectionPointTypes.Float, true);
          _this.registerInput("y", NodeMaterialBlockConnectionPointTypes.Float, true);
          _this.registerInput("z", NodeMaterialBlockConnectionPointTypes.Float, true);
          _this.registerInput("w", NodeMaterialBlockConnectionPointTypes.Float, true);
          _this.registerOutput("xyzw", NodeMaterialBlockConnectionPointTypes.Vector4);
          _this.registerOutput("xyz", NodeMaterialBlockConnectionPointTypes.Vector3);
          _this.registerOutput("xy", NodeMaterialBlockConnectionPointTypes.Vector2);
          return _this;
      }
      /**
       * Gets the current class name
       * @returns the class name
       */
      VectorMergerBlock.prototype.getClassName = function () {
          return "VectorMergerBlock";
      };
      Object.defineProperty(VectorMergerBlock.prototype, "xyzIn", {
          /**
           * Gets the xyz component (input)
           */
          get: function () {
              return this._inputs[0];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xyIn", {
          /**
           * Gets the xy component (input)
           */
          get: function () {
              return this._inputs[1];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "x", {
          /**
           * Gets the x component (input)
           */
          get: function () {
              return this._inputs[2];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "y", {
          /**
           * Gets the y component (input)
           */
          get: function () {
              return this._inputs[3];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "z", {
          /**
           * Gets the z component (input)
           */
          get: function () {
              return this._inputs[4];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "w", {
          /**
           * Gets the w component (input)
           */
          get: function () {
              return this._inputs[5];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xyzw", {
          /**
           * Gets the xyzw component (output)
           */
          get: function () {
              return this._outputs[0];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xyzOut", {
          /**
           * Gets the xyz component (output)
           */
          get: function () {
              return this._outputs[1];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xyOut", {
          /**
           * Gets the xy component (output)
           */
          get: function () {
              return this._outputs[2];
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xy", {
          /**
           * Gets the xy component (output)
           * @deprecated Please use xyOut instead.
           */
          get: function () {
              return this.xyOut;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(VectorMergerBlock.prototype, "xyz", {
          /**
           * Gets the xyz component (output)
           * @deprecated Please use xyzOut instead.
           */
          get: function () {
              return this.xyzOut;
          },
          enumerable: false,
          configurable: true
      });
      VectorMergerBlock.prototype._buildBlock = function (state) {
          _super.prototype._buildBlock.call(this, state);
          var xInput = this.x;
          var yInput = this.y;
          var zInput = this.z;
          var wInput = this.w;
          var xyInput = this.xyIn;
          var xyzInput = this.xyzIn;
          var v4Output = this._outputs[0];
          var v3Output = this._outputs[1];
          var v2Output = this._outputs[2];
          if (xyzInput.isConnected) {
              if (v4Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v4Output, state) + (" = vec4(" + xyzInput.associatedVariableName + ", " + (wInput.isConnected ? this._writeVariable(wInput) : "0.0") + ");\r\n");
              }
              else if (v3Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v3Output, state) + (" = " + xyzInput.associatedVariableName + ";\r\n");
              }
              else if (v2Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v2Output, state) + (" = " + xyzInput.associatedVariableName + ".xy;\r\n");
              }
          }
          else if (xyInput.isConnected) {
              if (v4Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v4Output, state) + (" = vec4(" + xyInput.associatedVariableName + ", " + (zInput.isConnected ? this._writeVariable(zInput) : "0.0") + ", " + (wInput.isConnected ? this._writeVariable(wInput) : "0.0") + ");\r\n");
              }
              else if (v3Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v3Output, state) + (" = vec3(" + xyInput.associatedVariableName + ", " + (zInput.isConnected ? this._writeVariable(zInput) : "0.0") + ");\r\n");
              }
              else if (v2Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v2Output, state) + (" = " + xyInput.associatedVariableName + ";\r\n");
              }
          }
          else {
              if (v4Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v4Output, state) + (" = vec4(" + (xInput.isConnected ? this._writeVariable(xInput) : "0.0") + ", " + (yInput.isConnected ? this._writeVariable(yInput) : "0.0") + ", " + (zInput.isConnected ? this._writeVariable(zInput) : "0.0") + ", " + (wInput.isConnected ? this._writeVariable(wInput) : "0.0") + ");\r\n");
              }
              else if (v3Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v3Output, state) + (" = vec3(" + (xInput.isConnected ? this._writeVariable(xInput) : "0.0") + ", " + (yInput.isConnected ? this._writeVariable(yInput) : "0.0") + ", " + (zInput.isConnected ? this._writeVariable(zInput) : "0.0") + ");\r\n");
              }
              else if (v2Output.hasEndpoints) {
                  state.compilationString += this._declareOutput(v2Output, state) + (" = vec2(" + (xInput.isConnected ? this._writeVariable(xInput) : "0.0") + ", " + (yInput.isConnected ? this._writeVariable(yInput) : "0.0") + ");\r\n");
              }
          }
          return this;
      };
      return VectorMergerBlock;
  }(NodeMaterialBlock));
  export { VectorMergerBlock };
  _TypeStore.RegisteredTypes["BABYLON.VectorMergerBlock"] = VectorMergerBlock;
  //# sourceMappingURL=vectorMergerBlock.js.map