!!ARBvp1.0 OPTION ARB_position_invariant ;

MOV		result.texcoord[0], vertex.texcoord[0];

END

#======================================================================

!!ARBfp1.0 
OPTION ARB_precision_hint_nicest;

PARAM	zero = { 0, 0, 0, 1 };
PARAM	one = { 1, 1, 1, 1 };
PARAM	ten = { 0, 10000, 0, 1 };
PARAM	half = { 0.5, 0.5, 0.5, 0.5 };
PARAM	default = { 0, 0, 0, 1 };

PARAM	scale1 = { 0.22, 0.33, 0.33, 1 };
PARAM	scale2 = { 0.01, 0.01, 0.01, 1 };
PARAM	small = { 0.1, 0.1, 0.1, 1 };
PARAM	pointFive = { 0.5, 0.5, 0.5, 0.5 };

PARAM	warpFactor2 = { 0.995, 0.995, 0.995, 1 };
PARAM	redBlend = { 1, 0.98, 0.98, 1 };

TEMP	unadjustedTC, adjustedTC, warpedAdjustedTC, R0, R1, R2, alpha, warpFactor;

# do the alpha lookup
TXP		R0, fragment.texcoord[0], texture[2], 2D;
MOV		alpha, R0.yyyy;

MOV		warpFactor, warpFactor2;

# =======================================
# compute _currentRender preturbed texcoords
# =======================================
MUL		R0, fragment.position, program.env[1];
MOV		R1, R0;
RCP		R1.w, R1.w;
MOV		R0.w, default;
MUL		R0.xy, R0, R1.wwww;

SUB		R0.xy, R0, pointFive;
MUL		R0.xy, R0, warpFactor;
ADD		R0.xy, R0, pointFive;

MUL		warpedAdjustedTC, R0, program.env[0];				# scale by the screen non-power-of-two-adjust

# compute screen-adjusted texture coordinate
MUL		adjustedTC, fragment.position, program.env[1];
MUL		adjustedTC, adjustedTC, program.env[0];

# do the texture lookup
TXP		R0, adjustedTC, texture[0], 2D;
TXP		R1, warpedAdjustedTC, texture[1], 2D;

# final color = R1 * 0.99 + R0 * 0.1
MUL	R0, R0, alpha;
SUB	R2, one, alpha;
MUL	R1, R1, R2;

ADD		R2, R0, R1;
MUL		R2, redBlend, R2;
MOV		result.color.xyz, R2;

END

