Files
sanspie 17cb5e4291 Stage 2-5: assets, scene/ECS, editor, 3D, and Aego Script
Stage 2: render pipeline and UI toolkit over gpu/platform.
Stage 3: schema registry, asset pipeline + runtime loader, scene graph and ECS.
Stage 4: editor — docking, inspector, scene/game views, play mode, asset browser, console, profiler; 4.5 adds the 3D foundation (mixed 2D/3D spaces, meshes, depth).
Stage 5: Aego Script — compiler (lexer/parser/types/resolver/checker/asm/compiler), bytecode with verifier and register VM, instance runtime, stdlib, native bindings, and editor/CLI integration (aego run/edit/check/test/dump).
2026-10-08 13:17:28 +03:00

19 lines
418 B
Go

package mathx
func QuatYawPitch(yaw, pitch float32) Quat {
return QuatAxisAngle(Vec3{Y: 1}, yaw).Mul(QuatAxisAngle(Vec3{X: 1}, pitch))
}
func YawPitchOf(dir Vec3) (yaw, pitch float32) {
h := Sqrt(dir.X*dir.X + dir.Z*dir.Z)
return Atan2(-dir.X, -dir.Z), Atan2(dir.Y, h)
}
func QuatLookDir(dir Vec3) Quat {
if dir.LenSq() < 1e-12 {
return QuatIdentity()
}
y, p := YawPitchOf(dir)
return QuatYawPitch(y, p)
}