Class ChunksGridLayer
Container for data related to Terrain Chunks Grid. Chunk visibility, Chunk Metrics per chunk, not per cell.
Inherited Members
Namespace: Fwt.HexTerrains.Data
Assembly: fwt.hexterrains.dll
Syntax
public class ChunksGridLayer : IComponentData, IQueryTypeParameter, IDisposable
Fields
ChunkMetrics
Chunk visibility data layer. Contains visibility for each chunk.
Declaration
public ChunkMetricsDataLayer ChunkMetrics
Field Value
| Type | Description |
|---|---|
| ChunkMetricsDataLayer |
ChunkVisibility
Chunk metrics data layer. Contains metrics for each chunk.
Declaration
public ChunkVisibilityDataLayer ChunkVisibility
Field Value
| Type | Description |
|---|---|
| ChunkVisibilityDataLayer |
Properties
Settings
Terrain settings
Declaration
public HexTerrainSettings Settings { get; protected set; }
Property Value
| Type | Description |
|---|---|
| HexTerrainSettings |
TerrainMetrics
Terrain Metrics (Cells count, chunks count, cell size, chunk size, etc.)
Declaration
public HexTerrainMetrics TerrainMetrics { get; protected set; }
Property Value
| Type | Description |
|---|---|
| HexTerrainMetrics |
ViewportData
Cached camera values. Used to avoid recalculations of the every frame
Declaration
public VersionValue<CameraViewPortData> ViewportData { get; protected set; }
Property Value
| Type | Description |
|---|---|
| VersionValue<CameraViewPortData> |
Methods
Cleanup()
Cleans up the chunks grid data on Cleanup frame stage. Usually this clears the dirty flags.
Declaration
public virtual void Cleanup()
CleanupAsync()
Declaration
public virtual void CleanupAsync()
CompleteAllJobs()
Completes all jobs (read and write) related to the chunks grid.
Declaration
public virtual void CompleteAllJobs()
Dispose()
Declaration
public virtual void Dispose()
Init(HexTerrainSettings)
Initializes/Reinitializes the ChunksGridLayer with the provided settings.
Declaration
public virtual void Init(HexTerrainSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSettings | settings | terrain settings used to intialize the chunks grid |
OpenAllToWrite()
Opens all chunks to read. Use this method before writing to the chunks.
Declaration
public virtual void OpenAllToWrite()
RecalcChunkMetrics()
Recalculates the chunk metrics for all chunks.
Declaration
public virtual void RecalcChunkMetrics()
Resize(int2)
Reinitializes the ChunksGridLayer with the cached settings but new terrain size (in cells).
Declaration
public virtual void Resize(int2 terrainSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int2 | terrainSize | new terrain size in cells |
SetAllDirty(bool)
Sets the dirty flag for all chunks in the grid.
Declaration
public virtual void SetAllDirty(bool isDirty)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isDirty | the dirty flag to set for all chunks |
SetViewportData(CameraViewPortData)
Sets the viewport data. This is used to cache the camera data (position, rotation, scale, size, etc.) to calculate which chunks are visible and where are they visible in case the terrain's edges are connected.
Declaration
public virtual void SetViewportData(CameraViewPortData viewportData)
Parameters
| Type | Name | Description |
|---|---|---|
| CameraViewPortData | viewportData | new viewport data |