/// <summary>
        /// Add a new spot light to the render.
        /// </summary>
        /// <param name="spotLight">New spot light to be added.</param>
        public void AddSpotLight(SpotLight spotLight)
        {
            _directionalLightEffect.Parameters["colorMap"].SetValue(_colorTarget);
            _directionalLightEffect.Parameters["normalMap"].SetValue(_normalTarget);
            _directionalLightEffect.Parameters["depthMap"].SetValue(_depthTarget);

            _directionalLightEffect.Parameters["lightDirection"].SetValue(spotLight.Direction);
            _directionalLightEffect.Parameters["Color"].SetValue(Color.White.ToVector3());

            _directionalLightEffect.Parameters["cameraPosition"].SetValue(CameraManager.ActiveCamera.Position);
            _directionalLightEffect.Parameters["InvertViewProjection"].SetValue(
                Matrix.Invert(CameraManager.ActiveCamera.View * CameraManager.ActiveCamera.Projection));

            _directionalLightEffect.Parameters["halfPixel"].SetValue(_halfPixel);

            _directionalLightEffect.Techniques[0].Passes[0].Apply();
            _quadRenderer.Render(Vector2.One * -1, Vector2.One);
        }
        /// <summary>
        /// Load all the neccessary elements of the renderer, including render targets,
        /// point and spot lights.
        /// </summary>
        public void LoadContent()
        {
            // Calculate the halfPixel value
            _halfPixel = new Vector2()
            {
                X = 0.5f / (float)EngineManager.GameGraphicsDevice.PresentationParameters.BackBufferWidth,
                Y = 0.5f / (float)EngineManager.GameGraphicsDevice.PresentationParameters.BackBufferHeight
            };

            _quadRenderer.LoadContent();

            // Create the Render Targets in which will render the objects
            PresentationParameters pp = EngineManager.GameGraphicsDevice.PresentationParameters;
            int           width       = pp.BackBufferWidth;
            int           height      = pp.BackBufferHeight;
            SurfaceFormat format      = pp.BackBufferFormat;

            _colorTarget = new RenderTarget2D(EngineManager.GameGraphicsDevice, width, height, false,
                                              SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount,
                                              RenderTargetUsage.PreserveContents);
            _normalTarget = new RenderTarget2D(EngineManager.GameGraphicsDevice, width, height, false,
                                               SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount,
                                               RenderTargetUsage.PreserveContents);
            _depthTarget = new RenderTarget2D(EngineManager.GameGraphicsDevice, width, height, false,
                                              SurfaceFormat.Single, pp.DepthStencilFormat, pp.MultiSampleCount,
                                              RenderTargetUsage.PreserveContents);
            _lightsTarget = new RenderTarget2D(EngineManager.GameGraphicsDevice, width, height, false,
                                               SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount,
                                               RenderTargetUsage.PreserveContents);

            // Load the effects to be used in the deferred rendering
            _renderGBuffer          = EngineManager.ContentManager.Load <Effect>("Content/Effects/RenderGBuffer");
            _directionalLightEffect = EngineManager.ContentManager.Load <Effect>("Content/Effects/DirectionalLight");
            _finalCombineEffect     = EngineManager.ContentManager.Load <Effect>("Content/Effects/CombineFinal");
            _pointLightEffect       = EngineManager.ContentManager.Load <Effect>("Content/Effects/PointLight");

            // Create the point lights in the scene
            _pointLights = new PointLight[4];

            _pointLights[0] = new PointLight();
            _pointLights[0].lightPosition  = new Vector3(0, 10, 5);
            _pointLights[0].color          = Color.White;
            _pointLights[0].lightRadius    = 15;
            _pointLights[0].LightIntensity = 5;

            _pointLights[1] = new PointLight();
            _pointLights[1].lightPosition  = new Vector3(10, 10, 5);
            _pointLights[1].color          = Color.White;
            _pointLights[1].lightRadius    = 15;
            _pointLights[1].LightIntensity = 5;

            _pointLights[2] = new PointLight();
            _pointLights[2].lightPosition  = new Vector3(20, 10, 5);
            _pointLights[2].color          = Color.White;
            _pointLights[2].lightRadius    = 15;
            _pointLights[2].LightIntensity = 5;

            _pointLights[3] = new PointLight();
            _pointLights[3].lightPosition  = new Vector3(25, 25, -25);
            _pointLights[3].color          = Color.White;
            _pointLights[3].lightRadius    = 50;
            _pointLights[3].LightIntensity = 50;

            // Create the spot lights in the scene
            _spotLights = new SpotLight[3];

            _spotLights[0]           = new SpotLight();
            _spotLights[0].Position  = new Vector3(0, 10, 5);
            _spotLights[0].Direction = new Vector3(0, -1, -1);
            _spotLights[0].Strength  = 0.7f;
            _spotLights[0].ConeAngle = 0.5f;
            _spotLights[0].ConeDelay = 2.0f;

            _spotLights[1]           = new SpotLight();
            _spotLights[1].Position  = new Vector3(10, 10, 0);
            _spotLights[1].Direction = new Vector3(10, 0, 0);
            _spotLights[1].Strength  = 0.7f;
            _spotLights[1].ConeAngle = 0.5f;
            _spotLights[1].ConeDelay = 2.0f;

            _spotLights[2]           = new SpotLight();
            _spotLights[2].Position  = new Vector3(20, 10, 0);
            _spotLights[2].Direction = new Vector3(20, 0, 0);
            _spotLights[2].Strength  = 0.7f;
            _spotLights[2].ConeAngle = 0.5f;
            _spotLights[2].ConeDelay = 2.0f;
        }