Interface IInitCellValueDataLayerArgs<TValue>
Defines the arguments used to initialize cell values in a data layer, including value ranges, fill options, and optional source texture settings.
Namespace: Fwt.HexTerrains.Data
Assembly: fwt.hexterrains.dll
Syntax
public interface IInitCellValueDataLayerArgs<TValue> where TValue : unmanaged
Type Parameters
| Name | Description |
|---|---|
| TValue | The unmanaged value type used for cell values in the data layer. |
Remarks
Implementations of this interface allow configuration of how cell values are initialized, supporting scenarios such as filling with a constant value, random values within a range, or values derived from a source texture. The specific combination of options determines the initialization behavior.
Properties
DefaultValue
When the layer is resized, this value is used to fill any new cells that are added to the layer. This allows for consistent initialization of new cells when the layer's dimensions change.
Declaration
TValue DefaultValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
FillValue
When the layer is initialized, this value is used to fill all cells in the layer. This provides a simple way to set a uniform initial value for all cells, which can be useful for creating flat terrain features or resetting cell values during initialization.
Declaration
TValue FillValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
IsApplySourceTexture
If true, the initialization process will apply values from a source texture to the cells. The source texture can be used to provide spatially varying initial values based on its pixel data, allowing for more complex and visually interesting terrain features SourceTextureValueOffset and SourceTextureValueScale.
Declaration
bool IsApplySourceTexture { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsFillWithRandomValues
If true, the initialization process will fill cells with random values within the specified range defined by RandomMinValue and RandomMaxValue. This option allows for the creation of more varied and natural-looking terrain features by introducing randomness into the initial cell values.
Declaration
bool IsFillWithRandomValues { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsFillWithValue
If true, the initialization process will fill cells with a constant value defined by FillValue. This option is useful for creating uniform terrain features or resetting cell values to a known state during initialization.
Declaration
bool IsFillWithValue { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaxValue
Value representing the maximum expected value in the cell. Does not restrict the actual values that can be assigned to the cell, but serves as a reference for normalization or scaling purposes when processing cell values, such as calculating a color map.
Declaration
TValue MaxValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
MinValue
Value representing the minimum expected value in the cell. Does not restrict the actual values that can be assigned to the cell, but serves as a reference for normalization or scaling purposes when processing cell values, such as calculating a color map.
Declaration
TValue MinValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
RandomMaxValue
If IsFillWithRandomValues is true, this value represents the maximum value in the range from which random values will be generated to fill the cells. The actual random values assigned to the cells will be greater than or equal to RandomMinValue and less than or equal to this maximum value."/>
Declaration
TValue RandomMaxValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
RandomMinValue
If IsFillWithRandomValues is true, this value represents the minimum value in the range from which random values will be generated to fill the cells. The actual random values assigned to the cells will be greater than or equal to this minimum value and less than or equal to RandomMaxValue."/>
Declaration
TValue RandomMinValue { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
SourceTexture
If IsApplySourceTexture is true, this property holds the reference to the source texture used to initialize cell values. The pixel data from this texture can be sampled and processed to derive initial values for the cells, allowing for spatially varying initialization based on the texture's content. The specific mapping of texture pixels to cell values can be influenced by SourceTextureValueOffset and SourceTextureValueScale to achieve the desired range and distribution of initial cell values."/>
Declaration
Texture2D SourceTexture { get; set; }
Property Value
| Type | Description |
|---|---|
| Texture2D |
SourceTextureValueOffset
If IsApplySourceTexture is true, this value is added to the sampled pixel values from the source texture before applying them to the cells. This allows for adjusting the baseline of the initial cell values derived from the texture, effectively shifting the range of values that can be assigned to the cells based on the texture's pixel data.
Declaration
float SourceTextureValueOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
SourceTextureValueScale
If IsApplySourceTexture is true, this value is multiplied with the sampled pixel values from the source texture (after applying SourceTextureValueOffset) before applying them to the cells. This allows for scaling the range of initial cell values derived from the texture, effectively amplifying or reducing the influence of the texture's pixel data on the final cell values.
Declaration
float SourceTextureValueScale { get; set; }
Property Value
| Type | Description |
|---|---|
| float |