//builds the vertex list, assigns values for lighting and light rotation
        public Landscape(Game game, float rotationSpeed, int worldSize)
        {
            this.worldSize = worldSize;
            DiamondSquareGenerator();
            BuildVertexNormals();
            VertexPositionNormalColor[] vertexList = BuildVertexArray();
            vertices = Buffer.Vertex.New(game.GraphicsDevice, vertexList);
            this.rotationSpeed = rotationSpeed;

            zAngle = 0f;
            yAngle = (float)Math.PI;
            lightDirection = new Vector3(0f, (float)Math.Sin(yAngle), (float)Math.Cos(zAngle));
            specularColor = new Vector3(0.5f, 0.5f, 0.5f);
            diffuseColor = new Vector3(0.5f, 0.5f, 0.5f);
            ambientColor = new Vector3(0.1f, 0.1f, 0.1f);

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
                LightingEnabled = true,
                PreferPerPixelLighting = true,
                View = Matrix.LookAtLH(new Vector3(0, 0, -5), new Vector3(0, 0, 0), Vector3.UnitY),
                Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f,
                    (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 100.0f),
                World = Matrix.Identity
            };

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            this.game = game;
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            String response = "y";

            while (response == "y")
            {
                Game theGame = new Game();
                theGame.Play();

                Console.Write("Play Again (y/n)? ");
                response = Console.ReadLine();
            }
        }
Beispiel #3
0
 public Sun(Game game, float x, float yAngle, float zAngle, float sideLength, float rotationSpeed, float diameter)
 {
     this.rotationSpeed = rotationSpeed;
     this.x = x;
     this.yAngle = yAngle;
     this.zAngle = zAngle;
     this.sideLength = sideLength;
     this.diameter = diameter;
     this.projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f,
             (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 1000.0f);
     basicEffect = new BasicEffect(game.GraphicsDevice)
     {
         VertexColorEnabled = true,
         LightingEnabled = false,
         PreferPerPixelLighting = true,
         View = Matrix.LookAtLH(new Vector3(0, 0, -5), new Vector3(0, 0, 0), Vector3.UnitY),
         Projection = projection
     };
     this.game = game;
     BuildVertices();
 }
