Builtin constants
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)
- 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 initialize, update, and vertex shaders only)
- vec3 shadron_Mouse – the cumulative user mouse movement in pixels. The Z dimension is controlled with the scroll wheel
The camera view matrix has been replaced by the camera_view library.
The global macro SHADRON_VERSION holds the version of the Shadron runtime as an integer value (e.g. 140 for version 1.4.0), 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.