public SkyRenderer(ContentManager contentManager, Camera camera)
            : base(contentManager)
        {
            this.camera = camera;
             skyDome = Content.Load<Model>("sky_dome");
             effect = Content.Load<Effect>("sky");
             skyDome.Meshes[0].MeshParts[0].Effect = effect.Clone(Device);
             projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Device.Viewport.AspectRatio,
            Config.Instance.Rendering.NearClippingDistance, Config.Instance.Rendering.FarClippingDistance);

             var pp = Device.PresentationParameters;
             cloudsRenderTarget = new RenderTarget2D(Device, pp.BackBufferWidth, pp.BackBufferHeight, 1, Device.DisplayMode.Format);
             cloudStaticMap = CreateStaticMap(32);

             fullScreenVertexDeclaration = new VertexDeclaration(Device, VertexPositionTexture.VertexElements);
             fullScreenVertices = SetUpFullscreenVertices();
        }
        public WaterRenderer(ContentManager contentManager, Scene scene, Camera camera)
            : base(contentManager)
        {
            effect = Content.Load<Effect>("water");
             bumpTexture = Content.Load<Texture2D>("water_texture");

             bumpTexture.GenerateMipMaps(TextureFilter.Anisotropic);
             this.camera = camera;

             var vertices = new VertexPositionTexture[6 * scene.Water.WaterQuads.Count];
             int idx = 0;
             foreach (var quad in scene.Water.WaterQuads)
             {
            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmin, quad.Level, -quad.Ymin),
               new Vector2(quad.Xmin, -quad.Ymin) / WaterTextureCoordsDivisor);
            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmax, quad.Level, -quad.Ymin),
               new Vector2(quad.Xmax, -quad.Ymin) / WaterTextureCoordsDivisor);
            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmin, quad.Level, -quad.Ymax),
               new Vector2(quad.Xmin, -quad.Ymax) / WaterTextureCoordsDivisor);

            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmax, quad.Level, -quad.Ymin),
               new Vector2(quad.Xmax, -quad.Ymin) / WaterTextureCoordsDivisor);
            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmax, quad.Level, -quad.Ymax),
               new Vector2(quad.Xmax, -quad.Ymax) / WaterTextureCoordsDivisor);
            vertices[idx++] = new VertexPositionTexture(new Vector3(quad.Xmin, quad.Level, -quad.Ymax),
               new Vector2(quad.Xmin, -quad.Ymax) / WaterTextureCoordsDivisor);
             }

             vertexBuffer = new VertexBuffer(Device, vertices.Length * VertexPositionTexture.SizeInBytes, BufferUsage.None);
             vertexBuffer.SetData(vertices);
             vertexDeclaration = new VertexDeclaration(Device, VertexPositionTexture.VertexElements);
             primitivesToDraw = scene.Water.WaterQuads.Count * 2;

             projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Device.Viewport.AspectRatio,
            Config.Instance.Rendering.NearClippingDistance, Config.Instance.Rendering.FarClippingDistance);
        }
        public void Initialize()
        {
            camera = new Camera();
             camera.UpdatePosition(new Vector3(0, 100, 0));

             textInfoPanel = new InfoPanelFor3Dview(Content);
             textInfoPanel.Camera = camera;
             AddSubRenderer(textInfoPanel);

             projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Device.Viewport.AspectRatio,
            Config.Instance.Rendering.NearClippingDistance, Config.Instance.Rendering.FarClippingDistance);

             effect = Content.Load<Effect>("effect");

             waterRenderer = new WaterRenderer(Content, SceneContent, camera);
             skyRenderer = new SkyRenderer(Content, camera);
             secondDepthBuffer = new DepthStencilBuffer(Device, Device.PresentationParameters.BackBufferWidth, Device.PresentationParameters.BackBufferHeight, Device.DepthStencilBuffer.Format);

             Mouse.SetPosition(Device.Viewport.Width / 2, Device.Viewport.Height / 2);
             originalMouseState = Mouse.GetState();
        }