2
0

PostStepRegistry.cpp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2025, 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 postprocessing steps available. Do not edit this file
  36. directly (unless you are adding new steps), instead use the
  37. corresponding preprocessor flag to selectively disable steps.
  38. */
  39. #include "PostProcessing/ProcessHelper.h"
  40. #ifndef ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS
  41. # include "PostProcessing/CalcTangentsProcess.h"
  42. #endif
  43. #ifndef ASSIMP_BUILD_NO_JOINVERTICES_PROCESS
  44. # include "PostProcessing/JoinVerticesProcess.h"
  45. #endif
  46. #if !(defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS && defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS && defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
  47. # include "PostProcessing/ConvertToLHProcess.h"
  48. #endif
  49. #ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
  50. # include "PostProcessing/TriangulateProcess.h"
  51. #endif
  52. #ifndef ASSIMP_BUILD_NO_DROPFACENORMALS_PROCESS
  53. # include "PostProcessing/DropFaceNormalsProcess.h"
  54. #endif
  55. #ifndef ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS
  56. # include "PostProcessing/GenFaceNormalsProcess.h"
  57. #endif
  58. #ifndef ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS
  59. # include "PostProcessing/GenVertexNormalsProcess.h"
  60. #endif
  61. #ifndef ASSIMP_BUILD_NO_REMOVEVC_PROCESS
  62. # include "PostProcessing/RemoveVCProcess.h"
  63. #endif
  64. #ifndef ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS
  65. # include "PostProcessing/SplitLargeMeshes.h"
  66. #endif
  67. #ifndef ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS
  68. # include "PostProcessing/PretransformVertices.h"
  69. #endif
  70. #ifndef ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS
  71. # include "PostProcessing/LimitBoneWeightsProcess.h"
  72. #endif
  73. #ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
  74. # include "PostProcessing/ValidateDataStructure.h"
  75. #endif
  76. #ifndef ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS
  77. # include "PostProcessing/ImproveCacheLocality.h"
  78. #endif
  79. #ifndef ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS
  80. # include "PostProcessing/FixNormalsStep.h"
  81. #endif
  82. #ifndef ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS
  83. # include "PostProcessing/RemoveRedundantMaterials.h"
  84. #endif
  85. #if (!defined ASSIMP_BUILD_NO_EMBEDTEXTURES_PROCESS)
  86. # include "PostProcessing/EmbedTexturesProcess.h"
  87. #endif
  88. #ifndef ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS
  89. # include "PostProcessing/FindInvalidDataProcess.h"
  90. #endif
  91. #ifndef ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS
  92. # include "PostProcessing/FindDegenerates.h"
  93. #endif
  94. #ifndef ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS
  95. # include "PostProcessing/SortByPTypeProcess.h"
  96. #endif
  97. #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
  98. # include "PostProcessing/ComputeUVMappingProcess.h"
  99. #endif
  100. #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
  101. # include "PostProcessing/TextureTransform.h"
  102. #endif
  103. #ifndef ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS
  104. # include "PostProcessing/FindInstancesProcess.h"
  105. #endif
  106. #ifndef ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS
  107. # include "PostProcessing/OptimizeMeshes.h"
  108. #endif
  109. #ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
  110. # include "PostProcessing/OptimizeGraph.h"
  111. #endif
  112. #ifndef ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS
  113. # include "PostProcessing/SplitByBoneCountProcess.h"
  114. #endif
  115. #ifndef ASSIMP_BUILD_NO_DEBONE_PROCESS
  116. # include "PostProcessing/DeboneProcess.h"
  117. #endif
  118. #if (!defined ASSIMP_BUILD_NO_GLOBALSCALE_PROCESS)
  119. # include "PostProcessing/ScaleProcess.h"
  120. #endif
  121. #if (!defined ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS)
  122. # include "PostProcessing/ArmaturePopulate.h"
  123. #endif
  124. #if (!defined ASSIMP_BUILD_NO_GENBOUNDINGBOXES_PROCESS)
  125. # include "PostProcessing/GenBoundingBoxesProcess.h"
  126. #endif
  127. namespace Assimp {
  128. // ------------------------------------------------------------------------------------------------
  129. void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out)
  130. {
  131. // ----------------------------------------------------------------------------
  132. // Add an instance of each post processing step here in the order
  133. // of sequence it is executed. Steps that are added here are not
  134. // validated - as RegisterPPStep() does - all dependencies must be given.
  135. // ----------------------------------------------------------------------------
  136. out.reserve(31);
  137. #if (!defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS)
  138. out.push_back( new MakeLeftHandedProcess());
  139. #endif
  140. #if (!defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS)
  141. out.push_back( new FlipUVsProcess());
  142. #endif
  143. #if (!defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
  144. out.push_back( new FlipWindingOrderProcess());
  145. #endif
  146. #if (!defined ASSIMP_BUILD_NO_REMOVEVC_PROCESS)
  147. out.push_back( new RemoveVCProcess());
  148. #endif
  149. #if (!defined ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
  150. out.push_back( new RemoveRedundantMatsProcess());
  151. #endif
  152. #if (!defined ASSIMP_BUILD_NO_EMBEDTEXTURES_PROCESS)
  153. out.push_back( new EmbedTexturesProcess());
  154. #endif
  155. #if (!defined ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS)
  156. out.push_back( new FindInstancesProcess());
  157. #endif
  158. #if (!defined ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
  159. out.push_back( new OptimizeGraphProcess());
  160. #endif
  161. #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
  162. out.push_back( new ComputeUVMappingProcess());
  163. #endif
  164. #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
  165. out.push_back( new TextureTransformStep());
  166. #endif
  167. #if (!defined ASSIMP_BUILD_NO_GLOBALSCALE_PROCESS)
  168. out.push_back( new ScaleProcess());
  169. #endif
  170. #if (!defined ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS)
  171. out.push_back( new ArmaturePopulate());
  172. #endif
  173. #if (!defined ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
  174. out.push_back( new PretransformVertices());
  175. #endif
  176. #if (!defined ASSIMP_BUILD_NO_TRIANGULATE_PROCESS)
  177. out.push_back( new TriangulateProcess());
  178. #endif
  179. #if (!defined ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS)
  180. //find degenerates should run after triangulation (to sort out small
  181. //generated triangles) but before sort by p types (in case there are lines
  182. //and points generated and inserted into a mesh)
  183. out.push_back( new FindDegeneratesProcess());
  184. #endif
  185. #if (!defined ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS)
  186. out.push_back( new SortByPTypeProcess());
  187. #endif
  188. #if (!defined ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS)
  189. out.push_back( new FindInvalidDataProcess());
  190. #endif
  191. #if (!defined ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS)
  192. out.push_back( new OptimizeMeshesProcess());
  193. #endif
  194. #if (!defined ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
  195. out.push_back( new FixInfacingNormalsProcess());
  196. #endif
  197. #if (!defined ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS)
  198. out.push_back( new SplitByBoneCountProcess());
  199. #endif
  200. #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
  201. out.push_back( new SplitLargeMeshesProcess_Triangle());
  202. #endif
  203. #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
  204. out.push_back( new DropFaceNormalsProcess());
  205. #endif
  206. #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
  207. out.push_back( new GenFaceNormalsProcess());
  208. #endif
  209. // .........................................................................
  210. // DON'T change the order of these five ..
  211. // XXX this is actually a design weakness that dates back to the time
  212. // when Importer would maintain the postprocessing step list exclusively.
  213. // Now that others access it too, we need a better solution.
  214. out.push_back( new ComputeSpatialSortProcess());
  215. // .........................................................................
  216. #if (!defined ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS)
  217. out.push_back( new GenVertexNormalsProcess());
  218. #endif
  219. #if (!defined ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS)
  220. out.push_back( new CalcTangentsProcess());
  221. #endif
  222. #if (!defined ASSIMP_BUILD_NO_JOINVERTICES_PROCESS)
  223. out.push_back( new JoinVerticesProcess());
  224. #endif
  225. // .........................................................................
  226. out.push_back( new DestroySpatialSortProcess());
  227. // .........................................................................
  228. #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
  229. out.push_back( new SplitLargeMeshesProcess_Vertex());
  230. #endif
  231. #if (!defined ASSIMP_BUILD_NO_DEBONE_PROCESS)
  232. out.push_back( new DeboneProcess());
  233. #endif
  234. #if (!defined ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
  235. out.push_back( new LimitBoneWeightsProcess());
  236. #endif
  237. #if (!defined ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
  238. out.push_back( new ImproveCacheLocalityProcess());
  239. #endif
  240. #if (!defined ASSIMP_BUILD_NO_GENBOUNDINGBOXES_PROCESS)
  241. out.push_back(new GenBoundingBoxesProcess);
  242. #endif
  243. }
  244. }