Beispiel #4
0
 // Ensures that all objects are being rendered from a consistent viewpoint  Vector3.UnitY  new Vector3(0,1,0)
 public Camera(Game game)
 {
     View = Matrix.LookAtLH(new Vector3(3, 3, 3), new Vector3(0, 0, 0), Vector3.UnitY);
     Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 100.0f);
     this.game = game;
 }
        public Landscape(Game game)
        {
            // generate the height map
            heightMap = DiamondSquareGrid(gridSize, seed, minHeight, maxHeight, roughness / 10.0f);

            // the number of vertices we will need
            int vertexCount = (gridSize - 1) * (gridSize - 1) * 6 + 12; // 12 for water

            // initialise the mesh
            VertexPositionNormalColor[] mesh = new VertexPositionNormalColor[vertexCount];

            // calculate the average height in Y off which to base colour.
            float sum = 0;
            for (int x = 0; x < gridSize - 1; x++)
            {
                for (int z = 0; z < gridSize - 1; z++)
                {
                    float y = heightMap[x][z];
                    sum += y;
                    if (y > biggestY)
                    {
                        biggestY = y;
                    }
                    else if (y < smallestY)
                    {
                        smallestY = y;
                    }
                }
            }
            averageHeight = sum / ((gridSize - 1)* (gridSize - 1));
            rangeY = biggestY - smallestY;
            waterHeight = smallestY + (rangeY / 2) - rangeY * 0.1f;

            // adjust camera to be above land and water (STATIC IN CAMERA CLASS NOW)
            // float heightAtCamera = heightAtPoint(cameraPosition.X, cameraPosition.Y);
            // cameraPosition.Y += ((waterHeight >= heightAtCamera) ? waterHeight : heightAtCamera);

            // generate vertices for the triangles based on the height map
            int counter = 0;
            for (int x=0; x<gridSize-1; x++)
            {
                for (int z=0; z<gridSize-1; z++)
                {
                    // pos Z
                    // tl - - tr
                    //  | \   |
                    //  |   \ |
                    // bl - - br  pos X

                    float botLeft = heightMap[x][z];
                    float topLeft = heightMap[x][z + 1];
                    float botRight = heightMap[x + 1][z];
                    float topRight = heightMap[x + 1][z + 1];

                    // Triangle A
                    Vector3 a1 = new Vector3(x * scale, botLeft * scale, z * scale);
                    Vector3 a2 = new Vector3(x * scale, topLeft * scale, z * scale + scale);
                    Vector3 a3 = new Vector3(x * scale + scale, botRight * scale, z * scale);
                    Vector3 aNormal = -Vector3.Cross(a1 - a2, a3  - a1);

                    mesh[counter++] = new VertexPositionNormalColor(a1, aNormal, getColor(a1.Y));
                    mesh[counter++] = new VertexPositionNormalColor(a2, aNormal, getColor(a2.Y));
                    mesh[counter++] = new VertexPositionNormalColor(a3, aNormal, getColor(a3.Y));

                    // Triangle B
                    Vector3 b1 = new Vector3(x * scale, topLeft * scale, z * scale + scale);
                    Vector3 b2 = new Vector3(x * scale + scale, topRight * scale, z * scale + scale);
                    Vector3 b3 = new Vector3(x * scale + scale, botRight * scale, z * scale);
                    Vector3 bNormal = -Vector3.Cross(b1 - b2, b3 - b1);

                    mesh[counter++] = new VertexPositionNormalColor(b1, bNormal, getColor(b1.Y));
                    mesh[counter++] = new VertexPositionNormalColor(b2, bNormal, getColor(b2.Y));
                    mesh[counter++] = new VertexPositionNormalColor(b3, bNormal, getColor(b3.Y));
                }
            }

            // WATER !
            // Top Triangle A
            Vector3 wt11 = new Vector3(0.0f, waterHeight * scale, 0.0f);
            Vector3 wt12 = new Vector3(0.0f, waterHeight * scale, (gridSize - 1) * scale);
            Vector3 wt13 = new Vector3((gridSize - 1) * scale, waterHeight * scale, 0.0f);

            mesh[counter++] = new VertexPositionNormalColor(wt11, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt12, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt13, Vector3.UnitY, waterColor);

            // Top Triangle B
            Vector3 wt21 = new Vector3(0.0f, waterHeight * scale, (gridSize - 1) * scale);
            Vector3 wt22 = new Vector3((gridSize - 1) * scale, waterHeight * scale, (gridSize - 1) * scale);
            Vector3 wt23 = new Vector3((gridSize - 1) * scale, waterHeight * scale, 0.0f);

            mesh[counter++] = new VertexPositionNormalColor(wt21, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt22, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt23, Vector3.UnitY, waterColor);

            // Bottom (reverse triangle definitions)
            mesh[counter++] = new VertexPositionNormalColor(wt11, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt13, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt12, Vector3.UnitY, waterColor);

            mesh[counter++] = new VertexPositionNormalColor(wt21, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt23, Vector3.UnitY, waterColor);
            mesh[counter++] = new VertexPositionNormalColor(wt22, Vector3.UnitY, waterColor);

            // Create vertex buffer
            vertices = Buffer.Vertex.New(game.GraphicsDevice, mesh);

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
                View = Matrix.LookAtLH(new Vector3(0, 0, 0), new Vector3(0, 0, 0), Vector3.UnitY),
                Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 100.0f),
                World = Matrix.Identity
            };

            // Lighting
            basicEffect.LightingEnabled = true;
            basicEffect.AmbientLightColor = new Vector3(0.15f, 0.15f, 0.15f);
            basicEffect.DirectionalLight0.DiffuseColor = new Vector3(0.4f, 0.4f, 0.4f);
            basicEffect.DirectionalLight0.SpecularColor = new Vector3(0.8f, 0.8f, 0.8f);

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            this.game = game;
        }
