Class Terrain
- Namespace
 - Alis.Core.Physic.Common.TextureTools
 
- Assembly
 - Alis.dll
 
Simple class to maintain a terrain. It can keep track
public class TerrainInheritance
Inherited Members
Constructors
Terrain(World, AABB)
Creates a new terrain.
public Terrain(World world, AABB area)Parameters
Terrain(World, Vector2, float, float)
Creates a new terrain
public Terrain(World world, Vector2 position, float width, float height)Parameters
worldWorld- 
The World
 positionVector2- 
The position (center) of the terrain.
 widthfloat- 
The width of the terrain.
 heightfloat- 
The height of the terrain.
 
Fields
CellSize
Points per cell.
public int CellSizeField Value
Center
Center of terrain in world units.
public Vector2 CenterField Value
Decomposer
Decomposer to use when regenerating terrain. Can be changed on the fly without consequence. Note: Some decomposerers are unstable.
public TriangulationAlgorithm DecomposerField Value
Height
Height of terrain in world units.
public float HeightField Value
Iterations
Number of iterations to perform in the Marching Squares algorithm. Note: More then 3 has almost no effect on quality.
public int IterationsField Value
PointsPerUnit
Points per each world unit used to define the terrain in the point cloud.
public int PointsPerUnitField Value
SubCellSize
Points per sub cell.
public int SubCellSizeField Value
Width
Width of terrain in world units.
public float WidthField Value
World
World to manage terrain in.
public World WorldField Value
_bodyMap
Generated bodies.
private List<Body>[,] _bodyMapField Value
_dirtyArea
The dirty area
private AABB _dirtyAreaField Value
_localHeight
The local height
private float _localHeightField Value
_localWidth
The local width
private float _localWidthField Value
_terrainMap
Point cloud defining the terrain.
private sbyte[,] _terrainMapField Value
- sbyte[,]
 
_topLeft
The top left
private Vector2 _topLeftField Value
_xnum
The xnum
private int _xnumField Value
_ynum
The ynum
private int _ynumField Value
Methods
ApplyData(sbyte[,], Vector2)
Apply the specified texture data to the terrain.
public void ApplyData(sbyte[,] data, Vector2 offset = default)Parameters
GenerateTerrain(int, int)
Generates the terrain using the specified gx
private void GenerateTerrain(int gx, int gy)Parameters
Initialize()
Initialize the terrain for use.
public void Initialize()ModifyTerrain(Vector2, sbyte)
Modify a single point in the terrain.
public void ModifyTerrain(Vector2 location, sbyte value)Parameters
locationVector2- 
World location to modify. Automatically clipped.
 valuesbyte- 
-1 = inside terrain, 1 = outside terrain
 
RegenerateTerrain()
Regenerate the terrain.
public void RegenerateTerrain()RemoveOldData(int, int, int, int)
Removes the old data using the specified x start
private void RemoveOldData(int xStart, int xEnd, int yStart, int yEnd)