Terrain

package
v0.0.0-...-9749107 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlendMapGenerator

type BlendMapGenerator struct {
	R Range `yaml:"r"`
	G Range `yaml:"g"`
	B Range `yaml:"b"`
}

func (*BlendMapGenerator) GenerateBlendMap

func (generator *BlendMapGenerator) GenerateBlendMap(heightMap *HeightMap) (*Texture.Texture2D, error)

type Chunk

type Chunk struct {
	Mesh.Mesh
}

type HeightMap

type HeightMap struct {
	NumRows    int
	NumColumns int
	Scale      float32
	// contains filtered or unexported fields
}

func ImportHeightMap

func ImportHeightMap(filename string) (HeightMap, error)

func NewHeightMapFromGrey

func NewHeightMapFromGrey(img *image.Gray) HeightMap

func (*HeightMap) GetBiTangent

func (heightMap *HeightMap) GetBiTangent(x int, z int) GeometryMath.Vector3

func (*HeightMap) GetHeight

func (heightMap *HeightMap) GetHeight(x int, z int) float32

func (*HeightMap) GetHeightScaled

func (heightMap *HeightMap) GetHeightScaled(x int, z int) float32

func (*HeightMap) GetNormal

func (heightMap *HeightMap) GetNormal(x int, z int) GeometryMath.Vector3

func (*HeightMap) GetTangent

func (heightMap *HeightMap) GetTangent(x int, z int) GeometryMath.Vector3

func (*HeightMap) UnmarshalYAML

func (heightMap *HeightMap) UnmarshalYAML(value *yaml.Node) error

type ITerrain

type ITerrain interface {
	GetHeightAt(terrainPos GeometryMath.Vector3) float32
}

type PlacementMap

type PlacementMap HeightMap

func ImportPlacementMap

func ImportPlacementMap(filename string) (PlacementMap, error)

func NewPlacementMapFromGrey

func NewPlacementMapFromGrey(img *image.Gray) PlacementMap

func (*PlacementMap) GetProbability

func (placementMap *PlacementMap) GetProbability(x int, z int) float32

func (*PlacementMap) GetProbabilityAtArea

func (placementMap *PlacementMap) GetProbabilityAtArea(minX, minZ, maxX, maxZ int) float32

func (*PlacementMap) UnmarshalYAML

func (placementMap *PlacementMap) UnmarshalYAML(value *yaml.Node) error

type PlacementMapGenerator

type PlacementMapGenerator struct {
	Ranges []Range `yaml:"ranges"`
}

type Range

type Range struct {
	Height      float32 `yaml:"height"`
	OpaqueRange float32 `yaml:"opaqueRange"`
	BlendRange  float32 `yaml:"blendRange"`
}

func (*Range) GetFactor

func (heightRange *Range) GetFactor(height float32) float32

type Terrain

type Terrain struct {
	Chunks   []Chunk
	Material *Material.BlendMaterial

	TileSize  float32
	HeightMap HeightMap

	OffsetX float32
	OffsetZ float32
}

func GenerateTerrain

func GenerateTerrain(heightMap HeightMap, tileSize float32) (*Terrain, error)

func (*Terrain) Draw

func (terrain *Terrain) Draw(shader Shader.IShaderProgram, invoker Scene.IDrawable, scene Scene.IScene, camera Camera.ICamera) error

func (*Terrain) GetHeightAt

func (terrain *Terrain) GetHeightAt(terrainPos GeometryMath.Vector3) float32

func (*Terrain) SetModelMatrix

func (terrain *Terrain) SetModelMatrix(mat GeometryMath.Matrix4x4)

func (*Terrain) UnmarshalYAML

func (terrain *Terrain) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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