Debian Codegraph @

plugins/md3model/plugin.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2001-2006, William Joseph.
3 All Rights Reserved.
4
5 This file is part of GtkRadiant.
6
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.
11
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.
16
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
20 */
21
22 #include "iscenegraph.h"
23 #include "irender.h"
24 #include "iselection.h"
25 #include "iimage.h"
26 #include "imodel.h"
27 #include "igl.h"
28 #include "ifilesystem.h"
29 #include "iundo.h"
30 #include "ifiletypes.h"
31 #include "iscriplib.h"
32
33 #include "modulesystem/singletonmodule.h"
34 #include "typesystem.h"
35
36 #include "md3.h"
37 #include "mdl.h"
38 #include "md2.h"
39 #include "mdc.h"
40 #include "mdlimage.h"
41 #include "md5.h"
42
43
44 class MD3ModelLoader : public ModelLoader
45 {
46 public:
47 scene::Node& loadModel( ArchiveFile& file ){
48 return loadMD3Model( file );
49 }
50 };
51
52 class ModelDependencies :
53 public GlobalFileSystemModuleRef,
54 public GlobalOpenGLModuleRef,
55 public GlobalUndoModuleRef,
56 public GlobalSceneGraphModuleRef,
57 public GlobalShaderCacheModuleRef,
58 public GlobalSelectionModuleRef,
59 public GlobalFiletypesModuleRef
60 {
61 };
62
63 class ModelMD3API : public TypeSystemRef
64 {
65 MD3ModelLoader m_modelmd3;
66 public:
67 typedef ModelLoader Type;
68 STRING_CONSTANT( Name, "md3" );
69
70 ModelMD3API(){
71 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md3 models", "*.md3" ) );
72 }
73 ModelLoader* getTable(){
74 return &m_modelmd3;
75 }
76 };
77
78 typedef SingletonModule<ModelMD3API, ModelDependencies> ModelMD3Module;
79
80 ModelMD3Module g_ModelMD3Module;
81
82
83
84 class MD2ModelLoader : public ModelLoader
85 {
86 public:
87 scene::Node& loadModel( ArchiveFile& file ){
88 return loadMD2Model( file );
89 }
90 };
91
92 class ModelMD2API : public TypeSystemRef
93 {
94 MD2ModelLoader m_modelmd2;
95 public:
96 typedef ModelLoader Type;
97 STRING_CONSTANT( Name, "md2" );
98
99 ModelMD2API(){
100 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md2 models", "*.md2" ) );
101 }
102 ModelLoader* getTable(){
103 return &m_modelmd2;
104 }
105 };
106
107 typedef SingletonModule<ModelMD2API, ModelDependencies> ModelMD2Module;
108
109 ModelMD2Module g_ModelMD2Module;
110
111 class MDLModelLoader : public ModelLoader
112 {
113 public:
114 scene::Node& loadModel( ArchiveFile& file ){
115 return loadMDLModel( file );
116 }
117 };
118
119 class ModelMDLAPI : public TypeSystemRef
120 {
121 MDLModelLoader m_modelmdl;
122 public:
123 typedef ModelLoader Type;
124 STRING_CONSTANT( Name, "mdl" );
125
126 ModelMDLAPI(){
127 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdl models", "*.mdl" ) );
128 }
129 ModelLoader* getTable(){
130 return &m_modelmdl;
131 }
132 };
133
134 typedef SingletonModule<ModelMDLAPI, ModelDependencies> ModelMDLModule;
135
136 ModelMDLModule g_ModelMDLModule;
137
138 class MDCModelLoader : public ModelLoader
139 {
140 public:
141 scene::Node& loadModel( ArchiveFile& file ){
142 return loadMDCModel( file );
143 }
144 };
145
146 class ModelMDCAPI : public TypeSystemRef
147 {
148 MDCModelLoader m_modelmdc;
149 public:
150 typedef ModelLoader Type;
151 STRING_CONSTANT( Name, "mdc" );
152
153 ModelMDCAPI(){
154 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "mdc models", "*.mdc" ) );
155 }
156 ModelLoader* getTable(){
157 return &m_modelmdc;
158 }
159 };
160
161 typedef SingletonModule<ModelMDCAPI, ModelDependencies> ModelMDCModule;
162
163 ModelMDCModule g_ModelMDCModule;
164
165
166 class ImageMDLAPI
167 {
168 _QERPlugImageTable m_imagemdl;
169 public:
170 typedef _QERPlugImageTable Type;
171 STRING_CONSTANT( Name, "mdl" );
172
173 ImageMDLAPI(){
174 m_imagemdl.loadImage = &LoadMDLImage;
175 }
176 _QERPlugImageTable* getTable(){
177 return &m_imagemdl;
178 }
179 };
180
181 typedef SingletonModule<ImageMDLAPI, GlobalFileSystemModuleRef> ImageMDLModule;
182
183 ImageMDLModule g_ImageMDLModule;
184
185
186 class MD5ModelLoader : public ModelLoader
187 {
188 public:
189 scene::Node& loadModel( ArchiveFile& file ){
190 return loadMD5Model( file );
191 }
192 };
193
194 class ModelMD5Dependencies : public ModelDependencies, public GlobalScripLibModuleRef
195 {
196 };
197
198 class ModelMD5API : public TypeSystemRef
199 {
200 MD5ModelLoader m_modelmd5;
201 public:
202 typedef ModelLoader Type;
203 STRING_CONSTANT( Name, "md5mesh" );
204
205 ModelMD5API(){
206 GlobalFiletypesModule::getTable().addType( Type::Name(), Name(), filetype_t( "md5 meshes", "*.md5mesh" ) );
207 }
208 ModelLoader* getTable(){
209 return &m_modelmd5;
210 }
211 };
212
213 typedef SingletonModule<ModelMD5API, ModelMD5Dependencies> ModelMD5Module;
214
215 ModelMD5Module g_ModelMD5Module;
216
217
218 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
219 initialiseModule( server );
220
221 g_ModelMD3Module.selfRegister();
222 g_ModelMD2Module.selfRegister();
223 g_ModelMDLModule.selfRegister();
224 g_ModelMDCModule.selfRegister();
225 g_ImageMDLModule.selfRegister();
226 g_ModelMD5Module.selfRegister();
227 }