ImporterRegistry.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2017, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. // Modified by Lasse Oorni for Urho3D
  35. /** @file ImporterRegistry.cpp
  36. Central registry for all importers available. Do not edit this file
  37. directly (unless you are adding new loaders), instead use the
  38. corresponding preprocessor flag to selectively disable formats.
  39. */
  40. #include <vector>
  41. #include "BaseImporter.h"
  42. // Urho3D: disable IRRMESH if IRR disabled
  43. #ifdef ASSIMP_BUILD_NO_IRR_IMPORTER
  44. #define ASSIMP_BUILD_NO_IRRMESH_IMPORTER
  45. #endif
  46. // ------------------------------------------------------------------------------------------------
  47. // Importers
  48. // (include_new_importers_here)
  49. // ------------------------------------------------------------------------------------------------
  50. #ifndef ASSIMP_BUILD_NO_X_IMPORTER
  51. # include "XFileImporter.h"
  52. #endif
  53. #ifndef ASSIMP_BUILD_NO_AMF_IMPORTER
  54. # include "AMFImporter.hpp"
  55. #endif
  56. #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
  57. # include "3DSLoader.h"
  58. #endif
  59. #ifndef ASSIMP_BUILD_NO_MD3_IMPORTER
  60. # include "MD3Loader.h"
  61. #endif
  62. #ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
  63. # include "MDLLoader.h"
  64. #endif
  65. #ifndef ASSIMP_BUILD_NO_MD2_IMPORTER
  66. # include "MD2Loader.h"
  67. #endif
  68. #ifndef ASSIMP_BUILD_NO_PLY_IMPORTER
  69. # include "PlyLoader.h"
  70. #endif
  71. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
  72. # include "ASELoader.h"
  73. #endif
  74. #ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
  75. # include "ObjFileImporter.h"
  76. #endif
  77. #ifndef ASSIMP_BUILD_NO_HMP_IMPORTER
  78. # include "HMPLoader.h"
  79. #endif
  80. #ifndef ASSIMP_BUILD_NO_SMD_IMPORTER
  81. # include "SMDLoader.h"
  82. #endif
  83. #ifndef ASSIMP_BUILD_NO_MDC_IMPORTER
  84. # include "MDCLoader.h"
  85. #endif
  86. #ifndef ASSIMP_BUILD_NO_MD5_IMPORTER
  87. # include "MD5Loader.h"
  88. #endif
  89. #ifndef ASSIMP_BUILD_NO_STL_IMPORTER
  90. # include "STLLoader.h"
  91. #endif
  92. #ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
  93. # include "LWOLoader.h"
  94. #endif
  95. #ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
  96. # include "DXFLoader.h"
  97. #endif
  98. #ifndef ASSIMP_BUILD_NO_NFF_IMPORTER
  99. # include "NFFLoader.h"
  100. #endif
  101. #ifndef ASSIMP_BUILD_NO_RAW_IMPORTER
  102. # include "RawLoader.h"
  103. #endif
  104. #ifndef ASSIMP_BUILD_NO_SIB_IMPORTER
  105. # include "SIBImporter.h"
  106. #endif
  107. #ifndef ASSIMP_BUILD_NO_OFF_IMPORTER
  108. # include "OFFLoader.h"
  109. #endif
  110. #ifndef ASSIMP_BUILD_NO_AC_IMPORTER
  111. # include "ACLoader.h"
  112. #endif
  113. #ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
  114. # include "BVHLoader.h"
  115. #endif
  116. #ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
  117. # include "IRRMeshLoader.h"
  118. #endif
  119. #ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
  120. # include "IRRLoader.h"
  121. #endif
  122. #ifndef ASSIMP_BUILD_NO_Q3D_IMPORTER
  123. # include "Q3DLoader.h"
  124. #endif
  125. #ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
  126. # include "B3DImporter.h"
  127. #endif
  128. #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
  129. # include "ColladaLoader.h"
  130. #endif
  131. #ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
  132. # include "TerragenLoader.h"
  133. #endif
  134. #ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
  135. # include "CSMLoader.h"
  136. #endif
  137. #ifndef ASSIMP_BUILD_NO_3D_IMPORTER
  138. # include "UnrealLoader.h"
  139. #endif
  140. #ifndef ASSIMP_BUILD_NO_LWS_IMPORTER
  141. # include "LWSLoader.h"
  142. #endif
  143. #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
  144. # include "OgreImporter.h"
  145. #endif
  146. #ifndef ASSIMP_BUILD_NO_OPENGEX_IMPORTER
  147. # include "OpenGEXImporter.h"
  148. #endif
  149. #ifndef ASSIMP_BUILD_NO_MS3D_IMPORTER
  150. # include "MS3DLoader.h"
  151. #endif
  152. #ifndef ASSIMP_BUILD_NO_COB_IMPORTER
  153. # include "COBLoader.h"
  154. #endif
  155. #ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
  156. # include "BlenderLoader.h"
  157. #endif
  158. #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
  159. # include "Q3BSPFileImporter.h"
  160. #endif
  161. #ifndef ASSIMP_BUILD_NO_NDO_IMPORTER
  162. # include "NDOLoader.h"
  163. #endif
  164. #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
  165. # include "IFCLoader.h"
  166. #endif
  167. #ifndef ASSIMP_BUILD_NO_XGL_IMPORTER
  168. # include "XGLLoader.h"
  169. #endif
  170. #ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
  171. # include "FBXImporter.h"
  172. #endif
  173. #ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
  174. # include "AssbinLoader.h"
  175. #endif
  176. #ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
  177. # include "glTFImporter.h"
  178. # include "glTF2Importer.h"
  179. #endif
  180. #ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
  181. # include "C4DImporter.h"
  182. #endif
  183. #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
  184. # include "D3MFImporter.h"
  185. #endif
  186. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  187. # include "X3DImporter.hpp"
  188. #endif
  189. #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
  190. # include "MMDImporter.h"
  191. #endif
  192. namespace Assimp {
  193. // ------------------------------------------------------------------------------------------------
  194. void GetImporterInstanceList(std::vector< BaseImporter* >& out)
  195. {
  196. // ----------------------------------------------------------------------------
  197. // Add an instance of each worker class here
  198. // (register_new_importers_here)
  199. // ----------------------------------------------------------------------------
  200. out.reserve(64);
  201. #if (!defined ASSIMP_BUILD_NO_X_IMPORTER)
  202. out.push_back( new XFileImporter());
  203. #endif
  204. #if (!defined ASSIMP_BUILD_NO_OBJ_IMPORTER)
  205. out.push_back( new ObjFileImporter());
  206. #endif
  207. #ifndef ASSIMP_BUILD_NO_AMF_IMPORTER
  208. out.push_back( new AMFImporter() );
  209. #endif
  210. #if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
  211. out.push_back( new Discreet3DSImporter());
  212. #endif
  213. #if (!defined ASSIMP_BUILD_NO_MD3_IMPORTER)
  214. out.push_back( new MD3Importer());
  215. #endif
  216. #if (!defined ASSIMP_BUILD_NO_MD2_IMPORTER)
  217. out.push_back( new MD2Importer());
  218. #endif
  219. #if (!defined ASSIMP_BUILD_NO_PLY_IMPORTER)
  220. out.push_back( new PLYImporter());
  221. #endif
  222. #if (!defined ASSIMP_BUILD_NO_MDL_IMPORTER)
  223. out.push_back( new MDLImporter());
  224. #endif
  225. #if (!defined ASSIMP_BUILD_NO_ASE_IMPORTER)
  226. #if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
  227. out.push_back( new ASEImporter());
  228. # endif
  229. #endif
  230. #if (!defined ASSIMP_BUILD_NO_HMP_IMPORTER)
  231. out.push_back( new HMPImporter());
  232. #endif
  233. #if (!defined ASSIMP_BUILD_NO_SMD_IMPORTER)
  234. out.push_back( new SMDImporter());
  235. #endif
  236. #if (!defined ASSIMP_BUILD_NO_MDC_IMPORTER)
  237. out.push_back( new MDCImporter());
  238. #endif
  239. #if (!defined ASSIMP_BUILD_NO_MD5_IMPORTER)
  240. out.push_back( new MD5Importer());
  241. #endif
  242. #if (!defined ASSIMP_BUILD_NO_STL_IMPORTER)
  243. out.push_back( new STLImporter());
  244. #endif
  245. #if (!defined ASSIMP_BUILD_NO_LWO_IMPORTER)
  246. out.push_back( new LWOImporter());
  247. #endif
  248. #if (!defined ASSIMP_BUILD_NO_DXF_IMPORTER)
  249. out.push_back( new DXFImporter());
  250. #endif
  251. #if (!defined ASSIMP_BUILD_NO_NFF_IMPORTER)
  252. out.push_back( new NFFImporter());
  253. #endif
  254. #if (!defined ASSIMP_BUILD_NO_RAW_IMPORTER)
  255. out.push_back( new RAWImporter());
  256. #endif
  257. #if (!defined ASSIMP_BUILD_NO_SIB_IMPORTER)
  258. out.push_back( new SIBImporter());
  259. #endif
  260. #if (!defined ASSIMP_BUILD_NO_OFF_IMPORTER)
  261. out.push_back( new OFFImporter());
  262. #endif
  263. #if (!defined ASSIMP_BUILD_NO_AC_IMPORTER)
  264. out.push_back( new AC3DImporter());
  265. #endif
  266. #if (!defined ASSIMP_BUILD_NO_BVH_IMPORTER)
  267. out.push_back( new BVHLoader());
  268. #endif
  269. #if (!defined ASSIMP_BUILD_NO_IRRMESH_IMPORTER)
  270. out.push_back( new IRRMeshImporter());
  271. #endif
  272. #if (!defined ASSIMP_BUILD_NO_IRR_IMPORTER)
  273. out.push_back( new IRRImporter());
  274. #endif
  275. #if (!defined ASSIMP_BUILD_NO_Q3D_IMPORTER)
  276. out.push_back( new Q3DImporter());
  277. #endif
  278. #if (!defined ASSIMP_BUILD_NO_B3D_IMPORTER)
  279. out.push_back( new B3DImporter());
  280. #endif
  281. #if (!defined ASSIMP_BUILD_NO_COLLADA_IMPORTER)
  282. out.push_back( new ColladaLoader());
  283. #endif
  284. #if (!defined ASSIMP_BUILD_NO_TERRAGEN_IMPORTER)
  285. out.push_back( new TerragenImporter());
  286. #endif
  287. #if (!defined ASSIMP_BUILD_NO_CSM_IMPORTER)
  288. out.push_back( new CSMImporter());
  289. #endif
  290. #if (!defined ASSIMP_BUILD_NO_3D_IMPORTER)
  291. out.push_back( new UnrealImporter());
  292. #endif
  293. #if (!defined ASSIMP_BUILD_NO_LWS_IMPORTER)
  294. out.push_back( new LWSImporter());
  295. #endif
  296. #if (!defined ASSIMP_BUILD_NO_OGRE_IMPORTER)
  297. out.push_back( new Ogre::OgreImporter());
  298. #endif
  299. #if (!defined ASSIMP_BUILD_NO_OPENGEX_IMPORTER )
  300. out.push_back( new OpenGEX::OpenGEXImporter() );
  301. #endif
  302. #if (!defined ASSIMP_BUILD_NO_MS3D_IMPORTER)
  303. out.push_back( new MS3DImporter());
  304. #endif
  305. #if (!defined ASSIMP_BUILD_NO_COB_IMPORTER)
  306. out.push_back( new COBImporter());
  307. #endif
  308. #if (!defined ASSIMP_BUILD_NO_BLEND_IMPORTER)
  309. out.push_back( new BlenderImporter());
  310. #endif
  311. #if (!defined ASSIMP_BUILD_NO_Q3BSP_IMPORTER)
  312. out.push_back( new Q3BSPFileImporter() );
  313. #endif
  314. #if (!defined ASSIMP_BUILD_NO_NDO_IMPORTER)
  315. out.push_back( new NDOImporter() );
  316. #endif
  317. #if (!defined ASSIMP_BUILD_NO_IFC_IMPORTER)
  318. out.push_back( new IFCImporter() );
  319. #endif
  320. #if ( !defined ASSIMP_BUILD_NO_XGL_IMPORTER )
  321. out.push_back( new XGLImporter() );
  322. #endif
  323. #if ( !defined ASSIMP_BUILD_NO_FBX_IMPORTER )
  324. out.push_back( new FBXImporter() );
  325. #endif
  326. #if ( !defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER )
  327. out.push_back( new AssbinImporter() );
  328. #endif
  329. #if ( !defined ASSIMP_BUILD_NO_GLTF_IMPORTER )
  330. out.push_back( new glTFImporter() );
  331. out.push_back( new glTF2Importer() );
  332. #endif
  333. #if ( !defined ASSIMP_BUILD_NO_C4D_IMPORTER )
  334. out.push_back( new C4DImporter() );
  335. #endif
  336. #if ( !defined ASSIMP_BUILD_NO_3MF_IMPORTER )
  337. out.push_back( new D3MFImporter() );
  338. #endif
  339. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  340. out.push_back( new X3DImporter() );
  341. #endif
  342. #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
  343. out.push_back( new MMDImporter() );
  344. #endif
  345. }
  346. /** will delete all registered importers. */
  347. void DeleteImporterInstanceList(std::vector< BaseImporter* >& deleteList){
  348. for(size_t i= 0; i<deleteList.size();++i){
  349. delete deleteList[i];
  350. deleteList[i]=NULL;
  351. }//for
  352. }
  353. } // namespace Assimp