Class DynamicGeoPlastLayer
Inheritance
DynamicGeoPlastLayer
Assembly: fwt.hexterrains.dll
Syntax
public class DynamicGeoPlastLayer : VisualGeoPlastLayer, IDisposable, ISerializableTerrainLayer
Fields
DownFlowTargetLayerRef
Reference to the layer the plast amount condenses TO. (Down flow)
Declaration
public HexTerrainLayerReference DownFlowTargetLayerRef
Field Value
DynamicSettings
Settings for the flow of the geo plast. Contains settings such as flow speed, flow direction, etc.
Declaration
public DynamicGeoPlastSettings DynamicSettings
Field Value
IncomingVolumeFlowChunks
Hash set that stores chunk indexes to which the incoming flow happens
Declaration
public NativeParallelHashSetDataLayer<int> IncomingVolumeFlowChunks
Field Value
UpFlowTargetLayerRef
Reference to the layer the plast amount evaporates TO. (Up flow)
Declaration
public HexTerrainLayerReference UpFlowTargetLayerRef
Field Value
VolumeFlowMap
Flow data for the geo plast per cell.
Volume of geo plast units flown FROM the cell in each of 6 directions.
7th value is a total volume flown out of the cell.
Flow is a transfer of geo plast volume from this cell to its neighbors.
Declaration
public FlowMapDataLayer VolumeFlowMap
Field Value
VolumeFlowPotentialMap
Each source of flow contributes to the flow potential map.
Then when the actual flow map is calculated, the flow potential map is used to determine the actual flow to each direction.
Meaning, there may be ability to flow down the hill but there are several directions with the same hight difference,
so the actual flow map calculation uses the relative potential, so flow down the hill will be split proportionally to the potential in each direction.
Each value in the array is a struct with 8 slots. 0-5 are the 6 directions, 7 is upwards (out of the cell), 8 is downwards (into the cell).
Declaration
public FlowMapDataLayer VolumeFlowPotentialMap
Field Value
Methods
ApplyHorizontalVolumeFlowMap(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle ApplyHorizontalVolumeFlowMap(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
ApplySimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Applies calculated Change.
For instance, there is a flow in all directions + up + down already calculated at this stage,
so this stage applies calculated change. For instance, it changes the plast amount according to calculated flow maps.
Declaration
public override JobHandle ApplySimulation(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type |
Name |
Description |
| HexTerrainSimulationTimer |
simulationTime |
Simulation timer. Use it's values to be in sync with other simulations
|
| GeoPlastLayerGroup |
geoPlastLayerList |
Layer list to query for referenced geo plasts from.
For instance, for evaporation calculation there is a reference to a evaporation target geo plast layer,
so it will be retrieved from this layer list
|
| JobHandle |
dependency |
dependency to schedule jobs with
|
Returns
| Type |
Description |
| JobHandle |
job handle to all scheduled jobs
|
Overrides
ApplyVerticalFlowMap(HexTerrainSimulationTimer, DirectionFlowSettings, GeoPlastLayerGroup, FlowDirections, JobHandle)
Declaration
public virtual JobHandle ApplyVerticalFlowMap(HexTerrainSimulationTimer simulationTime, DirectionFlowSettings flowSettings, GeoPlastLayerGroup geoPlastLayerList, FlowDirections direction, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
ApplyVerticalVolumeFlowMap(HexTerrainSimulationTimer, DirectionFlowSettings, GeoPlastLayer, FlowDirections, JobHandle)
Declaration
public virtual JobHandle ApplyVerticalVolumeFlowMap(HexTerrainSimulationTimer simulationTime, DirectionFlowSettings flowSettings, GeoPlastLayer targetLayer, FlowDirections flowDirection, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
ApplyVerticalVolumeFlowMap(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle ApplyVerticalVolumeFlowMap(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
ApplyVolumeFlowFromCell(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle ApplyVolumeFlowFromCell(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
ApplyVolumeFlowMap(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle ApplyVolumeFlowMap(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
CalculateHorizontalVolumeFlowPotential(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Default implementation of the horizontal flow potential calculation.
Flows to neighboring cells trying to equalize the height difference between height of ceiling between adjacent cells.
Declaration
public virtual JobHandle CalculateHorizontalVolumeFlowPotential(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type |
Name |
Description |
| HexTerrainSimulationTimer |
simulationTime |
Simulation timer. Use it's values to be in sync with other simulations
|
| GeoPlastLayerGroup |
geoPlastLayerList |
Layer list to query for referenced geo plasts from.
For instance, for evaporation calculation there is a reference to a evaporation target geo plast layer,
so it will be retrieved from this layer list
|
| JobHandle |
dependency |
dependency to schedule jobs with
|
Returns
| Type |
Description |
| JobHandle |
job handle to all scheduled jobs
|
CalculateSimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Calculates actual Change based on Change Potential.
For instance, there is a flow potential in all directions + up + down,
so total flow potential may exceed the total amount of geo plast in this cell,
and existing amount splits proportionally to the flow potential.
Declaration
public override JobHandle CalculateSimulation(HexTerrainSimulationTimer simulationTimer, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type |
Name |
Description |
| HexTerrainSimulationTimer |
simulationTimer |
Simulation timer. Use it's values to be in sync with other simulations
|
| GeoPlastLayerGroup |
geoPlastLayerList |
Layer list to query for referenced geo plasts from.
For instance, for evaporation calculation there is a reference to a evaporation target geo plast layer,
so it will be retrieved from this layer list
|
| JobHandle |
dependency |
dependency to schedule jobs with
|
Returns
| Type |
Description |
| JobHandle |
job handle to all scheduled jobs
|
Overrides
CalculateVerticalVolumeFlowPotential(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle CalculateVerticalVolumeFlowPotential(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
CalculateVolumeFlowMap(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle CalculateVolumeFlowMap(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
CalculateVolumeFlowPotential(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Declaration
public virtual JobHandle CalculateVolumeFlowPotential(HexTerrainSimulationTimer simulationTime, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
Returns
| Type |
Description |
| JobHandle |
|
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
ClearVolumeFlowMap(JobHandle)
Clears the flow potential map (fills it wil zero values)
Declaration
public virtual JobHandle ClearVolumeFlowMap(JobHandle dependency)
Parameters
| Type |
Name |
Description |
| JobHandle |
dependency |
|
Returns
| Type |
Description |
| JobHandle |
|
ClearVolumeFlowPotentialMap(JobHandle)
Clears the flow potential map (fills it wil zero values)
Declaration
public virtual JobHandle ClearVolumeFlowPotentialMap(JobHandle dependency)
Parameters
| Type |
Name |
Description |
| JobHandle |
dependency |
|
Returns
| Type |
Description |
| JobHandle |
|
CompleteAllJobs()
Completes all jobs that affect data layers.
Declaration
public override void CompleteAllJobs()
Overrides
Dispose()
Disposes all allocated native memory.
Declaration
public override void Dispose()
Overrides
GetTotalVolumeFlow(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 GetTotalVolumeFlow(int cellIndex)
Parameters
| Type |
Name |
Description |
| int |
cellIndex |
cell index to get data from
|
Returns
| Type |
Description |
| float |
value if available, otherwise - default
|
GetTotalVolumeFlowPotential(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 GetTotalVolumeFlowPotential(int cellIndex)
Parameters
| Type |
Name |
Description |
| int |
cellIndex |
cell index to get data from
|
Returns
| Type |
Description |
| float |
value if available, otherwise - default
|
GetVerticalFlowTarget<TGeoPlast>(GeoPlastLayerGroup, FlowDirections)
Declaration
public virtual TGeoPlast GetVerticalFlowTarget<TGeoPlast>(GeoPlastLayerGroup geoPlastLayerGroup, FlowDirections direction) where TGeoPlast : GeoPlastLayer
Parameters
Returns
| Type |
Description |
| TGeoPlast |
|
Type Parameters
| Name |
Description |
| TGeoPlast |
|
GetVolumeFlow(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 FixedArray8<float> GetVolumeFlow(int cellIndex)
Parameters
| Type |
Name |
Description |
| int |
cellIndex |
cell index to get data from
|
Returns
GetVolumeFlowPotential(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 FixedArray8<float> GetVolumeFlowPotential(int cellIndex)
Parameters
| Type |
Name |
Description |
| int |
cellIndex |
cell index to get data from
|
Returns
Init(HexTerrainSettings)
Initializes/Reinitializes the area data.
Declaration
public override void Init(HexTerrainSettings settings)
Parameters
Overrides
InitLayerData(IInitGeoPlastLayerConfig)
Declaration
public override void InitLayerData(IInitGeoPlastLayerConfig args)
Parameters
Overrides
PrepareSimulation(HexTerrainSimulationTimer, GeoPlastLayerGroup, JobHandle)
Calculates Change Potential. For instance, the flow potential per direction + up + down.
It's like in a physics engine the stage when the velocity is calculated,
and the actual movement will be calculated later based on the actual state like mass and velocity and collisions, etc.
Declaration
public override JobHandle PrepareSimulation(HexTerrainSimulationTimer simulationTimer, GeoPlastLayerGroup geoPlastLayerList, JobHandle dependency)
Parameters
| Type |
Name |
Description |
| HexTerrainSimulationTimer |
simulationTimer |
Simulation timer. Use it's values to be in sync with other simulations
|
| GeoPlastLayerGroup |
geoPlastLayerList |
Layer list to query for referenced geo plasts from.
For instance, for evaporation calculation there is a reference to a evaporation target geo plast layer,
so it will be retrieved from this layer list
|
| JobHandle |
dependency |
dependency to schedule jobs with
|
Returns
| Type |
Description |
| JobHandle |
job handle to all scheduled jobs
|
Overrides
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
SetFlow(int, FixedArray8<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 SetFlow(int cellIndex, FixedArray8<float> value)
Parameters
Returns
| Type |
Description |
| bool |
true if success, otherwise - false
|
SetFlowPotential(int, FixedArray8<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 SetFlowPotential(int cellIndex, FixedArray8<float> value)
Parameters
Returns
| Type |
Description |
| bool |
true if success, otherwise - false
|
SetTotalFlow(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 SetTotalFlow(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
|
SetTotalFlowPotential(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 SetTotalFlowPotential(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
|
Implements
Extension Methods