terrain

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Painter

type Painter struct {
	// contains filtered or unexported fields
}

func NewPainter

func NewPainter(elev [][]float64) *Painter

func (*Painter) PaintIsocontour added in v0.1.1

func (p *Painter) PaintIsocontour(filename string, levels int) error

Paints only contour of elevation levels

func (*Painter) PaintTerrain added in v0.1.1

func (p *Painter) PaintTerrain(filename string, rules []*Rule) error

Paints generated terrain and saves it into a file. If filename is an empty string it paints it onto the screen as wallpepers using feh

type Rule

type Rule struct {
	Value float64
	Color string
}

Rule is a color rule for a point of elevation map

func NewRule

func NewRule(value float64, color string) *Rule

func (*Rule) Test

func (r *Rule) Test(value float64) string

Test testing provided value agains the rule. If value is following the rule returns hex color, if not - empty string

type TerrainGenerator

type TerrainGenerator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(
	octaves int,
	gain, lacunarity, frequency, scale float64,
) *TerrainGenerator

func (*TerrainGenerator) Generate

func (g *TerrainGenerator) Generate(w, h int, seed int64) [][]float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL