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#include "Renderer/BsRendererExtension.h"
4#include "CoreThread/BsCoreThread.h"
5#include "Renderer/BsRendererManager.h"
6#include "Renderer/BsRenderer.h"
7
8namespace bs
9{
10 void RendererExtension::_initializer(RendererExtension* obj, const Any& data)
11 {
12 auto coreInitializer = [=]()
13 {
14 RendererManager::instance().getActive()->addPlugin(obj);
15 obj->initialize(data);
16 };
17
18 gCoreThread().queueCommand(coreInitializer);
19 }
20
21 void RendererExtension::_deleter(RendererExtension* obj)
22 {
23 auto deleteObj = [=]()
24 {
25 RendererManager::instance().getActive()->removePlugin(obj);
26
27 obj->destroy();
28 obj->~RendererExtension();
29
30 bs_free(obj);
31 };
32
33 // Queue deletion on the core thread
34 gCoreThread().queueCommand(deleteObj);
35 }
36}