2
0

Main.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <Samples/Common/SampleApp.h>
  6. using namespace anki;
  7. class MyApp : public SampleApp
  8. {
  9. public:
  10. using SampleApp::SampleApp;
  11. Error userPreInit() final
  12. {
  13. ANKI_CHECK(SampleApp::userPreInit());
  14. g_cvarCoreStartupScene = "Assets/Scene.lua";
  15. return Error::kNone;
  16. }
  17. Error userMainLoop(Bool& quit, Second elapsedTime) final
  18. {
  19. ANKI_CHECK(SampleApp::userMainLoop(quit, elapsedTime));
  20. static Bool firstTime = true;
  21. if(firstTime)
  22. {
  23. firstTime = false;
  24. SceneNode& knight = SceneGraph::getSingleton().findSceneNode("MESH_kinght.001");
  25. AnimationResourcePtr anim;
  26. ANKI_CHECK(ResourceManager::getSingleton().loadResource("Assets/Armature_mixamo.com_Layer0_2ff0b9b4a30af3d0.ankianim", anim));
  27. AnimationPlayInfo inf;
  28. inf.m_repeatTimes = -1;
  29. inf.m_animationSpeedScale = 2.1f;
  30. knight.getFirstComponentOfType<SkinComponent>().playAnimation(0, anim, inf);
  31. }
  32. return Error::kNone;
  33. }
  34. };
  35. ANKI_MAIN_FUNCTION(myMain)
  36. int myMain(int argc, char* argv[])
  37. {
  38. Error err = Error::kNone;
  39. MyApp* app = new MyApp(argc, argv, "Sponza");
  40. err = app->mainLoop();
  41. delete app;
  42. if(err)
  43. {
  44. ANKI_LOGE("Error reported. Bye!!");
  45. }
  46. else
  47. {
  48. ANKI_LOGI("Bye!!");
  49. }
  50. return 0;
  51. }