Fix native retained presentation batching
This commit is contained in:
@@ -4,6 +4,21 @@ namespace Age.Engine.Tests;
|
||||
|
||||
public class OneShotColorTests
|
||||
{
|
||||
[Fact]
|
||||
public void TimedPresentation_TracksOnlyVisibleFiniteChannelsUntilSampledComplete()
|
||||
{
|
||||
var visible = Visible(GfxState.PackColor(0, 0xffffff));
|
||||
visible.SetAnimatedObjectColorResolved(0x100, 0, 100, 0xff, 0xffffff);
|
||||
Assert.True(visible.HasActiveTimedPresentation(1000));
|
||||
visible.SnapshotVisibleObjects(1000);
|
||||
visible.SnapshotVisibleObjects(1100);
|
||||
Assert.False(visible.HasActiveTimedPresentation(1100));
|
||||
|
||||
var unbound = new GfxState();
|
||||
unbound.SetAnimatedObjectColorResolved(0x200, 0, 100, 0xff, 0xffffff);
|
||||
Assert.False(unbound.HasActiveTimedPresentation(1000));
|
||||
}
|
||||
|
||||
private static GfxState Visible(long current)
|
||||
{
|
||||
var gfx = new GfxState();
|
||||
|
||||
@@ -324,6 +324,17 @@ public sealed class GfxState
|
||||
return _surfaceTransitions.Values.Any(t => TransitionProgress(t, nowMs) < 1.0);
|
||||
}
|
||||
|
||||
/// <summary>Native op 0x21c keeps presenting until both queued surface commands and finite one-shot
|
||||
/// object channels have completed. Ambient cyclic/spritesheet/color pulses are deliberately excluded.</summary>
|
||||
public bool HasActiveTimedPresentation(long nowMs)
|
||||
{
|
||||
lock (_lock)
|
||||
return _surfaceTransitions.Values.Any(t => TransitionProgress(t, nowMs) < 1.0) ||
|
||||
_objects.Values.Any(o => o.Visible &&
|
||||
(o.OneShotColorEnabled || o.ScaleEnabled ||
|
||||
o.RotationChannelEnabled || o.TranslationEnabled));
|
||||
}
|
||||
|
||||
/// <summary>Click completion affects only type-0 foreground transitions, never ambient object channels.</summary>
|
||||
public int CompleteForegroundTransitions(long nowMs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user