private void AddLight(SpotLight spotLight)
        {
            effect2Lights.CurrentTechnique = effect2Lights.Techniques["DeferredSpotLight"];
            effect2Lights.Parameters["xNormalMap"].SetValue(normalMap);
            effect2Lights.Parameters["xDepthMap"].SetValue(depthMap);

            effect2Lights.Parameters["xLightPosition"].SetValue(spotLight.Position);
            effect2Lights.Parameters["xLightStrength"].SetValue(spotLight.Strength);
            effect2Lights.Parameters["xConeDirection"].SetValue(spotLight.Direction);
            effect2Lights.Parameters["xConeAngle"].SetValue(spotLight.ConeAngle);
            effect2Lights.Parameters["xConeDecay"].SetValue(spotLight.ConeDecay);

            Matrix viewProjInv = Matrix.Invert(fpsCam.ViewMatrix * fpsCam.ProjectionMatrix);

            effect2Lights.Parameters["xViewProjectionInv"].SetValue(viewProjInv);

            effect2Lights.Begin();
            foreach (EffectPass pass in effect2Lights.CurrentTechnique.Passes)
            {
                pass.Begin();
                device.VertexDeclaration = fsVertexDeclaration;
                device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleStrip, fsVertices, 0, 2);
                pass.End();
            }
            effect2Lights.End();
        }
        private void RenderShadowMap(SpotLight spotLight)
        {
            device.SetRenderTarget(0, shadowTarget);

            effectShadowMap.CurrentTechnique = effectShadowMap.Techniques["ShadowMap"];
            effectShadowMap.Parameters["xView"].SetValue(spotLight.ViewMatrix);
            effectShadowMap.Parameters["xProjection"].SetValue(spotLight.ProjectionMatrix);
            RenderScene(effectShadowMap);

            device.SetRenderTarget(0, null);
            shadowMap = shadowTarget.GetTexture();
        }