2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "iscenegraph.h"
24 #include "iselection.h"
28 #include "ifilesystem.h"
30 #include "ifiletypes.h"
31 #include "iscriplib.h"
33 #include "modulesystem/singletonmodule.h"
34 #include "typesystem.h"
44 class MD3ModelLoader : public ModelLoader {
46 scene::Node &loadModel(ArchiveFile &file)
48 return loadMD3Model(file);
52 class ModelDependencies :
53 public GlobalFileSystemModuleRef,
54 public GlobalOpenGLModuleRef,
55 public GlobalUndoModuleRef,
56 public GlobalSceneGraphModuleRef,
57 public GlobalShaderCacheModuleRef,
58 public GlobalSelectionModuleRef,
59 public GlobalFiletypesModuleRef {
62 class ModelMD3API : public TypeSystemRef {
63 MD3ModelLoader m_modelmd3;
65 typedef ModelLoader Type;
67 STRING_CONSTANT(Name, "md3");
71 GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("md3 models", "*.md3"));
74 ModelLoader *getTable()
80 typedef SingletonModule<ModelMD3API, ModelDependencies> ModelMD3Module;
82 ModelMD3Module g_ModelMD3Module;
85 class MD2ModelLoader : public ModelLoader {
87 scene::Node &loadModel(ArchiveFile &file)
89 return loadMD2Model(file);
93 class ModelMD2API : public TypeSystemRef {
94 MD2ModelLoader m_modelmd2;
96 typedef ModelLoader Type;
98 STRING_CONSTANT(Name, "md2");
102 GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("md2 models", "*.md2"));
105 ModelLoader *getTable()
111 typedef SingletonModule<ModelMD2API, ModelDependencies> ModelMD2Module;
113 ModelMD2Module g_ModelMD2Module;
115 class MDLModelLoader : public ModelLoader {
117 scene::Node &loadModel(ArchiveFile &file)
119 return loadMDLModel(file);
123 class ModelMDLAPI : public TypeSystemRef {
124 MDLModelLoader m_modelmdl;
126 typedef ModelLoader Type;
128 STRING_CONSTANT(Name, "mdl");
132 GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("mdl models", "*.mdl"));
135 ModelLoader *getTable()
141 typedef SingletonModule<ModelMDLAPI, ModelDependencies> ModelMDLModule;
143 ModelMDLModule g_ModelMDLModule;
145 class MDCModelLoader : public ModelLoader {
147 scene::Node &loadModel(ArchiveFile &file)
149 return loadMDCModel(file);
153 class ModelMDCAPI : public TypeSystemRef {
154 MDCModelLoader m_modelmdc;
156 typedef ModelLoader Type;
158 STRING_CONSTANT(Name, "mdc");
162 GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("mdc models", "*.mdc"));
165 ModelLoader *getTable()
171 typedef SingletonModule<ModelMDCAPI, ModelDependencies> ModelMDCModule;
173 ModelMDCModule g_ModelMDCModule;
177 _QERPlugImageTable m_imagemdl;
179 typedef _QERPlugImageTable Type;
181 STRING_CONSTANT(Name, "mdl");
185 m_imagemdl.loadImage = &LoadMDLImage;
188 _QERPlugImageTable *getTable()
194 typedef SingletonModule<ImageMDLAPI, GlobalFileSystemModuleRef> ImageMDLModule;
196 ImageMDLModule g_ImageMDLModule;
199 class MD5ModelLoader : public ModelLoader {
201 scene::Node &loadModel(ArchiveFile &file)
203 return loadMD5Model(file);
207 class ModelMD5Dependencies : public ModelDependencies, public GlobalScripLibModuleRef {
210 class ModelMD5API : public TypeSystemRef {
211 MD5ModelLoader m_modelmd5;
213 typedef ModelLoader Type;
215 STRING_CONSTANT(Name, "md5mesh");
219 GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("md5 meshes", "*.md5mesh"));
222 ModelLoader *getTable()
228 typedef SingletonModule<ModelMD5API, ModelMD5Dependencies> ModelMD5Module;
230 ModelMD5Module g_ModelMD5Module;
233 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
235 initialiseModule(server);
237 g_ModelMD3Module.selfRegister();
238 g_ModelMD2Module.selfRegister();
239 g_ModelMDLModule.selfRegister();
240 g_ModelMDCModule.selfRegister();
241 g_ImageMDLModule.selfRegister();
242 g_ModelMD5Module.selfRegister();