#define LINEAR_CLAMP_MAP(x) \
		MipFilter[x] = LINEAR; \
		MagFilter[x] = LINEAR; \
		MinFilter[x] = LINEAR; \
		AddressU[x] = CLAMP; \
		AddressV[x] = CLAMP
		
#define LINEAR_WRAP_MAP(x) \
		MipFilter[x] = LINEAR; \
		MagFilter[x] = LINEAR; \
		MinFilter[x] = LINEAR; \
		AddressU[x] = WRAP; \
		AddressV[x] = WRAP

#define DIFF_MAP LINEAR_WRAP_MAP(0)
#define NORM_MAP LINEAR_CLAMP_MAP(1)
#define CHAN_MAP LINEAR_CLAMP_MAP(2)
#define APP_MAP  LINEAR_CLAMP_MAP(3)
	  	
#define DEPTH_ENABLE \
		ZEnable = TRUE; \
		ZWriteEnable = TRUE
		
#define DEPTH_DISABLE \
		ZEnable = FALSE; \
		ZWriteEnable = FALSE
		
#define ALPHA_BLEND_ENABLE \
		AlphaBlendEnable = TRUE; \
		SrcBlend = SRCALPHA; \
		DestBlend = INVSRCALPHA

#define ALPHA_MASK_ENABLE \
        AlphaBlendEnable = TRUE; \
        SrcBlend = DESTALPHA; \
        DestBlend = ZERO
        
#define ALPHA_BLEND_DISABLE \
		AlphaBlendEnable = FALSE; \
		SrcBlend = ONE; \
		DestBlend = ZERO
		
#define STENCIL_ENABLE  StencilEnable = TRUE
#define STENCIL_DISABLE StencilEnable = FALSE
#define CULL_DISABLE CullMode = NONE
#define CULL_ENABLE  CullMode = CW
#define CULL_REVERSE CullMode = CCW

sampler DiffMap : register(s0);
sampler NormMap : register(s1);
sampler ChanMap : register(s2);
sampler AppMap  : register(s3);
sampler ShadowMap : register(s4);

float4x4 o2pMat		: WORLDVIEWPROJECTION;	 // object to perspective matrix
float4x4 o2wMat		: WORLD;				 // object to world matrix
float4x4 viewMat    : VIEW;
float4x4 projMat    : PROJ;

#ifdef _OPENFIST_

float4x4 mat0		: MAT0;
float4x4 mat1		: MAT1;
float4   xyzw0		: XYZW0;
float4   xyzw1		: XYZW1;
float4   xyzw2		: XYZW2;
float4   xyzw3		: XYZW3;
float4	 wLitPos	: LPOS0;
float4	 wLitPos2	: LPOS1;
float3	 cLitClr    : LCLR0;
float3   cLitClr2   : LCLR1;
float    nLitInt    : LINT0;
float    nLitInt2   : LINT1;
float    nAmbInt    : AMBINT;
float3	 cAmbClr    : AMBCLR;
float4   bBoneTrans[96] : BONETRANS; 
float4 b2oBoneQuats[96] : BONEROTS;

#else // for XSI and other viewers
float4   bBoneTrans[96] < bool SasUiVisible = false; >;
float4 b2oBoneQuats[96] < bool SasUiVisible = false; >;
float4x4 mat0 < bool SasUiVisible = false; >;
float4x4 mat1 < bool SasUiVisible = false; >;
float4	 wLitPos2 < bool SasUiVisible = false; >;
float3   cLitClr2 < bool SasUiVisible = false; >;
float    nLitInt2 < bool SasUiVisible = false; >;
float4   xyzw1 < bool SasUiVisible = false; >;
float4   xyzw2 < bool SasUiVisible = false; >;
float4   xyzw3 < bool SasUiVisible = false; >;
float4	 wLitPos//	: LPOS0
<
    //string SasUiControl     = "Numeric";        // a.k.a. UIWidget
    //string SasUiLabel       = "Light Position"; // a.k.a. UIName
    //string SasUiDescription = "The position of light";
    // bool SasUiVisible = false; //XSI bug
    string SasBindAddress = "Sas.PointLight[0].Position";
>;// = { 100, 100, 100, 0 };

float3	 cLitClr
<
    //string SasUiControl     = "ColorPicker";
    //string SasUiLabel       = "Light Color"; // XSI bug
    //string SasUiDescription = "The color of the light";
    string SasBindAddress = "Sas.PointLight[0].Color"; //"Light01Color";//"Sas.Light[0].Color";
>;/// = {1.0f, 0.85f, 0.85f};

float nLitInt// : LINT
<
    string SasUiControl = "Numeric";
    string SasUiLabel   = "Light Intensity";
    float SasUiMax = 1.0f;
    float SasUiMin = 0.0f;
> = { 1.0f };

float3	 cAmbClr// : AMBCLR
<
    string SasUiControl     = "ColorPicker";
    string SasUiLabel       = "Ambient Light Color"; // XSI bug
    string SasUiDescription = "The color of the ambient light";
    //string SasBindAddress = "Sas.AmbientLight[0].Color"; XSI Bug - AmbientLight is slammed to 0.4,,,
> = {0.85f, 0.85f, 1.0f};

