Documentation
¶
Overview ¶
Package worldmaterialgpu defines prepared GPU material texture arrays.
Index ¶
Constants ¶
const ( Feature = "world/material-gpu@1" MetadataKey = "kartyWorldMaterialGPU" DescriptorEntry = "@world/material-gpu-layout" AlbedoEntry = "@world/material-albedo.ktx2" SSBumpEntry = "@world/material-ssbump.ktx2" DetailEntry = "@world/material-detail.ktx2" BinaryMagic = "KMG1" MaxDescriptorBytes = 1024 )
Variables ¶
var ErrMaterial = errors.New("prepared GPU world material is invalid")
Functions ¶
func EncodeDescriptor ¶
func EncodeDescriptor(d Descriptor) ([]byte, error)
EncodeDescriptor emits KMG1, canonical-layout SHA-256, uint16 count and full uint32 material IDs. All integers are big-endian; no trailing fields exist.
func ValidateDeclaration ¶
ValidateDeclaration rejects partial, orphaned or undeclared prepared arrays. A cartridge may contain ordinary levels alongside levels using this feature. The base material layout remains required, but old QOI images are not required for a level selecting the prepared GPU material contract.
Types ¶
type Descriptor ¶
Descriptor binds the full material order to the canonical source layout, including coverage and strength controls. Every material has all three arrays.
func DecodeDescriptor ¶
func DecodeDescriptor(encoded []byte) (Descriptor, error)
func NewDescriptor ¶
func NewDescriptor(layout worldmaterial.Layout) (Descriptor, error)
func (Descriptor) Validate ¶
func (d Descriptor) Validate(layout worldmaterial.Layout) error
type Pair ¶
type Pair struct {
Descriptor Descriptor
Albedo, SSBump, Detail []byte
}
Pair contains one mandatory trio, with caller-owned immutable byte slices. Each KTX2 contains final 256x256 material layers and all nine mip levels. Albedo is sRGB RGB and coverage alpha. SSBump is linear coefficients RGB and emission-mask alpha. Detail is linear normal XY, metallic B, smoothness A.