//////////////////////////////////////////////////////////////////////////////// // Filename: light.ps //////////////////////////////////////////////////////////////////////////////// ///////////// // DEFINES // ///////////// #define NUM_LIGHTS 4 ///////////// // GLOBALS // ///////////// Texture2D shaderTexture : register(t0); SamplerState SampleType : register(s0); 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; float lightIntensity[NUM_LIGHTS]; float4 colorArray[NUM_LIGHTS]; float4 colorSum; float4 color; int i; // Sample the texture pixel at this location. textureColor = shaderTexture.Sample(SampleType, input.tex); for(i=0; i