{"size": 895, "ext": "js", "max_stars_repo_path": "material/nodes/math/Saturate.js", "max_stars_repo_name": "projection-engine/pj-visual-prototype", "max_stars_repo_stars_event_min_datetime": "2021-12-31T14:21:08.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-31T14:21:08.000Z", "max_issues_repo_path": "material/nodes/math/Saturate.js", "max_issues_repo_name": "projection-engine/pj-visual-prototype", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "material/nodes/math/Saturate.js", "max_forks_repo_name": "projection-engine/pj-visual-prototype", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.5526315789, "max_line_length": 74, "alphanum_fraction": 0.5340782123}
import Node from '../../../components/Node'
import {DATA_TYPES} from "../../../../../engine/templates/DATA_TYPES";
import NODE_TYPES from "../../../components/NODE_TYPES";


export default class Saturate extends Node {
    constructor() {
        super([
            {label: 'In', key: 'a', accept: [DATA_TYPES.FLOAT]}
        ], [
            {label: 'Result', key: 'saturateRes', type: DATA_TYPES.FLOAT}
        ]);
        this.name = 'Saturate'
        this.size = 2
    }

    get type() {
        return NODE_TYPES.FUNCTION
    }


     getFunctionInstance() {
        return ''
    }

    async  getInputInstance(index) {
        return ''
    }

    getFunctionCall({a}, index) {
        this.saturateRes = 'saturateRes' + index
        if(a)
            return `float ${this.saturateRes} = clamp(${a.name}, 0., 1.);`
        else
            return `float ${this.saturateRes};`
    }

}