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
24 #include "iscenegraph.h"
26 #include "iselection.h"
30 #include "ifilesystem.h"
32 #include "ifiletypes.h"
33 #include "iscriplib.h"
35 #include "modulesystem/singletonmodule.h"
36 #include "typesystem.h"
46 class MD3ModelLoader : public ModelLoader
49 scene::Node& loadModel( ArchiveFile& file ){
50 return loadMD3Model( file );
54 class ModelDependencies :
55 public GlobalFileSystemModuleRef,
56 public GlobalOpenGLModuleRef,
57 public GlobalUndoModuleRef,
58 public GlobalSceneGraphModuleRef,
59 public GlobalShaderCacheModuleRef,
60 public GlobalSelectionModuleRef,
61 public GlobalFiletypesModuleRef
65 class ModelMD3API : public TypeSystemRef
67 MD3ModelLoader m_modelmd3;
69 typedef ModelLoader Type;
70 STRING_CONSTANT( Name, "md3" );
73 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md3 models", "*.md3" ) );
75 ModelLoader* getTable(){
80 typedef SingletonModule<ModelMD3API, ModelDependencies> ModelMD3Module;
82 ModelMD3Module g_ModelMD3Module;
86 class MD2ModelLoader : public ModelLoader
89 scene::Node& loadModel( ArchiveFile& file ){
90 return loadMD2Model( file );
94 class ModelMD2API : public TypeSystemRef
96 MD2ModelLoader m_modelmd2;
98 typedef ModelLoader Type;
99 STRING_CONSTANT( Name, "md2" );
102 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md2 models", "*.md2" ) );
104 ModelLoader* getTable(){
109 typedef SingletonModule<ModelMD2API, ModelDependencies> ModelMD2Module;
111 ModelMD2Module g_ModelMD2Module;
113 class MDLModelLoader : public ModelLoader
116 scene::Node& loadModel( ArchiveFile& file ){
117 return loadMDLModel( file );
121 class ModelMDLAPI : public TypeSystemRef
123 MDLModelLoader m_modelmdl;
125 typedef ModelLoader Type;
126 STRING_CONSTANT( Name, "mdl" );
129 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdl models", "*.mdl" ) );
131 ModelLoader* getTable(){
136 typedef SingletonModule<ModelMDLAPI, ModelDependencies> ModelMDLModule;
138 ModelMDLModule g_ModelMDLModule;
140 class MDCModelLoader : public ModelLoader
143 scene::Node& loadModel( ArchiveFile& file ){
144 return loadMDCModel( file );
148 class ModelMDCAPI : public TypeSystemRef
150 MDCModelLoader m_modelmdc;
152 typedef ModelLoader Type;
153 STRING_CONSTANT( Name, "mdc" );
156 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdc models", "*.mdc" ) );
158 ModelLoader* getTable(){
163 typedef SingletonModule<ModelMDCAPI, ModelDependencies> ModelMDCModule;
165 ModelMDCModule g_ModelMDCModule;
170 _QERPlugImageTable m_imagemdl;
172 typedef _QERPlugImageTable Type;
173 STRING_CONSTANT( Name, "mdl" );
176 m_imagemdl.loadImage = &LoadMDLImage;
178 _QERPlugImageTable* getTable(){
183 typedef SingletonModule<ImageMDLAPI, GlobalFileSystemModuleRef> ImageMDLModule;
185 ImageMDLModule g_ImageMDLModule;
188 class MD5ModelLoader : public ModelLoader
191 scene::Node& loadModel( ArchiveFile& file ){
192 return loadMD5Model( file );
196 class ModelMD5Dependencies : public ModelDependencies, public GlobalScripLibModuleRef
200 class ModelMD5API : public TypeSystemRef
202 MD5ModelLoader m_modelmd5;
204 typedef ModelLoader Type;
205 STRING_CONSTANT( Name, "md5mesh" );
208 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md5 meshes", "*.md5mesh" ) );
210 ModelLoader* getTable(){
215 typedef SingletonModule<ModelMD5API, ModelMD5Dependencies> ModelMD5Module;
217 ModelMD5Module g_ModelMD5Module;
220 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
221 initialiseModule( server );
223 g_ModelMD3Module.selfRegister();
224 g_ModelMD2Module.selfRegister();
225 g_ModelMDLModule.selfRegister();
226 g_ModelMDCModule.selfRegister();
227 g_ImageMDLModule.selfRegister();
228 g_ModelMD5Module.selfRegister();