The following constants are available globally in shader code. Some of them are only meaningful in a specific context, but they are always defined.
- ivec2 shadron_Dimensions – the frame dimensions (in pixels)
- vec2 shadron_PixelSize – the size of one pixel in the coordinate system of input position
- float shadron_Aspect – the frame aspect ratio (width / height)
- float shadron_Time – time from the start of the animation (in seconds)
- float shadron_DeltaTime – time elapsed between the last frame and the current frame (in seconds)
- vec3 shadron_Mouse – the cumulative user mouse movement in pixels. The Z dimension is controlled with the scroll wheel
- mat4 shadron_CameraView – the view matrix of a user camera that can be controlled with the arrow keys and mouse
- int shadron_SampleRate – the sample rate (sound shader only)
- int shadron_Step – index of the current step beginning from 0 (feedback and particle system update shader only)
- int shadron_ParticleID – index of the current particle (particle system only, not set in fragment shader)
The global macro SHADRON_VERSION holds the version of the Shadron runtime as an integer value (e.g. 114 for version 1.1.4), and can be used in conditional directives, in order to allow a script to support different versions of the program. However, the macro is undefined in versions prior to 1.1.2.
Depending on the platform you use, the global macro SHADRON_WINDOWS or SHADRON_MACOS will be defined as 1.