Main.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 <cstdio>
  6. #include <Samples/Common/SampleApp.h>
  7. using namespace anki;
  8. class MyApp : public SampleApp
  9. {
  10. public:
  11. using SampleApp::SampleApp;
  12. Error sampleExtraInit() final
  13. {
  14. ScriptResourcePtr script;
  15. ANKI_CHECK(ResourceManager::getSingleton().loadResource("Assets/Scene.lua", script));
  16. ANKI_CHECK(ScriptManager::getSingleton().evalString(script->getSource()));
  17. SceneNode& knight = SceneGraph::getSingleton().findSceneNode("MESH_kinght.001");
  18. AnimationResourcePtr anim;
  19. ANKI_CHECK(ResourceManager::getSingleton().loadResource("Assets/Armature_mixamo.com_Layer0_2ff0b9b4a30af3d0.ankianim", anim));
  20. AnimationPlayInfo inf;
  21. inf.m_repeatTimes = -1;
  22. inf.m_animationSpeedScale = 2.1f;
  23. knight.getFirstComponentOfType<SkinComponent>().playAnimation(0, anim, inf);
  24. return Error::kNone;
  25. }
  26. };
  27. ANKI_MAIN_FUNCTION(myMain)
  28. int myMain(int argc, char* argv[])
  29. {
  30. Error err = Error::kNone;
  31. MyApp* app = new MyApp(argc, argv, "Sponza");
  32. err = app->mainLoop();
  33. delete app;
  34. if(err)
  35. {
  36. ANKI_LOGE("Error reported. Bye!!");
  37. }
  38. else
  39. {
  40. ANKI_LOGI("Bye!!");
  41. }
  42. return 0;
  43. }