1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5
6 Copyright (c) 2006-2019, 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 "Common/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 // ------------------------------------------------------------------------------------------------
GetPostProcessingStepInstanceList(std::vector<BaseProcess * > & out)146 void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out)
147 {
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 out.reserve(31);
154 #if (!defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS)
155 out.push_back( new MakeLeftHandedProcess());
156 #endif
157 #if (!defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS)
158 out.push_back( new FlipUVsProcess());
159 #endif
160 #if (!defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
161 out.push_back( new FlipWindingOrderProcess());
162 #endif
163 #if (!defined ASSIMP_BUILD_NO_REMOVEVC_PROCESS)
164 out.push_back( new RemoveVCProcess());
165 #endif
166 #if (!defined ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
167 out.push_back( new RemoveRedundantMatsProcess());
168 #endif
169 #if (!defined ASSIMP_BUILD_NO_EMBEDTEXTURES_PROCESS)
170 out.push_back( new EmbedTexturesProcess());
171 #endif
172 #if (!defined ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS)
173 out.push_back( new FindInstancesProcess());
174 #endif
175 #if (!defined ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
176 out.push_back( new OptimizeGraphProcess());
177 #endif
178 #ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
179 out.push_back( new ComputeUVMappingProcess());
180 #endif
181 #ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
182 out.push_back( new TextureTransformStep());
183 #endif
184 #if (!defined ASSIMP_BUILD_NO_GLOBALSCALE_PROCESS)
185 out.push_back( new ScaleProcess());
186 #endif
187 #if (!defined ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS)
188 out.push_back( new ArmaturePopulate());
189 #endif
190 #if (!defined ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
191 out.push_back( new PretransformVertices());
192 #endif
193 #if (!defined ASSIMP_BUILD_NO_TRIANGULATE_PROCESS)
194 out.push_back( new TriangulateProcess());
195 #endif
196 #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 out.push_back( new FindDegeneratesProcess());
201 #endif
202 #if (!defined ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS)
203 out.push_back( new SortByPTypeProcess());
204 #endif
205 #if (!defined ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS)
206 out.push_back( new FindInvalidDataProcess());
207 #endif
208 #if (!defined ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS)
209 out.push_back( new OptimizeMeshesProcess());
210 #endif
211 #if (!defined ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
212 out.push_back( new FixInfacingNormalsProcess());
213 #endif
214 #if (!defined ASSIMP_BUILD_NO_SPLITBYBONECOUNT_PROCESS)
215 out.push_back( new SplitByBoneCountProcess());
216 #endif
217 #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
218 out.push_back( new SplitLargeMeshesProcess_Triangle());
219 #endif
220 #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
221 out.push_back( new DropFaceNormalsProcess());
222 #endif
223 #if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
224 out.push_back( new GenFaceNormalsProcess());
225 #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 out.push_back( new ComputeSpatialSortProcess());
232 // .........................................................................
233
234 #if (!defined ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS)
235 out.push_back( new GenVertexNormalsProcess());
236 #endif
237 #if (!defined ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS)
238 out.push_back( new CalcTangentsProcess());
239 #endif
240 #if (!defined ASSIMP_BUILD_NO_JOINVERTICES_PROCESS)
241 out.push_back( new JoinVerticesProcess());
242 #endif
243
244 // .........................................................................
245 out.push_back( new DestroySpatialSortProcess());
246 // .........................................................................
247
248 #if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
249 out.push_back( new SplitLargeMeshesProcess_Vertex());
250 #endif
251 #if (!defined ASSIMP_BUILD_NO_DEBONE_PROCESS)
252 out.push_back( new DeboneProcess());
253 #endif
254 #if (!defined ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
255 out.push_back( new LimitBoneWeightsProcess());
256 #endif
257 #if (!defined ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
258 out.push_back( new ImproveCacheLocalityProcess());
259 #endif
260 #if (!defined ASSIMP_BUILD_NO_GENBOUNDINGBOXES_PROCESS)
261 out.push_back(new GenBoundingBoxesProcess);
262 #endif
263 }
264
265 }
266