VERTEX
//#version 130 compability


uniform sampler2D tex1,tex2;
uniform mat4 SkinMatrices[100];
uniform float scale;
uniform float scaleOffset;
uniform float param0;
uniform float offsetValue;


void main()
{


	vec4 p  = gl_Vertex;
	p.y-= scaleOffset;
	p.y*= scale;
	p.y+= scaleOffset;
	float back = 0.0;
	if(p.z<-0.4)
		back = 0.5;
		
	
	vec3 weights2 = texture2D(tex1,vec2(0.25 + back + 0.25*(p.x/5.0), clamp(1-p.y/30.0 ,0.001,0.999))).xyz;
	if(param0 >0.5)
		weights2 = gl_MultiTexCoord1.xyz /255.0;
		
	vec4 offset = texture2D(tex2,vec2(0.25 + back + 0.25*(p.x/5.0), clamp(1-p.y/30.0 ,0.02,0.98)));		
	offset = (offset *2.0 -1.0)*offsetValue;
	offset.w=0;
	
	p = (p + offset) *SkinMatrices[int(weights2.r *255.0)];
		
	gl_Position =  gl_ModelViewProjectionMatrix * p;
	gl_TexCoord[0] = gl_MultiTexCoord0;
	


}



PIXEL
uniform sampler2D tex;


void main()
{
	gl_FragColor = texture2D(tex,gl_TexCoord[0].st)  ;
	
}