float nAmbInt// : AMBLINT
<
    string SasUiControl     = "Numeric";
    string SasUiLabel       = "Ambient Light Intensity";
    float SasUiMax = 1.0f;
    float SasUiMin = 0.0f;
> = { 0.3f };

float4   xyzw0		: XYZW0
<
    string SasUiControl = "Slider";
    string SasUiLabel   = "Fade Amount (X is for the UnlitFade technique)";
    float SasUiMax = 1.0f;
    float SasUiMin = 0.0f;
> = { 1.0f, 0, 0, 0 };
#endif


float4	 wCamPos	: CAMERAPOSITION;



//variable prefix 'n' = value/numbers (no space),
//				  'o' = object space,
//				  'w' = world space,
//				  'v' = view space, 
//				  't' = tangent space,
//				  'p' = perspective space (final- screen space)
//                'c' = color space [0...1]
//                'b' = bone space (each bone's origin)

/*-----------------------------------------------------------------------------------
||		Generic Lighting Equations
\*----------------------------------------------------------------------------------*/


float3 CalcLitClr(float3 surfaceClr, float3 litClr, float litInt)
{
    return surfaceClr * litClr.rgb * litInt;
}

float3 CalcLitClr(float3 surfaceClr, float3 litClr, float litInt, float3 toLit, float3 normal)
{
	return CalcLitClr(surfaceClr, litClr, litInt) * saturate(dot( normal, toLit ));
}

float3 CalcLitClr(float3 surfaceClr, float3 litClr, float litInt, float3 toLit, float3 normal, float3 halfAngle, float specularity, float glossiness = 0.5f)
{
	const int MaxGlossiness = 4096;
	
	float nSpecularIncidence = saturate(dot( normal, halfAngle ));
	float nSpecContribution	 = pow(nSpecularIncidence, pow((MaxGlossiness*glossiness), glossiness)); //normalizes visual glossiness, such that 0.5 glossiness appears about half as glossy as 1.0
	float3 specularLitClr = nSpecContribution * litInt * litClr * specularity;
	return CalcLitClr(surfaceClr, litClr, litInt, toLit, normal) + specularLitClr;
}

/*-----------------------------------------------------------------------------------
||		Generic Math Equations
\*----------------------------------------------------------------------------------*/

//the scalar is stored in the w
float4 mulQuat(float4 q2, float4 q1) // this function is taken from a math book that multiplies right to left, so by swapping q2 and q1 in the parameter list, this algorithm becomes left to right
{
	float s1 = q1.w;
	float s2 = q2.w;
	
	float3 v1 = q1.xyz;
	float3 v2 = q2.xyz;
	
	//mathematically written: s1*s2 - dot(v1,v2) + s1*v2 + s2*v1 + cross(v1, v2)
	return float4(s1*v2 + s2*v1 + cross(v1, v2), s1*s2 - dot(v1,v2));
}

// quaternion conjugate
float4 conjugate(float4 q) { return float4(-q.x, -q.y, -q.z, q.w); }
float4 rotateVecByQuat(float4 v, float4 q) { return mulQuat( mulQuat(conjugate(q), v), q ); }

// bone to object space transform (rotates vert around the bone center and than transforms it to a position [weighted for 4 bones])
float4 b2oTransform(float4 bPos, float4 nBlendIdxs, float4 nBlendWgts)
{
    float4 oPos = float4(0,0,0,0);
    int bone;
    bone = nBlendIdxs.x; oPos += (rotateVecByQuat(bPos, b2oBoneQuats[bone]) + bBoneTrans[bone]) * nBlendWgts.x;
    bone = nBlendIdxs.y; oPos += (rotateVecByQuat(bPos, b2oBoneQuats[bone]) + bBoneTrans[bone]) * nBlendWgts.y;
    bone = nBlendIdxs.w; oPos += (rotateVecByQuat(bPos, b2oBoneQuats[bone]) + bBoneTrans[bone]) * nBlendWgts.w;
    bone = nBlendIdxs.z; oPos += (rotateVecByQuat(bPos, b2oBoneQuats[bone]) + bBoneTrans[bone]) * nBlendWgts.z;
    oPos.w = 1;
    return oPos;
}

float4 sumRotations(float4 v, float4 nBlendIdxs, float4 nBlendWgts)
{
    float4 sum = float4(0,0,0,0);
    int bone;
    bone = nBlendIdxs.x; sum += rotateVecByQuat(v, b2oBoneQuats[bone]) * nBlendWgts.x;
    bone = nBlendIdxs.y; sum += rotateVecByQuat(v, b2oBoneQuats[bone]) * nBlendWgts.y;
    bone = nBlendIdxs.z; sum += rotateVecByQuat(v, b2oBoneQuats[bone]) * nBlendWgts.z;
    bone = nBlendIdxs.w; sum += rotateVecByQuat(v, b2oBoneQuats[bone]) * nBlendWgts.w;
    return sum;
}

/*-----------------------------------------------------------------------------------
||		Constant Color Shader
\*----------------------------------------------------------------------------------*/

struct ConstantIn								
{														
	float3 oPos		:	POSITION;						
};														

