public void RecreateTest() { int rows = 8; int cols = 10; TerrainInfo info = new TerrainInfo() { SouthWestLatLong = new Vector2(-37, 174), NorthEastLatLong = new Vector2(-36.999f, 174.001f), DegreesLatitudePerPixel = 0.001 / (double)rows, DegreesLongitudePerPixel = 0.001 / (double)cols }; float[,] altInMetres = info.CreateFlatAltitudes(rows, cols); Terrain terrain = new Terrain(); terrain.Recreate(info, altInMetres); SquareGrid grid = new SquareGrid(rows, cols, 1, 1); Assert.AreEqual(rows, terrain.LatRows); Assert.AreEqual(cols, terrain.LongColumns); Vector3 centreVertex = terrain.Vertices[terrain.Vertices.Length / 2]; VectorAssertions.AreEqual(new Vector3(), centreVertex, 0.1, "Centre vertex does not match"); }
public static void FlatTerrainGridTest() { using (WorldWindow game = new WorldWindow()) { Vector3 eye = new Vector3(-4000, 4000, -4000); game.Camera.LookAt(eye, new Vector3()); game.CameraControl.MoveSpeed = 1000; Terrain terrain = new Terrain(); int rows = 80; int cols = 100; TerrainInfo info = new TerrainInfo() { SouthWestLatLong = new Vector2(-37, 174), NorthEastLatLong = new Vector2(-36.9f, 174.1f), DegreesLatitudePerPixel = 0.2 / (double)rows, DegreesLongitudePerPixel = 0.2 / (double)cols }; float[,] altInMetres = info.CreateFlatAltitudes(rows, cols); terrain.Recreate(info, altInMetres); ShaderModelRenderer sm = new ShaderModelRenderer(terrain); game.Models.Add(sm); UserInterface ui = new UserInterface(game); float time = 0; game.UpdateFrame += (o, e) => { time += (float)e.Time; double fps = e.Time == 0 ? 1000 : 1.0 / e.Time; ui.PrintCommonStats(e.Time); }; game.Run(30); } }