genmap2derosion

package
v0.0.0-...-ce97658 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

README

Hydraulic Erosion

This package is based on the fantastic work of Nick McDonald! See: https://github.com/weigert/SimpleHydrology

Principle

See: https://nickmcd.me/2020/04/15/procedural-hydrology/ See: https://nickmcd.me/2020/11/23/particle-based-wind-erosion/

Notes

This is not a complete port of the code mentioned above and includes some experimental alternatives for determining water flux information.

alt text

TODO

  • Fix up climate simulation
    • Use primary heightmap directly
  • Finalize flood algorithm documentation
  • Either complete or remove flux based hydrology
  • Add vegetation
  • Clean up different erosion algorithms
  • Make effective use of sediment in hydrology

Done

  • Get rid of terrain struct
  • Move biomes to climate struct
  • Basic wind erosion

Documentation

Overview

Package genmap2derosion is based on "Simple Hydrology" See: https://nickmcd.me/2020/04/15/procedural-hydrology/

Index

Constants

View Source
const DefaultSeed = 12356

Variables

View Source
var DefaultParams = &Params{
	StoreGIFFrames: true,
	StorePNGCycles: true,
	Seed:           DefaultSeed,
	Size: vectors.IVec2{
		X: worldsize,
		Y: worldsize,
	},
	UseWindErosion: false,
}

Functions

func MapF

func MapF(f genheightmap.Modify, hm []float64)

Types

type Climate

type Climate struct {

	// Curent climate state.
	TempMap       []float64  // local temperature
	HumidityMap   []float64  // local humidity
	CloudMap      []bool     // cloud cover (true = cloudy)
	RainMap       []bool     // rain is falling (true = raining)
	WindMap       []float64  // local wind speeds
	WindDirection [2]float64 // global wind vector (from 0-1)

	// Average climate maps (collected over the course of the simulation)
	AvgRainMap     []float64 // average raininess over time
	AvgWindMap     []float64 // average wind speed over time
	AvgCloudMap    []float64 // average cloud cover over time
	AvgTempMap     []float64 // average temperature over time
	AvgHumidityMap []float64 // average humidity over time
	// contains filtered or unexported fields
}

func NewClimate

func NewClimate(dimX, dimY, day, seed int, heightmap []float64) *Climate

type Drop

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

func NewDrop

func NewDrop(pos vectors.Vec2) Drop

NewDrop returns a new particle at the given position.

func NewDropWithVolume

func NewDropWithVolume(pos vectors.Vec2, v float64) Drop

NewDropWithVolume returns a new particle at the given position with the given volume.

type Params

type Params struct {
	StoreGIFFrames bool
	StorePNGCycles bool
	Height         int64
	Width          int64
	Seed           int64
	Size           vectors.IVec2
	UseWindErosion bool
}

type Wind

type Wind struct {
	Index    int
	Pos      vectors.Vec2
	Height   float64
	PSpeed   vectors.Vec3
	Speed    vectors.Vec3
	Sediment float64 //Sediment Mass
}

func NewWind

func NewWind(pos vectors.Vec2) *Wind

func (*Wind) Cascade

func (w *Wind) Cascade(i int, h, sediment []float64, dim vectors.Vec2)

func (*Wind) Fly

func (w *Wind) Fly(h, windpath, sediment []float64, track []bool, dim vectors.Vec2, scale float64)

type World

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

func NewWorld

func NewWorld(params *Params) *World

func (*World) ApplyGen

func (w *World) ApplyGen(f genheightmap.GenFunc)

func (*World) ExportGif

func (w *World) ExportGif(path string) error

Export all frames to a GIF under the given path.

func (*World) ExportOBJ

func (w *World) ExportOBJ(path string) error

func (*World) ExportPng

func (w *World) ExportPng(name string, h []float64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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