rs2glsl
Automatically convert Rust code to GLSL for use in GPU programming.
Example
You can write Rust code like so
use *;
And it gets translated to the following GLSL code.
float smooth_min(float a, float b, float k) {
float h = a - b;
h = 0.5 + 0.5 * h;
if (h < 0.0) {
h = 0.0;
}
if (h > 1.0) {
h = 1.0;
}
return interpolation(a, b, h) - k * h * (1.0 - h);
}
You can access the examples GLSL definition like so:
GLSL_SMOOTH_MIN.definition
Have fun!