2 * @file PluginRegistration.cpp
3 * Declares and implements the MeshTexPluginDependencies class, and implements
4 * the plugin library's exported function Radiant_RegisterModules.
5 * @ingroup meshtex-plugin
9 * Copyright 2012 Joel Baxter
11 * This file is part of MeshTex.
13 * MeshTex is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 2 of the License, or
16 * (at your option) any later version.
18 * MeshTex is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with MeshTex. If not, see <http://www.gnu.org/licenses/>.
27 #include "PluginModule.h"
30 #include "iscenegraph.h"
31 #include "iselection.h"
34 #include "modulesystem/singletonmodule.h"
38 * Definition (in the declared superclasses) of the Radiant systems that this
39 * plugin depends on. GlobalRadiantModule, GlobalUndoModule,
40 * GlobalSceneGraphModule, GlobalSelectionModule, GlobalShadersModule, and of
41 * course GlobalPatchModule.
43 * @ingroup meshtex-plugin.
45 class MeshTexPluginDependencies :
46 public GlobalRadiantModuleRef,
47 public GlobalUndoModuleRef,
48 public GlobalSceneGraphModuleRef,
49 public GlobalSelectionModuleRef,
50 public GlobalShadersModuleRef,
51 public GlobalPatchModuleRef
55 * Default constructor. This function's only responsibility is to pass
56 * arguments to superclass constructors.
58 MeshTexPluginDependencies() :
59 GlobalShadersModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("shaders")),
60 GlobalPatchModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("patchtypes"))
67 * Register as a plugin with Radiant.
69 * @param server Radiant's module (library) manager.
71 * @relatesalso MeshTexPluginDependencies
74 typedef SingletonModule<PluginModule, MeshTexPluginDependencies> SingletonMeshTexPluginModule;
76 SingletonMeshTexPluginModule g_MeshTexPluginModule;
78 extern "C" void RADIANT_DLLEXPORT
79 Radiant_RegisterModules(ModuleServer& server)
81 // Set ourselves up as a plugin with the necessary dependences.
82 //static SingletonModule<PluginModule, MeshTexPluginDependencies> singleton;
83 // Alert Radiant that there's at least one module to be managed, and
84 // initialize some necessary stuff.
85 // XXX As far as I can tell it's not necessary for EVERY library to do this
86 // but it doesn't hurt, and this way we ensure it gets done.
87 initialiseModule(server);
88 // Register this library. Now we're active as a plugin.
89 g_MeshTexPluginModule.selfRegister();