struct ConstantAnimIn
{														
	float4 bPos		:	POSITION;						
    float4 nBlendIdxs : BLENDINDICES0;
	float4 nBlendWgts : BLENDWEIGHT0;
};

struct ConstantOut											
{														
	float4  pPos	:	POSITION;						
};														

ConstantOut vsConstant(ConstantIn vIn)								
{														
    ConstantOut vOut;												
    vOut.pPos = mul(float4(vIn.oPos, 1), o2pMat);
        return vOut;
};

ConstantOut vsConstantAnim(ConstantAnimIn vIn)
{
    ConstantOut vOut;
	vOut.pPos		= mul(b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts), o2pMat);
        return vOut;
}
														
float4 psConstant(ConstantOut pIn) : COLOR0					
{														
	return xyzw0;										
};


/*-----------------------------------------------------------------------------------
||		Inverse Image Mask Shader, Where black is opaque, white is transparent- creates a mask from
\*----------------------------------------------------------------------------------*/

struct MaskIn								
{														
	float3 oPos		:	POSITION;
	float2 tTex		:	TEXCOORD0;
};														

struct MaskAnimIn
{														
	float4 bPos		:	POSITION;						
	float2 tTex		:	TEXCOORD0;
    float4 nBlendIdxs : BLENDINDICES0;
	float4 nBlendWgts : BLENDWEIGHT0;
};

struct MaskOut											
{														
	float4  pPos	:	POSITION;						
	float2	tTex    :	TEXCOORD0;						
};														

MaskOut vsMask(MaskIn vIn)								
{														
    MaskOut vOut;												
    vOut.pPos = mul(float4(vIn.oPos, 1), o2pMat);
    vOut.tTex = vIn.tTex;
        return vOut;
};

MaskOut vsMaskAnim(MaskAnimIn vIn)
{
    MaskOut vOut;
	vOut.pPos = mul(b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts), o2pMat);
    vOut.tTex = vIn.tTex;
        return vOut;
}
														
float4 psMask(MaskOut pIn) : COLOR0					
{
    float4 cDiffuseClr = tex2D(DiffMap, pIn.tTex);
    float opacity = 1-cDiffuseClr.a;
	return float4(opacity, opacity, opacity, cDiffuseClr.a);
};





/*-----------------------------------------------------------------------------------
||		Static Unlit Shader
\*----------------------------------------------------------------------------------*/

struct UnlitIn								
{														
	float3 oPos		:	POSITION;						
	float2 tTex		:	TEXCOORD0;						
};														

struct UnlitAnimIn								
{														
	float4 bPos		:	POSITION;						
	float2 tTex		:	TEXCOORD0;
    float4 nBlendIdxs : BLENDINDICES0;
	float4 nBlendWgts : BLENDWEIGHT0;
};

struct UnlitOut											
{														
	float4  pPos	:	POSITION;						
	float2	tTex    :	TEXCOORD0;						
};														

float4 vsDiscard(UnlitIn vIn)	: POSITION { return float4(0,0,-1,1); }
float4 psDiscard()              : COLOR0   { return float4(1,0, 0,0); }

UnlitOut vsUnlit(UnlitIn vIn)								
{														
    UnlitOut vOut;												
    vOut.pPos = mul(float4(vIn.oPos, 1), o2pMat);
    vOut.tTex = vIn.tTex;
        return vOut;
};

UnlitOut vsUnlitAnim(UnlitAnimIn vIn)
{
    UnlitOut vOut;

	vOut.pPos		= mul(b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts), o2pMat);
    vOut.tTex		= vIn.tTex;

        return vOut;
}
														
float4 psUnlit(UnlitOut pIn) : COLOR0					
{														
	return tex2D(DiffMap, pIn.tTex);										
};

float4 psUnlitFade(UnlitOut pIn) : COLOR0					
{
    float4 cDiffuseColor = tex2D(DiffMap, pIn.tTex);
	return float4(cDiffuseColor.rgb, cDiffuseColor.a*xyzw0.x); // modulate alpha by the first component of the first generic shader vector
};




/*-----------------------------------------------------------------------------------
||		Blinn Shaders
\*----------------------------------------------------------------------------------*/


struct BlinnIn
{
	float4 oPos		: POSITION;
	float3 oNormal	: NORMAL;
	float2 tTex		: TEXCOORD0;
};

struct BlinnAnimIn
{
	float4 bPos		  : POSITION;
	float3 oNormal	  : NORMAL;
	float2 tTex		  : TEXCOORD0;
    float4 nBlendIdxs : BLENDINDICES0;
	float4 nBlendWgts : BLENDWEIGHT0;
};

struct BlinnOut
{
	float4 pPos		 : POSITION;
	float2 tTex		 : TEXCOORD0;
	float3 wToLit	 : TEXCOORD1;
	float3 wNormal	 : TEXCOORD3;
};

struct BlinnSpecOut
{
	float4 pPos		 : POSITION;
	float2 tTex		 : TEXCOORD0;
	float3 wToLit	 : TEXCOORD1;
	float3 wNormal	 : TEXCOORD3;
	float3 wHalfAngle: TEXCOORD4;
};


