/
plugin.cpp
56 lines (44 loc) · 1.28 KB
/
plugin.cpp
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
#include "imodule.h"
#include "debugging/debugging.h"
#include "itextstream.h"
#include "MD5ModelLoader.h"
#include "MD5AnimationCache.h"
namespace md5
{
class MD5Module :
public RegisterableModule
{
public:
// RegisterableModule implementation
const std::string& getName() const
{
static std::string _name("MD5Module");
return _name;
}
const StringSet& getDependencies() const
{
static StringSet _dependencies;
if (_dependencies.empty())
{
_dependencies.insert(MODULE_MODELFORMATMANAGER);
}
return _dependencies;
}
void initialiseModule(const ApplicationContext& ctx)
{
GlobalModelFormatManager().registerImporter(std::make_shared<md5::MD5ModelLoader>());
}
};
}
// DarkRadiant module entry point
extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry)
{
registry.registerModule(std::make_shared<md5::MD5Module>());
registry.registerModule(std::make_shared<md5::MD5AnimationCache>());
// Initialise the streams using the given application context
module::initialiseStreams(registry.getApplicationContext());
// Remember the reference to the ModuleRegistry
module::RegistryReference::Instance().setRegistry(registry);
// Set up the assertion handler
GlobalErrorHandler() = registry.getApplicationContext().getErrorHandlingFunction();
}