black_hole/definitions.glsl

This file defines the types which are used in the main functions of our black hole model. A C++ equivalent of this file allows the same functions to be compiled by a C++ compiler (in order to unit test our preprocessing functions).

To increase the code readability we introduce different "types" for dimensionless quantities and for angles, as well as for the two precomputed textures of our model:

// The types used in the main functions of our black hole shader. C++ equivalent
// of these types are used to compile these functions with a C++ compiler, both
// to reuse them in order to precompute the textures they need, and for testing
// them.

// Angles and dimensionless quantities.
#define Angle float
#define Real float

// An angle and a time (in the 1st and 2nd components, respectively).
#define TimedAngle vec2

// An inverse distance and a time (in the 1st and 2nd components, respectively).
#define TimedInverseDistance vec2

// A 2D texture with TimedAngle values.
#define RayDeflectionTexture sampler2D

// A 2D texture with TimedInverseDistance values.
#define RayInverseRadiusTexture sampler2D