// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage


surface
glossy
    [[ string description = "Glossy material" ]]
(
    color Cr = 1.0
        [[  string description = "Reflectance tint",
            float UImin = 0, float UImax = 1 ]],
    color Ct = 0.0
        [[  string description = "Transmission tint",
            float UImin = 0, float UImax = 1 ]],
    float ior = 1.5
        [[  string description = "Index of refraction",
            float UImin = 1.0, float UImax = 3.0 ]],
    float roughness = 0.5
        [[  string description = "Roughness of the surface",
            float UImin = 0, float UImax = 1 ]],
    float anisotropy = 0.0
        [[  string description = "Anisotropy of the surface",
            float UImin = 0, float UImax = 1 ]]
  )
{
    float alpha = roughness * roughness;
    float alpha_x = alpha * (1.0 - anisotropy);
    float alpha_y = alpha;
    vector U = normalize(cross(N, dPdv));
    Ci = dielectric_bsdf(N, U, Cr, Ct, alpha_x, alpha_y, ior, "ggx");
}