Beispiel #6
0
        public Sun(Game game, Landscape landscape)
        {
            this.landscape = landscape;
            this.terrain = landscape.Terrain;
            float sunsize = terrain.max / 4;
            numberUpdates = 80f;
            frontBottomLeftNormal = new Vector3(-0.333f, -0.333f,-0.333f);
            frontTopLeftNormal = new Vector3(-0.333f, 0.333f, -0.333f);
            frontTopRightNormal = new Vector3(0.333f, 0.333f, -0.333f);
            frontBottomRightNormal = new Vector3(0.333f,-0.333f, -0.333f);
            backBottomLeftNormal = new Vector3(-0.333f, -0.333f, 0.333f);
            backBottomRightNormal = new Vector3(0.333f, -0.333f, 0.333f);
            backTopLeftNormal = new Vector3(-0.333f,0.333f,0.333f);
            backTopRightNormal = new Vector3(0.333f, 0.333f , 0.333f);

            float sunX, sunY, sunZ, sunOffset;
            sunX = terrain.size; sunY = terrain.maxHeight + 10f; sunZ = terrain.size/2; sunOffset = 40f;
            frontBottomLeft = new Vector3(sunX-sunOffset, sunY - sunOffset, sunZ-sunOffset);
            frontTopLeft = new Vector3(sunX-sunOffset, sunY + sunOffset, sunZ-sunOffset);
            frontTopRight = new Vector3(sunX + sunOffset, sunY + sunOffset, sunZ-sunOffset);
            frontBottomRight = new Vector3(sunX + sunOffset, sunY - sunOffset, sunZ-sunOffset);
            backBottomLeft = new Vector3(sunX-sunOffset, sunY - sunOffset, sunZ + sunOffset);
            backBottomRight = new Vector3(sunX + sunOffset, sunY - sunOffset, sunZ + sunOffset);
            backTopLeft = new Vector3(sunX-sunOffset, sunY + sunOffset, sunZ + sunOffset);
            backTopRight = new Vector3(sunX + sunOffset, sunY + sunOffset, sunZ + sunOffset);

            vertices = Buffer.Vertex.New(
                game.GraphicsDevice,
                new[]
                    {
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow), // Front
                    new VertexPositionNormalColor(frontTopLeft, frontTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopRight, frontTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopRight, frontTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomRight, frontBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomLeft, backBottomLeftNormal, Color.Yellow), // BACK
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopLeft, backTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomLeft, backBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomRight, backBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopLeft, frontTopLeftNormal, Color.Yellow), // Top
                    new VertexPositionNormalColor(backTopLeft, backTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopLeft, frontTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopRight, frontTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow), // Bottom
                    new VertexPositionNormalColor(backBottomRight, backBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomLeft, backBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomRight, frontBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomRight, backBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow), // Left
                    new VertexPositionNormalColor(backBottomLeft, backBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopLeft, backTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomLeft, frontBottomLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopLeft, backTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopLeft, frontTopLeftNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomRight, frontBottomRightNormal, Color.Yellow), // Right
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backBottomRight, backBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontBottomRight, frontBottomRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(frontTopRight, frontTopRightNormal, Color.Yellow),
                    new VertexPositionNormalColor(backTopRight, backTopRightNormal, Color.Yellow),
            });

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
                View = Matrix.LookAtLH(landscape.currentPosition, landscape.currentTarget, landscape.currentUp),
                Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, -10.0f, (float)terrain.size * 2),
                World = Matrix.Identity,
            };

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            this.game = game;
        }
