#version 110
#define float4 vec4
#define float3 vec3
#define float2 vec2
#define oUV gl_TexCoord[0]
#define tex3D texture3D
#define tex2D texture2D
#define tex1D texture1D

				uniform sampler2D texture2d_1;

varying vec4 position;

varying vec4 Color;
	uniform float PosY;

varying vec2 TheUV;
varying float rnd;


void main (void) 
{


if (length (gl_PointCoord.xy-vec2 (0.5))>0.5) discard;
//if (gl_PointCoord.x>0.1) discard;

float3 Normal=gl_PointCoord.xyx;
Normal.z=1.0;
Normal=normalize (Normal);
gl_FragData[0]=Normal.xyzz;

//TheNormal.w=shadow;
float ffl=1.0-3.0*length (gl_PointCoord.xy-vec2 (0.5));
ffl=clamp (ffl,0.0,1.0);
float depth=rnd*1.0/pow(position.w*0.06,3.0+4.0*ffl);
depth=clamp (depth,0.0,1.0);
//depth=1.0;
//ffl*=0.6;
//ffl=pow (ffl,3.0);
ffl=clamp (ffl,0.0,1.0);

//ffl=1.0*PosY;
//ffl/=position.w*3.0;
//ffl=0.0;
//ffl=1.0;
ffl*=depth;
gl_FragData[1]=Color*ffl*1.0;
gl_FragData[1]=vec4 (ffl)*Color;
//gl_FragData[0]=Color*0.01;
///gl_Position.z;;
gl_FragData[0]=Normal.xyzz;
gl_FragData[0].w=1.0;

//gl_FragData[1]=vec4 (1.0,0.0,0.0,1.0);


//col=float4 (0.3,0.5,0.6,1.0)*rnd;
//gl_FragData[1]=1.43*3.7*vec4 (0.1,0.11,0.13,1.0)*texture2D (texture2d_1,TheUV).xyzz;

//if (gl_FragData[1].x<0.01) discard;
//gl_FragData[1]*=1.4*0.5;
//gl_FragData[1].a*=0.2;


}














