{"size": 3749, "ext": "js", "max_stars_repo_path": "node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js", "max_stars_repo_name": "Servletparty/pbi-hexagrid", "max_stars_repo_stars_event_min_datetime": "2021-10-20T15:18:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T09:49:03.000Z", "max_issues_repo_path": "node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js", "max_issues_repo_name": "Servletparty/pbi-hexagrid", "max_issues_repo_issues_event_min_datetime": "2021-06-19T18:20:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-04T13:49:32.000Z", "max_forks_repo_path": "node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js", "max_forks_repo_name": "Servletparty/pbi-hexagrid", "max_forks_repo_forks_event_min_datetime": "2021-08-13T08:35:19.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-13T08:35:19.000Z"}
{"max_stars_count": 2, "max_issues_count": 3, "max_forks_count": 1, "avg_line_length": 39.4631578947, "max_line_length": 194, "alphanum_fraction": 0.6132301947}
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 output the final color
 */
var FragmentOutputBlock = /** @class */ (function (_super) {
    __extends(FragmentOutputBlock, _super);
    /**
     * Create a new FragmentOutputBlock
     * @param name defines the block name
     */
    function FragmentOutputBlock(name) {
        var _this = _super.call(this, name, NodeMaterialBlockTargets.Fragment, true) || this;
        _this.registerInput("rgba", NodeMaterialBlockConnectionPointTypes.Color4, true);
        _this.registerInput("rgb", NodeMaterialBlockConnectionPointTypes.Color3, true);
        _this.registerInput("a", NodeMaterialBlockConnectionPointTypes.Float, true);
        _this.rgb.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);
        return _this;
    }
    /**
     * Gets the current class name
     * @returns the class name
     */
    FragmentOutputBlock.prototype.getClassName = function () {
        return "FragmentOutputBlock";
    };
    Object.defineProperty(FragmentOutputBlock.prototype, "rgba", {
        /**
         * Gets the rgba input component
         */
        get: function () {
            return this._inputs[0];
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FragmentOutputBlock.prototype, "rgb", {
        /**
         * Gets the rgb input component
         */
        get: function () {
            return this._inputs[1];
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FragmentOutputBlock.prototype, "a", {
        /**
         * Gets the a input component
         */
        get: function () {
            return this._inputs[2];
        },
        enumerable: false,
        configurable: true
    });
    FragmentOutputBlock.prototype._buildBlock = function (state) {
        _super.prototype._buildBlock.call(this, state);
        var rgba = this.rgba;
        var rgb = this.rgb;
        var a = this.a;
        state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;
        if (rgba.connectedPoint) {
            if (a.isConnected) {
                state.compilationString += "gl_FragColor = vec4(" + rgba.associatedVariableName + ".rgb, " + a.associatedVariableName + ");\r\n";
            }
            else {
                state.compilationString += "gl_FragColor = " + rgba.associatedVariableName + ";\r\n";
            }
        }
        else if (rgb.connectedPoint) {
            var aValue = "1.0";
            if (a.connectedPoint) {
                aValue = a.associatedVariableName;
            }
            if (rgb.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {
                state.compilationString += "gl_FragColor = vec4(" + rgb.associatedVariableName + ", " + rgb.associatedVariableName + ", " + rgb.associatedVariableName + ", " + aValue + ");\r\n";
            }
            else {
                state.compilationString += "gl_FragColor = vec4(" + rgb.associatedVariableName + ", " + aValue + ");\r\n";
            }
        }
        else {
            state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);
        }
        return this;
    };
    return FragmentOutputBlock;
}(NodeMaterialBlock));
export { FragmentOutputBlock };
_TypeStore.RegisteredTypes["BABYLON.FragmentOutputBlock"] = FragmentOutputBlock;
//# sourceMappingURL=fragmentOutputBlock.js.map