#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

varying vec3 normal;

				uniform sampler2D texture2d_1;
				uniform sampler2D texture2d_2;
				//uniform sampler2D texture2d_2;

				uniform samplerCube texture2d_cube;

	uniform float PosY;
varying vec3 position;
varying vec4 normalB;



void main (void) 
{


//float4 TheNormal=(nnormal.xyzz+float4 (1.0))*0.5;
//TheNormal.w=shadow;

vec3 Normal= (normal);

float dott=dot(normal.xyz,vec3 (1.0,0.0,0.0));
dott=clamp (dott,0.0,1.0);
dott=pow(dott,5.0);
dott=1.0+dott*1.4;




vec4 Norm=(Normal.xyzz+float4 (1.0))*0.5;

vec4 res=vec4 (0.8)*dott*vec4 (0.7,0.6,0.3,0.2);
res=res+ (Norm.xyzz-res)*0.2;
res*=vec4 (0.7,0.8,0.9,1.0)*0.6;


dott=dot(normal.xyz,vec3 (0.0,0.0,1.0));
dott=clamp (dott,0.0,1.0);
dott=pow(dott,5.0);
dott=1.0+dott*6.0;
res*=dott;





dott=dot(normalize (normal.xyz),vec3 (0.0,-1.0,0.0));
dott=clamp (dott,0.0,1.0);
dott=1.3-pow(dott,1.0);
res*=dott;



float ft=texture2D (texture2d_1,position.xz*3.5).x;
if (position.y>-0.07)
res*=1.0-0.6*ft;


if (length (position.xz*vec2 (1.0,1.2))<8.86*0.1)
if (position.y<-1.582*0.1-0.49*0.05)
{
//	res=res+(vec4 (0.7,1.0,0.6,1.0)-res)*0.08;
ft=texture2D (texture2d_1,position.xz*1.0).x;
//res*=1.0+0.5*ft*vec4 (0.3,0.5,0.3,1.0)*PosY;
}

//res*=1.0+0.3*texture (texture2d_cube,normalB.xyz);
//res+=0.2*texture2D (texture2d_2,position.xz*0.5+vec2 (0.5));
//res=vec4 (dott);
res*=vec4 (0.8,0.9,1.0,1.0);
gl_FragData[1]=res;

gl_FragData[0]=Norm;
gl_FragData[0].w=1.0;
//Diffuse+float4 (0.5);
//gl_FragData[1]=float4 (0.3,0.3,0.3,0.3);

}