Beispiel #7
0
        public Landscape(Game game)
        {
            Terrain = new HeightMap(10);

            terrain3D = new VertexPositionNormalColor[Terrain.max * Terrain.max * 6  + 12];
            int index = 0;
            for (int z = 0; z < Terrain.max; z++)
            {
                for (int x = 0; x < Terrain.max; x++)
                {
                    // Front left.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x, Terrain.get(x,z), z), Terrain.getVertexNormal(x,z) , Terrain.getColor(x,z));
                    index++;
                    // Back left.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x, Terrain.get(x, z + 1), z + 1), Terrain.getVertexNormal(x, z + 1), Terrain.getColor(x, z+1));
                    index++;

                    // Back right.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x + 1, Terrain.get(x + 1, z + 1), z + 1), Terrain.getVertexNormal(x + 1, z + 1), Terrain.getColor(x+1, z+1));
                    index++;

                    // Front left.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x, Terrain.get(x, z), z), Terrain.getVertexNormal(x, z), Terrain.getColor(x, z));
                    index++;

                    // Back right.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x + 1, Terrain.get(x + 1, z + 1), z + 1), Terrain.getVertexNormal(x + 1, z + 1), Terrain.getColor(x+1, z+1));
                    index++;

                    // Front right.
                    terrain3D[index] = new VertexPositionNormalColor(new Vector3(x + 1, Terrain.get(x + 1, z), z), Terrain.getVertexNormal(x + 1, z), Terrain.getColor(x+1, z));
                    index++;
                }
            }

            Color blue = Color.MidnightBlue;
            blue.A = 0xC0;

            waterHeight = 0.695f * Terrain.maxHeight;

            //Set Water Polygons
            // Front left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Front left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Front right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            //water from the bottom
            // Front left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Front left.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(0.0f, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Front right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            // Back right.
            terrain3D[index] = new VertexPositionNormalColor(new Vector3(Terrain.max, waterHeight, Terrain.max), new Vector3(0.0f, 1.0f, 0.0f), blue);
            index++;

            //initialized here because I wanted the terrain details to place the initial position/target.
            currentPosition = new Vector3(0.0f, Terrain.maxHeight, 0.0f); //start on corner of map at highest point of terrain
            currentTarget = new Vector3(Terrain.max, Terrain.maxHeight, Terrain.max); //looking across to other corner (same height)
            currentUp = Vector3.UnitY;
            prevMouseX = 0.5f;
            prevMouseY = 0.5f;

            vertices = Buffer.Vertex.New(game.GraphicsDevice, terrain3D);

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
                View = Matrix.LookAtLH(currentPosition, currentTarget, currentUp),
                Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, -10.0f, (float)Terrain.size * 2),
                World = Matrix.Identity,
                LightingEnabled = true
            };

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            basicEffect.EnableDefaultLighting();

            basicEffect.AmbientLightColor = new Vector3(.1f * 255/255, .1f * 244/255, .1f * 229/255);

            this.game = game;
        }
        public Sun(Game game)
        {
            // start position of the sun.
            pos = new Vector3(centre, 0, centre);

            var points = new[] { new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f),Vector3.Zero, Color.Yellow), // Front
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, -1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, -1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, 1.0f),Vector3.Zero, Color.Yellow), // BACK
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, 1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, 1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, 1.0f),Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, -1.0f),Vector3.Zero, Color.Yellow), // Top
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, -1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f),Vector3.Zero, Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f),Vector3.Zero, Color.Yellow), // Bottom
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow), // Left
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(-1.0f, 1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow), // Right
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, 1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, -1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, -1.0f), Vector3.Zero,Color.Yellow),
                        new VertexPositionNormalColor(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero,Color.Yellow) };

            // Scale and position the sun
            for (var i=0; i<points.Length; i++)
            {
                points[i].Position = points[i].Position*size + pos*landscapeScale;
            }

            vertices = Buffer.Vertex.New(
                game.GraphicsDevice,
                points);

            basicEffect = new BasicEffect(game.GraphicsDevice)
            {
                VertexColorEnabled = true,
                View = Matrix.LookAtLH(new Vector3(0, 0, -10), new Vector3(0, 0, 0), Vector3.UnitY),
                Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)game.GraphicsDevice.BackBuffer.Width / game.GraphicsDevice.BackBuffer.Height, 0.1f, 1000.0f),
                World = Matrix.Identity
            };

            inputLayout = VertexInputLayout.FromBuffer(0, vertices);
            this.game = game;
        }