LYGIA Shader Library

new (lygia/lighting/medium/new)

Medium Constructor.

Dependencies:

Use:

void mediumNew(out <medium> _mat)
<medium> mediumNew()

Check it on Github



#ifndef FNC_MEDIUM_NEW
#define FNC_MEDIUM_NEW

void mediumNew(out Medium _mat) {
    _mat.scattering   = vec3(1.0, 1.0, 1.0);
    _mat.absorption   = vec3(1.0, 1.0, 1.0);
    _mat.sdf     = RAYMARCH_MAX_DIST;

}

Medium mediumNew() {
    Medium mat;
    mediumNew(mat);
    return mat;
}

Medium mediumNew(vec3 scattering, vec3 absorption, float sdf) {
    Medium mat = mediumNew();
    mat.scattering = scattering;
    mat.absorption = absorption;
    mat.sdf = sdf;
    return mat;
}

Medium mediumNew(vec3 scattering, float sdf) {
    return mediumNew(scattering, vec3(0.0, 0.0, 0.0), sdf);
}

#endif

Dependencies:

Use:

void mediumNew(out <medium> _mat)
<medium> mediumNew()

Check it on Github



#ifndef FNC_MEDIUM_NEW
#define FNC_MEDIUM_NEW

void mediumNew(out Medium _mat) {
    _mat.scattering = float3(1.0, 1.0, 1.0);
    _mat.absorption = float3(1.0, 1.0, 1.0);
    _mat.sdf        = RAYMARCH_MAX_DIST;

}

Medium mediumNew() {
    Medium mat;
    mediumNew(mat);
    return mat;
}

Medium mediumNew(float3 scattering, float3 absorption, float sdf) {
    Medium mat = mediumNew();
    mat.scattering = scattering;
    mat.absorption = absorption;
    mat.sdf = sdf;
    return mat;
}

Medium mediumNew(float3 scattering, float sdf) {
    return mediumNew(scattering, float3(0.0, 0.0, 0.0), sdf);
}

#endif

License

MIT License (MIT) Copyright (c) 2024 Shadi EL Hajj

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository