Files
aego/editor/core/context/extras.go
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

147 lines
3.1 KiB
Go

package context
import (
"aego/core/ids"
"aego/core/mathx"
"aego/engine"
"aego/engine/i18n"
"aego/render/debug"
"aego/render/lighting"
"aego/render/view"
"aego/scene"
)
const DefaultVectorScale = 0.1
// LightingViewBridge changes the active Scene View's presentation session.
// It must not modify scene components, PlayWorld or asset documents.
type LightingViewBridge interface {
SetLightingView(enabled bool, mode lighting.DebugMode)
LightingView() (enabled bool, mode lighting.DebugMode)
LightingOutput() view.ID
LightingWorld() *engine.World
SetLightingEnvironmentPreview(ids.NodeID)
LightingEnvironmentPreview() ids.NodeID
}
type SettingsPage struct {
Section string
Title string
// Label optionally localizes the title at draw time, including after a language change.
Label i18n.Text
Order int
Draw func(draft any) bool
Keywords []i18n.Text
}
type VectorLayer struct {
ID string
Title i18n.Text
Draw func(*VectorSink)
}
type ProfilerSection struct {
Title i18n.Text
Play bool
Draw func()
}
// OverlayGame is the flag of Window → Game View Overlays; module overlays and debug channels in the Game View follow it.
const OverlayGame = "view.game.overlays"
type Overlays struct {
on map[string]bool
Scale float32
Fixed bool
}
func (o *Overlays) On(id string) bool {
return o.on[id]
}
func (o *Overlays) Set(id string, v bool) {
if o.on == nil {
o.on = map[string]bool{}
}
o.on[id] = v
}
func (o *Overlays) Toggle(id string) {
o.Set(id, !o.On(id))
}
func (o *Overlays) VectorScale() float32 {
if o.Scale <= 0 {
return DefaultVectorScale
}
return o.Scale
}
type VectorSink struct {
Editor *Editor
Scene *scene.Scene
World *engine.World
Debug *debug.Draw
View view.View
Px float32
Scale float32
Fixed bool
}
func (v *VectorSink) length(vec mathx.Vec2) mathx.Vec2 {
if !v.Fixed {
return vec.Scale(v.Scale)
}
l := vec.Len()
if l == 0 {
return vec
}
return vec.Scale(v.Px * 48 / l)
}
func (v *VectorSink) head(tip, dir mathx.Vec2, size float32, col mathx.Color) {
v.Debug.Line(tip, tip.Sub(dir.Rotated(0.45).Scale(size)), col)
v.Debug.Line(tip, tip.Sub(dir.Rotated(-0.45).Scale(size)), col)
}
func (v *VectorSink) Arrow(from, vec mathx.Vec2, col mathx.Color) {
d := v.length(vec)
l := d.Len()
if l < v.Px {
return
}
to := from.Add(d)
v.Debug.Line(from, to, col)
v.head(to, d.Scale(1/l), min(v.Px*10, l*0.5), col)
}
func (v *VectorSink) Arc(center mathx.Vec2, omega float32, col mathx.Color) {
if omega == 0 {
return
}
r := v.Px * 18
sweep := mathx.Pi * 1.5
if !v.Fixed {
sweep = mathx.Clamp(mathx.Abs(omega)*v.Scale*mathx.TwoPi, 0.2, mathx.TwoPi*0.9)
}
dir := float32(1)
if omega < 0 {
dir = -1
}
const segs = 24
prev := center.Add(mathx.Vec2{X: r})
var a float32
for i := 1; i <= segs; i++ {
a = dir * sweep * float32(i) / segs
p := center.Add(mathx.Vec2{X: r * mathx.Cos(a), Y: r * mathx.Sin(a)})
v.Debug.Line(prev, p, col)
prev = p
}
t := mathx.Vec2{X: -mathx.Sin(a) * dir, Y: mathx.Cos(a) * dir}
v.head(prev, t, v.Px*8, col)
}
func (v *VectorSink) Circle(center mathx.Vec2, r float32, col mathx.Color) {
v.Debug.Circle(center, r, 32, col)
}