Blame stuff/library/shaders/programs/glitter_ports.vert
|
Toshihiro Shimizu |
890ddd |
#ifdef GL_ES
|
|
Toshihiro Shimizu |
890ddd |
precision mediump float;
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
uniform mat3 worldToOutput;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
uniform vec4 outputRect;
|
|
Toshihiro Shimizu |
890ddd |
varying vec4 inputRect[1];
|
|
Toshihiro Shimizu |
890ddd |
varying mat3 worldToInput[1];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
uniform float radius;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
float det(mat3 m) { return m[0][0] * m[1][1] - m[0][1] * m[1][0]; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void main( void )
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
float rad = radius * sqrt(abs(det(worldToOutput)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
worldToInput[0] = worldToOutput; // Let the input and output references
|
|
Toshihiro Shimizu |
890ddd |
// be the same
|
|
Toshihiro Shimizu |
890ddd |
inputRect[0] = vec4(
|
|
Toshihiro Shimizu |
890ddd |
outputRect.x - rad,
|
|
Toshihiro Shimizu |
890ddd |
outputRect.y - rad,
|
|
Toshihiro Shimizu |
890ddd |
outputRect.z + rad,
|
|
Toshihiro Shimizu |
890ddd |
outputRect.w + rad);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
gl_Position = vec4(0.0); // Does not link without
|
|
Toshihiro Shimizu |
890ddd |
}
|