Documentation ¶
Index ¶
- type CellularDistanceFunc
- type CellularReturnType
- type DomainWarpType
- type Float
- type FractalType
- type NoiseType
- type RotationType3D
- type State
- func (state *State[T]) DomainWarp2D(x, y T) (T, T)
- func (state *State[T]) DomainWarp3D(x, y, z T) (T, T, T)
- func (state *State[T]) FractalType(ft FractalType)
- func (state *State[T]) GetNoise2D(x, y T) T
- func (state *State[T]) GetNoise3D(x, y, z T) T
- func (state *State[T]) Noise2D(x, y int) T
- func (state *State[T]) Noise3D(x, y, z int) T
- func (state *State[T]) NoiseType(nt NoiseType)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CellularDistanceFunc ¶
type CellularDistanceFunc int
CellularDistanceFunc describes the method for cellular distance functions.
const ( CellularDistanceEuclidean CellularDistanceFunc = iota CellularDistanceEuclideanSq CellularDistanceManhattan CellularDistanceHybrid )
type CellularReturnType ¶
type CellularReturnType int
CellularReturnType describes the return type for cellular distance noise.
const ( CellularReturnCellValue CellularReturnType = iota CellularReturnDistance CellularReturnDistance2 CellularReturnDistance2Add CellularReturnDistance2Sub CellularReturnDistance2Mul CellularReturnDistance2Div )
type DomainWarpType ¶
type DomainWarpType int
DomainWarpType describes the method used for domain warps.
const ( DomainWarpOpenSimplex2 DomainWarpType = iota DomainWarpOpenSimplex2Reduced DomainWarpBasicGrid )
type FractalType ¶
type FractalType int
FractalType describes the fractal method for fractal noise types.
const ( FractalNone FractalType = iota FractalFBm FractalRidged FractalPingPong FractalDomainWarpProgressive FractalDomainWarpIndependent )
type RotationType3D ¶
type RotationType3D int
RotationType3D describes a rotation method to apply to 3D noise.
const ( RotationNone RotationType3D = iota RotationImproveXYPlanes RotationImproveXZPlanes )
type State ¶
type State[T Float] struct { // Seed for all noise types. // // Default: 1337 Seed int // Frequency for all noise types. // // Default: 0.01 Frequency T // RotationType3D specified the type of rotation applied to 3D noise. // // Default: RotationNone RotationType3D RotationType3D // Octaves is the number of octaves used for all fractal noise types. // // Default: 3 Octaves int // Lacunarity is the octave Lacunarity for all fractal noise types. // // Default: 2.0 Lacunarity T // Gain is the octave gain for all fractal noise types. // // Default: 0.5 Gain T // WeightedStrength is the octave weighting for all non-domain warp fractal types. // // Default: 0.0 WeightedStrength T // PingPongStrength is the strength of the fractal ping pong effect. // // Default: 2.0 PingPongStrength T // CellularDistanceFunc specifies the distance function used in cellular noise calculations. // // Default: CellularDistanceEuclideanSq, CellularDistanceFunc CellularDistanceFunc // CellularReturnType specifies the cellular return type from cellular noise calculations. // // Default: CellularReturnDistance, CellularReturnType CellularReturnType // CellularJitterMod is the maximum distance a cellular point can move from it's grid position. // Setting this higher than 1 will cause artifacts. // // Default: 1.0 CellularJitterMod T // DomainWarpType specifies the algorithm when using DomainWarp2D or DomainWarp3D. // // Default: DomainWarpOpenSimplex2 DomainWarpType DomainWarpType // DomainWarpAmp is the maximum warp distance from original position when using DomainWarp2D // or DomainWarp3D. // // Default: 1.0 DomainWarpAmp T // contains filtered or unexported fields }
State contains the configuration for generating a noise. This should only be created with NewState, as it will initialize with sane defaults, including any private members.
May be used to generate either float32 or float64 values.
func New ¶
New initializes a new noise generator state with default values. This function must be used to create new states.
func (*State[T]) DomainWarp2D ¶
func (state *State[T]) DomainWarp2D(x, y T) (T, T)
DomainWarp2D warps the input position using current domain warp settings.
func (*State[T]) DomainWarp3D ¶
func (state *State[T]) DomainWarp3D(x, y, z T) (T, T, T)
DomainWarp2D warps the input position using current domain warp settings.
func (*State[T]) FractalType ¶
func (state *State[T]) FractalType(ft FractalType)
FractalType specifies the method used for combining octaves for all fractal noise types. Only effects DomainWarp2D and DomainWarp3D functions.
Default: FractalNone
func (*State[T]) GetNoise2D ¶
func (state *State[T]) GetNoise2D(x, y T) T
GetNoise2D calculates the noise value at the specified 2D position using the current state settings.
Return values are always normalized and in the range of -1.0 and 1.0.
func (*State[T]) GetNoise3D ¶
func (state *State[T]) GetNoise3D(x, y, z T) T
GetNoise3D calculates the noise value at the specified 3D position using the current state settings.
Return values are always normalized and in the range of -1.0 and 1.0.
func (*State[T]) Noise2D ¶
GetNoise2D calculates the noise value at the specified 2D position using the current state settings.
This is a convenience function for GetNoise2D that accepts integral coordinates. Return values are always normalized and in the range of -1.0 and 1.0.