mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 15:48:17 +01:00
Little code cleanups.
This commit is contained in:
parent
6306a9acb7
commit
f6f5aa0dd1
@ -24,10 +24,6 @@ type Renderer struct {
|
||||
Rejected int
|
||||
}
|
||||
|
||||
const (
|
||||
invalid = math.MinInt32 + 1
|
||||
)
|
||||
|
||||
func NewRenderer(xOfs, zOfs int16, width, height int) (renderer *Renderer) {
|
||||
dim := width * height
|
||||
pixSize := dim * 16 * 16
|
||||
@ -68,7 +64,6 @@ func (r *Renderer) RenderBlock(block *common.Block, nameIndex map[string]int32)
|
||||
// is already filled and the block is strictly below.
|
||||
blockY := int32(block.Coord.Y) << 4
|
||||
pos := int(bz)*r.width + int(bx)
|
||||
//fmt.Printf("pos: %d %d\n", pos, len(r.yMin))
|
||||
if blockY < r.yMin[pos] {
|
||||
r.Rejected++
|
||||
return
|
||||
@ -131,12 +126,14 @@ func (r *Renderer) CreateImage(colors []color.RGBA, background color.RGBA) *imag
|
||||
}
|
||||
|
||||
func safeColor(x int32) uint8 {
|
||||
if x < 0 {
|
||||
x = 0
|
||||
} else if x > 255 {
|
||||
x = 255
|
||||
switch {
|
||||
case x < 0:
|
||||
return 0
|
||||
case x > 255:
|
||||
return 255
|
||||
default:
|
||||
return uint8(x)
|
||||
}
|
||||
return uint8(x)
|
||||
}
|
||||
|
||||
func (r *Renderer) CreateShadedImage(colors []color.RGBA, background color.RGBA) *image.RGBA {
|
||||
|
Loading…
Reference in New Issue
Block a user