PostStepRegistry.cpp 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2012, 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 "AssimpPCH.h"
  40. #ifndef ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS
  41. # include "CalcTangentsProcess.h"
  42. #endif
  43. #ifndef ASSIMP_BUILD_NO_JOINVERTICES_PROCESS
  44. # include "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 "ConvertToLHProcess.h"
  48. #endif
  49. #ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
  50. # include "TriangulateProcess.h"
  51. #endif
  52. #ifndef ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS
  53. # include "GenFaceNormalsProcess.h"
  54. #endif
  55. #ifndef ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS
  56. # include "GenVertexNormalsProcess.h"
  57. #endif
  58. #ifndef ASSIMP_BUILD_NO_REMOVEVC_PROCESS
  59. # include "RemoveVCProcess.h"
  60. #endif
  61. #ifndef ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS
  62. # include "SplitLargeMeshes.h"
  63. #endif
  64. #ifndef ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS
  65. # include "PretransformVertices.h"
  66. #endif
  67. #ifndef ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS
  68. # include "LimitBoneWeightsProcess.h"
  69. #endif
  70. #ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
  71. # include "ValidateDataStructure.h"
  72. #endif
  73. #ifndef ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS
  74. # include "ImproveCacheLocality.h"
  75. #endif
  76. #ifndef ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS
  77. # include "FixNormalsStep.h"
  78. #endif
  79. #ifndef ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS
  80. # include "RemoveRedundantMaterials.h"
  81. #endif
  82. #ifndef ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS
  83. # include "FindInvalidDataProcess.h"
  84. #endif
  85. #ifndef ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS
  86. # include "FindDegenerates.h"
  87. #endif
  88. #ifndef ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS
  89. # include "SortByPTypeProcess.h"
  90. #endif
  91. #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
  92. # include "ComputeUVMappingProcess.h"
  93. #endif
  94. #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
  95. # include "TextureTransform.h"
  96. #endif
  97. #ifndef ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS
  98. # include "FindInstancesProcess.h"
  99. #endif
  100. #ifndef ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS
  101. # include "OptimizeMeshes.h"
  102. #endif
  103. #ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
  104. # include "OptimizeGraph.h"
  105. #endif
  106. #ifndef ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS
  107. # include "SplitByBoneCountProcess.h"
  108. #endif
  109. #ifndef ASSIMP_BUILD_NO_DEBONE_PROCESS
  110. # include "DeboneProcess.h"
  111. #endif
  112. namespace Assimp {
  113. // ------------------------------------------------------------------------------------------------
  114. void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out)
  115. {
  116. // ----------------------------------------------------------------------------
  117. // Add an instance of each post processing step here in the order
  118. // of sequence it is executed. Steps that are added here are not
  119. // validated - as RegisterPPStep() does - all dependencies must be given.
  120. // ----------------------------------------------------------------------------
  121. out.reserve(25);
  122. #if (!defined ASSIMP_BUILD_NO_REMOVEVC_PROCESS)
  123. out.push_back( new RemoveVCProcess());
  124. #endif
  125. #if (!defined ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
  126. out.push_back( new RemoveRedundantMatsProcess());
  127. #endif
  128. #if (!defined ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS)
  129. out.push_back( new FindInstancesProcess());
  130. #endif
  131. #if (!defined ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
  132. out.push_back( new OptimizeGraphProcess());
  133. #endif
  134. #if (!defined ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS)
  135. out.push_back( new OptimizeMeshesProcess());
  136. #endif
  137. #if (!defined ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS)
  138. out.push_back( new FindDegeneratesProcess());
  139. #endif
  140. #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
  141. out.push_back( new ComputeUVMappingProcess());
  142. #endif
  143. #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
  144. out.push_back( new TextureTransformStep());
  145. #endif
  146. #if (!defined ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
  147. out.push_back( new PretransformVertices());
  148. #endif
  149. #if (!defined ASSIMP_BUILD_NO_TRIANGULATE_PROCESS)
  150. out.push_back( new TriangulateProcess());
  151. #endif
  152. #if (!defined ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS)
  153. out.push_back( new SortByPTypeProcess());
  154. #endif
  155. #if (!defined ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS)
  156. out.push_back( new FindInvalidDataProcess());
  157. #endif
  158. #if (!defined ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
  159. out.push_back( new FixInfacingNormalsProcess());
  160. #endif
  161. #if (!defined ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS)
  162. out.push_back( new SplitByBoneCountProcess());
  163. #endif
  164. #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
  165. out.push_back( new SplitLargeMeshesProcess_Triangle());
  166. #endif
  167. #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
  168. out.push_back( new GenFaceNormalsProcess());
  169. #endif
  170. // .........................................................................
  171. // DON'T change the order of these five ..
  172. // XXX this is actually a design weakness that dates back to the time
  173. // when Importer would maintain the postprocessing step list exclusively.
  174. // Now that others access it too, we need a better solution.
  175. out.push_back( new ComputeSpatialSortProcess());
  176. // .........................................................................
  177. #if (!defined ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS)
  178. out.push_back( new GenVertexNormalsProcess());
  179. #endif
  180. #if (!defined ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS)
  181. out.push_back( new CalcTangentsProcess());
  182. #endif
  183. #if (!defined ASSIMP_BUILD_NO_JOINVERTICES_PROCESS)
  184. out.push_back( new JoinVerticesProcess());
  185. #endif
  186. // .........................................................................
  187. out.push_back( new DestroySpatialSortProcess());
  188. // .........................................................................
  189. #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
  190. out.push_back( new SplitLargeMeshesProcess_Vertex());
  191. #endif
  192. #if (!defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS)
  193. out.push_back( new MakeLeftHandedProcess());
  194. #endif
  195. #if (!defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS)
  196. out.push_back( new FlipUVsProcess());
  197. #endif
  198. #if (!defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
  199. out.push_back( new FlipWindingOrderProcess());
  200. #endif
  201. #if (!defined ASSIMP_BUILD_DEBONE_PROCESS)
  202. out.push_back( new DeboneProcess());
  203. #endif
  204. #if (!defined ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
  205. out.push_back( new LimitBoneWeightsProcess());
  206. #endif
  207. #if (!defined ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
  208. out.push_back( new ImproveCacheLocalityProcess());
  209. #endif
  210. }
  211. }