<commit_before>// This file is distributed under the MIT license.
// See the LICENSE file for details.

namespace visionaray
{

//-------------------------------------------------------------------------------------------------
// Public interface
//

template <typename T>
VSNRAY_FUNC
inline spectrum<T> glass<T>::ambient() const
{
    return spectrum<T>(0.0); // TODO: no support for  ambient
}

template <typename T>
template <typename SR>
VSNRAY_FUNC
inline spectrum<typename SR::scalar_type> glass<T>::shade(SR const& sr) const
{
    return specular_bsdf_.f(sr.normal, sr.view_dir, sr.light_dir);
}

template <typename T>
template <typename SR, typename U, typename Interaction, typename Generator>
VSNRAY_FUNC
inline spectrum<U> glass<T>::sample(
        SR const&       sr,
        vector<3, U>&   refl_dir,
        U&              pdf,
        Interaction&    inter,
        Generator&      gen
        ) const
{
    auto f = specular_bsdf_.sample_f(sr.normal, sr.view_dir, refl_dir, pdf, inter, gen);
    // If ray originates in 2nd medium, flip normal
    auto n = select(
        U(dot(sr.normal, sr.view_dir)) > U(0.0),
        vector<3, U>(sr.normal),
        vector<3, U>(-sr.normal)
        );
    return f * (dot(n, refl_dir) / pdf);
}

template <typename T>
template <typename SR, typename Interaction>
VSNRAY_FUNC
inline typename SR::scalar_type glass<T>::pdf(SR const& sr, Interaction const& inter) const
{
    VSNRAY_UNUSED(inter);
    return specular_bsdf_.pdf(sr.normal, sr.view_dir, sr.light_dir);
}

template <typename T>
VSNRAY_FUNC
inline spectrum<T>& glass<T>::ct()
{
    return specular_bsdf_.ct;
}

template <typename T>
VSNRAY_FUNC
inline spectrum<T> const& glass<T>::ct() const
{
    return specular_bsdf_.ct;
}<commit_msg>Base visibility decisions on geomtric normal dir<commit_after>// This file is distributed under the MIT license.
// See the LICENSE file for details.

namespace visionaray
{

//-------------------------------------------------------------------------------------------------
// Public interface
//

template <typename T>
VSNRAY_FUNC
inline spectrum<T> glass<T>::ambient() const
{
    return spectrum<T>(0.0); // TODO: no support for  ambient
}

template <typename T>
template <typename SR>
VSNRAY_FUNC
inline spectrum<typename SR::scalar_type> glass<T>::shade(SR const& sr) const
{
    return specular_bsdf_.f(sr.normal, sr.view_dir, sr.light_dir);
}

template <typename T>
template <typename SR, typename U, typename Interaction, typename Generator>
VSNRAY_FUNC
inline spectrum<U> glass<T>::sample(
        SR const&       sr,
        vector<3, U>&   refl_dir,
        U&              pdf,
        Interaction&    inter,
        Generator&      gen
        ) const
{
    auto f = specular_bsdf_.sample_f(sr.normal, sr.view_dir, refl_dir, pdf, inter, gen);
    // If ray originates in 2nd medium, flip normal
    auto n = faceforward(sr.normal, sr.view_dir, sr.geometric_normal);
    return f * (dot(n, refl_dir) / pdf);
}

template <typename T>
template <typename SR, typename Interaction>
VSNRAY_FUNC
inline typename SR::scalar_type glass<T>::pdf(SR const& sr, Interaction const& inter) const
{
    VSNRAY_UNUSED(inter);
    return specular_bsdf_.pdf(sr.normal, sr.view_dir, sr.light_dir);
}

template <typename T>
VSNRAY_FUNC
inline spectrum<T>& glass<T>::ct()
{
    return specular_bsdf_.ct;
}

template <typename T>
VSNRAY_FUNC
inline spectrum<T> const& glass<T>::ct() const
{
    return specular_bsdf_.ct;
}
{'fraction_non_alphanumeric': 0.16815690798961638, 'fraction_numerical': 0.003461205653302567, 'mean_word_length': 2.8068057080131723, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1779188', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1091, 'n_words': 313}