Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class ViewModeConfigAsset

    Provides a base class for view mode configuration assets that manage color map updates for various terrain layers in a Unity environment.

    Inheritance
    object
    Object
    ScriptableObject
    ViewModeConfigAssetBase
    ViewModeConfigAsset
    Implements
    IViewModeConfig
    Inherited Members
    ViewModeConfigAssetBase._name
    ViewModeConfigAssetBase.Name
    ViewModeConfigAssetBase._description
    ViewModeConfigAssetBase.Description
    ViewModeConfigAssetBase._colorMapTexturesTemp
    ViewModeConfigAssetBase._icon
    ViewModeConfigAssetBase.Icon
    ViewModeConfigAssetBase.UpdateColorMap(EntityManager, Entity, bool)
    ViewModeConfigAssetBase.IsSupportedLayer<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference)
    ViewModeConfigAssetBase.UpdateColorMapTexture(CellColorsDataLayer, bool, Texture2D)
    ViewModeConfigAssetBase.GetTerrainLayer<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference)
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Fwt.HexTerrains.ViewModes.Data
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class ViewModeConfigAsset : ViewModeConfigAssetBase, IViewModeConfig
    Remarks

    This abstract class defines common functionality for updating color maps associated with terrain layers, such as height, biome, cell regions, and specialized GeoPlast layers. Derived classes should implement the required logic for updating color maps based on the current view mode. The class is intended to be used as a ScriptableObject asset and supports integration with Unity's Entity Component System (ECS).

    Fields

    _colorMapTextures

    Declaration
    [Tooltip("Collection of color map textures to copy colors from data layers onto.")]
    [SerializeField]
    protected List<Texture2D> _colorMapTextures
    Field Value
    Type Description
    List<Texture2D>

    Properties

    ColorMapTextures

    Declaration
    protected List<Texture2D> ColorMapTextures { get; set; }
    Property Value
    Type Description
    List<Texture2D>

    Methods

    CheckIfAvailableAndAddTexture<TLayerComponent, TLayer>(List<Texture2D>, int, EntityManager, Entity, HexTerrainLayerReference)

    Checks whether the specified texture is available and supported for the given terrain layer, and adds it to the provided texture list if so.

    Declaration
    protected bool CheckIfAvailableAndAddTexture<TLayerComponent, TLayer>(List<Texture2D> colorMapTexturesTemp, int textureIndex, EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : HexTerrainLayer
    Parameters
    Type Name Description
    List<Texture2D> colorMapTexturesTemp

    The list to which the texture will be added if available and supported. Cannot be null.

    int textureIndex

    The index of the texture to check and add. Must be within the bounds of the available textures.

    EntityManager entityManager

    The EntityManager instance used to query component data for the terrain entity.

    Entity terrainEntity

    The entity representing the terrain to check for the specified layer.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to validate support for.

    Returns
    Type Description
    bool

    true if the texture is available, supported, and was added to the list; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing the terrain layer group. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The mesh layer type associated with the terrain layer. Must inherit from ChunkMeshLayer.

    Remarks

    This method performs validation on the input parameters and ensures that the specified layer is supported before adding the texture. No changes are made if any validation fails.

    GetColorMapTexture(int)

    Retrieves the color map texture at the specified index from the ColorMapTextures collection.

    Declaration
    protected Texture2D GetColorMapTexture(int textureIndex)
    Parameters
    Type Name Description
    int textureIndex

    The zero-based index of the color map texture to retrieve. Must be within the bounds of the color map texture collection.

    Returns
    Type Description
    Texture2D

    The texture at the specified index if available; otherwise, null.

    Remarks

    Returns null if the color map texture collection is not initialized or if the specified index is out of range.

    GetColorMapTextures(EntityManager, Entity)

    Retrieves the collection of color map textures available for the specified terrain entity.

    Declaration
    public override IList<Texture2D> GetColorMapTextures(EntityManager entityManager, Entity terrainEntity)
    Parameters
    Type Name Description
    EntityManager entityManager

    The entity manager used to access and query entities and their components.

    Entity terrainEntity

    The entity representing the terrain for which to retrieve color map textures.

    Returns
    Type Description
    IList<Texture2D>

    A list of UnityEngine.Texture2D objects representing the color map textures for the specified terrain entity. The list is empty if no color map textures are found.

    Overrides
    ViewModeConfigAssetBase.GetColorMapTextures(EntityManager, Entity)

    UpdateCellEntityColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the color map for cell entities in the specified terrain layer using the provided textures buffer and layer reference.

    Declaration
    protected virtual bool UpdateCellEntityColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : CellEntityLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entities within the terrain.

    Entity terrainEntity

    The entity representing the terrain whose cell entity color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, the default texture is used.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing the terrain layer group. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The cell entity layer type associated with the terrain layer. Must inherit from CellEntityLayer.

    UpdateCellObjectColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the color map for cell objects in the specified terrain layer using the provided textures buffer and layer reference.

    Declaration
    protected virtual bool UpdateCellObjectColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : CellObjectLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entities and their components.

    Entity terrainEntity

    The entity representing the terrain whose cell object color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, all relevant textures may be updated.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The type of the terrain layer group component, which must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The type of the cell object layer to update.

    UpdateCellRegionColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the color map for a cell region layer associated with the specified terrain entity and layer reference.

    Declaration
    protected virtual bool UpdateCellRegionColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : CellRegionLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entity data.

    Entity terrainEntity

    The terrain entity whose cell region color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, all relevant textures may be updated.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing the terrain layer group. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The cell region layer type to update. Must inherit from CellRegionLayer.

    UpdateChunkMeshBiomeColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the biome color map for a chunk mesh layer using the specified terrain layer and color map textures.

    Declaration
    protected virtual bool UpdateChunkMeshBiomeColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : ChunkMeshLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and manage entities and their components.

    Entity terrainEntity

    The entity representing the terrain for which the biome color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to be used for the update operation.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, all relevant textures may be updated.

    Returns
    Type Description
    bool

    true if the biome color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing the terrain layer group. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The chunk mesh layer type to update. Must inherit from ChunkMeshLayer.

    UpdateChunkMeshHeightColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the height-based color map texture for a terrain chunk mesh layer if the specified layer is present.

    Declaration
    protected virtual bool UpdateChunkMeshHeightColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : ChunkMeshLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and manage entities and their components.

    Entity terrainEntity

    The entity representing the terrain chunk whose color map is to be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, the default texture is used.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false if the specified terrain layer is not present.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing the terrain layer group. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The chunk mesh layer type to update. Must inherit from ChunkMeshLayer.

    UpdateColorMapTexture(CellColorsDataLayer, bool, int)

    Updates the color map texture for the specified data layer if the color map or view mode is marked as dirty.

    Declaration
    protected virtual bool UpdateColorMapTexture(CellColorsDataLayer colorMap, bool isViewModeDirty, int textureIndex = 0)
    Parameters
    Type Name Description
    CellColorsDataLayer colorMap

    The color map data layer to update. Cannot be null.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the texture to be updated.

    int textureIndex

    The index of the texture to update within the buffer. If not specified, the color map's default texture index is used. Must be within the bounds of the buffer.

    Returns
    Type Description
    bool

    true if the color map texture was successfully updated; otherwise, false.

    Remarks

    This method only updates the texture if the color map or view mode is dirty and the specified texture exists in the buffer. No action is taken if the color map is not dirty, the view mode is not dirty, or the texture is unavailable.

    UpdateColorMap<TDataLayer, TCellValue>(TDataLayer, bool, int)

    Declaration
    protected bool UpdateColorMap<TDataLayer, TCellValue>(TDataLayer dataLayer, bool isViewModeDirty, int textureIndex = 0) where TDataLayer : ColorMapCellValueDataLayer<TCellValue> where TCellValue : unmanaged
    Parameters
    Type Name Description
    TDataLayer dataLayer
    bool isViewModeDirty
    int textureIndex
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TDataLayer
    TCellValue

    UpdateGeoPlastAmountColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the color map for the specified GeoPlast terrain layer using the provided textures buffer and layer reference.

    Declaration
    protected virtual bool UpdateGeoPlastAmountColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : GeoPlastLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entities and their components.

    Entity terrainEntity

    The entity representing the terrain whose color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the specific terrain layer to update.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, the default texture is used.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The type of the terrain layer group component, which must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The type of the GeoPlast terrain layer to update.

    UpdateGeoPlastDensityColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the density color map for a specified GeoPlast terrain layer using the provided texture buffer and layer reference.

    Declaration
    protected virtual bool UpdateGeoPlastDensityColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : GeoPlastLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entity components.

    Entity terrainEntity

    The entity representing the terrain whose density color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the specific terrain layer to update.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If not specified, all relevant textures may be updated.

    Returns
    Type Description
    bool

    true if the density color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The type of the terrain layer group component, which must implement IComponentData.

    TLayer

    The type of the GeoPlast terrain layer to update.

    UpdateGeoPlastHeatColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the heat color map texture for a specified terrain layer if the layer exists.

    Declaration
    protected virtual bool UpdateGeoPlastHeatColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : MaterialGeoPlastLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entity components.

    Entity terrainEntity

    The entity representing the terrain whose heat color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the terrain layer to identify which layer's heat color map should be updated.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, the default texture is used.

    Returns
    Type Description
    bool

    true if the heat color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The type of the terrain layer group component, which must implement IComponentData.

    TLayer

    The type of the material layer associated with the terrain.

    UpdateGeoPlastTemperatureColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Declaration
    protected virtual bool UpdateGeoPlastTemperatureColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : MaterialGeoPlastLayer
    Parameters
    Type Name Description
    EntityManager entityManager
    Entity terrainEntity
    HexTerrainLayerReference layerReference
    bool isViewModeDirty
    int textureIndex
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TLayerComponent
    TLayer

    UpdateGeoPlastVolumeColorMap<TLayerComponent, TLayer>(EntityManager, Entity, HexTerrainLayerReference, bool, int)

    Updates the color map texture for a GeoPlast volume layer associated with the specified terrain entity.

    Declaration
    protected virtual bool UpdateGeoPlastVolumeColorMap<TLayerComponent, TLayer>(EntityManager entityManager, Entity terrainEntity, HexTerrainLayerReference layerReference, bool isViewModeDirty, int textureIndex = 0) where TLayerComponent : HexTerrainLayerGroup, IComponentData where TLayer : GeoPlastLayer
    Parameters
    Type Name Description
    EntityManager entityManager

    The EntityManager instance used to access and modify entity data.

    Entity terrainEntity

    The entity representing the terrain whose volume color map will be updated.

    HexTerrainLayerReference layerReference

    A reference to the specific terrain layer to update within the terrain entity.

    bool isViewModeDirty

    Indicates whether the view mode has changed and requires the color map to be refreshed.

    int textureIndex

    The optional index of the texture to update. If null, the default texture is used.

    Returns
    Type Description
    bool

    true if the color map was successfully updated; otherwise, false.

    Type Parameters
    Name Description
    TLayerComponent

    The component type representing a group of terrain layers. Must implement HexTerrainLayerGroup and IComponentData.

    TLayer

    The terrain layer type to update. Must derive from GeoPlastLayer.

    Implements

    IViewModeConfig

    Extension Methods

    Extensions_UnityObject.SmartDestroy<TObject>(TObject)
    Extensions_UnityObject.SmartDisableGameObject<TObject>(TObject)
    Extensions_UnityObject.SmartEnableGameObject<TObject>(TObject)
    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX