Texture now checks for transparent pixels
This commit is contained in:
parent
fae918a196
commit
45fa282b61
11
texture.go
11
texture.go
@ -4,9 +4,10 @@ import "image"
|
|||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
|
|
||||||
type texture struct {
|
type texture struct {
|
||||||
pix []uint8
|
pix []uint8
|
||||||
stride int
|
stride int
|
||||||
rect image.Rectangle
|
rect image.Rectangle
|
||||||
|
transparent bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (backend *Backend) NewTexture (source image.Image) tomo.Texture {
|
func (backend *Backend) NewTexture (source image.Image) tomo.Texture {
|
||||||
@ -27,6 +28,10 @@ func (backend *Backend) NewTexture (source image.Image) tomo.Texture {
|
|||||||
texture.pix[index + 2] = uint8(r >> 8)
|
texture.pix[index + 2] = uint8(r >> 8)
|
||||||
texture.pix[index + 3] = uint8(a >> 8)
|
texture.pix[index + 3] = uint8(a >> 8)
|
||||||
index += 4
|
index += 4
|
||||||
|
|
||||||
|
if a != 0xFFFF {
|
||||||
|
texture.transparent = true
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
return texture
|
return texture
|
||||||
|
Reference in New Issue
Block a user