Class HexSurfaceRenderLayer
Base class for surface types of HexTerrain layers
Implements
Inherited Members
Namespace: Fwt.HexTerrains.Surfaces.Data
Assembly: fwt.hexterrains.dll
Syntax
public abstract class HexSurfaceRenderLayer : IDisposable
Fields
ChunkMeshSources
Data layer that stores mesh sources for the hex terrain chunks. Mesh sources are filled in respected Jobs and then used to generate/fill meshes for the chunks.
Declaration
public ChunkMeshSourcesDataLayer ChunkMeshSources
Field Value
| Type | Description |
|---|---|
| ChunkMeshSourcesDataLayer |
ChunkMeshes
Data layer that stores meshes for the hex terrain chunks.
Declaration
public ChunkMeshesDataLayer ChunkMeshes
Field Value
| Type | Description |
|---|---|
| ChunkMeshesDataLayer |
DefaultRenderConfig
Fallback render config for the hex terrain chunks. When getting a render config for view mode, if the config is not found, this one will be used instead.
Declaration
public HexTerrainRenderConfigAsset DefaultRenderConfig
Field Value
| Type | Description |
|---|---|
| HexTerrainRenderConfigAsset |
OffsetTransform
Surface is rendered with this offset from the terrain's origin
Declaration
public Matrix4x4 OffsetTransform
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
RenderConfigs
List of render configs for the hex terrain chunks. Config index = view mode. So if you have 3 view modes, you will have 3 configs in this list.
Declaration
public List<HexTerrainRenderConfigAsset> RenderConfigs
Field Value
| Type | Description |
|---|---|
| List<HexTerrainRenderConfigAsset> |
Properties
RenderSettings
Render settings of the object. Provides materials to render a HexSurface terrain layers
Declaration
public HexTerrainRenderSettings RenderSettings { get; protected set; }
Property Value
| Type | Description |
|---|---|
| HexTerrainRenderSettings |
Settings
Settings of the terrain this object is connected to
Declaration
public HexTerrainSettings Settings { get; protected set; }
Property Value
| Type | Description |
|---|---|
| HexTerrainSettings |
Methods
Cleanup()
Every frame on the Cleanup stage this method is called to clean up the data layers. Usually, cleans up the dirty flags
Declaration
public virtual void Cleanup()
CompleteAllJobs()
Completes all jobs for all the data layers.
Declaration
public void CompleteAllJobs()
Dispose()
Declaration
public virtual void Dispose()
GetChunkMesh(int)
Returns a mesh for the Chunk with given index
Declaration
public virtual Mesh GetChunkMesh(int chunkIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | chunkIndex |
Returns
| Type | Description |
|---|---|
| Mesh |
GetRenderConfigAsset(int)
Returns a render config asset for provided view mode RenderConfigs If nothing is found, returns a DefaultRenderConfig DefaultRenderConfig
Declaration
public HexTerrainRenderConfigAsset GetRenderConfigAsset(int viewMode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | viewMode | view mode to get a render config for |
Returns
| Type | Description |
|---|---|
| HexTerrainRenderConfigAsset | render config asset |
InitRenderConfigs<TRenderDataConfig>(NativeArray<TRenderDataConfig>)
Copies render configs from the given array of render data configs. Basically, extracts a config assets from render data config. Does not change or cache the provided array of configs, only copies data from it, so it is safe to dispose a provided array after this method call.
Declaration
public virtual void InitRenderConfigs<TRenderDataConfig>(NativeArray<TRenderDataConfig> renderDataConfigs) where TRenderDataConfig : unmanaged, IBufferElementData, IHexSurfaceRenderConfig
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TRenderDataConfig> | renderDataConfigs |
Type Parameters
| Name | Description |
|---|---|
| TRenderDataConfig | render configs array to copy from |
OpenAllToWrite()
Completes all jobs for all the data layers. Opens all data layers to write.
Declaration
public void OpenAllToWrite()
ReInit()
Expected that the Surface data this object is connected to is already initialized/resized, So to reflect changes we need simply reinitialize the render data
Declaration
public abstract void ReInit()
SetAllDirty(bool)
If isDirty == false, marks all data as clean, so it will not be recalculated. If isDirty == true, marks all data as dirty, so it will be recalculated.
Declaration
public virtual void SetAllDirty(bool isDirty)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isDirty | new dirty state |
SetChunkMesh(int, Mesh)
Sets a mesh for the chunk with a given index
Declaration
public virtual bool SetChunkMesh(int chunkIndex, Mesh mesh)
Parameters
| Type | Name | Description |
|---|---|---|
| int | chunkIndex | |
| Mesh | mesh |
Returns
| Type | Description |
|---|---|
| bool |