/usr/share/psychtoolbox-3/PsychOpenGL/PsychGLSLShaders/BasicGaussBlobShader.vert.txt is in psychtoolbox-3-common 3.0.12.20160126.dfsg1-1ubuntu1.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /*
* File: BasicGaussBlobShader.vert.txt
* Shader for drawing of basic parameterized gaussian blob patches.
*
* This is the vertex shader. It takes the attributes (parameters)
* provided by the Screen('DrawTexture(s)') command, performs some
* basic calculations on it - the calculations that only need to be
* done once per gauss blob patch and that can be reliably carried out
* at sufficient numeric precision in a vertex shader - then it passes
* results of computations and other attributes as 'varying' parameters
* to the fragment shader.
*
* (c) 2014 by Mario Kleiner, licensed under MIT license.
*/
/* Constants that we need: square-root of 2*pi: */
const float sqrtof2pi = 2.5066282746;
/* Conversion factor from degrees to radians: */
const float deg2rad = 3.141592654 / 180.0;
/* Texel position of center of blob patch: Constant, set */
/* once when the shader is created: */
uniform vec2 Center;
/* If disableNorm is set to 1.0, then the normalization term below is */
/* not applied to the blobs final values. Default is 0.0, ie. apply it. */
uniform float disableNorm;
/* Constant from setup code: Premultiply to contrast value: */
uniform float contrastPreMultiplicator;
/* Attributes passed from Screen(): See the ProceduralShadingAPI.m file for infos: */
attribute vec4 sizeAngleFilterMode;
attribute vec4 modulateColor;
attribute vec4 auxParameters0;
/* Information passed to the fragment shader: Attributes and precalculated per patch constants: */
varying vec4 baseColor;
varying float Expmultiplier;
varying float Angle;
varying float GammaSquared;
void main()
{
/* Apply standard geometric transformations to patch: */
gl_Position = ftransform();
/* Don't pass real texture coordinates, but ones corrected for hardware offsets (-0.5,0.5) */
/* and so that the center of the gabor patch has coordinate (0,0): */
gl_TexCoord[0] = gl_MultiTexCoord0 - vec4(Center, 0.0, 0.0) + vec4(-0.5, 0.5, 0.0, 0.0);
/* Contrast value is stored in auxParameters0[0]: */
float Contrast = auxParameters0[0];
/* Convert Angle from degrees to radians: */
Angle = deg2rad * sizeAngleFilterMode.z;
/* Precalc a couple of per-patch constant parameters: */
float SpaceConstant = auxParameters0[1];
Expmultiplier = -0.5 / (SpaceConstant * SpaceConstant);
/* The spatial aspect ratio Gamma is stored in the 3rd aux parameter. */
float Gamma = auxParameters0[2];
GammaSquared = Gamma * Gamma;
/* Conditionally apply non-standard normalization term iff disableNorm == 0.0 */
float mc = disableNorm + (1.0 - disableNorm) * (1.0 / (sqrtof2pi * SpaceConstant));
/* Premultiply the wanted Contrast to the color: */
baseColor = modulateColor * mc * Contrast * contrastPreMultiplicator;
}
|