Ogre terrain Configuration File Parsing

Source: Internet
Author: User

This article is reproduced,ArticleSource http://blog.csdn.net/gelu1231/archive/2009/02/19/3910576.aspx

 

 

Ogre generates terrain through the configuration file, greatly improving the flexibility of terrain generation. This section briefly analyzes the meaning of each configuration item in the terrain configuration file (terrain. cfg.

Worldtexturew.terrain_texture.jpg  // Terrain texture
Detailtexturew.terrain_detail.jpg   // Terrain details texture (detailed texture is used when the camera is very close to the ground)
Detailtile = 3  // Number of tiled details in a small terrain Block
Pagesource = heightmap  // Height chart data source
Heightmap.image%terrain.png // Height image name (grayscale image file name), which must be 2 ^ n + 1
Pagesize = 513  // Height chart size
Tilesize = 65  // Small terrain block size
Maxpixelerror = 3  // The error is sufficient when the level details are used.
Pageworldx= 1500   // The X direction of the terrain in the world
Pageworldz= 1500 // Z direction
Maxheight = 100 // The largest terrain ing height in the world
Maxmipmaplevel = 5 // Upper limit of level details
# Vertexnormals = Yes   // Calculate the vertex normal, computer light, or GPU in the buffer.ProgramOpen when used
# Vertexcolors = Yes   // Set the vertex color in the buffer. If a GPU program needs to enable this function
# Usetristrips = Yes  // We recommend that you disable the current hardware.
Vertexprogrammorph = Yes // Use the vertex program for the processing of the level of granularity.
Lodmorphstart = 0.2  // The start point of the combination of the two levels of dsls: the ratio of the distance between the two levels of height and the low level of dsls.

The following parameters are used to provide your own coloring program. This will provide your own defined material.
The settings of worldtexture and detailtexture are no longer used.

Morphlodfactorparamname = morphfactor
// If vertexprogrammorph is set to yes, the custom material contains an advanced vertex program. It specifies a vertex
// The parameter name of the program. This parameter is used to combine the dashboard. The parameter value ranges from 0 to 1, indicating that the value is not adjusted, and 1 indicates that the parameter value is completely adjusted to the next level.
Morphlodfactorparamindex // It is used when materail contains a low-level vertex program. The meaning is the same as above.
Custommaterialname // The specified materail name

The preceding configuration file defines the Terrain Based on the height chart.

These parameter definitions can be summarized into two categories: ogre uses the first type to generate a terrain from a height chart
Mesh and material.

The second type is the custom material and GPU vertex program, which can replace the coloring program automatically generated by ogre.
Note:
Terrainscencemanager divides a height chart into multiple pages, each of which consists of several tile. They define a set of vertex sets that constitute a square in the generated mesh.
The texture defined by worldtexture does not have to be as big as the target terrain.
Pageworldx and pageworldz can scale the world's terrain.
Maxheight scales the terrain in the Y direction.
Detailtexture only uses one texture. For example, you should use custom materail for multi-level texture.

Load terrain from a program
Setworldgeometry () is overloaded. One is used to load the configuration file, and the other is used in the program.
To achieve the function of manual loading. Here, scenedata is converted to STD: Map by typedef, which stores
See those value pairs. Suppose we have read what we want from a binary file to scenedata. We want to do
Is to convert the read content to the type required by setworldgeometry.

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.