1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsCorePrerequisites.h"
6#include "Utility/BsModule.h"
7
8namespace bs
9{
10 /** @addtogroup Renderer-Internal
11 * @{
12 */
13
14 /**
15 * Allows you to change and retrieve the active renderer. Active renderer will be used for rendering all objects in
16 * the following frame.
17 *
18 * @note No renderer is active by default. You must make a renderer active before doing any rendering.
19 */
20 class BS_CORE_EXPORT RendererManager : public Module<RendererManager>
21 {
22 public:
23 ~RendererManager();
24
25 /**
26 * Attempts to find a renderer with the specified name and makes it active. Exception is thrown if renderer with
27 * the specified name doesn't exist. You must call initialize() after setting the active renderer to properly
28 * activate it.
29 */
30 void setActive(const String& name);
31
32 /** Initializes the currently active renderer, making it ready to render. */
33 void initialize();
34
35 /** Returns the currently active renderer. Null if no renderer is active. */
36 SPtr<ct::Renderer> getActive() { return mActiveRenderer; }
37
38 /**
39 * Registers a new renderer factory. Any renderer you try to make active with setActive() you will need to have
40 * previously registered here.
41 */
42 void _registerFactory(SPtr<RendererFactory> factory);
43 private:
44 Vector<SPtr<RendererFactory>> mAvailableFactories;
45
46 SPtr<ct::Renderer> mActiveRenderer;
47 };
48
49 /** @} */
50}
51
52