import { ClampToEdgeWrapping, RepeatWrapping } from "three";
import { clamp01 } from "../../../../../core/math/clamp01.js";

/**
 *
 * @param {number} clamping
 * @param {number} v
 * @return {number}
 */
export function apply_texture_clamping_to_coordinate(clamping, v) {

    switch (clamping) {
        case RepeatWrapping:
            return v % 1;
        case ClampToEdgeWrapping:
            return clamp01(v);
        default:
            // unsupported?
            return v;
    }

}
