!!ARBfp1.0

PARAM lightDiff = program.env[1];
PARAM lightSpec = program.env[2];
PARAM materialDiff = state.material.diffuse;
PARAM materialSpec = state.material.specular;
PARAM shininess = state.material.shininess;
TEMP temp, light, normal, eye, R, diff, spec;

DP3 temp, fragment.texcoord[0], fragment.texcoord[0];
RSQ temp, temp.x;
MUL normal, temp.x, fragment.texcoord[0];
DP3 temp, fragment.texcoord[1], fragment.texcoord[1];
RSQ temp, temp.x;
MUL light, temp.x, fragment.texcoord[1];
DP3 temp, fragment.texcoord[2], fragment.texcoord[2];
RSQ temp, temp.x;
MUL eye, temp.x, fragment.texcoord[2];

DP3_SAT diff, normal, light;
MUL diff, diff, lightDiff;
MUL diff, diff, materialDiff;

DP3 R, normal, light;
MUL R, R.x, normal;
MUL R, 2.0, R;
ADD R, R, -light;

DP3_SAT spec, R, eye;
POW spec, spec.x, shininess.x;
MUL spec, spec, lightDiff;
MUL spec, spec, materialDiff;

ADD_SAT result.color, diff, spec;
MOV result.color.w, 1.0;

END
