-// simple vertex shader
-
-attribute float attrib1;
-attribute float attrib2;
-attribute float attrib3;
-
attribute float results;
attribute float clamp;
attribute float geomSize;
-attribute float attrib4;
attribute float minSize;
attribute float maxSize;
attribute float magnification;
-float3 ComputePointSize( float3 inColor )
-{
- float a1 = attrib1;
- float a2 = attrib2;
- float a3 = attrib3;
- float a4 = attrib4;
-
- int r = inColor.x * 255;
- int g = inColor.y * 255;
- int b = inColor.z * 255;
- int h = 0;
-
- int max = r;
- int whatmax = 0;
- if( g > max )
- {
- max = g;
- whatmax = 1;
- }
- if( b > max )
- {
- max = b;
- whatmax = 2;
- }
- int min = r;
- if ( g < min ) min = g;
- if ( b < min ) min = b;
- int delta = max-min;
-
- if( delta == 0 )
- {
- h = 0;
- }
- else if( whatmax == 0 )
- {
- if ( g >= b )
- h = (120*(g-b)+delta)/(2*delta);
- else
- h = (120*(g-b+delta)+delta)/(2*delta) + 300;
- }
- else if( whatmax == 1 )
- {
- if ( b > r )
- h = 120 + (120*(b-r)+delta)/(2*delta);
- else
- h = 60 + (120*(b-r+delta)+delta)/(2*delta);
- }
- else
- {
- if ( r > g )
- h = 240 + (120*(r-g)+delta)/(2*delta);
- else
- h = 180 + (120*(r-g+delta)+delta)/(2*delta);
- }
-
- //minSize = 15.0;
- //maxSize = 40.0;
- float size = minSize + ( maxSize - minSize ) * ( 1 - h / 256.0f );
-
- return size;
-}
-
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
float size;
if( results == 1 )
- size = ComputePointSize( gl_Color );
+ size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f );
else
size = geomSize;
- //clamp = 100.0;
gl_PointSize = min( magnification * size * gl_ProjectionMatrix[0].x, clamp );
}