summaryrefslogtreecommitdiffstats
path: root/tests/language-server/private-ctor-call/lambert_diffuse_btdf.slang
blob: 82f766da4af3d24ddea389ca4d8c4e52d2fd14a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
implementing bsdfs;
public struct LambertDiffuseBTDF : IBSDF, IDifferentiable
{
    float3 albedo = {}; ///< Diffuse albedo.
#if 0
    public __init(float3 albedo_)
#else
    __init(float3 albedo_)
#endif
    {
        this.albedo = albedo_;
    }

    [Differentiable]
    public float3 eval(const float3 wi, const float3 wo, BSDFContext bc)
    {
        if (min(wi.z, -wo.z) < 1e-6f)
            return float3(0.f);

        return (1.0 / 3.1415) * albedo * -wo.z;
    }
}