Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class CellObjectLayer

    Terrain layer that contains a visual object per cell. Renders cell objects using Graphics.DrawMeshInstanced using provided BulkRenderer and CellObjectConfigs.

    Inheritance
    object
    HexTerrainLayer
    CellItemLayer
    CellObjectLayer
    Implements
    IDisposable
    ISerializableTerrainLayer
    Inherited Members
    CellItemLayer.ItemIndexMap
    CellItemLayer.ItemStateMap
    CellItemLayer.ItemPositionMap
    CellItemLayer.ItemRotationMap
    CellItemLayer.ItemScaleMap
    CellItemLayer.ItemTransformMap
    CellItemLayer.SurfaceLayerReference
    CellItemLayer.OverlapSurfaceLayerReference
    CellItemLayer.ItemTransformSettings
    CellItemLayer.UpdateCellItems(JobHandle)
    CellItemLayer.CalculateColorMap(JobHandle)
    CellItemLayer.UpdateLocalTransforms(JobHandle)
    CellItemLayer.GetCellItemIndex(int)
    CellItemLayer.GetCellItemState(int)
    CellItemLayer.GetCellItemLocalPosition(int)
    CellItemLayer.GetCellItemLocalRotation(int)
    CellItemLayer.GetCellItemLocalScale(int)
    CellItemLayer.GetCellItemLocalTransform(int)
    CellItemLayer.SetCellItemIndex(int, int)
    CellItemLayer.SetCellItemState(int, int)
    CellItemLayer.SetCellItemLocalPosition(int, float3)
    CellItemLayer.SetCellItemLocalRotation(int, quaternion)
    CellItemLayer.SetCellItemLocalScale(int, float3)
    CellItemLayer.SetCellItemLocalTransform(int, Matrix4x4)
    CellItemLayer.SetAllCellsItemIndex(int)
    CellItemLayer.SetAllCellsItemState(int)
    CellItemLayer.SetAllCellsLocalPosition(float3)
    CellItemLayer.SetAllCellsLocalRotation(quaternion)
    CellItemLayer.SetAllCellsLocalScale(float3)
    CellItemLayer.SetAllCellsLocalTransform(Matrix4x4)
    CellItemLayer.SerializeLayer(BinaryWriter)
    CellItemLayer.DeserializeLayer(BinaryReader, HexTerrainSettings)
    CellItemLayer.CompleteAllJobs()
    CellItemLayer.Cleanup()
    CellItemLayer.CleanupAsync(JobHandle)
    CellItemLayer.SetAllDirty(bool)
    HexTerrainLayer.Name
    HexTerrainLayer.Settings
    HexTerrainLayer.ParentLayer
    HexTerrainLayer.Resize(int2)
    HexTerrainLayer.InitColoredDataLayer<TValue>(ColorMapCellValueDataLayer<TValue>, IInitColorMapCellValueDataLayerArgs<TValue>)
    HexTerrainLayer.InitDataLayer<TValue>(CellValueDataLayer<TValue>, IInitCellValueDataLayerArgs<TValue>)
    HexTerrainLayer.GetTerrainLayerFromParent<TLayer>(int)
    HexTerrainLayer.GetTerrainLayerFromParent<TLayer>(string)
    HexTerrainLayer.GetTerrainLayerFromParent<TLayer>(int, string)
    HexTerrainLayer.GetTerrainLayerFromParent<TLayer>(HexTerrainLayerReference)
    HexTerrainLayer.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Fwt.HexTerrains.CellObjects.Data
    Assembly: fwt.hexterrains.dll
    Syntax
    public class CellObjectLayer : CellItemLayer, IDisposable, ISerializableTerrainLayer

    Fields

    AllCellObjectVisuals

    List of all cell object visuals settings. Each cell object can have multiple visuals (RenderEntities, e.g. mesh+submeshIndex+material combination) that can be rendered. So all possible visuals for all cell objects are stored in this list. Each cell object index corresponds to a range of LOD settings in AllCellObjectsLODSettings list. LOD settings store how much cell object visuals and starting from which index to take from this list to render that cell object.

    Declaration
    public NativeList<CellObjectVisualItemSettings> AllCellObjectVisuals
    Field Value
    Type Description
    NativeList<CellObjectVisualItemSettings>

    AllCellObjectsLODSettings

    List of all cell objects LOD settings. Meaning that if a layer has 5 LOD layers, here will be 5 settings for each cell object, so to find a 2nd LOD for a cell object with index 3, we will take AllCellObjectsLODSettings[3 * 5 + 2].

    Declaration
    public NativeList<CellObjectLODSettings> AllCellObjectsLODSettings
    Field Value
    Type Description
    NativeList<CellObjectLODSettings>

    BulkRenderer

    Bulk Renderer that stores meshes, materials and other settings for rendering meshes using Graphics.DrawMeshInstanced

    Declaration
    public IBulkRenderer BulkRenderer
    Field Value
    Type Description
    IBulkRenderer

    LODSettings

    List of LOD settings for cell objects. All cell objects will use these settings to determine how to render themselves based on the distance to the camera.

    Declaration
    public NativeList<CellObjectLayerLODSettings> LODSettings
    Field Value
    Type Description
    NativeList<CellObjectLayerLODSettings>

    VisualsByLOD

    Declaration
    public List<BulkRenderItemsDataLayer> VisualsByLOD
    Field Value
    Type Description
    List<BulkRenderItemsDataLayer>

    Properties

    LODsCount

    Declaration
    public virtual int LODsCount { get; set; }
    Property Value
    Type Description
    int

    MaxSubmeshesPerCell

    Maximum number of submeshes (RenderEntitySettings) that can be used to render a single cell object. Needed for initializing a _renderEntities multiHashMap, which can't change capacity in jobs, so we have to initialize the collection with maximum needed size.

    Declaration
    public virtual int MaxSubmeshesPerCell { get; set; }
    Property Value
    Type Description
    int

    StatesCountPerObject

    Number of states per cell object. When looking for a state for an object we multiply the object index by this value and add the state index. So if we need a 2nd state of the 3rd object, we will look for index = (3 * StatesPerObject) + 2.

    Declaration
    public int StatesCountPerObject { get; set; }
    Property Value
    Type Description
    int

    Methods

    CalculateCellObjects(HexTerrainVisibility, float3, float4x4, ChunkMeshLayerGroup, ChunksGridLayer, JobHandle)

    Declaration
    public virtual JobHandle CalculateCellObjects(HexTerrainVisibility terrainVisibility, float3 cameraPosition, float4x4 terrainTransform, ChunkMeshLayerGroup chunkMeshes, ChunksGridLayer chunksGrid, JobHandle dependency)
    Parameters
    Type Name Description
    HexTerrainVisibility terrainVisibility
    float3 cameraPosition
    float4x4 terrainTransform
    ChunkMeshLayerGroup chunkMeshes
    ChunksGridLayer chunksGrid
    JobHandle dependency
    Returns
    Type Description
    JobHandle

    CalculateCellObjectsLOD(HexTerrainVisibility, int, float4x4, BulkRenderItemsDataLayer, ChunkMeshLayer, ChunkMeshLayer, ChunksGridLayer, JobHandle)

    Declaration
    public virtual JobHandle CalculateCellObjectsLOD(HexTerrainVisibility terrainVisibility, int lodIndex, float4x4 terrainTransform, BulkRenderItemsDataLayer renderItemsDataLayer, ChunkMeshLayer surfaceLayer, ChunkMeshLayer overlapSurfaceLayer, ChunksGridLayer chunksLayer, JobHandle dependency)
    Parameters
    Type Name Description
    HexTerrainVisibility terrainVisibility
    int lodIndex
    float4x4 terrainTransform
    BulkRenderItemsDataLayer renderItemsDataLayer
    ChunkMeshLayer surfaceLayer
    ChunkMeshLayer overlapSurfaceLayer
    ChunksGridLayer chunksLayer
    JobHandle dependency
    Returns
    Type Description
    JobHandle

    CalculateCellObjectsLODSs(HexTerrainVisibility, float4x4, ChunkMeshLayer, ChunkMeshLayer, ChunksGridLayer, JobHandle)

    Declaration
    public virtual JobHandle CalculateCellObjectsLODSs(HexTerrainVisibility terrainVisibility, float4x4 terrainTransform, ChunkMeshLayer surfaceLayer, ChunkMeshLayer overlapSurfaceLayer, ChunksGridLayer chunksLayer, JobHandle dependency)
    Parameters
    Type Name Description
    HexTerrainVisibility terrainVisibility
    float4x4 terrainTransform
    ChunkMeshLayer surfaceLayer
    ChunkMeshLayer overlapSurfaceLayer
    ChunksGridLayer chunksLayer
    JobHandle dependency
    Returns
    Type Description
    JobHandle

    CreateRenderEntitiesLODLayer(int)

    Declaration
    public virtual BulkRenderItemsDataLayer CreateRenderEntitiesLODLayer(int lodIndex)
    Parameters
    Type Name Description
    int lodIndex
    Returns
    Type Description
    BulkRenderItemsDataLayer

    Dispose()

    Disposes all allocated native memory.

    Declaration
    public override void Dispose()
    Overrides
    CellItemLayer.Dispose()

    Init(HexTerrainSettings)

    Initializes/Reinitializes the area data.

    Declaration
    public override void Init(HexTerrainSettings settings)
    Parameters
    Type Name Description
    HexTerrainSettings settings

    new terrain settings

    Overrides
    CellItemLayer.Init(HexTerrainSettings)

    InitRenderEntitiesLOD(BulkRenderItemsDataLayer)

    Declaration
    public virtual void InitRenderEntitiesLOD(BulkRenderItemsDataLayer renderEntitiesDataLayer)
    Parameters
    Type Name Description
    BulkRenderItemsDataLayer renderEntitiesDataLayer

    InitRenderEntitiesLODs()

    Declaration
    public virtual void InitRenderEntitiesLODs()

    InitVisuals(IList<CellObjectVisualItemSettings>, IList<CellObjectLODSettings>)

    Creates (if not already created) and initializes the CellObjectConfigs list with the provided configs. Copies data from provided array, so it's safe to dispose a copyConfigsFrom array after this call.

    Declaration
    public virtual void InitVisuals(IList<CellObjectVisualItemSettings> copyVisualItemsFrom, IList<CellObjectLODSettings> copyObjectLODSettingsFrom)
    Parameters
    Type Name Description
    IList<CellObjectVisualItemSettings> copyVisualItemsFrom
    IList<CellObjectLODSettings> copyObjectLODSettingsFrom

    Init<TInitArgs>(HexTerrainSettings, TInitArgs)

    Initializes the terrain system using the specified settings and initialization arguments.

    Declaration
    public override void Init<TInitArgs>(HexTerrainSettings settings, TInitArgs initArgs)
    Parameters
    Type Name Description
    HexTerrainSettings settings

    The configuration settings to apply when initializing the terrain system. Cannot be null.

    TInitArgs initArgs

    Additional arguments required for initialization. The expected type and usage depend on the implementation.

    Type Parameters
    Name Description
    TInitArgs

    The type of the initialization arguments to be used during terrain system setup.

    Overrides
    CellItemLayer.Init<TInitArgs>(HexTerrainSettings, TInitArgs)

    Render(Camera, IBulkRenderer, BulkRenderItemsDataLayer)

    Declaration
    public virtual void Render(Camera camera, IBulkRenderer renderEntitiesConfig, BulkRenderItemsDataLayer renderItemsDataLayer)
    Parameters
    Type Name Description
    Camera camera
    IBulkRenderer renderEntitiesConfig
    BulkRenderItemsDataLayer renderItemsDataLayer

    Render(Camera, float)

    Declaration
    public virtual void Render(Camera camera, float normalizedCameraZoom)
    Parameters
    Type Name Description
    Camera camera
    float normalizedCameraZoom

    RenderLODs(Camera, float)

    Declaration
    public virtual bool RenderLODs(Camera camera, float normalizedCameraZoom)
    Parameters
    Type Name Description
    Camera camera
    float normalizedCameraZoom
    Returns
    Type Description
    bool

    Implements

    IDisposable
    ISerializableTerrainLayer

    Extension Methods

    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