Пример #1
0
        public void GetMapTest_1x1()
        {
            AltitudeMapReader reader = new Srtm3Reader();

            Vector2 southWest = new Vector2(-37, 173);
            Vector2 northEast = new Vector2(-36, 174);

            Vector2 diff = northEast - southWest;


            Vector3[,] h = reader.GetMap(southWest, northEast);

            Assert.AreEqual(diff.X * reader.TileHeight, (float)h.GetLength(0), 0.01);
            Assert.AreEqual(diff.Y * reader.TileWidth, (float)h.GetLength(1), 0.01);
        }
Пример #2
0
        public void GetSrtmNZMapTest()
        {
            TiledAltitudeMapReader reader = new Srtm3Reader();


            Vector2 southWest = new Vector2(-37, 173);
            Vector2 northEast = new Vector2(-36f, 174);

            Vector2 diff = northEast - southWest;



            Vector3[,] h = reader.GetMap(southWest, northEast);
            Assert.AreEqual(diff.X * reader.TileHeight / reader.DegreesLatitudePerTile, (float)h.GetLength(0), 0.01);
            Assert.AreEqual(diff.Y * reader.TileWidth / reader.DegreesLongitudePerTile, (float)h.GetLength(1), 0.01);
        }
Пример #3
0
        public static void AucklandTerrainGridTest()
        {
            using (WorldWindow game = new WorldWindow())
            {
                Vector3 eye = new Vector3(-1000, 4000, -1000);
                game.Camera.LookAt(eye, new Vector3());
                game.CameraControl.MoveSpeed = 1000;
                game.SetZRange(100, 100000);

                Vector2 SouthWestLatLong = new Vector2(-37, 174);
                Vector2 NorthEastLatLong = new Vector2(-36, 175);
                Terrain terrain          = new Terrain();

                TiledAltitudeMapReader mapReader = new Srtm3Reader()
                {
                    AltitudeScale = 10
                };
                Vector3[,] lla = mapReader.GetMap(SouthWestLatLong, NorthEastLatLong);


                Vector2 auckland = new Vector2(-36.8468f, 174.7908f);
                terrain.Recreate(lla, auckland);

                ShaderModelRenderer sm = new ShaderModelRenderer(terrain)
                {
                    VertexShaderFilaneme = "Shaders/vs_norm.glsl"
                };

                game.Models.Add(sm);


                UserInterface ui = new UserInterface(game);

                game.RenderFrame += (o, e) => ui.PrintCommonStats(e.Time);


                game.Run(30);
            }
        }