ImporterRegistry.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2020, 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. /** @file ImporterRegistry.cpp
  35. Central registry for all importers available. Do not edit this file
  36. directly (unless you are adding new loaders), instead use the
  37. corresponding preprocessor flag to selectively disable formats.
  38. */
  39. #include <vector>
  40. #include <assimp/BaseImporter.h>
  41. // ------------------------------------------------------------------------------------------------
  42. // Importers
  43. // (include_new_importers_here)
  44. // ------------------------------------------------------------------------------------------------
  45. #ifndef ASSIMP_BUILD_NO_X_IMPORTER
  46. # include "X/XFileImporter.h"
  47. #endif
  48. #ifndef ASSIMP_BUILD_NO_AMF_IMPORTER
  49. # include "AMF/AMFImporter.hpp"
  50. #endif
  51. #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
  52. # include "3DS/3DSLoader.h"
  53. #endif
  54. #ifndef ASSIMP_BUILD_NO_MD3_IMPORTER
  55. # include "MD3/MD3Loader.h"
  56. #endif
  57. #ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
  58. # include "MDL/MDLLoader.h"
  59. #endif
  60. #ifndef ASSIMP_BUILD_NO_MD2_IMPORTER
  61. # include "MD2/MD2Loader.h"
  62. #endif
  63. #ifndef ASSIMP_BUILD_NO_PLY_IMPORTER
  64. # include "Ply/PlyLoader.h"
  65. #endif
  66. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
  67. # include "ASE/ASELoader.h"
  68. #endif
  69. #ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
  70. # include "Obj/ObjFileImporter.h"
  71. #endif
  72. #ifndef ASSIMP_BUILD_NO_HMP_IMPORTER
  73. # include "HMP/HMPLoader.h"
  74. #endif
  75. #ifndef ASSIMP_BUILD_NO_SMD_IMPORTER
  76. # include "SMD/SMDLoader.h"
  77. #endif
  78. #ifndef ASSIMP_BUILD_NO_MDC_IMPORTER
  79. # include "MDC/MDCLoader.h"
  80. #endif
  81. #ifndef ASSIMP_BUILD_NO_MD5_IMPORTER
  82. # include "MD5/MD5Loader.h"
  83. #endif
  84. #ifndef ASSIMP_BUILD_NO_STL_IMPORTER
  85. # include "STL/STLLoader.h"
  86. #endif
  87. #ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
  88. # include "LWO/LWOLoader.h"
  89. #endif
  90. #ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
  91. # include "DXF/DXFLoader.h"
  92. #endif
  93. #ifndef ASSIMP_BUILD_NO_NFF_IMPORTER
  94. # include "NFF/NFFLoader.h"
  95. #endif
  96. #ifndef ASSIMP_BUILD_NO_RAW_IMPORTER
  97. # include "Raw/RawLoader.h"
  98. #endif
  99. #ifndef ASSIMP_BUILD_NO_SIB_IMPORTER
  100. # include "SIB/SIBImporter.h"
  101. #endif
  102. #ifndef ASSIMP_BUILD_NO_OFF_IMPORTER
  103. # include "OFF/OFFLoader.h"
  104. #endif
  105. #ifndef ASSIMP_BUILD_NO_AC_IMPORTER
  106. # include "AC/ACLoader.h"
  107. #endif
  108. #ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
  109. # include "BVH/BVHLoader.h"
  110. #endif
  111. #ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
  112. # include "Irr/IRRMeshLoader.h"
  113. #endif
  114. #ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
  115. # include "Irr/IRRLoader.h"
  116. #endif
  117. #ifndef ASSIMP_BUILD_NO_Q3D_IMPORTER
  118. # include "Q3D/Q3DLoader.h"
  119. #endif
  120. #ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
  121. # include "B3D/B3DImporter.h"
  122. #endif
  123. #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
  124. # include "Collada/ColladaLoader.h"
  125. #endif
  126. #ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
  127. # include "Terragen/TerragenLoader.h"
  128. #endif
  129. #ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
  130. # include "CSM/CSMLoader.h"
  131. #endif
  132. #ifndef ASSIMP_BUILD_NO_3D_IMPORTER
  133. # include "Unreal/UnrealLoader.h"
  134. #endif
  135. #ifndef ASSIMP_BUILD_NO_LWS_IMPORTER
  136. # include "LWS/LWSLoader.h"
  137. #endif
  138. #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
  139. # include "Ogre/OgreImporter.h"
  140. #endif
  141. #ifndef ASSIMP_BUILD_NO_OPENGEX_IMPORTER
  142. # include "OpenGEX/OpenGEXImporter.h"
  143. #endif
  144. #ifndef ASSIMP_BUILD_NO_MS3D_IMPORTER
  145. # include "MS3D/MS3DLoader.h"
  146. #endif
  147. #ifndef ASSIMP_BUILD_NO_COB_IMPORTER
  148. # include "COB/COBLoader.h"
  149. #endif
  150. #ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
  151. # include "Blender/BlenderLoader.h"
  152. #endif
  153. #ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
  154. # include "Q3BSP/Q3BSPFileImporter.h"
  155. #endif
  156. #ifndef ASSIMP_BUILD_NO_NDO_IMPORTER
  157. # include "NDO/NDOLoader.h"
  158. #endif
  159. #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
  160. # include "Importer/IFC/IFCLoader.h"
  161. #endif
  162. #ifndef ASSIMP_BUILD_NO_XGL_IMPORTER
  163. # include "XGL/XGLLoader.h"
  164. #endif
  165. #ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
  166. # include "FBX/FBXImporter.h"
  167. #endif
  168. #ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
  169. # include "Assbin/AssbinLoader.h"
  170. #endif
  171. #ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
  172. # include "glTF/glTFImporter.h"
  173. # include "glTF2/glTF2Importer.h"
  174. #endif
  175. #ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
  176. # include "C4D/C4DImporter.h"
  177. #endif
  178. #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
  179. # include "3MF/D3MFImporter.h"
  180. #endif
  181. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  182. # include "X3D/X3DImporter.hpp"
  183. #endif
  184. #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
  185. # include "MMD/MMDImporter.h"
  186. #endif
  187. #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
  188. # include "M3D/M3DImporter.h"
  189. #endif
  190. //#ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
  191. //# include "Importer/StepFile/StepFileImporter.h"
  192. //#endif
  193. namespace Assimp {
  194. // ------------------------------------------------------------------------------------------------
  195. void GetImporterInstanceList(std::vector< BaseImporter* >& out)
  196. {
  197. // ----------------------------------------------------------------------------
  198. // Add an instance of each worker class here
  199. // (register_new_importers_here)
  200. // ----------------------------------------------------------------------------
  201. out.reserve(64);
  202. #if (!defined ASSIMP_BUILD_NO_X_IMPORTER)
  203. out.push_back( new XFileImporter());
  204. #endif
  205. #if (!defined ASSIMP_BUILD_NO_OBJ_IMPORTER)
  206. out.push_back( new ObjFileImporter());
  207. #endif
  208. #ifndef ASSIMP_BUILD_NO_AMF_IMPORTER
  209. out.push_back( new AMFImporter() );
  210. #endif
  211. #if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
  212. out.push_back( new Discreet3DSImporter());
  213. #endif
  214. #if (!defined ASSIMP_BUILD_NO_M3D_IMPORTER)
  215. out.push_back( new M3DImporter());
  216. #endif
  217. #if (!defined ASSIMP_BUILD_NO_MD3_IMPORTER)
  218. out.push_back( new MD3Importer());
  219. #endif
  220. #if (!defined ASSIMP_BUILD_NO_MD2_IMPORTER)
  221. out.push_back( new MD2Importer());
  222. #endif
  223. #if (!defined ASSIMP_BUILD_NO_PLY_IMPORTER)
  224. out.push_back( new PLYImporter());
  225. #endif
  226. #if (!defined ASSIMP_BUILD_NO_MDL_IMPORTER)
  227. out.push_back( new MDLImporter());
  228. #endif
  229. #if (!defined ASSIMP_BUILD_NO_ASE_IMPORTER)
  230. #if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
  231. out.push_back( new ASEImporter());
  232. # endif
  233. #endif
  234. #if (!defined ASSIMP_BUILD_NO_HMP_IMPORTER)
  235. out.push_back( new HMPImporter());
  236. #endif
  237. #if (!defined ASSIMP_BUILD_NO_SMD_IMPORTER)
  238. out.push_back( new SMDImporter());
  239. #endif
  240. #if (!defined ASSIMP_BUILD_NO_MDC_IMPORTER)
  241. out.push_back( new MDCImporter());
  242. #endif
  243. #if (!defined ASSIMP_BUILD_NO_MD5_IMPORTER)
  244. out.push_back( new MD5Importer());
  245. #endif
  246. #if (!defined ASSIMP_BUILD_NO_STL_IMPORTER)
  247. out.push_back( new STLImporter());
  248. #endif
  249. #if (!defined ASSIMP_BUILD_NO_LWO_IMPORTER)
  250. out.push_back( new LWOImporter());
  251. #endif
  252. #if (!defined ASSIMP_BUILD_NO_DXF_IMPORTER)
  253. out.push_back( new DXFImporter());
  254. #endif
  255. #if (!defined ASSIMP_BUILD_NO_NFF_IMPORTER)
  256. out.push_back( new NFFImporter());
  257. #endif
  258. #if (!defined ASSIMP_BUILD_NO_RAW_IMPORTER)
  259. out.push_back( new RAWImporter());
  260. #endif
  261. #if (!defined ASSIMP_BUILD_NO_SIB_IMPORTER)
  262. out.push_back( new SIBImporter());
  263. #endif
  264. #if (!defined ASSIMP_BUILD_NO_OFF_IMPORTER)
  265. out.push_back( new OFFImporter());
  266. #endif
  267. #if (!defined ASSIMP_BUILD_NO_AC_IMPORTER)
  268. out.push_back( new AC3DImporter());
  269. #endif
  270. #if (!defined ASSIMP_BUILD_NO_BVH_IMPORTER)
  271. out.push_back( new BVHLoader());
  272. #endif
  273. #if (!defined ASSIMP_BUILD_NO_IRRMESH_IMPORTER)
  274. out.push_back( new IRRMeshImporter());
  275. #endif
  276. #if (!defined ASSIMP_BUILD_NO_IRR_IMPORTER)
  277. out.push_back( new IRRImporter());
  278. #endif
  279. #if (!defined ASSIMP_BUILD_NO_Q3D_IMPORTER)
  280. out.push_back( new Q3DImporter());
  281. #endif
  282. #if (!defined ASSIMP_BUILD_NO_B3D_IMPORTER)
  283. out.push_back( new B3DImporter());
  284. #endif
  285. #if (!defined ASSIMP_BUILD_NO_COLLADA_IMPORTER)
  286. out.push_back( new ColladaLoader());
  287. #endif
  288. #if (!defined ASSIMP_BUILD_NO_TERRAGEN_IMPORTER)
  289. out.push_back( new TerragenImporter());
  290. #endif
  291. #if (!defined ASSIMP_BUILD_NO_CSM_IMPORTER)
  292. out.push_back( new CSMImporter());
  293. #endif
  294. #if (!defined ASSIMP_BUILD_NO_3D_IMPORTER)
  295. out.push_back( new UnrealImporter());
  296. #endif
  297. #if (!defined ASSIMP_BUILD_NO_LWS_IMPORTER)
  298. out.push_back( new LWSImporter());
  299. #endif
  300. #if (!defined ASSIMP_BUILD_NO_OGRE_IMPORTER)
  301. out.push_back( new Ogre::OgreImporter());
  302. #endif
  303. #if (!defined ASSIMP_BUILD_NO_OPENGEX_IMPORTER )
  304. out.push_back( new OpenGEX::OpenGEXImporter() );
  305. #endif
  306. #if (!defined ASSIMP_BUILD_NO_MS3D_IMPORTER)
  307. out.push_back( new MS3DImporter());
  308. #endif
  309. #if (!defined ASSIMP_BUILD_NO_COB_IMPORTER)
  310. out.push_back( new COBImporter());
  311. #endif
  312. #if (!defined ASSIMP_BUILD_NO_BLEND_IMPORTER)
  313. out.push_back( new BlenderImporter());
  314. #endif
  315. #if (!defined ASSIMP_BUILD_NO_Q3BSP_IMPORTER)
  316. out.push_back( new Q3BSPFileImporter() );
  317. #endif
  318. #if (!defined ASSIMP_BUILD_NO_NDO_IMPORTER)
  319. out.push_back( new NDOImporter() );
  320. #endif
  321. #if (!defined ASSIMP_BUILD_NO_IFC_IMPORTER)
  322. out.push_back( new IFCImporter() );
  323. #endif
  324. #if ( !defined ASSIMP_BUILD_NO_XGL_IMPORTER )
  325. out.push_back( new XGLImporter() );
  326. #endif
  327. #if ( !defined ASSIMP_BUILD_NO_FBX_IMPORTER )
  328. out.push_back( new FBXImporter() );
  329. #endif
  330. #if ( !defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER )
  331. out.push_back( new AssbinImporter() );
  332. #endif
  333. #if ( !defined ASSIMP_BUILD_NO_GLTF_IMPORTER )
  334. out.push_back( new glTFImporter() );
  335. out.push_back( new glTF2Importer() );
  336. #endif
  337. #if ( !defined ASSIMP_BUILD_NO_C4D_IMPORTER )
  338. out.push_back( new C4DImporter() );
  339. #endif
  340. #if ( !defined ASSIMP_BUILD_NO_3MF_IMPORTER )
  341. out.push_back( new D3MFImporter() );
  342. #endif
  343. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  344. out.push_back( new X3DImporter() );
  345. #endif
  346. #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
  347. out.push_back( new MMDImporter() );
  348. #endif
  349. //#ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
  350. // out.push_back(new StepFile::StepFileImporter());
  351. //#endif
  352. }
  353. /** will delete all registered importers. */
  354. void DeleteImporterInstanceList(std::vector< BaseImporter* >& deleteList){
  355. for(size_t i= 0; i<deleteList.size();++i){
  356. delete deleteList[i];
  357. deleteList[i]=nullptr;
  358. }//for
  359. }
  360. } // namespace Assimp