!!ARBfp1.0

#Declarations
TEMP r0;
TEMP r1;
TEMP r2;
TEMP r3;

ATTRIB coord0 = fragment.texcoord[0];
ATTRIB coord1 = fragment.texcoord[1];
ATTRIB coord2 = fragment.texcoord[2];
ATTRIB coord3 = fragment.texcoord[3];
ATTRIB illum = fragment.color;

PARAM scale = {2.0, 0.9, 1.8, 2.0};   
PARAM half = 0.5;
PARAM freq = {0.9, 0.9, 0.9, 0.9};  
PARAM mortarColor = {0.8, 0.8, 0.8};  #mortarColor
PARAM brickColor = {0.8, 0.0, 0.0};  #brickColor
PARAM turbScale = { 1.0, 0.5, 0.25, 0.125};
PARAM turbScale2 = {1.0, 0.0625, 0.00390625, 0.000244140625};
PARAM two = 2.0;
PARAM four = 4.0;
PARAM three = 3.0;

OUTPUT out = result.color;

#Instructions
TEX r0, coord0, texture[0], 3D;
TEX r1, coord1, texture[0], 3D;
TEX r2, coord2, texture[0], 3D;
TEX r3, coord3, texture[0], 3D;

MAD r0, r0, two, -1.0;
MAD r1, r1, two, -1.0;
MAD r2, r2, two, -1.0;
MAD r3, r3, two, -1.0;
DP4 r0.x, r0, turbScale;
DP4 r0.y, r1, turbScale;
DP4 r0.z, r2, turbScale;
DP4 r0.w, r3, turbScale;
DP4_SAT r0, r0, turbScale2;
#MAD_SAT r0, r0, four, -two;

TEX r0, r0, texture[1], 2D;
#MOV r0, r1;

#apply shading
MUL r0.xyz, r0, illum;
MAX r0.xyz, r0, 0.0;
MIN r0.xyz, r0, 1.0;

#write the result
MOV out.xyz, r0;
MOV out.w, 1.0;


END
