From 3d00a0321ce7a844c5bc0b4cb3ee19a225821621 Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 14 Sep 2005 06:12:58 +0000 Subject: [PATCH] *** empty log message *** --- resources/Vertex_Program_ARB.txt | 50 +++++--------------------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/resources/Vertex_Program_ARB.txt b/resources/Vertex_Program_ARB.txt index aa80032d..2d8462e2 100755 --- a/resources/Vertex_Program_ARB.txt +++ b/resources/Vertex_Program_ARB.txt @@ -1,43 +1,8 @@ // simple vertex shader -/* -struct VS_INPUT { - float3 Pos : POSITION; - float I : TEXCOORD0; -}; -struct VS_OUTPUT { -// float4 Pos : POSITION; -// float4 Col : COLOR0; - float Size : PSIZE; -}; - -float ComputePointSize(float3 inVertex, float inSize) { - float4 viewPos = mul(float4(inVertex, 1), WorldView); - float dist = (viewPos.x * viewPos.x + viewPos.y * viewPos.y + viewPos.z * viewPos.z); - float size = viewportSize.y * inSize * globalPointSize * rsqrt((1 + dist)); - - return max( 16.0f, size ); -} - -VS_OUTPUT VertexShader_PointSpritePalette(VS_INPUT vIn) { - VS_OUTPUT Out; - -// Out.Pos = mul(float4(vIn.Pos, 1), WorldViewProjection); - - if( vIn.I < limitMin || vIn.I > limitMax ) { - Out.Size = 0; - } else { - float stepValue = vIn.I; - - float size1 = 1.0f; - float size2 = 4.0f; - float pSize = size1 + stepValue * (size2 - size1); - Out.Size = ComputePointSize(vIn.Pos, pSize) * 0.5; - } - - return Out; -} -*/ +attribute float minSize; +attribute float maxSize; +attribute float clamp; float3 ComputePointSize( float3 inColor ) { @@ -85,8 +50,8 @@ float3 ComputePointSize( float3 inColor ) h = 180 + (120*(r-g+delta)+delta)/(2*delta); } - float minSize = 15.0f; - float maxSize = 50.0f; + minSize = 15.0; + maxSize = 40.0; float size = minSize + ( maxSize - minSize ) * ( 1 - h / 256.0f ); @@ -97,10 +62,11 @@ void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - //gl_FrontColor = gl_Color; + gl_FrontColor = gl_Color; float size = ComputePointSize( gl_Color ); - gl_PointSize = size * gl_ProjectionMatrix[0].x; + clamp = 100.0; + gl_PointSize = min( size * gl_ProjectionMatrix[0].x, clamp ); } -- 2.39.2