!!ARBvp1.0

#Declarations
ATTRIB in = vertex.position;
ATTRIB inCol = vertex.color;
ATTRIB nrm = vertex.normal;

PARAM mvp[4] = { state.matrix.mvp };
PARAM mv[4] = { state.matrix.modelview };
PARAM light = { 0.57735, 0.57735, 0.57735, 0.0};
PARAM const = {0.0, 0.0, 0.0, 0.2};
PARAM scale = 0.0078125;
PARAM sixteen = 16.0;
PARAM half = 0.5;

OUTPUT out = result.position;
OUTPUT col = result.color;
OUTPUT tex0 = result.texcoord[0];
OUTPUT tex1 = result.texcoord[1];
OUTPUT tex2 = result.texcoord[2];
OUTPUT tex3 = result.texcoord[3];

TEMP eNrm;
TEMP tmp;

#Code

#use model coords as tex coords
MAD tmp, in, scale, half;
MOV tex0, tmp;
MUL tmp, tmp, sixteen;
MOV tex1, tmp;
MUL tmp, tmp, sixteen;
MOV tex2, tmp;
MUL tmp, tmp, sixteen;
MOV tex3, tmp;

#transform the positions
DP4 out.x, in, mvp[0];
DP4 out.y, in, mvp[1];
DP4 out.z, in, mvp[2];
DP4 out.w, in, mvp[3];

#transfrom the normal to eye-space
DP3 eNrm.x, mv[0], nrm;
DP3 eNrm.y, mv[1], nrm;
DP3 eNrm.z, mv[2], nrm;

#simple intensity
DP3 eNrm.x, eNrm, light;

#kill negative illum
MAX eNrm.x, eNrm.x, const.x;

#add ambient term
ADD col, eNrm.x, const.w;


END

