ITerrainExporter
Description
- Derived from
Full source code is included in the Tinman 3D SDK download. |
Base interface for classes that export terrain mesh chunks.
Based on a view-dependent continuous level-of-detail terrain mesh, a terrain exporter generates static terrain chunks, for various usages:
-
Mesh geometry for rendering.
-
Mesh geometry for collision detection resp. physics simulation.
-
Terrain imagery, for example
PNG
orJPG
files. -
Terrain textures, for example
BC1
for GPU upload and rendering.
Using a ITerrainExporter to render a 3D terrain involves the following steps:
-
Inspect IMapInfo.Map to determine the map type, then use MapInfo.FaceFirst and MapInfo.FaceLast to find the pyramid coordinates of the root tile on each cubemap face. Perform the following steps for each root tile.
-
Use HasChunk and PyramidCoords.Child to traverse the tile hierarchy, starting at the root tile. Perform the following steps for each visited tile.
-
Use GetChunk to obtain the coefficients that are necessary to perform common computations for the terrain mesh chunk.
-
Use the GetVertexData method to obtain vertex data for the tile. Optionally use GetVertexMask to determine an optimal vertex format.
-
Use the GetIndexData method to obtain index data for the tile, then use GetIndexRange to find the index ranges for rendering the either whole tile or just one of its quadrants.
-
Use GetTextureMask to determine the kind of unique texturing to perform for the tile. Then, use GetTextureData to obtain the texture data for rendering with TerrainVertexData.TextureCoordinates.
-
Use GetMaterialMask to determine if material-based texturing must be applied to the tile. Then, use GetMaterialMask and GetMaterialData to obtain the required materials and to determine the texturing mode: tri-planar texturing or planar texturing (use TerrainChunk.MaterialCoordinates to compute the texture coordinates, based on position).
Public / Methods
Public / Attributes
OnChanged
An event that is fired each time the source terrain data has changed, affecting the generated data of one or more terrain mesh chunks.
TileSize
Returns the tile size of the root terrain chunk (on any cubemap face).
The tile size defines the visual quality threshold that is used to generate terrain mesh chunks. The continuous level-of-detail of each terrain mesh chunk is chosen so that the projected geometric error correlates with the ratio between screen pixels and texels.