spine

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package spine loads Spine 3.7 JSON and atlas exports and evaluates them into indexed 2D geometry for Onix's render pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPreprocessed

func IsPreprocessed(data []byte) bool

IsPreprocessed reports whether skeleton data contains Onix's compiled Spine IR.

func Preprocess

func Preprocess(skeletonJSON, atlasData []byte) ([]byte, error)

Preprocess compiles Spine skeleton and atlas source data into a linked IR.

Types

type Player

type Player struct {
	Resource *Resource

	Animation string
	Skin      string

	Speed float32
	Alpha float32

	Loop bool
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(resource *Resource) *Player

func (*Player) AnimationBounds

func (p *Player) AnimationBounds() (float32, float32, float32, float32, bool)

AnimationBounds returns stable bounds for the player's current animation and skin. The bounds cover the complete animation instead of only the current pose.

func (*Player) AnimationComplete

func (p *Player) AnimationComplete() bool

func (*Player) AnimationDuration

func (p *Player) AnimationDuration() float32

func (*Player) AnimationTime

func (p *Player) AnimationTime() float32

func (*Player) AppendMeshBatchInto

func (p *Player) AppendMeshBatchInto(batch *render.MeshBatch3D, projection, model mgl32.Mat4) (minX, minY, maxX, maxY float32, valid bool)

AppendMeshBatchInto appends directly to a shared batch, baking the model into positions so adjacent players can use one identity instance. Bounds stay local.

func (*Player) Bounds

func (p *Player) Bounds() (float32, float32, float32, float32, bool)

func (*Player) MeshBatch

func (p *Player) MeshBatch(projection, model mgl32.Mat4) render.MeshBatch3D

func (*Player) MeshBatchInto

func (p *Player) MeshBatchInto(batch *render.MeshBatch3D, projection, model mgl32.Mat4) (minX, minY, maxX, maxY float32, valid bool)

MeshBatchInto writes the current mesh into batch while retaining its slice capacity and returns the generated local-space bounds.

func (*Player) SetAnimation

func (p *Player) SetAnimation(name string, loop bool) error

func (*Player) SetSkin

func (p *Player) SetSkin(name string) error

func (*Player) Update

func (p *Player) Update(delta float32)

type Resource

type Resource struct {
	Texture *graphics.Texture

	Height float32
	Width  float32
	// contains filtered or unexported fields
}

func Decode

func Decode(skeletonJSON, atlasData, textureData []byte, texturePath string, options graphics.TextureOptions, decoder graphics.ImageDecoder) (*Resource, error)

func Load

func Load(skeletonJSON, atlasData []byte, texture *graphics.Texture) (*Resource, error)

func LoadWithTexture

func LoadWithTexture(skeletonJSON, atlasData []byte, options graphics.TextureOptions, loadTexture func(graphics.TextureOptions) (*graphics.Texture, error)) (*Resource, error)

LoadWithTexture parses a skeleton once, resolves its texture options, and asks loadTexture for a texture that may come from a shared cache. The caller retains ownership of the returned texture.

func (*Resource) Animations

func (a *Resource) Animations() []string

func (*Resource) Skins

func (a *Resource) Skins() []string

Jump to

Keyboard shortcuts

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