Documentation
¶
Index ¶
- func RenderImg(source SourceInterface, gradient Gradient, filename string, width int, ...) error
- type Abs
- type Add
- type Billow
- type Clamp
- type Constant
- type Displace
- type Divide
- type Gradient
- type Invert
- type Max
- type Min
- type Multiply
- type Perlin
- type Power
- type RidgedMulti
- type SourceInterface
- type Sphere
- type Turbulence
- type Turbulence1D
- type WhiteNoise
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderImg ¶
func RenderImg(source SourceInterface, gradient Gradient, filename string, width int, height int) error
RenderImg generates an image from source, stored in filename.
The gradient parameter defines the colors to build the image. The parameters width & height defines the size. The image should be squared, to avoid deformations.
Types ¶
type Abs ¶
type Abs struct {
Source SourceInterface
}
Abs takes 1 source on which to fetch the absolute values.
type Add ¶
type Add struct { SourceA SourceInterface SourceB SourceInterface }
Add takes 2 sources to do the sum.
type Billow ¶
Billow implements SourceInterface.
- Frequency sets the first (biggest) Octave. - Lacunarity sets the multiplier to the frequency for each successive Octave. - Persistence sets the amplitude for each successive Octave. - OctaveCount sets the number of Octaves to generate and blend. - Seed sets the random seed, useful to regenerate the same image if required.
type Clamp ¶
type Clamp struct { Source SourceInterface SourceMin, SourceMax SourceInterface }
Clamp takes 1 source and min/max values.
type Constant ¶
type Constant struct {
Value float64
}
Constant implements SourceInterface.
It stores a static Value.
type Displace ¶ added in v1.1.0
type Displace struct { Source SourceInterface SourceX, SourceY, SourceZ SourceInterface }
Displace takes 1 Source to which we modify the axis with the value of the three SourceX, SourceY, SourceZ.
type Divide ¶
type Divide struct { SourceA SourceInterface SourceB SourceInterface }
Divide takes 2 sources to divide the value from the SourceA by the value of the SourceB.
type Gradient ¶
Gradient is an unsorted map of colors, with positions [-1;1] as keys.
type Invert ¶
type Invert struct {
Source SourceInterface
}
Invert takes 1 source from which to inverse the values.
type Max ¶
type Max struct { SourceA SourceInterface SourceB SourceInterface }
Max takes 1 source and a maximum value.
type Min ¶
type Min struct { SourceA SourceInterface SourceB SourceInterface }
Min takes 1 source and a minimum value.
type Multiply ¶
type Multiply struct { SourceA SourceInterface SourceB SourceInterface }
Multiply takes 2 sources to be multiplied.
type Perlin ¶
Perlin implements SourceInterface.
- Frequency sets the first (biggest) Octave. - Lacunarity sets the multiplier to the frequency for each successive Octave. - Persistence sets the amplitude for each successive Octave. - OctaveCount sets the number of Octaves to generate and blend. - Seed sets the random seed, useful to regenerate the same image if required.
type Power ¶
type Power struct { SourceA SourceInterface SourceB SourceInterface }
Power takes 2 sources.
type RidgedMulti ¶
type RidgedMulti struct {
Frequency, Lacunarity, Persistence, Offset, Gain float64
OctaveCount, Seed int
}
RidgedMulti implements SourceInterface.
- Frequency sets the first (biggest) Octave. - Lacunarity sets the multiplier to the frequency for each successive Octave. - Persistence sets the amplitude for each successive Octave. - Offset is added for each successive Octave, enabling more ridges, a rougher result. - Gain sets the factor for the high-frequency ridges, enabling more detailed noises in high Octaves. - OctaveCount sets the number of Octaves to generate and blend. - Seed sets the random seed, useful to regenerate the same image if required.
func (RidgedMulti) GetValue ¶
func (ridgedMulti RidgedMulti) GetValue(x, y, z float64) float64
GetValue returns the value between [-1;1] for a given 3D position.
type SourceInterface ¶
SourceInterface defines a Source/Operator.
Its method GetValue returns a value between [-1;1], for a given 3 dimension position.
type Sphere ¶
Sphere is a SourceInterface.
Frequency is the quantity of inner spheres, and the Offsets allow a padding to center/move away the sphere(s).
type Turbulence ¶ added in v1.1.0
type Turbulence struct { Source SourceInterface Frequency, Power float64 Roughness, Seed int }
func (Turbulence) GetValue ¶ added in v1.1.0
func (turbulence Turbulence) GetValue(x, y, z float64) float64
GetValue returns the value from Source, computed using the displacement of x,y,z with SourceX, SourceY and SourceZ values.
type Turbulence1D ¶ added in v1.1.0
type Turbulence1D struct { Source SourceInterface Frequency, Power float64 Roughness, Seed int }
func (Turbulence1D) GetValue ¶ added in v1.1.0
func (turbulence Turbulence1D) GetValue(x, y, z float64) float64
GetValue returns the value from Source, computed using the displacement of x,y,z with SourceX, SourceY and SourceZ values.
type WhiteNoise ¶ added in v1.1.0
type WhiteNoise struct { }
WhiteNoise implements SourceInterface.
It returns a completely random value.
func (WhiteNoise) GetValue ¶ added in v1.1.0
func (whiteNoise WhiteNoise) GetValue(x, y, z float64) float64
GetValue returns a random value between [-1;1] for a given 3D position.