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 ¶
- func IsPreprocessed(data []byte) bool
- func Preprocess(skeletonJSON, atlasData []byte) ([]byte, error)
- type Player
- func (p *Player) AnimationBounds() (float32, float32, float32, float32, bool)
- func (p *Player) AnimationComplete() bool
- func (p *Player) AnimationDuration() float32
- func (p *Player) AnimationTime() float32
- func (p *Player) AppendMeshBatchInto(batch *render.MeshBatch3D, projection, model mgl32.Mat4) (minX, minY, maxX, maxY float32, valid bool)
- func (p *Player) Bounds() (float32, float32, float32, float32, bool)
- func (p *Player) MeshBatch(projection, model mgl32.Mat4) render.MeshBatch3D
- func (p *Player) MeshBatchInto(batch *render.MeshBatch3D, projection, model mgl32.Mat4) (minX, minY, maxX, maxY float32, valid bool)
- func (p *Player) SetAnimation(name string, loop bool) error
- func (p *Player) SetSkin(name string) error
- func (p *Player) Update(delta float32)
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPreprocessed ¶
IsPreprocessed reports whether skeleton data contains Onix's compiled Spine IR.
func Preprocess ¶
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 (*Player) AnimationBounds ¶
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 (*Player) AnimationDuration ¶
func (*Player) AnimationTime ¶
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) 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.
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 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.