Clips (.aeanim) and controllers (.aectrl) with importers, AnimationPlayer and Animator with crossfades, root motion and events on fixed steps, rewind support. Editor: Animation panel (dope sheet, curves, record, preview, trajectory), Animator panel, sprite sheet slicer and flipbooks, Programming workspace, export panel redesign. Motion 2D ledge climb. 11c: the component and Create palette.
56 lines
918 B
Go
56 lines
918 B
Go
package sprite
|
|
|
|
import (
|
|
"aego/core/mathx"
|
|
"aego/gpu"
|
|
"aego/render/texture"
|
|
)
|
|
|
|
type BlendMode uint8
|
|
|
|
const (
|
|
BlendPremultiplied BlendMode = iota
|
|
BlendOpaque
|
|
BlendAdditive
|
|
blendCount
|
|
)
|
|
|
|
type Draw struct {
|
|
Region texture.Region
|
|
Position mathx.Vec2
|
|
Size mathx.Vec2
|
|
Scale mathx.Vec2
|
|
Rotation float32
|
|
Origin mathx.Vec2
|
|
Z float32
|
|
Tint mathx.Color
|
|
Layer int16
|
|
Order int16
|
|
Blend BlendMode
|
|
Sampler gpu.SamplerHandle
|
|
FlipX bool
|
|
FlipY bool
|
|
}
|
|
|
|
func (d *Draw) scale() mathx.Vec2 {
|
|
if d.Scale.X == 0 && d.Scale.Y == 0 {
|
|
return mathx.Vec2{X: 1, Y: 1}
|
|
}
|
|
return d.Scale
|
|
}
|
|
|
|
func (d *Draw) WorldSize(pixelsPerUnit float32) mathx.Vec2 {
|
|
base := d.Size
|
|
if base.X == 0 && base.Y == 0 {
|
|
if pixelsPerUnit <= 0 {
|
|
pixelsPerUnit = 1
|
|
}
|
|
base = d.Region.Size().Scale(1 / pixelsPerUnit)
|
|
}
|
|
return base.Mul(d.scale())
|
|
}
|
|
|
|
func (d *Draw) tint() mathx.Color {
|
|
return d.Tint
|
|
}
|