Dungeon Architect  17.0.0
DungeonArchitect.Landscape.LandscapeDataRasterizer Class Reference

Manages the landscape data and performs various rasterization algorithms (draw cells, lines etc) More...

Public Member Functions

 LandscapeDataRasterizer (Terrain terrain, Rect worldBounds)
 Creates a new instance More...
 
void LoadData ()
 Loads the data from the terrain into memory for modification More...
 
void DrawCell (float x, float y, float w, float h, float elevation)
 
void DrawCell (float x, float y, float w, float h, float elevation, float flatten)
 Rasterizes the terrain height along the specified world cooridnate with the specified elevation height More...
 
void SmoothCell (float x, float y, float w, float h, float elevation, int smoothingDistance, AnimationCurve smoothingCurve)
 
void SmoothCell (float x, float y, float w, float h, float elevation, int smoothingDistance, AnimationCurve smoothingCurve, float flatten)
 Applies a smoothing blur filter based on the user-defined smoothing curve More...
 
void SaveData ()
 Saves the data in memory back into the terrain. This modifies the terrain object More...
 

Static Public Member Functions

static float GetHeight (Terrain terrain, float worldX, float worldZ)
 Gets the height of the terrain at the specified world space More...
 
static void WorldToTerrainDistance (Terrain terrain, float worldDistX, float worldDistZ, out int terrainDistX, out int terrainDistZ)
 
static void TerrainToWorldDistance (Terrain terrain, int terrainDistX, int terrainDistZ, out float worldDistX, out float worldDistZ)
 
static void WorldToTerrainCoord (Terrain terrain, float x, float y, out int gx, out int gy)
 Converts the world coordinate to internal terrain coordinate where the data is loaded More...
 
static void WorldToTerrainCoord (Terrain terrain, float x, float y, out int gx, out int gy, RasterizerTextureSpace textureSpace)
 Converts the world coordinate to internal terrain coordinate where the data is loaded More...
 
static void WorldToTerrainTextureCoord (Terrain terrain, float x, float y, out int tx, out int ty)
 Converts the world coordinate to terrain texture coordinate More...
 
static void WorldToTerrainDetailCoord (Terrain terrain, float x, float y, out int tx, out int ty)
 Converts the world coordinate to terrain texture coordinate More...
 

Detailed Description

Manages the landscape data and performs various rasterization algorithms (draw cells, lines etc)

Definition at line 17 of file LandscapeDataRasterizer.cs.

Constructor & Destructor Documentation

◆ LandscapeDataRasterizer()

DungeonArchitect.Landscape.LandscapeDataRasterizer.LandscapeDataRasterizer ( Terrain  terrain,
Rect  worldBounds 
)

Creates a new instance

Parameters
terrainThe terrain object to modify
elevationThe prefered ground level elevation

Definition at line 32 of file LandscapeDataRasterizer.cs.

Member Function Documentation

◆ DrawCell()

void DungeonArchitect.Landscape.LandscapeDataRasterizer.DrawCell ( float  x,
float  y,
float  w,
float  h,
float  elevation,
float  flatten 
)

Rasterizes the terrain height along the specified world cooridnate with the specified elevation height

Parameters
xx cooridnate in world space
yz coordinate in world space
wwidth in world space
hheight in world space
elevationThe elevation to set in the specified bounds

Definition at line 254 of file LandscapeDataRasterizer.cs.

◆ GetHeight()

static float DungeonArchitect.Landscape.LandscapeDataRasterizer.GetHeight ( Terrain  terrain,
float  worldX,
float  worldZ 
)
static

Gets the height of the terrain at the specified world space

Parameters
terrainThe terrain object
worldXX cooridnate in world space
worldZZ cooridnate in world space
Returns
The Y height of the terrain at the specified location

Definition at line 88 of file LandscapeDataRasterizer.cs.

◆ LoadData()

void DungeonArchitect.Landscape.LandscapeDataRasterizer.LoadData ( )

Loads the data from the terrain into memory for modification

Definition at line 48 of file LandscapeDataRasterizer.cs.

◆ SaveData()

void DungeonArchitect.Landscape.LandscapeDataRasterizer.SaveData ( )

Saves the data in memory back into the terrain. This modifies the terrain object

Definition at line 361 of file LandscapeDataRasterizer.cs.

◆ SmoothCell()

void DungeonArchitect.Landscape.LandscapeDataRasterizer.SmoothCell ( float  x,
float  y,
float  w,
float  h,
float  elevation,
int  smoothingDistance,
AnimationCurve  smoothingCurve,
float  flatten 
)

Applies a smoothing blur filter based on the user-defined smoothing curve

Parameters
xx cooridnate in world space
yz coordinate in world space
wwidth in world space
hheight in world space
elevationThe elevation to set in the specified bounds
smoothingDistanceThe distance to apply the smoothing transition on. For e.g. if the distance it 5, the smoothing would occur over 5 units
smoothingCurveThe user defined curve to control the steepness of cliffs

Definition at line 307 of file LandscapeDataRasterizer.cs.

◆ WorldToTerrainCoord() [1/2]

static void DungeonArchitect.Landscape.LandscapeDataRasterizer.WorldToTerrainCoord ( Terrain  terrain,
float  x,
float  y,
out int  gx,
out int  gy 
)
static

Converts the world coordinate to internal terrain coordinate where the data is loaded

Parameters
terrainThe terrain to query
xx coordinate in world coordinate
yz coordinate in world coordinate
gxx cooridnate in the 2D terrain height data coordinate
gyy cooridnate in the 2D terrain height data coordinate

Definition at line 132 of file LandscapeDataRasterizer.cs.

◆ WorldToTerrainCoord() [2/2]

static void DungeonArchitect.Landscape.LandscapeDataRasterizer.WorldToTerrainCoord ( Terrain  terrain,
float  x,
float  y,
out int  gx,
out int  gy,
RasterizerTextureSpace  textureSpace 
)
static

Converts the world coordinate to internal terrain coordinate where the data is loaded

Parameters
terrainThe terrain to query
xx coordinate in world coordinate
yz coordinate in world coordinate
gxx cooridnate in the 2D terrain height data coordinate
gyy cooridnate in the 2D terrain height data coordinate

Definition at line 145 of file LandscapeDataRasterizer.cs.

◆ WorldToTerrainDetailCoord()

static void DungeonArchitect.Landscape.LandscapeDataRasterizer.WorldToTerrainDetailCoord ( Terrain  terrain,
float  x,
float  y,
out int  tx,
out int  ty 
)
static

Converts the world coordinate to terrain texture coordinate

Parameters
terrainThe terrain to query
xx coordinate in world coordinate
yz coordinate in world coordinate
txx cooridnate in the 2D terrain texture data coordinate
tyy cooridnate in the 2D terrain texture data coordinate

Definition at line 219 of file LandscapeDataRasterizer.cs.

◆ WorldToTerrainTextureCoord()

static void DungeonArchitect.Landscape.LandscapeDataRasterizer.WorldToTerrainTextureCoord ( Terrain  terrain,
float  x,
float  y,
out int  tx,
out int  ty 
)
static

Converts the world coordinate to terrain texture coordinate

Parameters
terrainThe terrain to query
xx coordinate in world coordinate
yz coordinate in world coordinate
txx cooridnate in the 2D terrain texture data coordinate
tyy cooridnate in the 2D terrain texture data coordinate

Definition at line 190 of file LandscapeDataRasterizer.cs.


The documentation for this class was generated from the following file: