Documentation
¶
Overview ¶
Package texcompress implements pure-Go block compression for build-time texture preprocessing. Every encoder is deterministic and reuses scratch storage where possible, so a build stays reproducible and keeps a small heap.
Encoders read straight or premultiplied RGBA8 pixels and never touch alpha unless the target format stores it. BC1 and BC3 read colour from the red, green, and blue channels; BC4 and BC5 read red and green, which is where normal and material maps keep their data. ASTC 4x4 stores all four channels in its standard constant-color block form.
Index ¶
- func DecodeBCLevel(dst, src []byte, width, height int, format render.TextureFormat)
- func EncodeChain(format render.TextureFormat, pixels []byte, width, height int) ([]byte, int, error)
- func EncodeLevel(format render.TextureFormat, pixels []byte, width, height int) ([]byte, error)
- func Formats() []render.TextureFormat
- func Opaque(pixels []byte) bool
- func Supported(format render.TextureFormat) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBCLevel ¶ added in v0.1.9
func DecodeBCLevel(dst, src []byte, width, height int, format render.TextureFormat)
DecodeBCLevel expands one BC1 RGB or BC3 level, clipping partial edge blocks to its logical dimensions. Both buffers have been sized by the caller.
func EncodeChain ¶
func EncodeChain(format render.TextureFormat, pixels []byte, width, height int) ([]byte, int, error)
EncodeChain compresses a full mip chain from the largest level down to 1x1 and returns the concatenated payload together with its level count.
func EncodeLevel ¶
EncodeLevel compresses one mip level of RGBA8 pixels.
func Formats ¶
func Formats() []render.TextureFormat
Formats reports every format this package can encode.
func Opaque ¶
Opaque reports whether every texel of an RGBA8 level is fully opaque. BC1 cannot store alpha, so callers use this to choose between BC1 and BC3.
func Supported ¶
func Supported(format render.TextureFormat) bool
Supported reports whether format has an encoder in this package.
Types ¶
This section is empty.