BlinnOut vsBlinn(BlinnIn vIn)
{
	BlinnOut vOut;

    float4 wPos		= mul(vIn.oPos, o2wMat);
      vOut.pPos		= mul(vIn.oPos, o2pMat);
            
    vOut.wToLit		= wLitPos - wPos;
    vOut.wNormal	= mul(vIn.oNormal, (float3x3)o2wMat);
    
    vOut.tTex		= vIn.tTex;

    return vOut;
}

BlinnOut vsBlinnAnim(BlinnAnimIn vIn)
{
    BlinnOut vOut;

    float4 oPos = b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts);
    float4 wPos = mul(oPos, o2wMat);
      vOut.pPos = mul(oPos, o2pMat);

    vOut.wToLit = wLitPos - wPos;
    vOut.wNormal= mul(sumRotations(float4(vIn.oNormal,1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);

    vOut.tTex   = vIn.tTex;

    return vOut;
}


float4 psBlinn(BlinnOut vIn): COLOR0
{
	float4 cDiffuseClr      = tex2D(DiffMap, vIn.tTex);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, normalize(vIn.wToLit), normalize(vIn.wNormal))
                + CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt), cDiffuseClr.a); // transparency
}


BlinnSpecOut vsBlinnSpec(BlinnIn vIn)
{
	BlinnSpecOut vOut;

    float4 wPos		= mul(vIn.oPos, o2wMat);
      vOut.pPos		= mul(vIn.oPos, o2pMat);
            
    float3 wToCam	= normalize(wCamPos - wPos);
    vOut.wToLit		= normalize(wLitPos - wPos);
    vOut.wNormal	= mul(vIn.oNormal, (float3x3)o2wMat);
    vOut.wHalfAngle	= vOut.wToLit + wToCam;
    
    vOut.tTex		= vIn.tTex;

    return vOut;
}

BlinnSpecOut vsBlinnSpecAnim(BlinnAnimIn vIn)
{
    BlinnSpecOut vOut;

    float4 oPos = b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts);
    float4 wPos = mul(oPos, o2wMat);
      vOut.pPos = mul(oPos, o2pMat);

    float3 wToCam = normalize(wCamPos - wPos);
    vOut.wToLit   = normalize(wLitPos - wPos);
    vOut.wNormal  = mul(sumRotations(float4(vIn.oNormal,1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);
    vOut.wHalfAngle = vOut.wToLit + wToCam;

    vOut.tTex   = vIn.tTex;

    return vOut;
}

float4 psBlinnSpec(BlinnSpecOut vIn): COLOR0
{
	float4 cDiffuseClr      = tex2D(DiffMap, vIn.tTex);
	float4 nChannelMap		= tex2D(ChanMap, vIn.tTex);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, normalize(vIn.wToLit), normalize(vIn.wNormal), normalize(vIn.wHalfAngle), nChannelMap.r)
                + CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt), cDiffuseClr.a); // transparency
}

float4 psBlinnSpecGloss(BlinnSpecOut vIn): COLOR0
{
	float4 cDiffuseClr      = tex2D(DiffMap, vIn.tTex);
	float4 nChannelMap		= tex2D(ChanMap, vIn.tTex);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, normalize(vIn.wToLit), normalize(vIn.wNormal), normalize(vIn.wHalfAngle), nChannelMap.r, nChannelMap.g)
                + CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt), cDiffuseClr.a); // transparency
}


/*-----------------------------------------------------------------------------------
||		Static Normal Mapped Blinn Shader
\*----------------------------------------------------------------------------------*/

struct NormalIn
{
	float4 oPos		: POSITION;
	float3 oNormal  : NORMAL;
	float4 oTangent : TANGENT;
	float2 tTex     : TEXCOORD0;
};

struct NormalAnimIn
{
	float4 bPos		: POSITION;
	float3 oNormal  : NORMAL;
	float4 oTangent : TANGENT;
	float2 tTex     : TEXCOORD0;
    float4 nBlendIdxs : BLENDINDICES0;
	float4 nBlendWgts : BLENDWEIGHT0;
};

struct NormalOut
{
	float4 pPos		 : POSITION;
	float2 tTex		 : TEXCOORD0;
	float3 tToLit	 : TEXCOORD1;
};

struct NormalSpecIn
{
	float4 oPos		: POSITION;
	float3 oNormal  : NORMAL;
	float4 oTangent : TANGENT;
	float2 tTex     : TEXCOORD0;
};

struct NormalSpecOut
{
	float4 pPos		 : POSITION;
	float2 tTex		 : TEXCOORD0;
	float3 tToLit	 : TEXCOORD1;
	float3 tHalfAngle: TEXCOORD2;
};


NormalOut vsNormal(NormalIn vIn)
{
	NormalOut vOut;

	float3 wTangent  = mul(vIn.oTangent, (float3x3)o2wMat);
	float3 wNormal   = mul(vIn.oNormal,  (float3x3)o2wMat);
	float3 wBinormal = cross(wNormal, wTangent) * vIn.oTangent.w;

	float3x3 w2tMat = { wTangent.x, wBinormal.x, wNormal.x, 
						wTangent.y, wBinormal.y, wNormal.y,
						wTangent.z, wBinormal.z, wNormal.z };

	float4 wPos     = mul(vIn.oPos, o2wMat);
    vOut.pPos		= mul(vIn.oPos, o2pMat);
    float4 wToLit   = (wLitPos - wPos);
    vOut.tToLit		= mul(wToLit, w2tMat);
    
    vOut.tTex		= vIn.tTex;

	return vOut;
}

