From 8e20dab9326ed09aaec6a0b02af0b020975f23d7 Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 10 Oct 2005 16:24:21 +0000 Subject: [PATCH] Improved. --- resources/Vertex_Program_ARB.txt | 72 +------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/resources/Vertex_Program_ARB.txt b/resources/Vertex_Program_ARB.txt index 3773961e..104e9aa8 100755 --- a/resources/Vertex_Program_ARB.txt +++ b/resources/Vertex_Program_ARB.txt @@ -1,79 +1,10 @@ -// 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; @@ -82,10 +13,9 @@ void main() 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 ); } -- 2.39.2