Class GeoPlastLayer
Inherited Members
Namespace: Fwt.HexTerrains.GeoPlasts.Data
Assembly: fwt.hexterrains.dll
Syntax
public class GeoPlastLayer : HexTerrainLayer, IDisposable, ISerializableTerrainLayer
Fields
AmountMap
Amount of geo plast per cell.
Declaration
public ColorMapCellValueDataLayer_Float AmountMap
Field Value
| Type | Description |
|---|---|
| ColorMapCellValueDataLayer_Float |
BedrockHeightMap
Height of the bedrock per cell, in units.
Declaration
public CellValueDataLayer<float> BedrockHeightMap
Field Value
| Type | Description |
|---|---|
| CellValueDataLayer<float> |
BedrockPlastReference
Reference to the bedrock layer, used to get the bedrock height and other metrics.
Declaration
public HexTerrainLayerReference BedrockPlastReference
Field Value
| Type | Description |
|---|---|
| HexTerrainLayerReference |
CeilingHeightMap
Height of the layer's top, in units. Bedrock height + Geo Plast volume.
Declaration
public CellValueDataLayer<float> CeilingHeightMap
Field Value
| Type | Description |
|---|---|
| CellValueDataLayer<float> |
DensityMap
Density map per cell. Amount * this value = Volume.
Declaration
public ColorMapCellValueDataLayer_Float DensityMap
Field Value
| Type | Description |
|---|---|
| ColorMapCellValueDataLayer_Float |
GeoPlastSettings
Settings for the geo plast layer. Contain all geo plast related settings, such as temperature, humidity, flow settings, etc.
Declaration
public GeoPlastSettings GeoPlastSettings
Field Value
| Type | Description |
|---|---|
| GeoPlastSettings |
VolumeMap
Taken volume for each cell, how much volume is already taken by the Geo Plast.
Declaration
public ColorMapCellValueDataLayer_Float VolumeMap
Field Value
| Type | Description |
|---|---|
| ColorMapCellValueDataLayer_Float |
Methods
ApplySimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Called for all layers in the layers list after the simulation is calculated. Used to apply the simulation data to the actual layer data (PlastAmountMap, heat map, etc.)
Declaration
public virtual JobHandle ApplySimulation(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSimulationTimer | simulationTime | Simulation time structure. Use this values in your calculations to be in sync with all other simulations |
| GeoPlastLayerGroup | geoPlastLayerList | layer list to get the referenced layers from. For instance, the Bedrock or Ceiling layer are taken from here |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled job |
CalculateBedrock(JobHandle)
Calculates the bedrock height map based on the bedrock GeoPlast.
Declaration
public virtual JobHandle CalculateBedrock(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency to schedule jobs with |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle to all scheduled jobs |
CalculateCeiling(JobHandle)
Calculates the ceiling height map based on the bedrock and volume maps.
Declaration
public virtual JobHandle CalculateCeiling(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency |
Returns
| Type | Description |
|---|---|
| JobHandle |
CalculateColorMap(JobHandle)
Schedules the calculation of the color map, ensuring it is executed after the specified job dependency completes.
Declaration
public override JobHandle CalculateColorMap(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | A job handle representing the dependency that must be completed before the color map calculation begins. |
Returns
| Type | Description |
|---|---|
| JobHandle | A job handle that can be used to track the completion of the color map calculation job. |
Overrides
CalculateDensity(JobHandle)
Calculates the density map.
Declaration
public virtual JobHandle CalculateDensity(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for all jobs to be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled jobs |
CalculateSimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Called for all layers in the layers list to calculate the exact simulation values. Used to calculate flow maps, diffuse maps, evaporation maps, condensation maps, etc.
Declaration
public virtual JobHandle CalculateSimulation(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSimulationTimer | simulationTime | Simulation time structure. Use this values in your calculations to be in sync with all other simulations |
| GeoPlastLayerGroup | geoPlastLayerList | layer list to get the referenced layers from. For instance, the Bedrock or Ceiling layer are taken from here |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled job |
CalculateVolume(JobHandle)
Calculates the actual volume of the GeoPlast based on the plast amount map and density settings.
Declaration
public virtual JobHandle CalculateVolume(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency to schedule jobs with |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle to all scheduled jobs |
Cleanup()
Every frame there is a cleanup stage. This function is called. Usually used to clean the dirty flags.
Declaration
public override void Cleanup()
Overrides
CleanupAsync(JobHandle)
Async version of Cleanup() Cleanup() Difference between regular Cleanup() is that it schedules jobs that clean up data layers, so you don't have to wait for the results and can continue working. Every frame there is a cleanup stage. This function is called. Usually used to clean the dirty flags.
Declaration
public override JobHandle CleanupAsync(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency |
Returns
| Type | Description |
|---|---|
| JobHandle |
Overrides
CompleteAllJobs()
Completes all jobs that affect data layers.
Declaration
public override void CompleteAllJobs()
Overrides
DeserializeLayer(BinaryReader, HexTerrainSettings)
Requests a deserialization of the layer data. Returns false if the layer does not support deserialization.
Declaration
public virtual bool DeserializeLayer(BinaryReader reader, HexTerrainSettings terrainSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryReader | reader | binary reader to deserialize data from |
| HexTerrainSettings | terrainSettings | deserialized terrain settings (layer was serialized with this settings) |
Returns
| Type | Description |
|---|---|
| bool |
Dispose()
Disposes all allocated native memory.
Declaration
public override void Dispose()
Overrides
DoPlastUpdate(JobHandle)
Called at the end of the update cycle to prepare any data needed for the update. Called after calculating Volume, Pressure, etc.
Declaration
public virtual JobHandle DoPlastUpdate(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for all jobs to be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled jobs |
GetBedrockHeight(int)
Waits until all related jobs are completed and returns the value for the given cell index if any or default if not available (if cell index is wrong, for instance). Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual float? GetBedrockHeight(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to get data from |
Returns
| Type | Description |
|---|---|
| float? | value if available, otherwise - default |
GetBedrockLayer()
Declaration
public virtual GeoPlastLayer GetBedrockLayer()
Returns
| Type | Description |
|---|---|
| GeoPlastLayer |
GetCeilingHeight(int)
Waits until all related jobs are completed and returns the value for the given cell index if any or default if not available (if cell index is wrong, for instance). Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual float? GetCeilingHeight(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to get data from |
Returns
| Type | Description |
|---|---|
| float? | value if available, otherwise - default |
GetDensity(int)
Waits until all related jobs are completed and returns the value for the given cell index if any or default if not available
Declaration
public virtual float? GetDensity(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to get data from |
Returns
| Type | Description |
|---|---|
| float? | value if available, otherwise - default |
GetPlastAmount(int)
Waits until all related jobs are completed and returns the value for the given cell index if any or default if not available (if cell index is wrong, for instance). Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual float? GetPlastAmount(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to get data from |
Returns
| Type | Description |
|---|---|
| float? | value if available, otherwise - default |
GetPlastVolume(int)
Waits until all related jobs are completed and returns the value for the given cell index if any or default if not available (if cell index is wrong, for instance). Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual float? GetPlastVolume(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to get data from |
Returns
| Type | Description |
|---|---|
| float? | value if available, otherwise - default |
Init(HexTerrainSettings)
Initializes/Reinitializes the area data.
Declaration
public override void Init(HexTerrainSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSettings | settings | new terrain settings |
Overrides
Init(HexTerrainSettings, IInitGeoPlastLayerConfig)
Declaration
public virtual void Init(HexTerrainSettings settings, IInitGeoPlastLayerConfig args)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSettings | settings | |
| IInitGeoPlastLayerConfig | args |
InitLayerData(IInitGeoPlastLayerConfig)
Declaration
public virtual void InitLayerData(IInitGeoPlastLayerConfig args)
Parameters
| Type | Name | Description |
|---|---|---|
| IInitGeoPlastLayerConfig | args |
PreparePlastUpdate(JobHandle)
Called at the beginning of the update cycle to prepare any data needed for the update. Called before calculating Volume, Pressure, etc.
Declaration
public virtual JobHandle PreparePlastUpdate(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for all jobs to be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled jobs |
PrepareSimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Called for all layers in the layers list before the simulation starts. Used to prepare any data needed for the simulation (flow potential, diffuse potential, etc.)
Declaration
public virtual JobHandle PrepareSimulation(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainSimulationTimer | simulationTime | Simulation time structure. Use this values in your calculations to be in sync with all other simulations |
| GeoPlastLayerGroup | geoPlastLayerList | layer list to get the referenced layers from. For instance, the Bedrock or Ceiling layer are taken from here |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled job |
RenderGeoPlast(ChunkMeshLayerGroup, JobHandle)
Renders the GeoPlast values to the HexSurface HeightMap and BiomeMap.
Declaration
public virtual JobHandle RenderGeoPlast(ChunkMeshLayerGroup chunkMeshLayerList, JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkMeshLayerGroup | chunkMeshLayerList | |
| JobHandle | dependency | input dependency. All jobs will be scheduled with this one as dependency |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle of the scheduled jobs |
SerializeLayer(BinaryWriter)
Requests a serialization of the layer data. Returns false if the layer does not support serialization.
Declaration
public virtual bool SerializeLayer(BinaryWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryWriter | writer | binary writer to serialize data by |
Returns
| Type | Description |
|---|---|
| bool | True if serialized, false if not serialized/not supported/not implemented |
SetAllDirty(bool)
Sets all data layers dirty value. If isDirty is true, all data layers will be marked as dirty and will be recalculated on the next frame. If isDirty is false, all data layers will be marked as clean and will not be recalculated on the next frame.
Declaration
public override void SetAllDirty(bool isDirty)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isDirty |
Overrides
SetBedrockHeight(int, float)
Waits until all related jobs are completed and sets the value for the given cell index if there is a cell with that index. Returns true if successfull, otherwise - false. Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual bool SetBedrockHeight(int cellIndex, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to set data to |
| float | value |
Returns
| Type | Description |
|---|---|
| bool | true if success, otherwise - false |
SetCeilingHeight(int, float)
Waits until all related jobs are completed and sets the value for the given cell index if there is a cell with that index. Returns true if successfull, otherwise - false. Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual bool SetCeilingHeight(int cellIndex, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to set data to |
| float | value |
Returns
| Type | Description |
|---|---|
| bool | true if success, otherwise - false |
SetDensity(int, float)
Waits until all related jobs are completed and Sets the value for the given cell index if there is a cell with that index.
Declaration
public virtual bool SetDensity(int cellIndex, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to set data to |
| float | value | value to set |
Returns
| Type | Description |
|---|---|
| bool | true if success, otherwise - false |
SetPlastAmount(int, float)
Waits until all related jobs are completed and sets the value for the given cell index if there is a cell with that index. Returns true if successfull, otherwise - false. Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual bool SetPlastAmount(int cellIndex, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to set data to |
| float | value | value to set |
Returns
| Type | Description |
|---|---|
| bool | true if success, otherwise - false |
SetPlastVolume(int, float)
Waits until all related jobs are completed and sets the value for the given cell index if there is a cell with that index. Returns true if successfull, otherwise - false. Expensive operation as it has to wait for all jobs to complete for immediate access.
Declaration
public virtual bool SetPlastVolume(int cellIndex, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cellIndex | cell index to set data to |
| float | value |
Returns
| Type | Description |
|---|---|
| bool | true if success, otherwise - false |