本文整理汇总了C++中Model::FindAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::FindAnimation方法的具体用法?C++ Model::FindAnimation怎么用?C++ Model::FindAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::FindAnimation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliModelBuildAnimation04
int UtcDaliModelBuildAnimation04(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::MeshActor::New()");
Dali::ModelData modelData = BuildTreeModel();
// Raise a request
Model model = Model::New("Tree");
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
if(request)
{
platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
}
application.Render();
application.SendNotification();
Actor actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
DALI_TEST_CHECK(actor);
DALI_TEST_CHECK(actor.GetName().compare("root") == 0);
DALI_TEST_EQUALS(model.NumberOfAnimations(), static_cast<size_t>(1), TEST_LOCATION);
unsigned int animIndex=0;
bool found = model.FindAnimation("Fred", animIndex);
DALI_TEST_CHECK(!found);
END_TEST;
}
示例2: UtcDaliModelBuildAnimation01
int UtcDaliModelBuildAnimation01(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::MeshActor::New()");
Dali::ModelData modelData = BuildTreeModel();
// Raise a request
Model model = Model::New("Tree");
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
if(request)
{
platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
}
application.Render();
application.SendNotification();
Actor actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
Stage::GetCurrent().Add(actor);
DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
DALI_TEST_CHECK(actor);
DALI_TEST_CHECK(actor.GetName().compare("root") == 0);
DALI_TEST_EQUALS(model.NumberOfAnimations(), static_cast<size_t>(1), TEST_LOCATION);
unsigned int animIndex=0;
bool found = model.FindAnimation("Anim1", animIndex);
DALI_TEST_CHECK(found);
Animation twigAnim = ModelActorFactory::BuildAnimation(model, actor, animIndex);
DALI_TEST_CHECK(twigAnim);
DALI_TEST_EQUALS(twigAnim.GetDuration(), 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_CHECK(twigAnim.GetDefaultAlphaFunction() == Dali::AlphaFunctions::Linear);
Actor twigActor = actor.FindChildByName("twig");
DALI_TEST_CHECK(twigActor);
// Start the animation
twigAnim.Play();
float durationSeconds = 10.0f;
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
twigAnim.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(2.0f, 1.0f, 0.0f), 0.01f, TEST_LOCATION );
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
application.SendNotification();
DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(2.5f, 1.0f, 2.5f), 0.01f, TEST_LOCATION );
application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 75% progress */);
application.SendNotification();
DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(3.5f, 1.0f, 7.5f), 0.01f, TEST_LOCATION );
application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* Past Finished */);
application.SendNotification();
DALI_TEST_EQUALS( twigActor.GetCurrentPosition(), Vector3(4.0f, 1.0f, 10.0f), 0.01f, TEST_LOCATION );
finishCheck.CheckSignalReceived();
END_TEST;
}