!!ARBvp1.0 OPTION ARB_position_invariant ;

# Cel Shader v1.0 by Junkguy
# junkguy@gmail.com
# www.junkguy.tk
# This uses my own cel shading algorithm.
# You may NOT use this shader in your own mod without my permission.

TEMP	R0, R1, R2;
PARAM	defaultTexCoord = { 0, 0.5, 0, 1 };
SUB		R0, program.env[4], vertex.position;
DP3		result.texcoord[0].x, vertex.attrib[9], R0;
DP3		result.texcoord[0].y, vertex.attrib[10], R0;
DP3		result.texcoord[0].z, vertex.attrib[11], R0;
MOV		result.texcoord[2], defaultTexCoord;
DP4		result.texcoord[2].x, vertex.position, program.env[9];
DP4		result.texcoord[3].x, vertex.position, program.env[6];
DP4		result.texcoord[3].y, vertex.position, program.env[7];
DP4		result.texcoord[3].w, vertex.position, program.env[8];
MOV		result.texcoord[4], defaultTexCoord;
DP4		result.texcoord[4].x, vertex.attrib[8], program.env[12];
DP4		result.texcoord[4].y, vertex.attrib[8], program.env[13];
MAD		result.color.xyz, vertex.color, program.env[16], program.env[17];

END

!!ARBfp1.0 
OPTION ARB_precision_hint_nicest;

TEMP	light, color, R1, localNormal;
PARAM	subOne = { -1, -1, -1, -1 };
PARAM	scaleTwo = { 2, 2, 2, 2 };
TEX	light, fragment.texcoord[0], texture[0], CUBE;
MAD	light, light, scaleTwo, subOne;
MOV localNormal, {0.5 ,0.5 ,1 ,0.5};
MAD	localNormal, localNormal, scaleTwo, subOne;
DP3	light, light, localNormal;
TXP	R1, fragment.texcoord[3], texture[3], 2D;
MUL	light, light, R1;
TXP	R1, fragment.texcoord[2], texture[2], 2D;
MUL	light, light, R1;
MUL light, light, {20,20,20,20};
FLR light, light;
MUL light, light, {0.05,0.05,0.05,0.05};
TEMP	d1,d2,d3;
TEX	d1, {0.51,0.5,0.5,0.5}, texture[4], 2D;
TEX	d2, {0.3,0.32,0.3,0.3}, texture[4], 2D;
TEX	d3, {0.7,0.8,0.7,0.5}, texture[4], 2D;
ADD	d1, d1, d2;
ADD	R1, d1, d3;
MUL	R1, R1, {0.33,0.33,0.33};
MUL	color.xyz, R1, program.env[0];
MUL	color.xyz, light, color;
MUL result.color.xyz, color, fragment.color;

END