NormalOut vsNormalAnim(NormalAnimIn vIn)
{
	NormalOut vOut;

	float3 wTangent  = mul(sumRotations(float4(vIn.oTangent.xyz, 1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);
	float3 wNormal   = mul(sumRotations(float4(vIn.oNormal,      1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);
	float3 wBinormal = cross(wNormal, wTangent) * vIn.oTangent.w;

	float3x3 w2tMat = { wTangent.x, wBinormal.x, wNormal.x, 
						wTangent.y, wBinormal.y, wNormal.y,
						wTangent.z, wBinormal.z, wNormal.z };

    float4 oPos     = b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts);
	float4 wPos     = mul(oPos, o2wMat);
    vOut.pPos		= mul(oPos, o2pMat);
    float4 wToLit   = (wLitPos - wPos);
    vOut.tToLit		= mul(wToLit, w2tMat);
    
    vOut.tTex		= vIn.tTex;

	return vOut;
}

float4 psNormal(NormalOut vIn): COLOR0
{
	float3 cNormal		= tex2D(NormMap, vIn.tTex);
	float4 cDiffuseClr	= tex2D(DiffMap, vIn.tTex);
	float3 tNormal		= normalize(cNormal * 2 - 1);
	float3 tToLit		= normalize(vIn.tToLit);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, tToLit, tNormal)  //initial rebounded light
				+ CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt) // ambient light
				, cDiffuseClr.a); // transparency
}

NormalSpecOut vsNormalSpec(NormalIn vIn)
{
	NormalSpecOut vOut;

	float3 wTangent  = mul(vIn.oTangent, (float3x3)o2wMat);
	float3 wNormal   = mul(vIn.oNormal,  (float3x3)o2wMat);
	float3 wBinormal = cross(wNormal, wTangent) * vIn.oTangent.w;

	float3x3 w2tMat = { wTangent.x, wBinormal.x, wNormal.x, 
						wTangent.y, wBinormal.y, wNormal.y,
						wTangent.z, wBinormal.z, wNormal.z };

	float4 wPos     = mul(vIn.oPos, o2wMat);
    vOut.pPos		= mul(vIn.oPos, o2pMat);
    float4 wToCam   = (wCamPos - wPos);
    float4 wToLit   = (wLitPos - wPos);
    vOut.tToLit		= mul(wToLit, w2tMat);
    vOut.tHalfAngle	= mul((wToLit + wToCam), w2tMat);
    
    vOut.tTex		= vIn.tTex;

	return vOut;
}

NormalSpecOut vsNormalSpecAnim(NormalAnimIn vIn)
{
	NormalSpecOut vOut;

	float3 wTangent  = mul(sumRotations(float4(vIn.oTangent.xyz, 1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);
	float3 wNormal   = mul(sumRotations(float4(vIn.oNormal,      1), vIn.nBlendIdxs, vIn.nBlendWgts), (float3x3)o2wMat);
	float3 wBinormal = cross(wNormal, wTangent) * vIn.oTangent.w;

	float3x3 w2tMat = { wTangent.x, wBinormal.x, wNormal.x, 
						wTangent.y, wBinormal.y, wNormal.y,
						wTangent.z, wBinormal.z, wNormal.z };

    float4 oPos     = b2oTransform(vIn.bPos, vIn.nBlendIdxs, vIn.nBlendWgts);
	float4 wPos     = mul(oPos, o2wMat);
    vOut.pPos		= mul(oPos, o2pMat);
    float4 wToCam   = (wCamPos - wPos);
    float4 wToLit   = (wLitPos - wPos);
    vOut.tToLit		= mul(wToLit, w2tMat);
    vOut.tHalfAngle	= mul((wToLit + wToCam), w2tMat);
    
    vOut.tTex		= vIn.tTex;

	return vOut;
}

float4 psNormalSpec(NormalSpecOut vIn): COLOR0
{
	float3 cNormal		= tex2D(NormMap, vIn.tTex);
	float4 channelMap	= tex2D(ChanMap, vIn.tTex);
	float4 cDiffuseClr	= tex2D(DiffMap, vIn.tTex);
	float3 tNormal		= normalize(cNormal * 2 - 1);
	float3 tToLit		= normalize(vIn.tToLit);
	float3 tHalfAngle	= normalize(vIn.tHalfAngle);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, tToLit, tNormal, tHalfAngle, channelMap.r)  //initial rebounded light
				+ CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt) // ambient light
				, cDiffuseClr.a); // transparency
}

float4 psNormalSpecGloss(NormalSpecOut vIn): COLOR0
{
	float3 cNormal		= tex2D(NormMap, vIn.tTex);
	float4 channelMap	= tex2D(ChanMap, vIn.tTex);
	float4 cDiffuseClr	= tex2D(DiffMap, vIn.tTex);
	float3 tNormal		= normalize(cNormal * 2 - 1);
	float3 tToLit		= normalize(vIn.tToLit);
	float3 tHalfAngle	= normalize(vIn.tHalfAngle);

	return float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, tToLit, tNormal, tHalfAngle, channelMap.r, channelMap.g)  //initial rebounded light
				+ CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt) // ambient light
				, cDiffuseClr.a); // transparency
}

