CmApplication.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmHighLevelGpuProgram.h"
  4. namespace CamelotEngine
  5. {
  6. class RenderWindow;
  7. class Viewport;
  8. class Camera;
  9. class HighLevelGpuProgramManager;
  10. }
  11. namespace CamelotEngine
  12. {
  13. class CM_EXPORT Application
  14. {
  15. public:
  16. Application();
  17. void startUp(const String& renderSystemDll, const String& rendererDll);
  18. void runMainLoop();
  19. void shutDown();
  20. UINT64 getAppWindowId();
  21. RenderWindowPtr getPrimaryRenderWindow() const { return mPrimaryRenderWindow; }
  22. // TODO: This is just for debug purposes. Normally I'd want to have one render context per scene view, not one global one
  23. DeferredRenderContextPtr getPrimaryRenderContext() const { return mPrimaryRenderContext; }
  24. /**
  25. * @brief Loads a plugin.
  26. *
  27. * @param pluginName Name of the plugin to load, without extension.
  28. */
  29. void loadPlugin(const String& pluginName);
  30. private:
  31. RenderWindowPtr mPrimaryRenderWindow;
  32. DeferredRenderContextPtr mPrimaryRenderContext;
  33. bool mIsFrameRenderingFinished;
  34. CM_MUTEX(mFrameRenderingFinishedMutex);
  35. /**
  36. * @brief Callback called from the render thread in order to initialize resources.
  37. */
  38. void updateResourcesCallback();
  39. /**
  40. * @brief Runs the OS specific message pump.
  41. */
  42. void updateMessagePump();
  43. /**
  44. * @brief Called when the frame finishes rendering.
  45. */
  46. void frameRenderingFinishedCallback();
  47. };
  48. CM_EXPORT Application& gApplication();
  49. }