Ctrl+K

Terrain

Declaration

public class tainicom.Aether.Physics2D.Common.TextureTools.Terrain

Simple class to maintain a terrain. It can keep track

Constructors

Terrain

Creates a new terrain.

void Terrain(World world, AABB area)

Parameters:

Name Type Description
world tainicom.Aether.Physics2D.Dynamics.World The World
area tainicom.Aether.Physics2D.Collision.AABB The area of the terrain.

Terrain

Creates a new terrain

void Terrain(World world, Vector2 position, float width, float height)

Parameters:

Name Type Description
world tainicom.Aether.Physics2D.Dynamics.World The World
position Strawberry.Math.Vector2 The position (center) of the terrain.
width System.Single The width of the terrain.
height System.Single The height of the terrain.

Fields

World

World to manage terrain in.

World World

Center

Center of terrain in world units.

Vector2 Center

Width

Width of terrain in world units.

float Width

Height

Height of terrain in world units.

float Height

PointsPerUnit

Points per each world unit used to define the terrain in the point cloud.

int PointsPerUnit

CellSize

Points per cell.

int CellSize

SubCellSize

Points per sub cell.

int SubCellSize

Iterations

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

int Iterations

Decomposer

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

TriangulationAlgorithm Decomposer

Methods

Initialize

Initialize the terrain for use.

void Initialize()

ApplyData

Apply the specified texture data to the terrain.

void ApplyData(sbyte[,] data, Vector2 offset = null)

Parameters:

Name Type Description
data System.SByte[,]
offset Strawberry.Math.Vector2 = null

ModifyTerrain

Modify a single point in the terrain.

void ModifyTerrain(Vector2 location, sbyte value)

Parameters:

Name Type Description
location Strawberry.Math.Vector2 World location to modify. Automatically clipped.
value System.SByte -1 = inside terrain, 1 = outside terrain

RegenerateTerrain

Regenerate the terrain.

void RegenerateTerrain()