C# Class Project2.GameObjects.Terrain

Inheritance: Project2.GameObjects.Abstract.ModelPhysicsObject
Show file Open project: nuclearpidgeon/graphicsproj2

Public Properties

Property Type Description
TerrainData ].float[

Public Methods

Method Description
GenerateDiamondSquare ( int n, float amplitude ) : ].float[
Terrain ( Project2Game game, System.Vector3 position, SharpDX.Toolkit.Graphics.Texture2D heightMap, double scale ) : System

Creates a static terrain mesh based on a heightmap texture.

Terrain ( Project2Game game, System.Vector3 position, int density, double scale, double amplitude ) : System

Construct a static physics mesh terrain procedurally using diamond-square. Density is n, a square with width 2^n-1 will be generated.

Terrain ( Project2Game game, System.Vector3 position, int xScale, int yScale, float frontHeight = 0.0f, float backHeight = 0.0f ) : System

Constructs a flat terrain

Private Methods

Method Description
GeneratePhyicsDescription ( System.Vector3 position, int xScale, int yScale, float frontHeight, float backHeight, bool isStatic ) : PhysicsDescription
GeneratePhysicsDescription ( System.Vector3 position, SharpDX.Toolkit.Graphics.Texture2D heightMapTexture, double scale, System.Boolean isStatic ) : PhysicsDescription

Static method to construct physics description

GeneratePhysicsDescription ( System.Vector3 position, int density, double scale, double amplitude, System.Boolean isStatic ) : PhysicsDescription
ProcessHeightMap ( SharpDX.Toolkit.Graphics.Texture2D heightMap ) : ].float[

Process a heightmap into a 2D array of integers representing the terrain data. Set the terrain object's height and width parameters.

Terrain ( Project2Game game, PhysicsDescription physicsDescription ) : System
getTerrainColour ( float height, float minHeight, float maxHeight ) : Color

Decides on a colour for terrain based on height and some noise

Method Details

GenerateDiamondSquare() public static method

public static GenerateDiamondSquare ( int n, float amplitude ) : ].float[
n int
amplitude float
return ].float[

Terrain() public method

Creates a static terrain mesh based on a heightmap texture.
public Terrain ( Project2Game game, System.Vector3 position, SharpDX.Toolkit.Graphics.Texture2D heightMap, double scale ) : System
game Project2Game
position System.Vector3
heightMap SharpDX.Toolkit.Graphics.Texture2D
scale double
return System

Terrain() public method

Construct a static physics mesh terrain procedurally using diamond-square. Density is n, a square with width 2^n-1 will be generated.
public Terrain ( Project2Game game, System.Vector3 position, int density, double scale, double amplitude ) : System
game Project2Game
position System.Vector3 Bottom left corner of heightfield
density int Controls number of points in height field as square of side length 2^n-1 (e.g. 6)
scale double Distance between height field points
amplitude double Variance of height field
return System

Terrain() public method

Constructs a flat terrain
public Terrain ( Project2Game game, System.Vector3 position, int xScale, int yScale, float frontHeight = 0.0f, float backHeight = 0.0f ) : System
game Project2Game
position System.Vector3
xScale int
yScale int
frontHeight float
backHeight float
return System

Property Details

TerrainData public property

public float[,] TerrainData
return ].float[