Yage3D.net
 

yage.scene.terrain

Authors:
Brandon Lyons, Eric Poggel

License:
Boost 1.0

class TerrainNode : yage.scene.visible.VisibleNode;
This class isn't implemented yet.

this(TerrainGenerator generator, TextureInstance[] textures, Vec2f min = (Vec!(2,float))(-128F), Vec2f max = (Vec!(2,float))(127F), Vec2f resolution = (Vec!(2,float))(256F));
Provide a class that sets the shape and textures of the terrain.

Params:
TerrainGenerator generator Instance of TerrainGenerator.
TextureInstance[] textures Textures to use on the terrain. The texture's transformation matrix can be scaled to allow textures to repeat. For example, a scale of (1/16, 1/16, 1) will repeat the texture 16 times in the x and y directions.
Vec2f min The minimum x and y value of the range of coordinates passed to generator's getPoint() function.
Vec2f max The maximum x and y value of the range of coordinates passed to generator's getPoint() function.
Vec2f resolution The number of points (grid resolution) in the x and y directions passed to generator's getPoint() function.

Geometry[] getVisibleGeometry (CameraNode camera, float pixelsPerPolygon = cast(float)32);
The terrain geometry is divided into blocks, each at multiple levels of detail. This function is used by the renderer to get a set of Geometry visible by the specified camera.

Params:
CameraNode camera Only blocks inside the Camera's view frustum will be returned.
float pixelsPerPolygon Blocks closer to the camera will provide higher resolution Geometry. Every block returned will have its polygons smaller than pixelsPerPolygon. Smaller values for pixelsPerPolygon will yield blocks with more polygons and a better rendering.

abstract interface TerrainGenerator ;
Defines functions a class must provide in order for TerrainNode to use it to generate Terrain.

struct TerrainPoint ;
Data structure for a single vertex in the Terrain Geometry.

Vec3f position ;
xyz position of the terrain point

Vec3f normal ;
Normal vector for this point on the terrain, used for lighting

Vec2f textureCoordinate ;
Texture coordinates for this point on the terrain

float[] textureBlend ;
Normalized vector of arbitrary length specifying the amount of each texture to

abstract TerrainPoint getPoint (Vec!(2,float) coordinate);
Get the values needed for a single vertex in the Terrain Geometry.

abstract TextureInstance getLightmap (Vec!(2,float) min, Vec!(2,float) max);
Get a lightmap Texture to use across the range of coordinates. If no lightmap is desired, this function can return a TextureInstance with a null Texture. The same TextureInstance can be reused across multiple calls with different values, if the Textures' texture matrix adjusted as needed.

Params:
Vec!(2,float) min Minumum xy coordinate of the rectangle needing a lightmap.
Vec!(2,float) max Maximum xy coordinate of the rectangle needing a lightmap.

Returns:
An RGB texture to use as a baked light-map. It's color values will be modulated with the terrain.

class HeightmapGenerator : yage.scene.terrain.TerrainGenerator;
A sample TerrainGenerator that uses a heightmap image to specify elevation and a color texture to specify which textures to use at a given point.

this(Image2!(ubyte,1) heightMap, Image2!(ubyte,4)[] textureBlend);
Params:
Image2!(ubyte,1) heightMap
textures The red component of the first textureBlend specifies how much of the first texture to use at this point, The green for the second texture, blue for the third, and alpha for the fourth. If more than four textures are used, the red component of the second textureBlend is used for the fifth, and so on.

this(char[] filename);
Load heightmap and textureBlends from Earth Sculptor, available at http://earthsculptor.com

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:29 2010