Class Terrain
- Namespace
- Alis.Core.Physic.Common.TextureTools
- Assembly
- Alis.dll
Simple class to maintain a terrain. It can keep track
public class Terrain
Inheritance
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
world
World-
The World
position
Vector2-
The position (center) of the terrain.
width
float-
The width of the terrain.
height
float-
The height of the terrain.
Fields
CellSize
Points per cell.
public int CellSize
Field Value
Center
Center of terrain in world units.
public Vector2 Center
Field Value
Decomposer
Decomposer to use when regenerating terrain. Can be changed on the fly without consequence. Note: Some decomposerers are unstable.
public TriangulationAlgorithm Decomposer
Field Value
Height
Height of terrain in world units.
public float Height
Field Value
Iterations
Number of iterations to perform in the Marching Squares algorithm. Note: More then 3 has almost no effect on quality.
public int Iterations
Field Value
PointsPerUnit
Points per each world unit used to define the terrain in the point cloud.
public int PointsPerUnit
Field Value
SubCellSize
Points per sub cell.
public int SubCellSize
Field Value
Width
Width of terrain in world units.
public float Width
Field Value
World
World to manage terrain in.
public World World
Field Value
_bodyMap
Generated bodies.
private List<Body>[,] _bodyMap
Field Value
_dirtyArea
The dirty area
private AABB _dirtyArea
Field Value
_localHeight
The local height
private float _localHeight
Field Value
_localWidth
The local width
private float _localWidth
Field Value
_terrainMap
Point cloud defining the terrain.
private sbyte[,] _terrainMap
Field Value
- sbyte[,]
_topLeft
The top left
private Vector2 _topLeft
Field Value
_xnum
The xnum
private int _xnum
Field Value
_ynum
The ynum
private int _ynum
Field 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
location
Vector2-
World location to modify. Automatically clipped.
value
sbyte-
-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)