Class AddNoiseUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer>
Inheritance
Implements
Inherited Members
Namespace: Fwt.HexTerrains.UserTools.SM.States
Assembly: fwt.hexterrains.dll
Syntax
public abstract class AddNoiseUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer> : DataLayerBrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer, TDataLayer, float>, ISmState where TBrushTarget : HexTerrainLayerGroup where TTerrainLayer : HexTerrainLayer where TDataLayer : CellValueDataLayer<float>
Type Parameters
| Name | Description |
|---|---|
| TBrushTarget | |
| TTerrainLayer | |
| TDataLayer |
Constructors
AddNoiseUserToolStateBase(ISmState)
Declaration
protected AddNoiseUserToolStateBase(ISmState parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ISmState | parent |
Properties
NoiseRep
Gets the noise repetition parameters as a two-dimensional vector.
Declaration
public virtual float2 NoiseRep { get; }
Property Value
| Type | Description |
|---|---|
| float2 |
NoiseScale
Gets the scale factors applied to noise generation along each axis.
Declaration
public virtual float2 NoiseScale { get; }
Property Value
| Type | Description |
|---|---|
| float2 |
TerrainLayerIndex
Gets or sets the index of the terrain layer associated with this instance.
Declaration
public override int TerrainLayerIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
ApplyBrush(int, int2, int, TBrushTarget, int)
Applies a procedural brush effect to the specified terrain cell using Perlin noise to determine elevation.
Declaration
public override bool ApplyBrush(int brushMode, int2 cellCoord, int cellIndex, TBrushTarget brushTarget, int mouseButton)
Parameters
| Type | Name | Description |
|---|---|---|
| int | brushMode | The brush mode to use when applying the effect. Determines the type of brush operation performed. |
| int2 | cellCoord | The coordinates of the terrain cell to which the brush is applied. |
| int | cellIndex | The index of the terrain cell within the data layer. |
| TBrushTarget | brushTarget | The target object containing terrain settings and context for the brush operation. |
| int | mouseButton | The mouse button used to trigger the brush action. Typically indicates the type of user interaction. |
Returns
| Type | Description |
|---|---|
| bool | true if the brush effect was successfully applied to the terrain cell; otherwise, false. |
Overrides
Remarks
This method uses Perlin noise to procedurally set the elevation of the specified terrain cell. The operation will fail if the terrain or data layer is unavailable for the given target.
Init(UserToolStateSettings)
Initializes the tool state with the specified settings.
Declaration
public override void Init(UserToolStateSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| UserToolStateSettings | settings | The settings to apply to the tool state. Cannot be null. |
Overrides
InitDefaultSettings()
Initializes the default parameter settings for the user tool by configuring the data source with predefined values and constraints.
Declaration
protected override void InitDefaultSettings()
Overrides
Remarks
This method sets up the data source with default parameters such as layer index, noise scale, and noise repetition, including their initial values, visibility, and valid ranges. It is typically called during tool initialization to ensure consistent starting values for user interaction.
LoadSettings()
Loads the terrain layer settings from the underlying data source and applies them to the current instance.
Declaration
protected override void LoadSettings()
Overrides
Remarks
This method overrides the base implementation to retrieve and set values specific to terrain layer configuration, such as layer index, noise scale, and noise repetition. It is typically called during initialization to ensure that the object's settings reflect the persisted or default values.
SaveSettings()
Saves the current terrain and noise settings to persistent storage.
Declaration
protected override void SaveSettings()
Overrides
Remarks
This method overrides the base implementation to store additional settings specific to terrain layers and noise parameters. It is typically called to persist user or application configuration changes.