#include "Types.h" //----------------------------------------------------- // Our Basic Settings //----------------------------------------------------- texture tNewDiffuse < string TextureType = "2D"; >; float NewDiffuseUTile<string UIDesc = "Diffuse U-Tile"; > = 1; float NewDiffuseVTile<string UIDesc = "Diffuse V-Tile"; > = 1; sampler sNewDiffuse = sampler_state { SRGBTexture = (useSRGB); Texture = (tNewDiffuse ); AddressU = Wrap; AddressV = Wrap; MinFilter = (texFilter); MagFilter = (texFilter); MaxAnisotropy = (maxAnisotropy); }; texture tNewBump < string TextureType = "2D"; >; float NewBumpUTile<string UIDesc = "Diffuse U-Tile"; > = 1; float NewBumpVTile<string UIDesc = "Diffuse V-Tile"; > = 1; sampler sNewBump = sampler_state { SRGBTexture = (useSRGB); Texture = (tNewBump ); AddressU = Wrap; AddressV = Wrap; MinFilter = (texFilter); MagFilter = (texFilter); MaxAnisotropy = (maxAnisotropy); }; //----------------------------------------------------------------------------- // Our New Shader //----------------------------------------------------------------------------- struct NewShader_Point_Pixel { float3 LightTangent : TEXCOORD0; float3 LightDist : TEXCOORD1; float4 BaseAndBump : TEXCOORD2; float4 Pos : TEXCOORD3; float4 Position : POSITION; float Fog : FOG; }; NewShader_Point_Pixel V_NewShader_Point( Vertex IN) { NewShader_Point_Pixel OUT; OUT.BaseAndBump.xy = Transform(IN.TexCoord0,float2(NewDiffuseUTile, NewDiffuseVTile)); OUT.BaseAndBump.zw = Transform(IN.TexCoord0,float2(NewBumpUTile, NewBumpVTile)); CalculateLighting(IN,OUT.LightTangent,OUT.LightDist); OUT.Position = mul(IN.Pos,mWorldViewProjection); OUT.Fog = 1; OUT.Pos = OUT.Position; return OUT; } float4 P_NewShader_Point( NewShader_Point_Pixel IN ) : COLOR { float4 Diffuse = tex2D(sNewDiffuse, IN.BaseAndBump.xy); float4 Bump = tex2D(sNewBump, IN.BaseAndBump.zw); float3 L = normalize(IN.LightTangent); float3 N = GetNormal(Bump); float NL = saturate(dot(N,L)); float4 color = float4(Diffuse.rgb*LightColor.rgb*NL*GetAttenuation(IN.LightDist),1); if(bHDRBlend) color = color + GetColorBuffer(IN.Pos); return color; } technique NewShaderPoint { pass p0 { alphablendenable = (0); AlphaTestEnable = (0); SrcBlend = (SourceBlend); DestBlend = (DestBlend); vertexshader = compile vs_2_0 V_NewShader_Point(); pixelshader = compile ps_2_0 P_NewShader_Point(); } }