//////////////////////////////////////////////////////////////////////////////// // Filename: light.ps //////////////////////////////////////////////////////////////////////////////// ///////////// // DEFINES // ///////////// #define NUM_LIGHTS 4 ///////////// // GLOBALS // ///////////// Texture2D shaderTexture : register(t0); SamplerState SampleType : register(s0); cbuffer LightBuffer { float4 ambientColor; float3 lightDirection; float padding; float specularPower; float4 specularColor; }; cbuffer LightColorBuffer { float4 diffuseColor[NUM_LIGHTS]; }; ////////////// // TYPEDEFS // ////////////// struct PixelInputType { float4 position : SV_POSITION; float2 tex : TEXCOORD0; float3 normal : NORMAL; float3 lightPos[NUM_LIGHTS] : TEXCOORD1; }; //////////////////////////////////////////////////////////////////////////////// // Pixel Shader //////////////////////////////////////////////////////////////////////////////// float4 LightPixelShader(PixelInputType input) : SV_TARGET { float4 textureColor; float3 lightDir; float4 color; float3 reflection; float4 specular; float lightIntensity[NUM_LIGHTS]; float4 colorArray[NUM_LIGHTS]; float4 colorSum; int i; // Sample the pixel color from the texture using the sampler at this texture coordinate location. textureColor = shaderTexture.Sample(SampleType, input.tex); for(i=0; i