ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / linux amd64 native (push) Skipped
ci / checks (push) Successful in 6m33s
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 12m26s
ci / release (push) Skipped
github-native / darwin amd64 native (push) Canceled after 0s
github-native / windows amd64 native (push) Canceled after 0s
github-native / darwin arm64 native (push) Canceled after 0s
37 lines
928 B
Go
37 lines
928 B
Go
package render2d
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"aego/core/mathx"
|
|
"aego/scene/frame"
|
|
)
|
|
|
|
func Test2DSpritesIn3DEditorPreviewOnly(t *testing.T) {
|
|
f := lightingTestWorld(t)
|
|
h := f.sprite("player", 1)
|
|
f.s.SetPosition(h, mathx.Vec2{X: 3, Y: 4})
|
|
f.s.SetScale(h, mathx.Vec2{X: 2, Y: 3})
|
|
f.r.Prepare(640, 480, 1)
|
|
var b frame.Bucket
|
|
collect3(f.r, &b, 1)
|
|
if len(b.Sprites3D) != 0 {
|
|
t.Fatal("ordinary 2D sprites must not change runtime 3D camera output")
|
|
}
|
|
f.r.SetPreview2DIn3D(true)
|
|
collect3(f.r, &b, 1)
|
|
if len(b.Sprites3D) != 1 {
|
|
t.Fatalf("editor preview sprites = %d, want 1", len(b.Sprites3D))
|
|
}
|
|
got := b.Sprites3D[0].World
|
|
want := mathx.Mat4Lift(f.s.RenderWorld(h))
|
|
if got != want || got.Translation() != (mathx.Vec3{X: 3, Y: -4}) {
|
|
t.Fatalf("preview transform = %v, want %v", got, want)
|
|
}
|
|
b.Sprites3D = nil
|
|
collect3(f.r, &b, 2)
|
|
if len(b.Sprites3D) != 0 {
|
|
t.Fatal("3D preview ignored the view's layer mask")
|
|
}
|
|
}
|