voxel

package
v0.0.0-...-12b68f4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Air Block = iota
	Grass
	Dirt
	Stone
	NumBlocks int = iota
)

Block Enum

View Source
const ChunkSize = 16

ChunkSize - size of chunk on all sides

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block int

Block Type Alias

type Chunk

type Chunk struct {
	X, Y, Z int
	Blocks  [ChunkSize][ChunkSize][ChunkSize]Block
}

Chunk struct

func NewChunk

func NewChunk(x, y, z int) *Chunk

NewChunk - creates a new chunk pointer

func (*Chunk) Map

func (c *Chunk) Map(f func(x, y, z int) Block)

Map - maps a function across all blocks

func (*Chunk) Simplex2D

func (c *Chunk) Simplex2D(seed int64, freq, amp float64)

Simplex2D - generates the chunk with 2d simplex noise

func (*Chunk) Simplex3D

func (c *Chunk) Simplex3D(seed int64, freq, amp float64)

Simplex3D - generates the chunk with 3d simplex noise

func (*Chunk) SimplexOctave2D

func (c *Chunk) SimplexOctave2D(seed int64, iter int, freq, amp, pers, lanc float64)

SimplexOctave2D - generates the chunk with 2d ocatve simplex noise

func (*Chunk) SimplexOctave3D

func (c *Chunk) SimplexOctave3D(seed int64, iter int, freq, amp, pers, lanc float64)

SimplexOctave3D - generates the chunk with 3d octave simplex noise

Jump to

Keyboard shortcuts

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