/*-----------------------------------------------------------------------------------
||		MapGlow (The alpha channel in the app texture determines the glow amount)
\*----------------------------------------------------------------------------------*/

float4 psMapGlow(UnlitOut pIn) : COLOR0
{
	float4 cApp = tex2D(AppMap, pIn.tTex);
	float nGlowAmount = cApp.a;
		return float4(cApp.rgb, nGlowAmount);
}

float4 psMapGlowMask(UnlitOut pIn) : COLOR0
{
	float4 cApp = tex2D(AppMap, pIn.tTex);
	float nGlowAmount = cApp.a;
		return float4(nGlowAmount,nGlowAmount,nGlowAmount, tex2D(DiffMap, pIn.tTex).a);
}


/*-----------------------------------------------------------------------------------
||		AlphaGlow (The alpha channel in the diffuse texture determines the glow amount)
\*----------------------------------------------------------------------------------*/

float4 psAlphaGlow(UnlitOut pIn) : COLOR0
{
	float4 cDiffuse = tex2D(DiffMap, pIn.tTex);
	float nGlowAmount = cDiffuse.a;
		return float4(cDiffuse.rgb, nGlowAmount);
}

float4 psAlphaGlowMask(UnlitOut pIn) : COLOR0
{
	float4 cDiffuse = tex2D(DiffMap, pIn.tTex);
	float nGlowAmount = cDiffuse.a;
		return float4(nGlowAmount,nGlowAmount,nGlowAmount, 1);
}

/*-----------------------------------------------------------------------------------
||		LightGlow (The brightness of the light determines the glow amount)
\*----------------------------------------------------------------------------------*/

float4 psLightGlow(BlinnOut pIn) : COLOR0
{
	
	// Renormalize the vectors
	pIn.wNormal  = normalize(pIn.wNormal);
	pIn.wToLit   = normalize(pIn.wToLit);
			
	// Calculate glow amount
	float nGlowAmount = max(dot(pIn.wNormal, pIn.wToLit), 0);
		
	float4 cDiffuse = tex2D(DiffMap, pIn.tTex);
		return float4(cDiffuse.rgb * cDiffuse.a, nGlowAmount);
}

float4 psLightGlowMask(BlinnOut pIn) : COLOR0
{
	
	// Renormalize the vectors
	pIn.wNormal  = normalize(pIn.wNormal);
	pIn.wToLit   = normalize(pIn.wToLit);
			
	// Calculate glow amount
	float nGlowAmount = max(dot(pIn.wNormal, pIn.wToLit), 0);

		return float4(nGlowAmount,nGlowAmount,nGlowAmount, 1); // technically this should take in account the average of the diffuse color
}


/*-----------------------------------------------------------------------------------
||		DiffuseGlow (The brightness of the diffuse texture defines the glow amount)
\*----------------------------------------------------------------------------------*/

float4 psDiffuseGlow(UnlitOut pIn) : COLOR0
{
	float4 cDiffuse = tex2D(DiffMap, pIn.tTex);
	float nGlowAmount = ((cDiffuse.r + cDiffuse.g + cDiffuse.b)*cDiffuse.a)/3.0f; // average of the colors (in reality this should be weighted by color)
		return float4(cDiffuse.rgb, nGlowAmount);
}

float4 psDiffuseGlowMask(UnlitOut pIn) : COLOR0
{
	float4 cDiffuse = tex2D(DiffMap, pIn.tTex);
	float nGlowAmount = ((cDiffuse.r + cDiffuse.g + cDiffuse.b))/3.0f; // average of the colors (in reality this should be weighted by color)
		return float4(nGlowAmount,nGlowAmount,nGlowAmount,cDiffuse.a);
}

/*-----------------------------------------------------------------------------------
||		ColorGlow (xyzw0 determines the glow color, where w is the intensity)
\*----------------------------------------------------------------------------------*/

float4 psColorGlow(UnlitOut pIn) : COLOR0
{
    float nGlowAmount = xyzw0.a * tex2D(DiffMap, pIn.tTex).a;
    return float4(xyzw0.rgb, nGlowAmount);
}

float4 psColorGlowMask(UnlitOut pIn) : COLOR0
{
    float nOpacity = tex2D(DiffMap, pIn.tTex).a;
    float nGlowAmount = xyzw0.a;
    return float4(nGlowAmount,nGlowAmount,nGlowAmount, nOpacity);
}

/*-----------------------------------------------------------------------------------
||		Shadow Mapping
\*----------------------------------------------------------------------------------*/

struct ShadowMapIn
{
	float3 oPos		: POSITION;
};

struct ShadowMapOut
{
	float4 pPos		 : POSITION;
	float tDepth	 : TEXCOORD0;
	float2 tZDepth	 : TEXCOORD1;
};

