aboutsummaryrefslogtreecommitdiff
path: root/tools/ArtistTools/source/BlastPlugin/Render/Interface/PluginBlast.cpp
blob: 3a9c9c9a51577eafd512c7369056ed0a3a6e4bdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "PluginBlast.h"

PluginBlast* g_Plugin = nullptr;

PluginBlast::PluginBlast()
{
}

PluginBlast::~PluginBlast()
{
}

typedef PluginBlast*(*Func)(void);

bool PluginBlast::Create(std::string strApi)
{
	if ("" == strApi)
		return false;

	std::string pluginDll = "";
	HMODULE module = NULL;
	Func CreateFunc = NULL;

#ifdef NV_ARTISTTOOLS
	pluginDll = "RenderBlast";
#else
	pluginDll = "FurRender";
#endif

	pluginDll.append(strApi);

#ifdef _WIN64
	pluginDll.append(".win64");
#else						  
	pluginDll.append(".win32");
#endif

#ifdef _DEBUG
	pluginDll.append(".d");
#else						  
#endif

	pluginDll.append(".dll");

	module = LoadLibraryA(pluginDll.c_str());
	if (NULL == module)
		return false;

	CreateFunc = (Func)GetProcAddress(module, "CreateRenderBlast");
	if (NULL == CreateFunc)
		return false;

	g_Plugin = CreateFunc();
	return (NULL != g_Plugin);
}

PluginBlast* PluginBlast::Instance()
{
	return g_Plugin;
}

void PluginBlast::Destroy()
{
	if (nullptr == g_Plugin)
		return;

	delete g_Plugin;
	g_Plugin = nullptr;
}