protected override void PreRender(VoxelSystemScene scene)
        {
            Camera.ViewMatrix = scene.Player.ViewMatrix;
            ShadowMap.SetLightDirection(scene.SunDirection);
            var center = scene.Player.Transform.WorldPosition;

            center.Floor();
            ShadowMap.SetCenter(center);
            VoxelBodyRenderer.SetCamera(Camera);
            VoxelBodyRenderer.SetShadowMap(ShadowMap);
        }
        public VoxelSystemSceneRenderer()
        {
            // terrain material
            var terrainMaterial = new VoxelTerrainMaterial();

            terrainMaterial.DiffuseIntensity = 0.1f;
            terrainMaterial.AmbientIntensity = 0.8f;
            terrainMaterial.MainTexture      = G.Assets.VoxelTextureAtlas.AtlasTexture;
            terrainMaterial.SunlightColor    = new Color(255, 255, 192);
            terrainMaterial.StarlightColor   = new Color(0, 20, 70);
            VoxelBodyRenderer = new VoxelBodyRenderer(terrainMaterial);

            Camera.ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(90), G.Graphics.Viewport.AspectRatio, 0.01f, 1000);

            // selection wireframe
            _selectionWireframe = new SelectionWireframe(new BasicEffect(G.Graphics));
            _selectionWireframe.Effect.DiffuseColor = Vector3.Zero;
            _selectionWireframe.Effect.Projection   = Camera.ProjectionMatrix;
            ShadowMap = new ShadowMap(4096 * 4);
            ShadowMap.SetCenter(Vector3.Zero);
            ShadowMap.SetRadius(100);
        }