ShadowMapOut vsShadowMap(ShadowMapIn vIn)
{

	ShadowMapOut vOut = (ShadowMapOut)0;
	
	// mat0 == LIGHT VIEW MATRIX
	// mat1 == LIGHT PROJ MATRIX
	
	//   float4x4 texBias = {0.5f,	0.0f,	0.0f,	0.0f,
	//				    0.0f,	-0.5f,	0.0f,	0.0f,
	//					0.0f,	0.0f,	1.0f,	0.0f,
	//					0.5f,	0.5f,	0.0f,	1.0f };
	

	//vOut.pPos = mul(float4(vIn.oPos, 1), o2pMat);
	vOut.pPos = mul(float4(vIn.oPos, 1), o2wMat);
    vOut.pPos = mul(vOut.pPos, mul(mat0, mat1));
    vOut.tDepth = saturate(vOut.pPos.z / vOut.pPos.w);
    //vOut.tDepth = saturate((vOut.pPos.z / vOut.pPos.w + 1.0f) / (100.0f - 1.0f));
    
    vOut.tZDepth.xy = vOut.pPos.zw;

    return vOut;
}

float4 psShadowMap(ShadowMapOut pIn) : COLOR0
{
	float s = (pIn.tZDepth.x / pIn.tZDepth.y);
	//float s = pIn.tDepth;
	return float4(s,s,s,1.0f);
}



struct ShadowReceiverBlinnOut
{
	float4 pPos		 : POSITION;
	float2 tTex		 : TEXCOORD0;
	float3 wToLit	 : TEXCOORD1;
	float3 wNormal	 : TEXCOORD3;
	float4 tProjTex	 : TEXCOORD4;
};

ShadowReceiverBlinnOut vsShadowReceiver(BlinnIn vIn)
{

	ShadowReceiverBlinnOut vOut = (ShadowReceiverBlinnOut)0;
	
	// mat0 == LIGHT VIEW MATRIX
	// mat1 == LIGHT PROJ MATRIX
	
    float4x4 texBias = { 0.5f,	0.0f,	0.0f,	0.0f,
						0.0f,	-0.5f,	0.0f,	0.0f,
						0.0f,	0.0f,	1.0f,	0.0f,
						0.5f,	0.5f,	0.0f,	1.0f };
							
	float4 wPos		= mul(vIn.oPos, o2wMat);
     
    vOut.pPos		= mul(vIn.oPos, o2pMat);        
    vOut.wToLit		= wLitPos - wPos;
    vOut.wNormal	= mul(vIn.oNormal, (float3x3)o2wMat);
    vOut.tTex		= vIn.tTex;
	vOut.tProjTex	= mul(wPos, mul(mat0, mul(mat1, texBias)));
		return vOut;
}

float4 psShadowReceiver(ShadowReceiverBlinnOut pIn) : COLOR0
{
	float4 cDiffuseClr      = tex2D(DiffMap, pIn.tTex);
	float4 cLitPixelClr     = float4(CalcLitClr(cDiffuseClr.rgb, cLitClr, nLitInt, normalize(pIn.wToLit), normalize(pIn.wNormal))
                                   + CalcLitClr(cDiffuseClr.rgb, cAmbClr, nAmbInt), cDiffuseClr.a); // transparency
	float4 cShadowPixelClr  = tex2Dproj(ShadowMap, pIn.tProjTex);
	return saturate(cLitPixelClr * cShadowPixelClr);
}




/*-----------------------------------------------------------------------------------
||		Engine Version of the Techniques
\*----------------------------------------------------------------------------------*/

