asset

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package asset defines the public, versioned processing contract shared by Karty SDK manifests, the CLI asset processors, and runtime hosts.

Index

Constants

View Source
const (
	MaxSourceAssetBytes           = 64 * 1024 * 1024
	MaxSourceImageDimension       = 16_384
	MaxSourceImagePixels          = 64 * 1024 * 1024
	MaxTextureDimension           = 8_192
	MaxTexturePixels              = 16 * 1024 * 1024
	MaxDecodedTextureBytes        = 64 * 1024 * 1024
	MaxDecodedTextures            = 256 * 1024 * 1024
	MaxSoundDurationSeconds       = 30
	MaxDecodedSoundBytes          = 6 * 1024 * 1024
	MaxDecodedSounds              = 64 * 1024 * 1024
	MaxSimultaneousSoundVoices    = 32
	MaxAudioStreamDurationSeconds = 4 * 60 * 60
	MaxEncodedAudioStreamBytes    = 512 * 1024 * 1024
)

Variables

View Source
var ErrContract = errors.New("asset processing contract is invalid")

Functions

This section is empty.

Types

type AudioRecipe

type AudioRecipe struct {
	SampleRate  uint32      `toml:"sample_rate"`
	ChannelMode ChannelMode `toml:"channels"`
}

AudioRecipe is the resolved, canonical input to qoa@1. Samples are converted to signed PCM16 before QOA encoding. Mono conversion is explicit; preserve keeps mono or stereo source channels unchanged.

func (AudioRecipe) Validate

func (recipe AudioRecipe) Validate() error

type Capabilities

type Capabilities struct {
	Processors []Processor  `toml:"processors"`
	Runtime    []Capability `toml:"runtime"`
}

Capabilities is the canonical SDK-manifest declaration of processors and runtime encodings. Lists must be sorted, unique, and contain known values.

func (Capabilities) Validate

func (capabilities Capabilities) Validate() error

type Capability

type Capability string

Capability identifies a runtime asset encoding accepted by a host.

const (
	CapabilityTextureQOIv1               Capability = "texture/qoi@1"
	CapabilitySoundQOAv1                 Capability = "sound/qoa@1"
	CapabilityAudioStreamQOAv1           Capability = "audio-stream/qoa@1"
	CapabilityVideoMPEG1v1               Capability = "video/mpeg1@1"
	CapabilityWorldLightingV1            Capability = "world/lighting@1"
	CapabilityWorldChunksV1              Capability = "world/chunks@1"
	CapabilityWorldLightmapsV1           Capability = "world/lightmaps@1"
	CapabilityWorldLightmapsPrebakedV1   Capability = "world/lightmaps-prebaked@1"
	CapabilityWorldMaterialMappingV1     Capability = "world/material-mapping@1"
	CapabilityWorldParticlesV1           Capability = "world/particles@1"
	CapabilityWorldParticlesV2           Capability = "world/particles@2"
	CapabilityWorldAnimationsV1          Capability = "world/animations@1"
	CapabilityWorldEmissionV1            Capability = "world/emission@1"
	CapabilityWorldEnvironmentV1         Capability = "world/environment@1"
	CapabilityWorldSolidRenderersV1      Capability = "world/solid-renderers@1"
	CapabilityWorldStaticSolidsV1        Capability = "world/static-solids@1"
	CapabilityWorldMaterialAtlasV1       Capability = "world/material-atlas@1"
	CapabilityWorldMaterialAtlasV2       Capability = "world/material-atlas@2"
	CapabilityWorldMaterialLayersV1      Capability = "world/material-layers@1"
	CapabilityWorldMaterialReflectanceV1 Capability = "world/material-reflectance@1"
)

type ChannelMode

type ChannelMode string
const (
	ChannelPreserve ChannelMode = "preserve"
	ChannelMono     ChannelMode = "mono"
)

type ImageFilter

type ImageFilter string
const (
	ImageFilterNearest ImageFilter = "nearest"
	ImageFilterSmooth  ImageFilter = "smooth-lanczos3"
)

type ImageRecipe

type ImageRecipe struct {
	MaxWidth  uint32      `toml:"max_width"`
	MaxHeight uint32      `toml:"max_height"`
	Filter    ImageFilter `toml:"filter"`
	BitDepth  uint8       `toml:"bit_depth"`
}

ImageRecipe is the resolved, canonical input to qoi@1. Zero maximums mean unlimited within the resource bounds. QOI output always has 8-bit channels. Resizing never upscales; dimensions use integer floor rounding and remain at least one pixel. Smooth filtering means Lanczos3 with straight-alpha pixels.

func (ImageRecipe) Validate

func (recipe ImageRecipe) Validate() error

type Processor

type Processor string

Processor identifies a byte-producing processor whose output and defaults are stable for the lifetime of the identifier.

const (
	ProcessorCopyPNGv1 Processor = "copy-png@1"
	ProcessorQOIv1     Processor = "qoi@1"
	ProcessorQOAv1     Processor = "qoa@1"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL