/usr/share/psychtoolbox-3/PsychOpenGL/PsychGLSLShaders/ICMMatrixMult4Shader.frag.txt is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /* ICMMatrixMult4Shader.frag.txt
*
* Multiplies first 3 components of a 4 component vec4 color vector with a
* defined 4x4 matrix and creates a 4 component output color vector, consisting
* of the original alpha component and the 3 rgb components from the matrix
* multiply. This adds a 4'th constant 1 component, multiplies the resulting
* 4 element vector with the 4x4 matrix, then divides the resulting 4 component
* vector by its 4th component, then truncates it back to a 3 component rgb vector.
*
* Can be used for projective color conversions, using the fourth component to allow
* adding or subtracting bias values.
*
* (C) 2012 Mario Kleiner - Released to you under MIT license.
*/
/* RGB to gray conversion weights for icmTransformColor1(): */
const vec3 ColorToGrayWeights = vec3(0.3, 0.59, 0.11);
/* 4 by 4 color transformation matrix: */
uniform mat4 M;
vec4 icmTransformColor(vec4 incolor)
{
vec4 outcolor, tmp;
/* Alpha is passed through unmodified: */
outcolor.a = incolor.a;
/* 1-extend, multiply, normalize: */
incolor.a = 1.0;
tmp = M * incolor;
tmp.rgb = tmp.rgb / tmp.a;
outcolor.rgb = tmp.rgb;
return(outcolor);
}
float icmTransformColor1(float incolor)
{
float outcolor;
vec4 tmp;
/* 1-extend, multiply, normalize: */
tmp = M * vec4(vec3(incolor), 1.0);
tmp.rgb = tmp.rgb / tmp.a;
outcolor = dot(tmp.rgb, ColorToGrayWeights);
return(outcolor);
}
|