Documentation ¶
Overview ¶
Package mesh contains methods for baking areas into GLTF meshes.
Index ¶
- func EncodeDetailedMesh(a *area.Area, t Transformer) (doc *gltf.Document, err error)
- func FASTFLOOR(x float64) int
- func Noise1(x float64) float64
- func Noise2(x, y float64) float64
- func Noise3(x, y, z float64) float64
- func Q(cond bool, v1 float64, v2 float64) float64
- type BaseTransform
- func (b *BaseTransform) ConvertTo3D(h hex.Hex, actual hex.HexFractional) [3]float32
- func (b *BaseTransform) EdgeColor(h hex.Hex, direction int) (top, bottom [3]uint8)
- func (b *BaseTransform) EdgeSlopeStrength() float32
- func (b *BaseTransform) HexColor(h hex.Hex) [3]uint8
- func (b *BaseTransform) PaintEdge(h hex.Hex, direction int) bool
- func (b *BaseTransform) PointColor(h hex.Hex, direction int) [3]uint8
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeDetailedMesh ¶
EncodeDetailedMesh
Types ¶
type BaseTransform ¶
type BaseTransform struct {
// contains filtered or unexported fields
}
func (*BaseTransform) ConvertTo3D ¶
func (b *BaseTransform) ConvertTo3D(h hex.Hex, actual hex.HexFractional) [3]float32
func (*BaseTransform) EdgeColor ¶
func (b *BaseTransform) EdgeColor(h hex.Hex, direction int) (top, bottom [3]uint8)
func (*BaseTransform) EdgeSlopeStrength ¶
func (b *BaseTransform) EdgeSlopeStrength() float32
func (*BaseTransform) PointColor ¶
func (b *BaseTransform) PointColor(h hex.Hex, direction int) [3]uint8
type Transformer ¶
type Transformer interface { // ConvertTo3D converts some hex vector to 3D cartesian space. // // glTF defines +Y as up, +Z as forward, and -X as right. ConvertTo3D(h hex.Hex, actual hex.HexFractional) [3]float32 // HexColor sets the color for the center vertex of each hex. HexColor(h hex.Hex) [3]uint8 // PointColor sets the color for a hex point vertex that // is shared by the hexes h, h.Direction(direction), and h.Direction(direction+1). // // You can use this in a fancy shader to draw borders around // hexes if you make it different from HexColor(). PointColor(h hex.Hex, direction int) [3]uint8 // EdgeColor returns the color of the rectangle that sits between // h and h.Neigbor(direction). This is not used by EncodeDetailed, // since that rectangle doesn't exist. EdgeColor(h hex.Hex, direction int) (top, bottom [3]uint8) // PaintEdge should return true if you want to draw the vertical edge between hexes // of different heights. PaintEdge(h hex.Hex, direction int) bool // EdgeSlopeStrength determines if hexes of different heights are shear (0.0) or // VERY sloped (1.0). EdgeSlopeStrength() float32 }
Transformer converts 2-dimensional cartesian space into three dimensions. Use this to select which dimension is "up" and do stretching if needed.
Click to show internal directories.
Click to hide internal directories.