LYGIA Shader Library

new (lygia/lighting/ray/new)

creates a new Ray asigning origin and direction

Dependencies:

Use:

rayNew(inout <Ray> ray, [<vec3> origin, <vec3> direction])
<Ray> rayNew(<vec3> origin, [<vec3> direction])

Check it on Github



#ifndef FNC_RAYNEW
#define FNC_RAYNEW

void rayNew(inout Ray ray, vec3 origin, vec3 direction) {
    ray.origin = origin;
    ray.direction = direction;
}

void rayNew(inout Ray ray, vec3 origin) {
    rayNew(ray, origin, vec3(0.0, 0.0, 1.0));
}

void rayNew(inout Ray ray) {
    rayNew(ray, vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0));
}

Ray rayNew(vec3 origin, vec3 direction) {
    Ray ray;
    ray.origin = vec3(0.0, 0.0, 0.0);
    ray.direction = vec3(0.0, 0.0, 1.0);
    rayNew(ray, origin, direction);
    return ray;
}

Ray rayNew(vec3 origin) {
    Ray ray;
    ray.origin = vec3(0.0, 0.0, 0.0);
    ray.direction = vec3(0.0, 0.0, 1.0);
    rayNew(ray, origin);
    return ray;
}

Ray rayNew() {
    Ray ray;
    ray.origin = vec3(0.0, 0.0, 0.0);
    ray.direction = vec3(0.0, 0.0, 1.0);
    rayNew(ray);
    return ray;
}

#endif

License

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