WorldWind Source Profiling series: WorldWind Real-time determination, update, initialization and rendering of terrain and texture data

Source: Internet
Author: User

WorldWind Real-time determination, updating, initialization and rendering of terrain and texture data

When the user clicks on the earth in WorldWind, the first response is the worldwindow.onpaint () function, and the subsequent procedure calls the process as shown.

Scattered knowledge points:

1, the Terrain tile class Terraintile quoted the Terrain Tile service class Terraintileservice, in Terraintile's Initialize () The Terraindownloadrequest object of the terrain download request class is instantiated and initiated in the function. The Terraintile class is also referenced in the Terraintileservice class, and a Terraintile class object is returned through the Getterraintile () function.

2. Terraintileservice is also referenced in the constructor of the terrain accessor class terrainaccessor or its subclasses nltterrainaccessor. It uses the Hashtable object M_tilecache to store a tile buffer entity class Terraintilecacheentry object that currently needs to be loaded or downloaded for establishing and maintaining an access download request queue.

3, Tilesizedegree: Each tile coverage of the degree of size;

Samplespertile: The elevation sampling points per tile;

4, the planet surface rendering class Worldsurfacerenderer and surface tile class surfacetile between each other reference, and Surfacetile class defined in the storage elevation data of the two-dimensional array float[,] M_heightdata = null, if the The array is empty when the hierarchy is greater than 2, the Terraintileservice class two-dimensional array public float[,] elevationdata assigned to M_heightdata, if the current level is less than or equal to 2 or elevationdata is empty, The space is redistributed for the m_heightdata. The Surfacetile.initialize (Drawargs Drawargs) function calls the public virtual Terraintile Getelevationarray of the Terrainaccessor class (double North, Double South, double west, double east, int samples), and Surfacetile.buildterrainmesh ().

5, Quadtree Tile class Quadtile refers to the terrain tile class Terraintile, return tile, and tile contains elevation array elevationdata.

6. The load () function of the configuration loader class configurationloader resolves the terrain accessor class object from the XML file Earth.xml, and the object constructs the World object NewWorld as a parameter.

7, M_world. The Update (Drawargs Drawargs) function calls this only if the camera height is less than 30000 meters. Terrainaccessor. Getelevationarray (b,l,s) calculates the elevation of the terrain of the user's mouse click, as follows: (1) Judging whether the terrain tile service is empty, (2) Judging if the higher resolution dataset is empty, or (3) by calling Terraintileservice. The Getterrainfile () function Gets the Terraintile object of the mouse-click area and adds it to the Access download request Hashtable object M_tilecache; (4) Determines whether the requested tile cache entity object (which is a further encapsulation of the Terraintile Class) has been initialized, as otherwise, the initialization of the tile is done. The so-called initialization is essentially parsing the data in a binary file with a. bil extension and putting it into a two-dimensional array elevationdata[x,y]. Among them, x=y= 150, representing the elevation data of 150x150 grid, and (5) calling Ttce. Terraintile. Getelevationat (b,l) Gets the elevation value of the latitude and longitude of the user's click, and uses bilinear interpolation method to interpolate and return it. In the WorldWind V1.4.0.1 version, the above function code is moved into the Worldwindow.render () function of the WorldWindow.cs file.

WorldWind Source Profiling series: WorldWind Real-time determination, update, initialization and rendering of terrain and texture data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.