#ifdef _OPENFIST_
technique Constant		              { pass p0 {                                        DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAnim                { pass p0 {                                        DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstantAnim();   pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAlpha               { pass p0 {                                        DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } 
                                        pass p1 {                                        DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAlphaAnim           { pass p0 {                                        DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsConstantAnim();   pixelshader = compile ps_2_0 psConstant();        } 
                                        pass p1 {                                        DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstantAnim();   pixelshader = compile ps_2_0 psConstant();        } }
technique Unlit		                  { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAnim                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlpha                  { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlphaAnim              { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitFade                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       } }
technique UnlitFadeAnim               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlitFade();       }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlitFade();       } }
technique UnlitAlphaDepthDisable      { pass p0 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlphaDepthDisableAnim  { pass p0 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psUnlit();           } }
technique Blinn                       { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnShadow                 { pass p0 { DIFF_MAP; LINEAR_CLAMP_MAP(4);         DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsShadowReceiver(); pixelshader = compile ps_2_0 psShadowReceiver();  } }
technique BlinnAnim                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnAnim();      pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnAlpha		          { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnAlphaAnim	          { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnAnim();      pixelshader = compile ps_2_0 psBlinn();           }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnAnim();      pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnSpec                   { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAnim               { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAlpha              { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } 
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAlphaAnim          { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpec();       } 
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecGloss              { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAnim          { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAlpha	      { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  }
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAlphaAnim     { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpecGloss();  }
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpecAnim();  pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique Normal                      { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAnim                  { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalAnim();     pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAlpha	              { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          }
                                        pass p1 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAlphaAnim             { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalAnim();     pixelshader = compile ps_2_0 psNormal();          }
                                        pass p1 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalAnim();     pixelshader = compile ps_2_0 psNormal();          } }
technique NormalSpec	              { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();	    } }
technique NormalSpecAlpha	          { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      } }
technique NormalSpecAlphaAnim         { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpecAnim(); pixelshader = compile ps_2_0 psNormalSpec();      }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpecAnim(); pixelshader = compile ps_2_0 psNormalSpec();      } }
technique NormalSpecGloss             { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAnim         { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpecAnim(); pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAlpha        { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAlphaAnim    { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpecAnim(); pixelshader = compile ps_2_0 psNormalSpecGloss(); }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpecAnim(); pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique ShadowMapCreation           { pass p0 {                                                                                                           vertexshader = compile vs_2_0 vsShadowMap();      pixelshader = compile ps_2_0 psShadowMap();       } }
technique Mask                        { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsMask();           pixelshader = compile ps_2_0 psMask();            } }
technique MaskAnim                    { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsMaskAnim();       pixelshader = compile ps_2_0 psMask();            } }
technique MapGlowMask                 { pass p0 { DIFF_MAP;                     APP_MAP; DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psMapGlowMask();     } }
technique AlphaGlowMask               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psAlphaGlowMask();   } }
technique LightGlowMask               { pass p0	{ DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psLightGlowMask();   } }
technique ColorGlowMask               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psColorGlowMask();   } }
technique DiffuseGlowMask             { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psDiffuseGlowMask(); } }
technique MapGlow                     { pass p0 { DIFF_MAP;                     APP_MAP; DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psMapGlow();         } }
technique AlphaGlow                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psAlphaGlow();       } }
technique LightGlow                   { pass p0	{ DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psLightGlow();       } }
technique ColorGlow                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psColorGlow();       } }
technique DiffuseGlow                 { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psDiffuseGlow();     } }
technique MapGlowMaskAnim             { pass p0 { DIFF_MAP;                     APP_MAP; DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psMapGlowMask();     } }
technique AlphaGlowMaskAnim           { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psAlphaGlowMask();   } }
technique LightGlowMaskAnim           { pass p0	{ DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnAnim();      pixelshader = compile ps_2_0 psLightGlowMask();   } }
technique ColorGlowMaskAnim           { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psColorGlowMask();   } }
technique DiffuseGlowMaskAnim         { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psDiffuseGlowMask(); } }
technique MapGlowAnim                 { pass p0 { DIFF_MAP;                     APP_MAP; DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psMapGlow();         } }
technique AlphaGlowAnim               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psAlphaGlow();       } }
technique LightGlowAnim               { pass p0	{ DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnAnim();      pixelshader = compile ps_2_0 psLightGlow();       } }
technique ColorGlowAnim               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psColorGlow();       } }
technique DiffuseGlowAnim             { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlitAnim();      pixelshader = compile ps_2_0 psDiffuseGlow();     } }


/*-----------------------------------------------------------------------------------
||		XSI Version of the Techniques (no animation, shadows or glows)
\*----------------------------------------------------------------------------------*/

#else
technique Constant		              { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAnim                { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAlpha               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique ConstantAlphaAnim           { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsConstant();       pixelshader = compile ps_2_0 psConstant();        } }
technique Unlit		                  { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAnim                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlpha                  { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlphaAnim              { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitFade                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       } }
technique UnlitFadeAnim               { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlitFade();       } }
technique UnlitAlphaDepthDisable      { pass p0 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique UnlitAlphaDepthDisableAnim  { pass p0 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } 
                                        pass p1 { DIFF_MAP;                              DEPTH_DISABLE; ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsUnlit();          pixelshader = compile ps_2_0 psUnlit();           } }
technique Blinn                       { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnAnim                   { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnAlpha		          { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnAlphaAnim	          { pass p0 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           }
                                        pass p1 { DIFF_MAP;                              DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinn();          pixelshader = compile ps_2_0 psBlinn();           } }
technique BlinnSpec                   { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAnim               { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAlpha              { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } 
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecAlphaAnim          { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } 
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpec();       } }
technique BlinnSpecGloss              { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAnim          { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAlpha	      { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  }
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique BlinnSpecGlossAlphaAnim     { pass p0 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  }
                                        pass p1 { DIFF_MAP;           CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsBlinnSpec();      pixelshader = compile ps_2_0 psBlinnSpecGloss();  } }
technique Normal                      { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAnim                  { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAlpha	              { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          }
                                        pass p1 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalAlphaAnim             { pass p0 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          }
                                        pass p1 { DIFF_MAP; NORM_MAP;                    DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormal();         pixelshader = compile ps_2_0 psNormal();          } }
technique NormalSpec	              { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();	   } }
technique NormalSpecAlpha	          { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      } }
technique NormalSpecAlphaAnim         { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpec();      } }
technique NormalSpecGloss             { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAnim         { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_DISABLE; STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAlpha        { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
technique NormalSpecGlossAlphaAnim    { pass p0 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_REVERSE; vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); }
                                        pass p1 { DIFF_MAP; NORM_MAP; CHAN_MAP;          DEPTH_ENABLE;  ALPHA_BLEND_ENABLE;  STENCIL_DISABLE; CULL_ENABLE;  vertexshader = compile vs_2_0 vsNormalSpec();     pixelshader = compile ps_2_0 psNormalSpecGloss(); } }
#endif

