public ClipmapTerrainManager(MultipleEffect3DEngine engine, Effect effect) { this.engine = engine; this.effect = effect; WidthInTiles = 1; WidthOfTiles = 256; TerrainFetcher = new Srtm3TextureFetcher(); StartingLongLat = new PointF(174, -37); TextureVariableName = "HiresTexture"; engine.InitializationComplete += (o, e) => { OnInitComplete(); }; engine.PreRendering += (o, e) => { OnPreRender(); }; engine.PostRendering += (o, e) => OnPostRender(); engine.CameraChanged += (o, e) => { OnCameraChanged(e); }; }
public void TestStrm3() { latLongRegion = new RectangleF(lng - w * 0.5f, lat - h * 0.5f, w, h); long t0 = System.Environment.TickCount; long t1 = System.Environment.TickCount; TerrainHeightTextureFetcher fetcher = new Srtm3TextureFetcher(); terrain = fetcher.FetchTerrain(latLongRegion); t0 = t1; t1 = System.Environment.TickCount; Console.WriteLine("Load: "+((t1-t0)/10)); Image img = ImagingFunctions.CreateImageFromArray(terrain, ImagingFunctions.HsvColourMap(256)); t0 = t1; t1 = System.Environment.TickCount; Console.WriteLine("Copy Image: " + ((t1 - t0) / 10)); ImagingFunctions.SaveAndDisplayImage(img, "terrainFetch.png"); t0 = t1; t1 = System.Environment.TickCount; Console.WriteLine("Save and show: " + ((t1 - t0) / 10)); }
private void FetchHiresTerrain() { TerrainHeightTextureFetcher fetcher = new Srtm3TextureFetcher(); Vector2 terrainLocation = new Vector2((float)MathExtensions.Round(initialTerrainLocation.X, 0.125), (float)MathExtensions.Round(initialTerrainLocation.Y, 0.125)); hiresTerrain = fetcher.FetchTerrain(GetCentredSquareRectangle(terrainLocation, DegreesToWorldUnits(0.5) / 1200.0f)); TerrainEffect.WriteHiresTexture(hiresTerrain); TerrainEffect.TerrainCentreLocation = new Vector2();// DegreesToWorldUnits(initialCameraLocation); }
public void TestStrm3PixelRegion() { PointF longLat = new PointF(lng, lat); TerrainHeightTextureFetcher fetcher = new Srtm3TextureFetcher(); Rectangle region = new Rectangle(0, 0, 1000, 1500); terrain = fetcher.FetchTerrain(longLat, region); Image img = ImagingFunctions.CreateImageFromArray(terrain, ImagingFunctions.HsvColourMap(256)); ImagingFunctions.SaveAndDisplayImage(img, "terrainFetchPixel030.png"); region = new Rectangle(0, 1500, 1000, 1500); terrain = fetcher.FetchTerrain(longLat, region); img = ImagingFunctions.CreateImageFromArray(terrain, ImagingFunctions.HsvColourMap(256)); ImagingFunctions.SaveAndDisplayImage(img, "terrainFetchPixel032.png"); }