Class GeoPlastLayerGroup
Represents a group of geological plast terrain layers, providing methods to simulate, update, and render all layers in sequence. Supports scheduling and chaining of jobs for simulation, density, volume, bedrock, ceiling, and rendering operations across all contained layers.
Inheritance
Inherited Members
Namespace: Fwt.HexTerrains.GeoPlasts.Data
Assembly: fwt.hexterrains.dll
Syntax
public class GeoPlastLayerGroup : HexTerrainLayerGroup<GeoPlastLayer>, IDisposable, ISerializableTerrainLayer, IComponentData, IQueryTypeParameter
Remarks
GeoPlastLayerGroup manages a collection of GeoPlastLayer instances, coordinating their simulation and update workflows using job handles for parallel processing. Methods typically iterate through all layers, scheduling jobs and combining dependencies to ensure correct execution order. If the layer collection is null or empty, most operations return the input dependency unchanged. This class is designed for use in systems that require synchronized simulation and rendering of multiple terrain layers, such as geological modeling or procedural terrain generation.
Fields
LastSimulationFrame
Declaration
protected long LastSimulationFrame
Field Value
| Type | Description |
|---|---|
| long |
Methods
ApplySimulation(HexTerrainSimulationTimer, JobHandle)
Applies calculated simulation for all the layers in order they are in the list. Calls ApplySimulation on each layer.
Declaration
public virtual JobHandle ApplySimulation(HexTerrainSimulationTimer simulationTime, 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 |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
CalculateBedrock(JobHandle)
Calculates Bedrock height for all the layers in order they are in the list.
Declaration
public virtual JobHandle CalculateBedrock(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
CalculateBedrockAndCeiling(JobHandle)
Schedules calculations for bedrock and ceiling layers, chaining them as jobs dependent on the specified job handle.
Declaration
public virtual JobHandle CalculateBedrockAndCeiling(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | A job handle representing the dependency that must be completed before bedrock and ceiling calculations begin. |
Returns
| Type | Description |
|---|---|
| JobHandle | A job handle that represents the scheduled bedrock and ceiling calculations, including the provided dependency. |
Remarks
If no layers are present, the method returns the input dependency unchanged. Each layer's bedrock and ceiling calculations are scheduled in sequence, with each depending on the completion of the previous job.
CalculateCeiling(JobHandle)
Calculates Ceiling height for all the layers in order they are in the list.
Declaration
public virtual JobHandle CalculateCeiling(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
CalculateDensity(JobHandle)
Schedules density calculation jobs for all layers and returns a handle that represents the combined job dependencies.
Declaration
public virtual JobHandle CalculateDensity(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | A job handle that represents the dependency to be completed before density calculations begin. |
Returns
| Type | Description |
|---|---|
| JobHandle | A job handle that can be used to track the completion of all scheduled density calculation jobs. If no layers are present, returns the input dependency handle unchanged. |
Remarks
If the Layers collection is null or empty, no jobs are scheduled and the input dependency is returned. This method is typically used to chain job dependencies when performing density calculations in parallel.
CalculatePlastUpdate(JobHandle)
Schedules plast update jobs for all non-null layers and returns a handle representing the combined job dependencies.
Declaration
public virtual JobHandle CalculatePlastUpdate(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | A Unity.Jobs.JobHandle representing the job dependency to which plast update jobs will be chained. |
Returns
| Type | Description |
|---|---|
| JobHandle | A Unity.Jobs.JobHandle that represents the combined dependencies of all scheduled plast update jobs. If no layers are present, returns the input dependency unchanged. |
Remarks
If the Layers collection is null or empty, no jobs are scheduled and the input dependency is returned. Each non-null layer in the Layers collection has its plast update job scheduled in sequence, chaining dependencies accordingly.
CalculateSimulation(HexTerrainSimulationTimer, JobHandle)
Calculates simulation for all the layers in order they are in the list. Calls CalculateSimulation on each layer.
Declaration
public virtual JobHandle CalculateSimulation(HexTerrainSimulationTimer simulationTime, 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 |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
CalculateVolume(JobHandle)
Calculates volume for all the layers in order they are in the list.
Declaration
public virtual JobHandle CalculateVolume(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
CreateTerrainLayer<TInitArgs>(TInitArgs)
This function is called to create a new terrain layer of type TTerrainLayer. Default implementation uses an Activator to create a new instance of TTerrainLayer, expecting that the TTerrainLayer has a parameterless constructor. Override this function in your derived class to have a custom way of creating a terrain layer.
Declaration
public override GeoPlastLayer CreateTerrainLayer<TInitArgs>(TInitArgs initArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| TInitArgs | initArgs | Initialization arguments for creating a layer |
Returns
| Type | Description |
|---|---|
| GeoPlastLayer | Returns a created instance of the terrain layer of type (inherited from) TTerrainLayer |
Type Parameters
| Name | Description |
|---|---|
| TInitArgs | Init terrain layer arguments object that is used in create layer process. Default implementation ignores this parameter, but in your overrided implementation it may be needed |
Overrides
InitTerrainLayer<TInitArgs>(GeoPlastLayer, HexTerrainSettings, TInitArgs)
Initializes the terrain layer with the specified settings and initialization arguments.
Declaration
public override void InitTerrainLayer<TInitArgs>(GeoPlastLayer layer, HexTerrainSettings settings, TInitArgs initArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPlastLayer | layer | nested terrain layer to be initialized with provided init args |
| HexTerrainSettings | settings | HexTerrainSettings of the terrain this layers list is attached to |
| TInitArgs | initArgs | Initialization arguments for provided nested terrain layer |
Type Parameters
| Name | Description |
|---|---|
| TInitArgs | Initialization arguments for a nested terrain layer |
Overrides
PreparePlastUpdate(JobHandle)
Prepares the update operations for all plast layers and returns a job handle representing the combined dependencies.
Declaration
public virtual JobHandle PreparePlastUpdate(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | A Unity.Jobs.JobHandle that represents the job dependency to be combined with the plast layer updates. |
Returns
| Type | Description |
|---|---|
| JobHandle | A Unity.Jobs.JobHandle that encapsulates the dependencies of all plast layer update jobs. If no layers are present, returns the input dependency unchanged. |
Remarks
This method iterates through all plast layers and schedules their update jobs, chaining them with the provided dependency. If the layers collection is null, no updates are scheduled and the original dependency is returned. This method is typically called as part of a job scheduling workflow to ensure that plast layer updates are properly synchronized.
PrepareSimulation(HexTerrainSimulationTimer, JobHandle)
Prepares all the layers in order they are in the list for simulation. Calls PrepareSimulation on each layer.
Declaration
public virtual JobHandle PrepareSimulation(HexTerrainSimulationTimer simulationTime, 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 |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
Render(ChunkMeshLayerGroup, JobHandle)
Renders all the layers in order they are in the list.
Declaration
public virtual JobHandle Render(ChunkMeshLayerGroup chunkMeshLayerList, JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkMeshLayerGroup | chunkMeshLayerList | chunk meshes layer that is used to display the geo plast layer data. For instance, the terrain surface is used to render a ground, the clouds chunk mesh is used to display atmosphere humid, etc. |
| JobHandle | dependency | dependency to schedule jobs with |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all scheduled jobs |
Simulate(HexTerrainSimulationTimer, JobHandle)
Simulates all the layers in order they are in the list.
Declaration
public virtual JobHandle Simulate(HexTerrainSimulationTimer simulationTime, 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 |
| JobHandle | dependency | dependency for jobs to schedule |
Returns
| Type | Description |
|---|---|
| JobHandle | job handle of all the scheduled jobs |
Update(JobHandle)
Calculates everything that could have changed between frames. Checks for dirty flags and recalculates only what is needed.
Declaration
public virtual JobHandle Update(JobHandle dependency)
Parameters
| Type | Name | Description |
|---|---|---|
| JobHandle | dependency | dependency to use for scheduling jobs |
Returns
| Type | Description |
|---|---|
| JobHandle | combined dependency of all scheduled jobs |