Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(w3ddevice): smooth motion on screens faster than 60 hz

Olcay Seyganf5eceefebd08
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3dc5b8d7c..bc6c6b45c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -227,6 +227,7 @@ found and fixed, EA's own, not port damage.**
- The match plays at the speed it always did. Every speed, delay, reload and build time in the game's data was converted to the shorter step, so a Crusader still fires every two seconds. The balance is the one you know.
- Mission timers keep EA's clock. A map's countdown still ticks 30 times a second, because the missions read a running timer's number and act on it: the second American mission declares victory when its "Win" timer drops below 1700, and on the first 60-step builds that came after 38 seconds instead of 10. The cutscene cues, the random music pick in the campaigns and the generals' challenges, the shell map's camera loop and the lightning on Eastern Everglades and Rocky Rampage were off the same way, 30 maps in all, and run on their original timing again. Custom maps get the same.
- Normal speed is 60 steps a second. Turbo mode, the one other speed a match can have, runs 120 of the same steps a second (see Turbo mode above). Replays still play as fast as you ask.
+- On a screen faster than 60 Hz the armies glide. The battle moves in 60 steps a second, so a 144 or 240 Hz monitor showed every step two to four times over and a tank crossing the map moved in small hops. Now each picture draws every unit part of the way between its last two steps. The picture runs one step, 16.7 ms, behind the battle; the battle itself does not change, and a replay drawn with it, without it and with no picture at all ends on the same checksum. A 60 Hz screen gets nothing it did not have. `-nosmoothmotion` turns it off for a run, `-smoothmotion` turns it on whatever the screen.
- The battle's arithmetic can run on a thread of its own, beside the drawing. The game works out a step and then draws, one after the other, so a heavy step stalls the picture; start it with `-logicthread 1` and the screen keeps drawing while the next step is worked out, which pays most in the late game, where the steps are heaviest. In a late 4-player match, uncapped, frames slower than 16.7 ms (one 60 Hz refresh) fell from 23% to 0.8%, the slowest one frame in a hundred fell from 24.0 to 16.5 ms live and from 16.0-16.5 to 10.6-12.5 ms in a replay, and the average frame went from 15.2 to 11.8 ms. The battle still takes 60 steps a second, no more and no fewer. Network games keep each step in step with the other machines as before and do not overlap yet.
- That thread is off by default again. It was on from 3.2.0, and the crash reports from 3.3.0 traced the random crashes in the middle of a match to the drawing and the battle writing to the same memory at the same moment. The game works a step out between frames now, as it did before 3.2.0. Two of those collisions are fixed, one over the smoke and fire both sides create and one in the work a step leaves for the screen, which could run twice. The rest are still being hunted, so `-logicthread 1` is for whoever wants the smoother late game and accepts the risk.
- Opening the pause menu no longer makes boats snap to a different angle or parked aircraft sink into the carrier deck. Boats keep their rocking angle and aircraft remain above the deck while the game is paused.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
index bb61fd7d1..dcff298c5 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
@@ -59,10 +59,11 @@ Int GameEngine_logicCatchupMaxFrames( Int logicFps );
Int GameEngine_matchFramesPerSecond( Bool turbo );
/** R1, smooth motion: the renderer's blend reads how far into the next logic tick the wall clock is
- (0 just after a tick, 1 a whole tick later or more; always 1 in fast mode or before the first tick).
- The logic loop notes each pass's last tick with GameEngine_noteLogicTickDone. */
-void GameEngine_noteLogicTickDone( Int logicFps, Bool fastMode );
+ (0 when the last tick was due, 1 a whole tick later or more; always 1 in fast mode or before the first
+ tick). GameEngine_tickFraction is the arithmetic, on the fine clock's ticks: 1 for a tick length of
+ 0, clamped to 0..1 otherwise. */
Real GameEngine_logicTickFraction( void );
+Real GameEngine_tickFraction( Int64 now, Int64 due, Real msPerTick, Int64 ticksPerSecond );
/** LOGIC-THREAD.md phase 4: a picture presented while the pass's tick still runs beside the render,
with another to follow in the same pass. The frame-time histograms count each picture as a pass of
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 0ab076c5f..21c531b42 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -373,6 +373,8 @@ public:
Bool m_shadowsForParticles; // "ShadowsForParticles": big alpha-blended particle clouds drop a soft blob on the ground
Bool m_volumetricSmokeShadows; // "VolumetricSmokeShadows": smoke and dust shade the world and themselves through the sun's map (Direct3D 11)
Bool m_smokeFireLighting; // "SmokeFireLighting": smoke takes light from the fire beside it
+ Bool m_smoothMotion; // R1: on a display faster than the logic, models drawn between their last two logic states (W3DSmoothMotion.h); -nosmoothmotion turns it off
+ Bool m_smoothMotionAnyDisplay; // -smoothmotion: the same whatever the display's refresh rate
Int m_waterStyle; // "WaterStyle": 0 = Classic, 1 = Modern (SDL); applied between render frames
Int m_cloudStyle; // "CloudStyle": 0 = Classic (default), 1 = Volumetric (when supported)
Bool m_explosionDebrisTrails; // "DebrisTrails": blasts throw smoke-trailing fragments and burning shrapnel
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
index 6abffc470..9a3e6790b 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
@@ -193,6 +193,10 @@ namespace LogicThread
/** Read -logicthread and start the thread if it asks for one. Called once, from GameEngine::init. */
void init( void );
+ /** TRUE once init started the thread (-logicthread 1 or 2). Smooth motion stays off then, so the
+ * render may overlap the tick (W3DDisplay::draw). */
+ Bool isEnabled( void );
+
/** Join the thread. Safe without an init(). */
void shutdown( void );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index 921f0cd14..9f2eb33e0 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -1078,6 +1078,29 @@ Int parseNoVolumetricSmoke(char *args[], int)
return 1;
}
+/* -nosmoothmotion: every model drawn where the last logic tick left it, a tick's state held until the
+ next, as on a 60 Hz screen. -recordfps still blends its in-between pictures. */
+Int parseNoSmoothMotion(char *args[], int)
+{
+ if (TheWritableGlobalData)
+ {
+ TheWritableGlobalData->m_smoothMotion = FALSE;
+ }
+ return 1;
+}
+
+/* -smoothmotion: models drawn between their last two logic states whatever the display's refresh rate,
+ for a 60 Hz screen rendering uncapped or a picture of the blend on any machine. */
+Int parseSmoothMotion(char *args[], int)
+{
+ if (TheWritableGlobalData)
+ {
+ TheWritableGlobalData->m_smoothMotion = TRUE;
+ TheWritableGlobalData->m_smoothMotionAnyDisplay = TRUE;
+ }
+ return 1;
+}
+
/* -nosmokefirelight: smoke left unlit by the fire beside it, for one run. */
Int parseNoSmokeFireLight(char *args[], int)
{
@@ -2874,6 +2897,8 @@ static CommandLineParam params[] =
{ "-shadowmapboth", parseShadowMapBoth },
{ "-noparticleshadows", parseNoParticleShadows },
{ "-novolumetricsmoke", parseNoVolumetricSmoke },
+ { "-nosmoothmotion", parseNoSmoothMotion },
+ { "-smoothmotion", parseSmoothMotion },
{ "-nosmokefirelight", parseNoSmokeFireLight },
{ "-lighting", parseLightingStyle },
{ "-quickstart", parseQuickStart },
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index 317fa08f3..94d310ca6 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1666,17 +1666,18 @@ Bool GameEngine_mayStartAnotherCatchupTick( Int ticksSoFar, Int maxTicks, Real e
return elapsedMsInLoop < LOGIC_CATCHUP_BUDGET_MS;
}
-/* R1, smooth motion: when the last logic tick finished and how long a tick lasts, so the renderer can
+/* R1, smooth motion: when the last logic tick was due and how long a tick lasts, so the renderer can
show models between their last two logic states (W3DSmoothMotion.h). Read, never written, by the
- client; nothing here reaches the logic. */
-static Int64 s_lastLogicTickTicks = 0;
+ client; nothing here reaches the logic. Set by noteLogicTickDue after each pass's ticks. */
+static Int64 s_lastTickDueTicks = 0;
static Real s_msPerLogicTick = 0.0f;
-void GameEngine_noteLogicTickDone( Int logicFps, Bool fastMode )
+Real GameEngine_tickFraction( Int64 now, Int64 due, Real msPerTick, Int64 ticksPerSecond )
{
- s_lastLogicTickTicks = Clock_Ticks();
- // Fast mode runs one tick per pass however long it takes: there is no tick length to blend over.
- s_msPerLogicTick = (logicFps > 0 && !fastMode) ? 1000.0f / (Real)logicFps : 0.0f;
+ if (msPerTick <= 0.0f || ticksPerSecond <= 0)
+ return 1.0f;
+ const Real fraction = (Real)((double)(now - due) * 1000.0 / (double)ticksPerSecond) / msPerTick;
+ return fraction < 0.0f ? 0.0f : (fraction > 1.0f ? 1.0f : fraction);
}
/* -recordfps: which of the logic frame's pictures the coming draw is. The logic loop moves it on once a
@@ -1755,11 +1756,7 @@ Real GameEngine_logicTickFraction( void )
const Int pictures = GameEngine_videoPictures();
if (pictures > 1)
return (Real)(GameEngine_videoPicture() + 1) / (Real)pictures;
- if (s_msPerLogicTick <= 0.0f)
- return 1.0f;
- const Real ms = (Real)(Clock_Ticks() - s_lastLogicTickTicks) * 1000.0f / (Real)Clock_Ticks_Per_Second();
- const Real fraction = ms / s_msPerLogicTick;
- return fraction < 0.0f ? 0.0f : (fraction > 1.0f ? 1.0f : fraction);
+ return GameEngine_tickFraction( Clock_Ticks(), s_lastTickDueTicks, s_msPerLogicTick, Clock_Ticks_Per_Second() );
}
Bool GameEngine_isLogicFrameDue( Real& accumMs, Real elapsedMs, Int logicFps )
@@ -2930,6 +2927,27 @@ static Bool s_passPlanned = FALSE;
static GameEngine::LogicPassPlan s_passPlan;
static UnsignedInt s_frameBeforeOverlap = 0;
static UnsignedInt s_planTimeMs = 0; ///< when the pacer last spent the time since the one before
+static Int64 s_planTimeTicks = 0; ///< the same moment on the fine clock, for smooth motion
+
+/* R1, smooth motion: the blend runs from the moment the pass's last tick was due, the pacer's plan time
+ less the debt it still holds. Stamped when the ticks finished, as it was, a late-game tick of 2 to
+ 12 ms moved the stamp by its own length and the picture jumped back and forth by up to 0.6 of a
+ tick. A network game holds no debt, so its stamp is the plan time, and its ticks come at the
+ network's rate. Fast mode runs one tick a pass however long it takes: no tick length to blend over. */
+static void noteLogicTickDue( Int logicFps, Bool fastMode, Bool networkPaced )
+{
+ Real msPerTick = 0.0f;
+ if (networkPaced)
+ {
+ // the frame that just ran may have ended the match and taken the network with it
+ const UnsignedInt rate = TheNetwork != NULL ? TheNetwork->getFrameRate() : 0;
+ msPerTick = rate > 0 ? 1000.0f / (Real)rate : 0.0f;
+ }
+ else if (logicFps > 0 && !fastMode)
+ msPerTick = 1000.0f / (Real)logicFps;
+ s_msPerLogicTick = msPerTick;
+ s_lastTickDueTicks = s_planTimeTicks - (Int64)( (double)s_logicAccumMs * (double)Clock_Ticks_Per_Second() / 1000.0 );
+}
void GameEngine::planLogicPass( LogicPassPlan &plan )
{
@@ -2973,6 +2991,7 @@ void GameEngine::planLogicPass( LogicPassPlan &plan )
Real elapsedMs = (Real)(now - prevLogicTime);
prevLogicTime = now;
s_planTimeMs = now;
+ s_planTimeTicks = Clock_Ticks();
const Bool logicMayRun =
((TheNetwork == NULL && !TheGameLogic->isGamePaused()) || (TheNetwork && TheNetwork->isFrameDataReady()));
@@ -3233,11 +3252,15 @@ void GameEngine::update( void )
else if (!GameEngine_isLogicFrameDue(s_logicAccumMs, 0.0f, m_maxFPS))
break;
}
- GameEngine_noteLogicTickDone( m_maxFPS, fastMode );
+ noteLogicTickDue( m_maxFPS, fastMode, networkPaced );
// a frame held by a scripted freeze keeps showing its last picture, rather than going back
- // half a frame every other pass
+ // half a frame every other pass; smooth motion shows it whole too, since the update may have
+ // moved a model (a script's teleport) that the blend and its restore would put back
if (TheGameLogic->getFrame() == frameBeforeTicks)
+ {
s_videoPicture = GameEngine_videoPictures() - 1;
+ s_msPerLogicTick = 0.0f;
+ }
#ifdef DEBUG_LOGGING
tLogicEnd = Clock_Ticks();
logicMS = engineElapsedMS( tLogicStart, tLogicEnd );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 8c36e88e5..1a14f2a91 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1038,6 +1038,8 @@ GlobalData::GlobalData()
m_shadowsForParticles = TRUE; //on by default: the shipped INI has no entry for it
m_volumetricSmokeShadows = TRUE;
m_smokeFireLighting = TRUE;
+ m_smoothMotion = TRUE;
+ m_smoothMotionAnyDisplay = FALSE;
m_waterStyle = 0; // classic by default; modern water is an explicit option
m_cloudStyle = 0; // Classic by default; volumetric hazard clouds are opt-in
m_explosionDebrisTrails = TRUE;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
index 0ec6c4882..0550dad8f 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
@@ -452,6 +452,12 @@ void LogicThread::init( void )
DEBUG_LOG(( "LOGICTHREAD: the tick runs on its own thread, the main thread waiting for it\n" ));
}
+//-------------------------------------------------------------------------------------------------
+Bool LogicThread::isEnabled( void )
+{
+ return s_enabled;
+}
+
//-------------------------------------------------------------------------------------------------
void LogicThread::shutdown( void )
{
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DSmoothMotion.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DSmoothMotion.h
index 0ec545da8..03af53373 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DSmoothMotion.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DSmoothMotion.h
@@ -19,14 +19,15 @@
// W3DSmoothMotion.h //////////////////////////////////////////////////////////////////////////////
// R1, smooth motion: a render object shown between its last two logic states.
//
-// The logic ticks at 30 Hz, and the client moves a model's render object only on the render frame
+// The logic ticks at 60 Hz, and the client moves a model's render object only on the render frame
// that follows a tick (W3DView::update draws drawables only when W3D's clock moved, W3DDisplay.cpp).
-// On a 144 Hz panel four frames in five showed the same transforms under a camera that moves every
-// frame. With SmoothMotion on, W3DDisplay::draw keeps each model's last two transforms and, just
-// before the scene renders, sets the render object to a blend of them by the fraction of a tick
-// that has passed; right after the render it puts the logic transform back, so picking and the
-// logic (ParticleUplinkCannonUpdate reads live bones) see exactly what they saw before. The picture
-// is one logic tick behind (33 ms at 30 Hz) and the game never changes.
+// On a 164 Hz panel each state stays up for two or three refreshes, unevenly, under a camera that
+// moves every refresh. On a display faster than the logic (and without -nosmoothmotion),
+// W3DDisplay::draw keeps each model's last two transforms and, just before the scene renders, sets
+// the render object to a blend of them by the fraction of a tick that has passed since the last one
+// was due (GameEngine_logicTickFraction); right after the render it puts the logic transform back, so
+// picking and the logic (ParticleUplinkCannonUpdate reads live bones) see exactly what they saw
+// before. The picture is one logic tick behind (16.7 ms at 60 Hz) and the game never changes.
//
// Header-only on purpose: W3DModelDraw includes it on every platform, and nothing new has to be
// listed in a build.
@@ -42,8 +43,10 @@
#include "vector3.h"
#include <math.h>
+#include <string.h>
-/// This render pass's blend (W3DDisplay.cpp): whether it is on (SmoothMotion, and not headless), and how
+/// This render pass's blend (W3DDisplay.cpp): whether it is on (a display faster than the logic, or a
+/// -recordfps picture, and not headless), and how
/// far between the last two logic ticks the picture is. W3DView's camera lock reads them too.
extern bool TheSmoothMotionActive;
extern float TheSmoothMotionAlpha;
@@ -65,7 +68,7 @@ enum SmoothMotionSnap
enum
{
- SMOOTH_SNAP_DISTANCE_UNITS = 60, ///< world units per tick; a fast jet moves about 7
+ SMOOTH_SNAP_DISTANCE_UNITS = 60, ///< world units per tick; a fast jet moves about 7 a 30 Hz tick, half that at 60
SMOOTH_SNAP_ROTATION_DEGREES = 120 ///< degrees per tick
};
@@ -107,41 +110,98 @@ inline bool SmoothMotion_Split(const Matrix3D &m, Matrix3D &rotation, float scal
return true;
}
-/// The blend of two logic transforms at `alpha` (0 = prev, 1 = cur) into `out`, or the reason not to
-/// (then `out` is `cur`). Translation is lerped, the rotation slerped, each column's scale lerped.
-inline SmoothMotionSnap SmoothMotion_Blend(const Matrix3D &prev, const Matrix3D &cur, float alpha, Matrix3D &out)
+/// What a blend between two logic transforms needs, worked out once a tick, so a picture only mixes:
+/// the split, the quaternions and the angle between them cost about as much as the mix itself.
+struct SmoothMotionParts
{
- out = cur;
- const Vector3 from = prev.Get_Translation(), to = cur.Get_Translation();
- if ((to - from).Length() > (float)SMOOTH_SNAP_DISTANCE_UNITS) {
+ Vector3 From;
+ Vector3 To;
+ Quaternion RotationFrom;
+ Quaternion RotationTo; ///< on RotationFrom's side of the sphere, so the mix turns the short way
+ float Theta; ///< the angle between the two rotations; 0 when they are close enough to mix linearly
+ float OneOverSinTheta;
+ float ScaleFrom[3];
+ float ScaleTo[3];
+};
+
+/// Whether two logic transforms may be blended, and if so their parts. The rotation mix is WWMath's
+/// Slerp taken apart (its hemisphere flip, its linear threshold, its trig), so a picture comes out
+/// as it did when every picture called Slerp.
+inline SmoothMotionSnap SmoothMotion_Prepare(const Matrix3D &prev, const Matrix3D &cur, SmoothMotionParts &parts)
+{
+ parts.From = prev.Get_Translation();
+ parts.To = cur.Get_Translation();
+ if ((parts.To - parts.From).Length() > (float)SMOOTH_SNAP_DISTANCE_UNITS) {
return SMOOTH_SNAP_DISTANCE;
}
Matrix3D prev_rotation, cur_rotation;
- float prev_scale[3], cur_scale[3];
- if (!SmoothMotion_Split(prev, prev_rotation, prev_scale) || !SmoothMotion_Split(cur, cur_rotation, cur_scale)) {
+ if (!SmoothMotion_Split(prev, prev_rotation, parts.ScaleFrom) || !SmoothMotion_Split(cur, cur_rotation, parts.ScaleTo)) {
return SMOOTH_SNAP_NOT_RIGID;
}
- Quaternion qa = Build_Quaternion(prev_rotation), qb = Build_Quaternion(cur_rotation);
- float dot = qa.X * qb.X + qa.Y * qb.Y + qa.Z * qb.Z + qa.W * qb.W;
- if (dot < 0.0f) dot = -dot;
- if (dot > 1.0f) dot = 1.0f;
- const float turned_degrees = 2.0f * acosf(dot) * (180.0f / 3.14159265358979f);
+ parts.RotationFrom = Build_Quaternion(prev_rotation);
+ parts.RotationTo = Build_Quaternion(cur_rotation);
+ const Quaternion &from = parts.RotationFrom;
+ Quaternion &to = parts.RotationTo;
+ float cos_theta = from.X * to.X + from.Y * to.Y + from.Z * to.Z + from.W * to.W;
+ if (cos_theta < 0.0f) {
+ cos_theta = -cos_theta;
+ to.X = -to.X;
+ to.Y = -to.Y;
+ to.Z = -to.Z;
+ to.W = -to.W;
+ }
+ const float turned_degrees = 2.0f * acosf(cos_theta > 1.0f ? 1.0f : cos_theta) * (180.0f / 3.14159265358979f);
if (turned_degrees > (float)SMOOTH_SNAP_ROTATION_DEGREES) {
return SMOOTH_SNAP_ROTATION;
}
- if (alpha <= 0.0f) { out = prev; return SMOOTH_BLENDED; }
- if (alpha >= 1.0f) { out = cur; return SMOOTH_BLENDED; }
+ parts.Theta = 0.0f;
+ parts.OneOverSinTheta = 0.0f;
+ if (1.0f - cos_theta >= WWMATH_EPSILON * WWMATH_EPSILON) {
+ parts.Theta = WWMath::Acos(cos_theta);
+ parts.OneOverSinTheta = 1.0f / WWMath::Sin(parts.Theta);
+ }
+ return SMOOTH_BLENDED;
+}
+
+/// The transform `alpha` of the way from `prev` to `cur` (0 = prev, 1 = cur), from their parts.
+/// Translation is lerped, the rotation slerped, each column's scale lerped.
+inline void SmoothMotion_Pose(const Matrix3D &prev, const Matrix3D &cur, const SmoothMotionParts &parts, float alpha,
+ Matrix3D &out)
+{
+ if (alpha <= 0.0f) { out = prev; return; }
+ if (alpha >= 1.0f) { out = cur; return; }
+ float from_weight = 1.0f - alpha;
+ float to_weight = alpha;
+ if (parts.Theta > 0.0f) {
+ from_weight = WWMath::Sin(parts.Theta - alpha * parts.Theta) * parts.OneOverSinTheta;
+ to_weight = WWMath::Sin(alpha * parts.Theta) * parts.OneOverSinTheta;
+ }
Quaternion q;
- Slerp(q, qa, qb, alpha);
+ q.X = from_weight * parts.RotationFrom.X + to_weight * parts.RotationTo.X;
+ q.Y = from_weight * parts.RotationFrom.Y + to_weight * parts.RotationTo.Y;
+ q.Z = from_weight * parts.RotationFrom.Z + to_weight * parts.RotationTo.Z;
+ q.W = from_weight * parts.RotationFrom.W + to_weight * parts.RotationTo.W;
Matrix3D rotation;
Build_Matrix3D(q, rotation);
out.Make_Identity();
for (int c = 0; c < 3; ++c) {
- const float s = prev_scale[c] + (cur_scale[c] - prev_scale[c]) * alpha;
+ const float s = parts.ScaleFrom[c] + (parts.ScaleTo[c] - parts.ScaleFrom[c]) * alpha;
for (int r = 0; r < 3; ++r) out[r][c] = rotation[r][c] * s;
}
- out.Set_Translation(from + (to - from) * alpha);
- return SMOOTH_BLENDED;
+ out.Set_Translation(parts.From + (parts.To - parts.From) * alpha);
+}
+
+/// The blend of two logic transforms at `alpha` (0 = prev, 1 = cur) into `out`, or the reason not to
+/// (then `out` is `cur`).
+inline SmoothMotionSnap SmoothMotion_Blend(const Matrix3D &prev, const Matrix3D &cur, float alpha, Matrix3D &out)
+{
+ out = cur;
+ SmoothMotionParts parts;
+ const SmoothMotionSnap snap = SmoothMotion_Prepare(prev, cur, parts);
+ if (snap == SMOOTH_BLENDED) {
+ SmoothMotion_Pose(prev, cur, parts, alpha, out);
+ }
+ return snap;
}
/// One render object's last two logic transforms, and whether a blend is on it now.
@@ -155,10 +215,12 @@ struct SmoothMotionTrack
bool CurHidden;
bool PrevHidden;
bool Applied; ///< the render object holds a blend, to be put back
+ bool Still; ///< blended, but Prev and Cur are the same matrix: nothing to blend or put back
SmoothMotionSnap Snap; ///< this tick's verdict
+ SmoothMotionParts Parts; ///< Prev to Cur taken apart, when the verdict is a blend
SmoothMotionTrack() : Model(0), Frame(0), HavePrev(false), CurHidden(false), PrevHidden(false), Applied(false),
- Snap(SMOOTH_SNAP_FIRST) { Prev.Make_Identity(); Cur.Make_Identity(); }
+ Still(false), Snap(SMOOTH_SNAP_FIRST) { Prev.Make_Identity(); Cur.Make_Identity(); }
/// On the first render frame after a tick: the transform the model holds now becomes Cur. The
/// verdict for the whole tick is decided here and counted once.
@@ -171,15 +233,19 @@ struct SmoothMotionTrack
Cur = now;
CurHidden = hidden;
HavePrev = same_model;
+ Still = false;
if (Model == 0) Snap = SMOOTH_SNAP_FIRST;
else if (!same_model) Snap = SMOOTH_SNAP_NEW_MODEL;
else if (marked) Snap = SMOOTH_SNAP_MARKED;
else if (hidden || PrevHidden) Snap = SMOOTH_SNAP_HIDDEN;
else if (!next_frame) Snap = SMOOTH_SNAP_FRAME_GAP;
- else {
- Matrix3D ignored;
- Snap = SmoothMotion_Blend(Prev, Cur, 0.5f, ignored);
+ else if (memcmp(&Prev, &Cur, sizeof(Matrix3D)) == 0) {
+ // most of a base stands still, and setting a model's transform every picture makes W3D work its
+ // sub-objects out again, so an unmoved model is left alone, and needs no parts
+ Snap = SMOOTH_BLENDED;
+ Still = true;
}
+ else Snap = SmoothMotion_Prepare(Prev, Cur, Parts);
Model = model;
Frame = frame;
++SmoothMotion_Counts()[Snap];
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
index d205bee15..2e1e336bf 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp
@@ -4361,9 +4361,18 @@ void W3DModelDraw::smoothMotionApply(Real alpha)
{
if (m_renderObject == NULL || m_smoothMotion.Model != m_renderObject || m_smoothMotion.Snap != SMOOTH_BLENDED)
return;
- Matrix3D shown;
- if (SmoothMotion_Blend(m_smoothMotion.Prev, m_smoothMotion.Cur, alpha, shown) != SMOOTH_BLENDED)
+ // an unmoved model already holds its one transform: shown as blended, nothing set
+ if (m_smoothMotion.Still)
+ {
+ m_smoothMotion.Applied = true;
return;
+ }
+ // a whole tick on (a paused game, a pass that fell behind) is the current transform, which it holds
+ if (alpha >= 1.0f)
+ return;
+ // the parts were taken at capture, so a picture only mixes them
+ Matrix3D shown;
+ SmoothMotion_Pose(m_smoothMotion.Prev, m_smoothMotion.Cur, m_smoothMotion.Parts, alpha, shown);
m_renderObject->Set_Transform(shown);
m_smoothMotion.Applied = true;
}
@@ -4376,7 +4385,7 @@ void W3DModelDraw::smoothMotionRestore()
if (!m_smoothMotion.Applied)
return;
m_smoothMotion.Applied = false;
- if (m_renderObject != NULL && m_smoothMotion.Model == m_renderObject)
+ if (m_renderObject != NULL && m_smoothMotion.Model == m_renderObject && !m_smoothMotion.Still)
m_renderObject->Set_Transform(m_smoothMotion.Cur);
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
index 985101487..70decebce 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
@@ -481,8 +481,12 @@ static double s_aircraftLeadSum = 0.0;
static unsigned long long s_aircraftLeadCount = 0;
static Real s_aircraftLeadMax = 0.0f;
static Real s_aircraftRadiusMax = 0.0f;
-static Int64 s_smoothPassTicks = 0; // R1's blend and restore, together, over the run
+static Int64 s_smoothPassTicks = 0; // R1's captures, blend and restore, together, over the run
static unsigned long long s_smoothPasses = 0;
+// R1's pacing (notePacing, below): the spread of the picture's game time about the wall clock, [0] a
+// tick's state held until the next, [1] blended
+static double s_pacingSpread[2] = { 0.0, 0.0 };
+static unsigned long long s_pacingPictures = 0;
W3DDisplay::~W3DDisplay()
{
@@ -502,8 +506,11 @@ W3DDisplay::~W3DDisplay()
fprintf(stderr, "\n");
}
if (s_smoothPasses > 0 && getenv("ZH_SMOOTH_MOTION_STATS") != NULL)
- fprintf(stderr, "smooth motion: blend and restore cost %.1f us a render frame over %llu frames\n",
+ fprintf(stderr, "smooth motion: capture, blend and restore cost %.1f us a render frame over %llu frames\n",
(double)s_smoothPassTicks * 1.0e6 / (double)Clock_Ticks_Per_Second() / (double)s_smoothPasses, s_smoothPasses);
+ if (s_pacingPictures > 0 && getenv("ZH_SMOOTH_MOTION_STATS") != NULL)
+ fprintf(stderr, "smooth motion: pacing over %llu pictures, shown game time about the wall clock spreads %.2f ms stepped, %.2f ms blended\n",
+ s_pacingPictures, sqrt(s_pacingSpread[0] / (double)s_pacingPictures), sqrt(s_pacingSpread[1] / (double)s_pacingPictures));
if (s_aircraftLeadCount > 0 && getenv("ZH_SMOOTH_MOTION_STATS") != NULL)
fprintf(stderr, "smooth motion: aircraft lead (logic position ahead of the drawn one): %llu samples, mean %.2f, max %.2f world units; the largest aircraft's bounding radius %.2f\n",
s_aircraftLeadCount, s_aircraftLeadSum / (double)s_aircraftLeadCount, s_aircraftLeadMax, s_aircraftRadiusMax);
@@ -2208,27 +2215,118 @@ float TheSmoothMotionAlpha = 1.0f;
static UnsignedInt s_smoothPositionFrame = 0xFFFFFFFFu;
static UnsignedInt s_smoothModelFrame = 0xFFFFFFFFu;
static Bool s_smoothApplied = FALSE;
+static Bool s_smoothBehind = FALSE; // this picture is a whole tick or more behind: nothing captured or blended
+
+/* Smooth motion's default: a blend only on a display that refreshes faster than the logic ticks. At 60 Hz
+ every refresh shows a new tick already, and the blend would only draw each one a tick late. The
+ adapter's mode is asked once. */
+static Bool displayOutpacesLogic()
+{
+ static Int refresh = -1;
+ if (refresh < 0)
+ {
+ D3DDISPLAYMODE mode;
+ memset(&mode, 0, sizeof(mode));
+ DX8Wrapper::_Get_D3D()->GetAdapterDisplayMode(WW3D::Get_Render_Device(), &mode);
+ refresh = (Int)mode.RefreshRate;
+ DEBUG_LOG(("smooth motion: the display refreshes at %d Hz, the logic ticks at %d: %s\n", refresh,
+ LOGICFRAMES_PER_SECOND, refresh > LOGICFRAMES_PER_SECOND ? "models drawn between ticks" : "no blend"));
+ }
+ return refresh > LOGICFRAMES_PER_SECOND;
+}
+
+/* With ZH_SMOOTH_MOTION_STATS, how evenly the picture's game time follows the wall clock: per window of 120
+ pictures, the spread of shown game time about the straight line through it against the wall clock, with
+ each tick's state held until the next (frame ticks) and blended (frame - 1 + fraction ticks). A 60 Hz
+ state held on a faster screen spreads a tick over the square root of 12, 4.8 ms. The line, and not
+ the wall clock itself, so a game the catch-up cap holds below full speed still measures; a gap over
+ 100 ms (the load, a pause, a hitch) starts the window again. */
+static void notePacing(UnsignedInt frame)
+{
+ const Int WINDOW = 120;
+ const Int SHOWN = 2;
+ // sums over the window, game time and wall time each counted from the window's start to keep them small
+ static double wallStart, wallLast, x, xx, shownStart[SHOWN], y[SHOWN], yy[SHOWN], xy[SHOWN];
+ static Int pictures = 0;
+ const double tickMs = 1000.0 / (double)LOGICFRAMES_PER_SECOND;
+ const double wallMs = (double)Clock_Ticks() * 1000.0 / (double)Clock_Ticks_Per_Second();
+ const double shown[SHOWN] = { (double)frame * tickMs,
+ ((double)frame - 1.0 + (double)GameEngine_logicTickFraction()) * tickMs };
+ if (pictures > 0 && wallMs - wallLast > 100.0)
+ pictures = 0;
+ wallLast = wallMs;
+ if (pictures == 0)
+ {
+ wallStart = wallMs;
+ x = xx = 0.0;
+ for (Int i = 0; i < SHOWN; ++i)
+ y[i] = yy[i] = xy[i] = 0.0;
+ }
+ const double w = wallMs - wallStart;
+ x += w;
+ xx += w * w;
+ for (Int i = 0; i < SHOWN; ++i)
+ {
+ if (pictures == 0)
+ shownStart[i] = shown[i];
+ const double s = shown[i] - shownStart[i];
+ y[i] += s;
+ yy[i] += s * s;
+ xy[i] += w * s;
+ }
+ if (++pictures < WINDOW)
+ return;
+ const double n = (double)WINDOW;
+ const double sxx = xx - x * x / n;
+ for (Int i = 0; i < SHOWN; ++i)
+ {
+ const double sxy = xy[i] - x * y[i] / n;
+ const double syy = yy[i] - y[i] * y[i] / n;
+ s_pacingSpread[i] += syy - sxy * sxy / sxx;
+ }
+ s_pacingPictures += WINDOW;
+ pictures = 0;
+}
static void smoothMotionBegin()
{
- // only -recordfps's pictures between two logic frames blend, from the frame before the first so
- // that one is captured
- TheSmoothMotionActive = !TheGlobalData->m_headless && GameEngine_videoBlends();
+ // on a display faster than the logic, unless -nosmoothmotion says no or the logic thread wants the
+ // render beside its tick; -recordfps's pictures between two logic frames always blend, from the frame
+ // before the first so that one is captured
+ const Bool video = GameEngine_videoBlends();
+ TheSmoothMotionActive = !TheGlobalData->m_headless
+ && ((TheGlobalData->m_smoothMotion && !LogicThread::isEnabled()
+ && (TheGlobalData->m_smoothMotionAnyDisplay || displayOutpacesLogic()))
+ || video);
TheSmoothMotionAlpha = TheSmoothMotionActive ? GameEngine_logicTickFraction() : 1.0f;
- if (!TheSmoothMotionActive)
+ // A picture a whole tick or more behind the battle shows every model at its logic transform, so it
+ // captures and blends nothing, and a game that has fallen behind pays nothing for the blend. The next
+ // picture under a tick captures, late in its tick if need be (the transforms are still that tick's),
+ // and a capture after a tick it missed snaps. -recordfps pictures never skip: a frame's last one has
+ // an alpha of 1, and the frame before the first blended one has to be captured.
+ s_smoothBehind = TheSmoothMotionAlpha >= 1.0f && !video;
+ static const Bool stats = getenv("ZH_SMOOTH_MOTION_STATS") != NULL;
+ if (stats && TheGameLogic->isInGame() && !TheGameLogic->isInShellGame() && !TheGameLogic->isGamePaused())
+ notePacing(TheGameClient->getFrame());
+ if (!TheSmoothMotionActive || s_smoothBehind)
return;
const UnsignedInt frame = TheGameClient->getFrame();
if (frame == s_smoothPositionFrame)
return;
+ const Int64 passStart = Clock_Ticks();
s_smoothPositionFrame = frame;
for (Drawable *draw = TheGameClient->firstDrawable(); draw != NULL; draw = draw->getNextDrawable())
draw->smoothMotionCapturePosition(frame);
+ s_smoothPassTicks += Clock_Ticks() - passStart;
}
static void smoothMotionApply()
{
if (!TheSmoothMotionActive)
return;
+ ++s_smoothPasses;
+ if (s_smoothBehind)
+ return;
const Int64 passStart = Clock_Ticks();
const UnsignedInt frame = TheGameClient->getFrame();
const Bool newTick = frame != s_smoothModelFrame;
@@ -2275,7 +2373,6 @@ static void smoothMotionApply()
}
s_smoothApplied = TRUE;
s_smoothPassTicks += Clock_Ticks() - passStart;
- ++s_smoothPasses;
}
static void smoothMotionRestore()
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
index 388c64937..bf8c7e44e 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
@@ -1826,8 +1826,9 @@ void W3DView::update(void)
// The lock follows on every render frame, each per-retail-frame factor scaled to this frame's
// length (1-(1-f)^steps), so it keeps retail's pull at any frame rate. Stepping it every 33 ms
// while the unit moves every logic frame, 16.7 ms, put the camera a frame behind on every second
- // one, a 2:1 judder. With smooth motion on it aims at the drawable's blended position as well.
- const Bool smoothLock = TheSmoothMotionActive;
+ // one, a 2:1 judder. With smooth motion on it aims at the drawable's blended position as well, except
+ // on a picture a whole tick behind, which captured nothing and would find a stale one.
+ const Bool smoothLock = TheSmoothMotionActive && TheSmoothMotionAlpha < 1.0f;
const Real lockSteps = (Real)waypointElapsedMs / (Real)CAMERA_STEP_MSEC;
auto perStep = [lockSteps](Real f) -> Real { return 1.0f - powf(1.0f - f, lockSteps); };
if (lockSteps > 0.0f && cameraLock != INVALID_ID)
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 429f16e52..a7d96f07c 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1694,6 +1694,59 @@ TEST(catchup_stops_paying_debt_when_the_logic_tick_is_what_is_slow)
CHECK_NEAR( 6.0f, elapsed, 0.01f );
}
+/* R1, smooth motion: how far the picture is between the last two logic states, counted from when the
+ last tick was due. Pure arithmetic on the fine clock; a million ticks a second here. */
+extern Real GameEngine_tickFraction( Int64 now, Int64 due, Real msPerTick, Int64 ticksPerSecond );
+
+TEST(smooth_motion_tick_fraction_runs_from_the_due_time)
+{
+ const Real tick = 1000.0f / 60.0f;
+ const Int64 freq = 1000000;
+ const Int64 due = 5000000;
+
+ CHECK_NEAR( 0.0f, GameEngine_tickFraction( due, due, tick, freq ), 0.0001f );
+ CHECK_NEAR( 0.5f, GameEngine_tickFraction( due + 8333, due, tick, freq ), 0.001f ); // mid-tick
+ CHECK_NEAR( 0.9f, GameEngine_tickFraction( due + 15000, due, tick, freq ), 0.001f );
+
+ // clamped both ways: a draw a hair before the stamp shows the state before, and a paused game,
+ // which stamps no tick, is a whole tick on within one and holds the last state from then on
+ CHECK_NEAR( 0.0f, GameEngine_tickFraction( due - 100, due, tick, freq ), 0.0001f );
+ CHECK_NEAR( 1.0f, GameEngine_tickFraction( due + 16667, due, tick, freq ), 0.0001f );
+ CHECK_NEAR( 1.0f, GameEngine_tickFraction( due + 30 * freq, due, tick, freq ), 0.0001f );
+
+ // no tick length (fast mode, -turbo, TiVO, -headless) or no clock: no blend, the state as it is
+ CHECK_NEAR( 1.0f, GameEngine_tickFraction( due + 8333, due, 0.0f, freq ), 0.0001f );
+ CHECK_NEAR( 1.0f, GameEngine_tickFraction( due + 8333, due, tick, 0 ), 0.0001f );
+
+ /* The stamp GameEngine::update hands it is the pacer's plan time less the debt left once the pass's
+ ticks are paid: that tick's due time. Passes 6 and 7 ms apart (a 164 Hz screen) plan at uneven
+ moments against the 16.7 ms tick, and the stamps still land exactly a tick apart, where the moment
+ a tick finished moved with its own cost. */
+ Real accum = 0.0f;
+ Real planTime = 0.0f;
+ Real lastDue = -1.0f;
+ Int stamps = 0;
+ for( Int pass = 0; pass < 500; ++pass )
+ {
+ Real elapsed = ( pass % 3 == 0 ) ? 7.0f : 6.0f;
+ planTime += elapsed;
+ Bool ticked = FALSE;
+ while( GameEngine_isLogicFrameDue( accum, elapsed, 60 ) )
+ {
+ ticked = TRUE;
+ elapsed = 0.0f;
+ }
+ if( !ticked )
+ continue;
+ const Real stamp = planTime - accum;
+ if( lastDue >= 0.0f )
+ CHECK_NEAR( tick, stamp - lastDue, 0.01f );
+ lastDue = stamp;
+ ++stamps;
+ }
+ CHECK( stamps >= 190 && stamps <= 192 ); // 3167 ms of passes, a tick every 16.7
+}
+
/* AnimateWindowManager.cpp: the same argument one layer up. The menu animations
count fixed steps and were authored against a capped frame rate, so with the
renderer uncapped they have to be paced off the wall clock too or a whole
diff --git a/GeneralsMD/Code/Tests/test_smooth_motion.cpp b/GeneralsMD/Code/Tests/test_smooth_motion.cpp
index 3b5ff58ba..e10b7b534 100644
--- a/GeneralsMD/Code/Tests/test_smooth_motion.cpp
+++ b/GeneralsMD/Code/Tests/test_smooth_motion.cpp
@@ -134,6 +134,63 @@ TEST(smooth_motion_track_verdicts_per_tick)
CHECK_EQ((int)(counts[SMOOTH_SNAP_HIDDEN] - before[SMOOTH_SNAP_HIDDEN]), 2);
}
+// A model that did not move between two ticks is blended in name only: W3DModelDraw leaves its
+// transform alone rather than setting the same matrix every picture.
+TEST(smooth_motion_track_marks_an_unmoved_model_still)
+{
+ const int model = 0;
+ SmoothMotionTrack t;
+ t.capture(at(5, 5, 0), &model, false, 20, false);
+ CHECK(!t.Still); // nothing before it
+ t.capture(at(5, 5, 0), &model, false, 21, false);
+ CHECK_EQ((int)t.Snap, (int)SMOOTH_BLENDED);
+ CHECK(t.Still);
+ t.capture(at(6, 5, 0), &model, false, 22, false);
+ CHECK_EQ((int)t.Snap, (int)SMOOTH_BLENDED);
+ CHECK(!t.Still);
+ t.capture(at(6, 5, 0), &model, false, 24, false); // unmoved over a tick not seen: a snap, not still
+ CHECK(!t.Still);
+}
+
+// The parts are taken once a tick at capture, and a picture only mixes them: off the midpoint, so
+// swapped slerp weights show, and against WWMath's own Slerp, which every picture used to call.
+TEST(smooth_motion_track_poses_from_parts_taken_at_capture)
+{
+ const int model = 0;
+ SmoothMotionTrack t;
+ t.capture(at(0, 0, 0, 0.0f, 1.0f), &model, false, 30, false);
+ t.capture(at(8, 4, 0, 90.0f, 2.0f), &model, false, 31, false);
+ CHECK_EQ((int)t.Snap, (int)SMOOTH_BLENDED);
+ Matrix3D out;
+ SmoothMotion_Pose(t.Prev, t.Cur, t.Parts, 0.25f, out);
+ CHECK_NEAR(heading_degrees(out), 22.5f, 1.0e-3f);
+ CHECK_NEAR(out.Get_Translation().X, 2.0f, EPS);
+ CHECK_NEAR(out.Get_Translation().Y, 1.0f, EPS);
+ CHECK_NEAR(out.Get_X_Vector().Length(), 1.25f, EPS);
+
+ const float pairs[][2] = { { 0.0f, 90.0f }, { 170.0f, -170.0f }, { 10.0f, 10.001f } };
+ const float alphas[] = { 0.1f, 0.37f, 0.8f };
+ for (int p = 0; p < 3; ++p) {
+ const Matrix3D from = at(0, 0, 0, pairs[p][0]), to = at(0, 0, 0, pairs[p][1]);
+ SmoothMotionParts parts;
+ CHECK_EQ((int)SmoothMotion_Prepare(from, to, parts), (int)SMOOTH_BLENDED);
+ Matrix3D from_rotation, to_rotation;
+ float scale[3];
+ SmoothMotion_Split(from, from_rotation, scale);
+ SmoothMotion_Split(to, to_rotation, scale);
+ for (int a = 0; a < 3; ++a) {
+ Quaternion q;
+ Slerp(q, Build_Quaternion(from_rotation), Build_Quaternion(to_rotation), alphas[a]);
+ Matrix3D expected;
+ Build_Matrix3D(q, expected);
+ SmoothMotion_Pose(from, to, parts, alphas[a], out);
+ for (int r = 0; r < 3; ++r)
+ for (int c = 0; c < 3; ++c)
+ CHECK_NEAR(out[r][c], expected[r][c], 1.0e-6f);
+ }
+ }
+}
+
TEST(drawable_update_composes_flushed_client_frame_when_pause_stops_animation)
{
W3DDrawableUpdate update;