C# Class FarseerPhysics.Common.TextureTools.Terrain

Simple class to maintain a terrain. It can keep track
Exibir arquivo Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
cellSize int
center Microsoft.Xna.Framework.Vector2
decomposer TriangulationAlgorithm
height float
iterations int
pointsPerUnit int
subCellSize int
width float
world FarseerPhysics.Dynamics.World

Public Methods

Method Description
Terrain ( World world, AABB area ) : System.Collections.Generic

Creates a new terrain.

Terrain ( World world, Vector2 position, float width, float height ) : System.Collections.Generic

Creates a new terrain

applyData ( sbyte data, Vector2 offset = default(Vector2) ) : void

Apply the specified texture data to the terrain.

generateTerrain ( int gx, int gy ) : void
initialize ( ) : void

Initialize the terrain for use.

modifyTerrain ( Vector2 location, sbyte value ) : void

Modify a single point in the terrain.

regenerateTerrain ( ) : void

Regenerate the terrain.

removeOldData ( int xStart, int xEnd, int yStart, int yEnd ) : void

Method Details

Terrain() public method

Creates a new terrain.
public Terrain ( World world, AABB area ) : System.Collections.Generic
world FarseerPhysics.Dynamics.World The World
area FarseerPhysics.Collision.AABB The area of the terrain.
return System.Collections.Generic

Terrain() public method

Creates a new terrain
public Terrain ( World world, Vector2 position, float width, float height ) : System.Collections.Generic
world FarseerPhysics.Dynamics.World The World
position Microsoft.Xna.Framework.Vector2 The position (center) of the terrain.
width float The width of the terrain.
height float The height of the terrain.
return System.Collections.Generic

applyData() public method

Apply the specified texture data to the terrain.
public applyData ( sbyte data, Vector2 offset = default(Vector2) ) : void
data sbyte
offset Microsoft.Xna.Framework.Vector2
return void

generateTerrain() public method

public generateTerrain ( int gx, int gy ) : void
gx int
gy int
return void

initialize() public method

Initialize the terrain for use.
public initialize ( ) : void
return void

modifyTerrain() public method

Modify a single point in the terrain.
public modifyTerrain ( Vector2 location, sbyte value ) : void
location Microsoft.Xna.Framework.Vector2 World location to modify. Automatically clipped.
value sbyte -1 = inside terrain, 1 = outside terrain
return void

regenerateTerrain() public method

Regenerate the terrain.
public regenerateTerrain ( ) : void
return void

removeOldData() public method

public removeOldData ( int xStart, int xEnd, int yStart, int yEnd ) : void
xStart int
xEnd int
yStart int
yEnd int
return void

Property Details

cellSize public_oe property

Points per cell.
public int cellSize
return int

center public_oe property

Center of terrain in world units.
public Vector2,Microsoft.Xna.Framework center
return Microsoft.Xna.Framework.Vector2

decomposer public_oe property

Decomposer to use when regenerating terrain. Can be changed on the fly without consequence. Note: Some decomposerers are unstable.
public TriangulationAlgorithm decomposer
return TriangulationAlgorithm

height public_oe property

Height of terrain in world units.
public float height
return float

iterations public_oe property

Number of iterations to perform in the Marching Squares algorithm. Note: More then 3 has almost no effect on quality.
public int iterations
return int

pointsPerUnit public_oe property

Points per each world unit used to define the terrain in the point cloud.
public int pointsPerUnit
return int

subCellSize public_oe property

Points per sub cell.
public int subCellSize
return int

width public_oe property

Width of terrain in world units.
public float width
return float

world public_oe property

World to manage terrain in.
public World,FarseerPhysics.Dynamics world
return FarseerPhysics.Dynamics.World