BsGLRenderSystemFactory.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include <string>
  6. #include "BsRenderSystemFactory.h"
  7. #include "BsRenderSystemManager.h"
  8. #include "BsGLRenderSystem.h"
  9. namespace BansheeEngine
  10. {
  11. const String SystemName = "BansheeGLRenderSystem";
  12. /**
  13. * @brief Handles creation of the OpenGL render system.
  14. */
  15. class GLRenderSystemFactory : public RenderSystemFactory
  16. {
  17. public:
  18. /**
  19. * @copydoc RenderSystemFactory::create
  20. */
  21. virtual void create();
  22. /**
  23. * @copydoc RenderSystemFactory::name
  24. */
  25. virtual const String& name() const { return SystemName; }
  26. private:
  27. /**
  28. * @brief Registers the factory with the render system manager when constructed.
  29. */
  30. class InitOnStart
  31. {
  32. public:
  33. InitOnStart()
  34. {
  35. static RenderSystemFactoryPtr newFactory;
  36. if(newFactory == nullptr)
  37. {
  38. newFactory = bs_shared_ptr<GLRenderSystemFactory>();
  39. RenderSystemManager::instance().registerRenderSystemFactory(newFactory);
  40. }
  41. }
  42. };
  43. static InitOnStart initOnStart; // Makes sure factory is registered on library load
  44. };
  45. }