当前位置: 首页>>代码示例>>C++>>正文


C++ Model::FindAnimation方法代码示例

本文整理汇总了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;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:35,代码来源:utc-Dali-Model.cpp

示例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;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:70,代码来源:utc-Dali-Model.cpp


注:本文中的Model::FindAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。