public void TestSpotLightRendererShadowing()
        {
            var game = new DX11Game();

            game.InitDirectX();
            var device  = game.Device;
            var context = device.ImmediateContext;

            var filledGBuffer = new TestFilledGBuffer(game, 800, 600);

            var light = new SpotLightRenderer(game, filledGBuffer.GBuffer);

            light.LightRadius *= 2;

            light.ShadowsEnabled = true;

            var toggle = false;



            game.GameLoopEvent += delegate
            {
                filledGBuffer.DrawUpdatedGBuffer();

                light.UpdateLightCamera();
                game.Camera = light.LightCamera;

                light.UpdateShadowMap(filledGBuffer.Draw);

                game.Camera = game.SpectaterCamera;


                game.SetBackbuffer();

                if (game.Keyboard.IsKeyPressed(Key.C))
                {
                    toggle = !toggle;
                }

                if (toggle)
                {
                    light.SpotDirection = game.SpectaterCamera.CameraDirection;
                    light.LightPosition = game.SpectaterCamera.CameraPosition;
                }

                if (game.Keyboard.IsKeyDown(Key.I))
                {
                    GBufferTest.DrawGBuffer(game, filledGBuffer.GBuffer);
                }
                else
                {
                    light.Draw();
                    game.TextureRenderer.Draw(light.ShadowMapRv, new Vector2(10, 10), new Vector2(300, 300));
                    game.LineManager3D.AddViewFrustum(light.LightCamera.ViewProjection,
                                                      new Color4(1, 0, 0));
                }
            };

            game.Run();
        }
        private void updateSpotShadows(SpotLightRenderer r, FrustumCullerView view)
        {
            var oldCam = game.Camera;

            r.UpdateLightCamera();
            game.Camera = r.LightCamera;
            //TODO: fix culling+removing of elements
            //view.UpdateVisibility(r.LightCamera.ViewProjection);
            //setMeshRendererVisibles(view);
            r.UpdateShadowMap(meshesRenderer.DrawShadowCastersDepth);
            game.Camera = oldCam;
        }