Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
EXPECTED_BLOCKS_PER_FLAT_MAPBLOCK = 16 * 16
)
Variables ¶
This section is empty.
Functions ¶
func AddColorComponent ¶
add a color component (darker, lighter)
func AdjustAndFill ¶ added in v1.0.3
Types ¶
type IsoDirection ¶ added in v1.0.3
type IsoDirection uint8
const ( // default direction, x and z increase IsoDirectionNorthEast IsoDirection = 0 IsoDirectionNorthWest IsoDirection = 1 IsoDirectionSouthWest IsoDirection = 2 IsoDirectionSouthEast IsoDirection = 3 )
look direction
type IsoRenderer ¶ added in v1.0.3
type IsoRenderer struct {
// contains filtered or unexported fields
}
func NewIsoRenderer ¶ added in v1.0.3
func NewIsoRenderer(cm *colormapping.ColorMapping, mba MapblockAccessor, height int) (*IsoRenderer, error)
func (*IsoRenderer) GetImagePos ¶ added in v1.0.3
func (r *IsoRenderer) GetImagePos(x, y, z float64) (float64, float64)
func (*IsoRenderer) Render ¶ added in v1.0.3
func (r *IsoRenderer) Render(pos MapblockPosGetter, y_block_height int, direction IsoDirection) (*image.NRGBA, error)
type MapRenderer ¶
type MapRenderer struct {
// contains filtered or unexported fields
}
Example ¶
// create color mapping cm := colormapping.NewColorMapping() // TODO: implemement mapblock fetching and parsing here accessor := func(pos MapblockPosGetter) (Mapblock, error) { return nil, nil } // create renderer with 256 px sidelength r, err := NewMapRenderer(cm, accessor, 256) if err != nil { panic(err) } // render the mapblock at 0,0,0 with 10 mapblocks y-height into an image img, err := r.Render(&MapblockPos{X: 0, Y: 0, Z: 0}, 10) if err != nil { panic(err) } // create an output file f, err := os.Create("output.png") if err != nil { panic(err) } // write to the file err = png.Encode(f, img) if err != nil { panic(err) }
Output:
func NewMapRenderer ¶
func NewMapRenderer(cm *colormapping.ColorMapping, mba MapblockAccessor, size int) (*MapRenderer, error)
func (*MapRenderer) IsViewBocking ¶
func (r *MapRenderer) IsViewBocking(nodename string) bool
func (*MapRenderer) Render ¶
func (r *MapRenderer) Render(pos MapblockPosGetter, y_block_height int) (*image.NRGBA, error)
type MapblockAccessor ¶
type MapblockAccessor func(pos MapblockPosGetter) (Mapblock, error)
type MapblockPos ¶
type MapblockPos struct {
X, Y, Z int
}
func (*MapblockPos) GetX ¶ added in v1.0.2
func (pos *MapblockPos) GetX() int
func (*MapblockPos) GetY ¶ added in v1.0.2
func (pos *MapblockPos) GetY() int
func (*MapblockPos) GetZ ¶ added in v1.0.2
func (pos *MapblockPos) GetZ() int
type MapblockPosGetter ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.