//Effect to render a poygon with texturing no lighting allowing UV wrapping

matrix matWorldViewProj;	//The World*View*Projection matrix

texture texDiffuseMap; //The diffuse colour texture map

//First technique is for VS1.0 and PS1.0
technique VS1_0__PS_1_0
{
	pass P0
	{
		//Load matrices
		VertexShaderConstant[0] = <matWorldViewProj>; // World*View*Projection
		
		Texture[0] = NULL;
		
		// textures
		Texture[0] = <texDiffuseMap>;
		MipFilter[0] = LINEAR;
		MinFilter[0] = LINEAR;
		MagFilter[0] = LINEAR;
		
		VertexShader = 
		decl
		{
			stream 0;
			float v0[3];	//Vertex Position
			d3dcolor v1[1];	//Vertex Colour
			float v2[2];	//Vertex UV1
			float v3[2];	//Vertex UV2
		}
		asm
		{
			vs.1.0					//Version 1.0 Vertex Shader
			m4x4	oPos, v0, c0	//Transform vertex to projection space and place in position output register
			mov		oD0, v1			//Move vertex colour into colour output register
			mov		oT0, v2			//Move vertex texture coord into texture output register
		};
		PixelShader =
		asm
		{
			ps.1.0					//Version 1.0 Pixel Shader
			tex t0					//Declare the diffuse texture
			mul r0, t0, v0			//Multiply the input vertex colour and texture colour into output colour register
		};
	}
}

//Second technique for no shaders
technique TNoShader
{
    pass P0
    {
        LightEnable[0] = FALSE;
        Lighting       = FALSE;
        SpecularEnable = FALSE;
        
        PixelShader = NULL;
        VertexShader = XYZ | Diffuse | Tex2;
        
        // textures
        Texture[0] = <texDiffuseMap>;
        MipFilter[0] = LINEAR;
		MinFilter[0] = LINEAR;
		MagFilter[0] = LINEAR;
        
        // texture stages
        ColorOp[0]   = MODULATE;
        ColorArg1[0] = TEXTURE;
        ColorArg2[0] = DIFFUSE;
        AlphaOp[0]   = MODULATE;
        AlphaArg1[0] = TEXTURE;
        AlphaArg2[0] = DIFFUSE;

        ColorOp[1]   = DISABLE;
        AlphaOp[1]   = DISABLE;
    }
}