/src/assimp/code/Common/PostStepRegistry.cpp
Line | Count | Source |
1 | | /* |
2 | | --------------------------------------------------------------------------- |
3 | | Open Asset Import Library (assimp) |
4 | | --------------------------------------------------------------------------- |
5 | | |
6 | | Copyright (c) 2006-2025, assimp team |
7 | | |
8 | | |
9 | | |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use of this software in source and binary forms, |
13 | | with or without modification, are permitted provided that the following |
14 | | conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above |
17 | | copyright notice, this list of conditions and the |
18 | | following disclaimer. |
19 | | |
20 | | * Redistributions in binary form must reproduce the above |
21 | | copyright notice, this list of conditions and the |
22 | | following disclaimer in the documentation and/or other |
23 | | materials provided with the distribution. |
24 | | |
25 | | * Neither the name of the assimp team, nor the names of its |
26 | | contributors may be used to endorse or promote products |
27 | | derived from this software without specific prior |
28 | | written permission of the assimp team. |
29 | | |
30 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
31 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
32 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
33 | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
34 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
35 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
36 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
37 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
38 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
39 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
40 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
41 | | --------------------------------------------------------------------------- |
42 | | */ |
43 | | |
44 | | /** @file ImporterRegistry.cpp |
45 | | |
46 | | Central registry for all postprocessing steps available. Do not edit this file |
47 | | directly (unless you are adding new steps), instead use the |
48 | | corresponding preprocessor flag to selectively disable steps. |
49 | | */ |
50 | | |
51 | | #include "PostProcessing/ProcessHelper.h" |
52 | | |
53 | | #ifndef ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS |
54 | | # include "PostProcessing/CalcTangentsProcess.h" |
55 | | #endif |
56 | | #ifndef ASSIMP_BUILD_NO_JOINVERTICES_PROCESS |
57 | | # include "PostProcessing/JoinVerticesProcess.h" |
58 | | #endif |
59 | | #if !(defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS && defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS && defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS) |
60 | | # include "PostProcessing/ConvertToLHProcess.h" |
61 | | #endif |
62 | | #ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS |
63 | | # include "PostProcessing/TriangulateProcess.h" |
64 | | #endif |
65 | | #ifndef ASSIMP_BUILD_NO_DROPFACENORMALS_PROCESS |
66 | | # include "PostProcessing/DropFaceNormalsProcess.h" |
67 | | #endif |
68 | | #ifndef ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS |
69 | | # include "PostProcessing/GenFaceNormalsProcess.h" |
70 | | #endif |
71 | | #ifndef ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS |
72 | | # include "PostProcessing/GenVertexNormalsProcess.h" |
73 | | #endif |
74 | | #ifndef ASSIMP_BUILD_NO_REMOVEVC_PROCESS |
75 | | # include "PostProcessing/RemoveVCProcess.h" |
76 | | #endif |
77 | | #ifndef ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS |
78 | | # include "PostProcessing/SplitLargeMeshes.h" |
79 | | #endif |
80 | | #ifndef ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS |
81 | | # include "PostProcessing/PretransformVertices.h" |
82 | | #endif |
83 | | #ifndef ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS |
84 | | # include "PostProcessing/LimitBoneWeightsProcess.h" |
85 | | #endif |
86 | | #ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS |
87 | | # include "PostProcessing/ValidateDataStructure.h" |
88 | | #endif |
89 | | #ifndef ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS |
90 | | # include "PostProcessing/ImproveCacheLocality.h" |
91 | | #endif |
92 | | #ifndef ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS |
93 | | # include "PostProcessing/FixNormalsStep.h" |
94 | | #endif |
95 | | #ifndef ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS |
96 | | # include "PostProcessing/RemoveRedundantMaterials.h" |
97 | | #endif |
98 | | #if (!defined ASSIMP_BUILD_NO_EMBEDTEXTURES_PROCESS) |
99 | | # include "PostProcessing/EmbedTexturesProcess.h" |
100 | | #endif |
101 | | #ifndef ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS |
102 | | # include "PostProcessing/FindInvalidDataProcess.h" |
103 | | #endif |
104 | | #ifndef ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS |
105 | | # include "PostProcessing/FindDegenerates.h" |
106 | | #endif |
107 | | #ifndef ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS |
108 | | # include "PostProcessing/SortByPTypeProcess.h" |
109 | | #endif |
110 | | #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS |
111 | | # include "PostProcessing/ComputeUVMappingProcess.h" |
112 | | #endif |
113 | | #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS |
114 | | # include "PostProcessing/TextureTransform.h" |
115 | | #endif |
116 | | #ifndef ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS |
117 | | # include "PostProcessing/FindInstancesProcess.h" |
118 | | #endif |
119 | | #ifndef ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS |
120 | | # include "PostProcessing/OptimizeMeshes.h" |
121 | | #endif |
122 | | #ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS |
123 | | # include "PostProcessing/OptimizeGraph.h" |
124 | | #endif |
125 | | #ifndef ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS |
126 | | # include "PostProcessing/SplitByBoneCountProcess.h" |
127 | | #endif |
128 | | #ifndef ASSIMP_BUILD_NO_DEBONE_PROCESS |
129 | | # include "PostProcessing/DeboneProcess.h" |
130 | | #endif |
131 | | #if (!defined ASSIMP_BUILD_NO_GLOBALSCALE_PROCESS) |
132 | | # include "PostProcessing/ScaleProcess.h" |
133 | | #endif |
134 | | #if (!defined ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS) |
135 | | # include "PostProcessing/ArmaturePopulate.h" |
136 | | #endif |
137 | | #if (!defined ASSIMP_BUILD_NO_GENBOUNDINGBOXES_PROCESS) |
138 | | # include "PostProcessing/GenBoundingBoxesProcess.h" |
139 | | #endif |
140 | | |
141 | | |
142 | | |
143 | | namespace Assimp { |
144 | | |
145 | | // ------------------------------------------------------------------------------------------------ |
146 | | void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out) |
147 | 276 | { |
148 | | // ---------------------------------------------------------------------------- |
149 | | // Add an instance of each post processing step here in the order |
150 | | // of sequence it is executed. Steps that are added here are not |
151 | | // validated - as RegisterPPStep() does - all dependencies must be given. |
152 | | // ---------------------------------------------------------------------------- |
153 | 276 | out.reserve(31); |
154 | 276 | #if (!defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS) |
155 | 276 | out.push_back( new MakeLeftHandedProcess()); |
156 | 276 | #endif |
157 | 276 | #if (!defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS) |
158 | 276 | out.push_back( new FlipUVsProcess()); |
159 | 276 | #endif |
160 | 276 | #if (!defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS) |
161 | 276 | out.push_back( new FlipWindingOrderProcess()); |
162 | 276 | #endif |
163 | 276 | #if (!defined ASSIMP_BUILD_NO_REMOVEVC_PROCESS) |
164 | 276 | out.push_back( new RemoveVCProcess()); |
165 | 276 | #endif |
166 | 276 | #if (!defined ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS) |
167 | 276 | out.push_back( new RemoveRedundantMatsProcess()); |
168 | 276 | #endif |
169 | 276 | #if (!defined ASSIMP_BUILD_NO_EMBEDTEXTURES_PROCESS) |
170 | 276 | out.push_back( new EmbedTexturesProcess()); |
171 | 276 | #endif |
172 | 276 | #if (!defined ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS) |
173 | 276 | out.push_back( new FindInstancesProcess()); |
174 | 276 | #endif |
175 | 276 | #if (!defined ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS) |
176 | 276 | out.push_back( new OptimizeGraphProcess()); |
177 | 276 | #endif |
178 | 276 | #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS |
179 | 276 | out.push_back( new ComputeUVMappingProcess()); |
180 | 276 | #endif |
181 | 276 | #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS |
182 | 276 | out.push_back( new TextureTransformStep()); |
183 | 276 | #endif |
184 | 276 | #if (!defined ASSIMP_BUILD_NO_GLOBALSCALE_PROCESS) |
185 | 276 | out.push_back( new ScaleProcess()); |
186 | 276 | #endif |
187 | 276 | #if (!defined ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS) |
188 | 276 | out.push_back( new ArmaturePopulate()); |
189 | 276 | #endif |
190 | 276 | #if (!defined ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS) |
191 | 276 | out.push_back( new PretransformVertices()); |
192 | 276 | #endif |
193 | 276 | #if (!defined ASSIMP_BUILD_NO_TRIANGULATE_PROCESS) |
194 | 276 | out.push_back( new TriangulateProcess()); |
195 | 276 | #endif |
196 | 276 | #if (!defined ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS) |
197 | | //find degenerates should run after triangulation (to sort out small |
198 | | //generated triangles) but before sort by p types (in case there are lines |
199 | | //and points generated and inserted into a mesh) |
200 | 276 | out.push_back( new FindDegeneratesProcess()); |
201 | 276 | #endif |
202 | 276 | #if (!defined ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS) |
203 | 276 | out.push_back( new SortByPTypeProcess()); |
204 | 276 | #endif |
205 | 276 | #if (!defined ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS) |
206 | 276 | out.push_back( new FindInvalidDataProcess()); |
207 | 276 | #endif |
208 | 276 | #if (!defined ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS) |
209 | 276 | out.push_back( new OptimizeMeshesProcess()); |
210 | 276 | #endif |
211 | 276 | #if (!defined ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS) |
212 | 276 | out.push_back( new FixInfacingNormalsProcess()); |
213 | 276 | #endif |
214 | 276 | #if (!defined ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS) |
215 | 276 | out.push_back( new SplitByBoneCountProcess()); |
216 | 276 | #endif |
217 | 276 | #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS) |
218 | 276 | out.push_back( new SplitLargeMeshesProcess_Triangle()); |
219 | 276 | #endif |
220 | 276 | #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS) |
221 | 276 | out.push_back( new DropFaceNormalsProcess()); |
222 | 276 | #endif |
223 | 276 | #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS) |
224 | 276 | out.push_back( new GenFaceNormalsProcess()); |
225 | 276 | #endif |
226 | | // ......................................................................... |
227 | | // DON'T change the order of these five .. |
228 | | // XXX this is actually a design weakness that dates back to the time |
229 | | // when Importer would maintain the postprocessing step list exclusively. |
230 | | // Now that others access it too, we need a better solution. |
231 | 276 | out.push_back( new ComputeSpatialSortProcess()); |
232 | | // ......................................................................... |
233 | | |
234 | 276 | #if (!defined ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS) |
235 | 276 | out.push_back( new GenVertexNormalsProcess()); |
236 | 276 | #endif |
237 | 276 | #if (!defined ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS) |
238 | 276 | out.push_back( new CalcTangentsProcess()); |
239 | 276 | #endif |
240 | 276 | #if (!defined ASSIMP_BUILD_NO_JOINVERTICES_PROCESS) |
241 | 276 | out.push_back( new JoinVerticesProcess()); |
242 | 276 | #endif |
243 | | |
244 | | // ......................................................................... |
245 | 276 | out.push_back( new DestroySpatialSortProcess()); |
246 | | // ......................................................................... |
247 | | |
248 | 276 | #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS) |
249 | 276 | out.push_back( new SplitLargeMeshesProcess_Vertex()); |
250 | 276 | #endif |
251 | 276 | #if (!defined ASSIMP_BUILD_NO_DEBONE_PROCESS) |
252 | 276 | out.push_back( new DeboneProcess()); |
253 | 276 | #endif |
254 | 276 | #if (!defined ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS) |
255 | 276 | out.push_back( new LimitBoneWeightsProcess()); |
256 | 276 | #endif |
257 | 276 | #if (!defined ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS) |
258 | 276 | out.push_back( new ImproveCacheLocalityProcess()); |
259 | 276 | #endif |
260 | 276 | #if (!defined ASSIMP_BUILD_NO_GENBOUNDINGBOXES_PROCESS) |
261 | 276 | out.push_back(new GenBoundingBoxesProcess); |
262 | 276 | #endif |
263 | 276 | } |
264 | | |
265 | | } |