Documentation
¶
Overview ¶
Package meshopt decodes the meshoptimizer bitstreams used by the EXT_meshopt_compression and KHR_meshopt_compression glTF extensions in pure Go: the attribute codec (versions 0 and 1), the triangle and index sequence codecs, and the octahedral, quaternion, exponential and color filters.
It is a port, modified for Go, of the scalar reference decoder in meshoptimizer 0.25 (https://github.com/zeux/meshoptimizer, Copyright (c) 2016-2025 Arseny Kapoulkine, MIT License; see the LICENSE file in this directory), and rejects truncated or malformed streams with an error instead of reading out of bounds.
Index ¶
- Variables
- func DecodeFilterColor(data []byte, count, stride int) error
- func DecodeFilterExp(data []byte, count, stride int) error
- func DecodeFilterOct(data []byte, count, stride int) error
- func DecodeFilterQuat(data []byte, count, stride int) error
- func DecodeIndexBuffer(dst []byte, count, size int, data []byte) error
- func DecodeIndexSequence(dst []byte, count, size int, data []byte) error
- func DecodeVertexBuffer(dst []byte, count, size int, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHeader reports an unknown header byte or unsupported codec version. ErrHeader = errors.New("meshopt: invalid header or unsupported version") // ErrData reports a truncated stream, trailing bytes or a malformed block. ErrData = errors.New("meshopt: malformed or truncated data") // ErrLayout reports an element size or count the codec cannot represent. ErrLayout = errors.New("meshopt: invalid element size or count") )
Errors returned for streams that cannot be decoded.
Functions ¶
func DecodeFilterColor ¶
DecodeFilterColor decodes count YCoCg-encoded colors stored as 4 unsigned bytes (stride 4) or 4 unsigned 16-bit integers (stride 8).
func DecodeFilterExp ¶
DecodeFilterExp decodes count elements of stride bytes holding 32-bit values with an 8-bit exponent and a 24-bit signed mantissa.
func DecodeFilterOct ¶
DecodeFilterOct decodes count octahedral-encoded unit vectors stored as 4 signed bytes (stride 4) or 4 signed 16-bit integers (stride 8).
func DecodeFilterQuat ¶
DecodeFilterQuat decodes count quaternions stored as 4 signed 16-bit integers with the largest component reconstructed (stride 8).
func DecodeIndexBuffer ¶
DecodeIndexBuffer decodes count triangle-list indices of size bytes (2 or 4) from the triangle codec stream data into dst.
func DecodeIndexSequence ¶
DecodeIndexSequence decodes count indices of size bytes (2 or 4) from the index sequence codec stream data into dst.
Types ¶
This section is empty.