oglc/shader/include/ray.glsl

40 lines
626 B
Plaintext
Raw Permalink Normal View History

2021-08-10 02:11:22 +02:00
struct Ray
{
vec3 origin;
vec3 direction;
vec3 energy;
2023-02-24 02:12:51 +01:00
float distance;
2021-08-10 02:11:22 +02:00
};
Ray createRay(vec3 origin, vec3 direction)
{
Ray ray;
ray.origin = origin;
ray.direction = direction;
ray.energy = vec3(1.0,1.0,1.0);
2023-02-24 02:12:51 +01:00
ray.distance = 0;
2021-08-10 02:11:22 +02:00
return ray;
}
struct RayHit
{
vec3 position;
float distance;
vec3 normal;
vec3 albedo;
2022-01-30 23:01:02 +01:00
int material;
2021-08-10 02:11:22 +02:00
};
RayHit createRayHit()
{
RayHit hit;
hit.position = vec3(0.0,0.0,0.0);
// TODO: this might not be defined
hit.distance = INF;
hit.normal = vec3(0.0,0.0,0.0);
hit.albedo = vec3(0.0,0.0,0.0);
return hit;
}