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