| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #include <EMotionFX/Source/Motion.h>
- #include <EMotionFX/Source/MotionInstance.h>
- #include <EMotionFX/Source/MotionManager.h>
- #include <EMotionFX/Source/MotionData/NonUniformMotionData.h>
- #include <Integration/System/SystemCommon.h>
- #include <Tests/SystemComponentFixture.h>
- #include <Tests/TestAssetCode/SimpleActors.h>
- #include <Tests/TestAssetCode/ActorFactory.h>
- #include <AzCore/Math/MathUtils.h>
- #include <vector>
- namespace EMotionFX
- {
- // The start state of the motion instance.
- struct MotionInstanceInputState
- {
- float m_currentTime;
- float m_playSpeed;
- bool m_freezeAtLLastFrame;
- AZ::u32 m_numCurrentLoops;
- AZ::u32 m_maxNumLoops;
- EPlayMode m_playMode;
- };
- // The expected output state of the motion instance.
- struct MotionInstanceOutputState
- {
- float m_currentTime;
- float m_lastCurrentTime;
- AZ::u32 m_numLoops;
- bool m_hasEnded;
- bool m_hasLooped;
- bool m_isFrozen;
- };
- // Test parameters (input and expected output).
- struct MotionInstanceTestParams
- {
- MotionInstanceInputState m_inputState;
- MotionInstanceOutputState m_outputState;
- float m_deltaTime;
- };
- class MotionInstanceFixture
- : public SystemComponentFixture
- , public ::testing::WithParamInterface<MotionInstanceTestParams>
- {
- public:
- void SetUp() override
- {
- SystemComponentFixture::SetUp();
- m_motion = aznew Motion("MotionInstanceTest");
- m_motion->SetMotionData(aznew NonUniformMotionData());
- m_motion->GetMotionData()->SetDuration(1.0f);
- m_actor = ActorFactory::CreateAndInit<SimpleJointChainActor>(5);
- ASSERT_NE(m_actor.get(), nullptr) << "Expected actor to not be a nullptr.";
- m_actorInstance = ActorInstance::Create(m_actor.get());
- ASSERT_NE(m_actorInstance, nullptr) << "Expected actor instance to not be a nullptr.";
- m_motionInstance = MotionInstance::Create(m_motion, m_actorInstance);
- ASSERT_NE(m_motionInstance, nullptr) << "Expected motion instance to not be a nullptr.";
- }
- void TearDown() override
- {
- if (m_motionInstance)
- {
- m_motionInstance->Destroy();
- }
- if (m_motion)
- {
- m_motion->Destroy();
- }
- if (m_actorInstance)
- {
- m_actorInstance->Destroy();
- }
- m_actor.reset();
- SystemComponentFixture::TearDown();
- }
- void InitMotionInstance(const MotionInstanceInputState& state)
- {
- m_motionInstance->SetCurrentTime(state.m_currentTime, true);
- m_motionInstance->SetPlaySpeed(state.m_playSpeed);
- m_motionInstance->SetFreezeAtLastFrame(state.m_freezeAtLLastFrame);
- m_motionInstance->SetNumCurrentLoops(state.m_numCurrentLoops);
- m_motionInstance->SetMaxLoops(state.m_maxNumLoops);
- m_motionInstance->SetPlayMode(state.m_playMode);
- }
- void VerifyOutputState(const MotionInstanceOutputState& state)
- {
- EXPECT_TRUE(AZ::IsClose(m_motionInstance->GetCurrentTime(), state.m_currentTime, AZ::Constants::FloatEpsilon)) << "Expected the current play time to be different.";
- EXPECT_TRUE(AZ::IsClose(m_motionInstance->GetLastCurrentTime(), state.m_lastCurrentTime, AZ::Constants::FloatEpsilon)) << "Expected the last current play time to be different.";
- EXPECT_EQ(m_motionInstance->GetNumCurrentLoops(), state.m_numLoops) << "Expected the current number of loops to be different.";
- EXPECT_EQ(m_motionInstance->GetHasEnded(), state.m_hasEnded) << "Expected the has ended state to be different.";
- EXPECT_EQ(m_motionInstance->GetHasLooped(), state.m_hasLooped) << "Expected the looped state to be different.";
- EXPECT_EQ(m_motionInstance->GetIsFrozen(), state.m_isFrozen) << "Expected the frozen state to be different.";
- }
- protected:
- AZStd::unique_ptr<Actor> m_actor;
- ActorInstance* m_actorInstance = nullptr;
- Motion* m_motion = nullptr;
- MotionInstance* m_motionInstance = nullptr;
- };
- TEST_P(MotionInstanceFixture, Update)
- {
- // Initialize the motion instance in our input state.
- const MotionInstanceTestParams& params = GetParam();
- InitMotionInstance(params.m_inputState);
- // Perform an update.
- m_motionInstance->Update(params.m_deltaTime);
- // Verify the expected output.
- VerifyOutputState(params.m_outputState);
- }
- std::vector<MotionInstanceTestParams> motionInstanceTestParams
- {
- //////////////////////////////// FORWARD PLAYBACK ////////////////////////////////////
- { // [0] Forward just a little bit in time.
- { // Input state.
- 0.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.1f, // Current play time.
- 0.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [1] Forward the exact full amount of the motion's duration, triggering a loop.
- { // Input state.
- 0.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.0f, // Current play time.
- 0.0f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 1.0f // Delta update time, in seconds.
- },
- { // [2] Start near the end, trigger a loop by wrapping around.
- { // Input state.
- 0.9f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.1f, // Current play time.
- 0.9f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.2f // Delta update time, in seconds.
- },
- { // [3] Update with a time value that is 3x as large as the motion duration.
- { // Input state.
- 0.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.5f, // Current play time.
- 0.5f, // Last current play time.
- 1, // Current loops. This currently isn't 3, as we currently do not support handling multiple loops in one update.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 3.0f // Delta update time, in seconds.
- },
- { // [4] Start out of range, in negative time.
- { // Input state.
- -3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.2f, // Current play time.
- -3.5f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.2f // Delta update time, in seconds.
- },
- { // [5] Start out of range, past the duration.
- { // Input state.
- 3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.1f, // Current play time.
- 3.5f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- //////////////////////////////// BACKWARD PLAYBACK ////////////////////////////////////
- { // [6] Progress just a little bit in time.
- { // Input state.
- 0.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.4f, // Current play time.
- 0.5f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [7] Progress the exact full amount of the motion's duration, triggering a loop.
- { // Input state.
- 1.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 1.0f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 1.0f // Delta update time, in seconds.
- },
- { // [8] Start near the beginning, trigger a loop by wrapping around.
- { // Input state.
- 0.1f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.9f, // Current play time.
- 0.1f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.2f // Delta update time, in seconds.
- },
- { // [9] Update with a time value that is 3x as large as the motion duration.
- { // Input state.
- 0.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.5f, // Current play time.
- 0.5f, // Last current play time.
- 1, // Current loops. This currently isn't 3, as we currently do not support handling multiple loops in one update.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 3.0f // Delta update time, in seconds.
- },
- { // [10] Start out of range, in negative time.
- { // Input state.
- -3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.9f, // Current play time.
- -3.5f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [11] Start out of range, past the duration.
- { // Input state.
- 3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.9f, // Current play time.
- 3.5f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- //////////////////////////////// FORWARD PLAYBACK WHILE FREEZING AT LAST FRAME, ONE LOOP MAX ////////////////////////////////////
- { // [12] Forward just a little bit in time.
- { // Input state.
- 0.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.1f, // Current play time.
- 0.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [13] Forward the exact full amount of the motion's duration, triggering a loop.
- { // Input state.
- 0.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 0.0f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 1.0f // Delta update time, in seconds.
- },
- { // [14] Start near the end, trigger a loop by wrapping around.
- { // Input state.
- 0.9f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 0.9f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 0.2f // Delta update time, in seconds.
- },
- { // [15] Update with a time value that is 3x as large as the motion duration.
- { // Input state.
- 0.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 0.5f, // Last current play time.
- 1, // Current loops. This currently isn't 3, as we currently do not support handling multiple loops in one update.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 3.0f // Delta update time, in seconds.
- },
- { // [16] Start out of range, in negative time.
- { // Input state.
- -3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.1f, // Current play time.
- -3.5f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [17] Start out of range, past the duration.
- { // Input state.
- 3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 3.5f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- //////////////////////////////// BACKWARD PLAYBACK WHILE FREEZING AT LAST FRAME, ONE LOOP MAX ////////////////////////////////////
- { // [18] Forward just a little bit in time.
- { // Input state.
- 1.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.9f, // Current play time.
- 1.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [19] Forward the exact full amount of the motion's duration, triggering a loop.
- { // Input state.
- 1.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.0f, // Current play time.
- 1.0f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 1.0f // Delta update time, in seconds.
- },
- { // [20] Start near the end, trigger a loop by wrapping around.
- { // Input state.
- 0.1f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.0f, // Current play time.
- 0.1f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 0.2f // Delta update time, in seconds.
- },
- { // [21] Update with a time value that is 3x as large as the motion duration.
- { // Input state.
- 0.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.0f, // Current play time.
- 0.5f, // Last current play time.
- 1, // Current loops. This currently isn't 3, as we currently do not support handling multiple loops in one update.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 3.0f // Delta update time, in seconds.
- },
- { // [22] Start out of range, in negative time.
- { // Input state.
- -3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.0f, // Current play time.
- -3.5f, // Last current play time.
- 1, // Current loops.
- true, // Has this motion ended?
- true, // Has looped?
- true, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [23] Start out of range, past the duration.
- { // Input state.
- 3.5f, // Current play time, in seconds.
- 1.0f, // Play speed.
- true, // Freeze at the last frame?
- 0, // Current number of loops.
- 1, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.9f, // Current play time.
- 3.5f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- //////////////////////////////// PLAYSPEED TESTS ////////////////////////////////////
- { // [24] Forward just a little bit in time, with increased play speed.
- { // Input state.
- 0.0f, // Current play time, in seconds.
- 3.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.3f, // Current play time.
- 0.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [25] Forward in time but wrap around, with higher play speed.
- { // Input state.
- 0.9f, // Current play time, in seconds.
- 3.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.2f, // Current play time.
- 0.9f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [26] Backward with increased play speed.
- { // Input state.
- 1.0f, // Current play time, in seconds.
- 3.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.7f, // Current play time.
- 1.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- { // [27] Backward in time but wrap around, with higher play speed.
- { // Input state.
- 0.1f, // Current play time, in seconds.
- 3.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_BACKWARD // The play mode.
- },
- { // Expected output state.
- 0.8f, // Current play time.
- 0.1f, // Last current play time.
- 1, // Current loops.
- false, // Has this motion ended?
- true, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.1f // Delta update time, in seconds.
- },
- //////////////////////////////// MISC TESTS ////////////////////////////////////
- { // [28] Zero time delta.
- { // Input state.
- 0.3f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.3f, // Current play time.
- 0.3f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.0f // Delta update time, in seconds.
- },
- { // [29] Zero time delta while on the motion duration edge.
- { // Input state.
- 1.0f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 1.0f, // Current play time.
- 1.0f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- 0.0f // Delta update time, in seconds.
- },
- { // [30] Negative delta time.
- { // Input state.
- 0.2f, // Current play time, in seconds.
- 1.0f, // Play speed.
- false, // Freeze at the last frame?
- 0, // Current number of loops.
- EMFX_LOOPFOREVER, // Maximum loops allowed.
- PLAYMODE_FORWARD // The play mode.
- },
- { // Expected output state.
- 0.2f, // Current play time.
- 0.2f, // Last current play time.
- 0, // Current loops.
- false, // Has this motion ended?
- false, // Has looped?
- false, // Are we in a frozen state?
- },
- -0.5f // Delta update time, in seconds.
- }
- };
- INSTANTIATE_TEST_CASE_P(MotionInstanceTests, MotionInstanceFixture, ::testing::ValuesIn(motionInstanceTestParams));
- } // namespace EMotionFX
|