rev |
line source |
nuclear@0
|
1 /*
|
nuclear@0
|
2 Open Asset Import Library (assimp)
|
nuclear@0
|
3 ----------------------------------------------------------------------
|
nuclear@0
|
4
|
nuclear@0
|
5 Copyright (c) 2006-2012, assimp team
|
nuclear@0
|
6 All rights reserved.
|
nuclear@0
|
7
|
nuclear@0
|
8 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
9 with or without modification, are permitted provided that the
|
nuclear@0
|
10 following conditions are met:
|
nuclear@0
|
11
|
nuclear@0
|
12 * Redistributions of source code must retain the above
|
nuclear@0
|
13 copyright notice, this list of conditions and the
|
nuclear@0
|
14 following disclaimer.
|
nuclear@0
|
15
|
nuclear@0
|
16 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
17 copyright notice, this list of conditions and the
|
nuclear@0
|
18 following disclaimer in the documentation and/or other
|
nuclear@0
|
19 materials provided with the distribution.
|
nuclear@0
|
20
|
nuclear@0
|
21 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
22 contributors may be used to endorse or promote products
|
nuclear@0
|
23 derived from this software without specific prior
|
nuclear@0
|
24 written permission of the assimp team.
|
nuclear@0
|
25
|
nuclear@0
|
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
37
|
nuclear@0
|
38 ----------------------------------------------------------------------
|
nuclear@0
|
39 */
|
nuclear@0
|
40
|
nuclear@0
|
41 #ifndef AI_PROCESS_HELPER_H_INCLUDED
|
nuclear@0
|
42 #define AI_PROCESS_HELPER_H_INCLUDED
|
nuclear@0
|
43
|
nuclear@0
|
44 #include "assimp/postprocess.h"
|
nuclear@0
|
45
|
nuclear@0
|
46 #include "SpatialSort.h"
|
nuclear@0
|
47 #include "BaseProcess.h"
|
nuclear@0
|
48 #include "ParsingUtils.h"
|
nuclear@0
|
49
|
nuclear@0
|
50 // -------------------------------------------------------------------------------
|
nuclear@0
|
51 // Some extensions to std namespace. Mainly std::min and std::max for all
|
nuclear@0
|
52 // flat data types in the aiScene. They're used to quickly determine the
|
nuclear@0
|
53 // min/max bounds of data arrays.
|
nuclear@0
|
54 #ifdef __cplusplus
|
nuclear@0
|
55 namespace std {
|
nuclear@0
|
56
|
nuclear@0
|
57 // std::min for aiVector3D
|
nuclear@0
|
58 template <typename TReal>
|
nuclear@0
|
59 inline ::aiVector3t<TReal> min (const ::aiVector3t<TReal>& a, const ::aiVector3t<TReal>& b) {
|
nuclear@0
|
60 return ::aiVector3t<TReal> (min(a.x,b.x),min(a.y,b.y),min(a.z,b.z));
|
nuclear@0
|
61 }
|
nuclear@0
|
62
|
nuclear@0
|
63 // std::max for aiVector3t<TReal>
|
nuclear@0
|
64 template <typename TReal>
|
nuclear@0
|
65 inline ::aiVector3t<TReal> max (const ::aiVector3t<TReal>& a, const ::aiVector3t<TReal>& b) {
|
nuclear@0
|
66 return ::aiVector3t<TReal> (max(a.x,b.x),max(a.y,b.y),max(a.z,b.z));
|
nuclear@0
|
67 }
|
nuclear@0
|
68
|
nuclear@0
|
69 // std::min for aiVector2t<TReal>
|
nuclear@0
|
70 template <typename TReal>
|
nuclear@0
|
71 inline ::aiVector2t<TReal> min (const ::aiVector2t<TReal>& a, const ::aiVector2t<TReal>& b) {
|
nuclear@0
|
72 return ::aiVector2t<TReal> (min(a.x,b.x),min(a.y,b.y));
|
nuclear@0
|
73 }
|
nuclear@0
|
74
|
nuclear@0
|
75 // std::max for aiVector2t<TReal>
|
nuclear@0
|
76 template <typename TReal>
|
nuclear@0
|
77 inline ::aiVector2t<TReal> max (const ::aiVector2t<TReal>& a, const ::aiVector2t<TReal>& b) {
|
nuclear@0
|
78 return ::aiVector2t<TReal> (max(a.x,b.x),max(a.y,b.y));
|
nuclear@0
|
79 }
|
nuclear@0
|
80
|
nuclear@0
|
81 // std::min for aiColor4D
|
nuclear@0
|
82 template <typename TReal>
|
nuclear@0
|
83 inline ::aiColor4t<TReal> min (const ::aiColor4t<TReal>& a, const ::aiColor4t<TReal>& b) {
|
nuclear@0
|
84 return ::aiColor4t<TReal> (min(a.r,b.r),min(a.g,b.g),min(a.b,b.b),min(a.a,b.a));
|
nuclear@0
|
85 }
|
nuclear@0
|
86
|
nuclear@0
|
87 // std::max for aiColor4D
|
nuclear@0
|
88 template <typename TReal>
|
nuclear@0
|
89 inline ::aiColor4t<TReal> max (const ::aiColor4t<TReal>& a, const ::aiColor4t<TReal>& b) {
|
nuclear@0
|
90 return ::aiColor4t<TReal> (max(a.r,b.r),max(a.g,b.g),max(a.b,b.b),max(a.a,b.a));
|
nuclear@0
|
91 }
|
nuclear@0
|
92
|
nuclear@0
|
93
|
nuclear@0
|
94 // std::min for aiQuaterniont<TReal>
|
nuclear@0
|
95 template <typename TReal>
|
nuclear@0
|
96 inline ::aiQuaterniont<TReal> min (const ::aiQuaterniont<TReal>& a, const ::aiQuaterniont<TReal>& b) {
|
nuclear@0
|
97 return ::aiQuaterniont<TReal> (min(a.w,b.w),min(a.x,b.x),min(a.y,b.y),min(a.z,b.z));
|
nuclear@0
|
98 }
|
nuclear@0
|
99
|
nuclear@0
|
100 // std::max for aiQuaterniont<TReal>
|
nuclear@0
|
101 template <typename TReal>
|
nuclear@0
|
102 inline ::aiQuaterniont<TReal> max (const ::aiQuaterniont<TReal>& a, const ::aiQuaterniont<TReal>& b) {
|
nuclear@0
|
103 return ::aiQuaterniont<TReal> (max(a.w,b.w),max(a.x,b.x),max(a.y,b.y),max(a.z,b.z));
|
nuclear@0
|
104 }
|
nuclear@0
|
105
|
nuclear@0
|
106
|
nuclear@0
|
107
|
nuclear@0
|
108 // std::min for aiVectorKey
|
nuclear@0
|
109 inline ::aiVectorKey min (const ::aiVectorKey& a, const ::aiVectorKey& b) {
|
nuclear@0
|
110 return ::aiVectorKey (min(a.mTime,b.mTime),min(a.mValue,b.mValue));
|
nuclear@0
|
111 }
|
nuclear@0
|
112
|
nuclear@0
|
113 // std::max for aiVectorKey
|
nuclear@0
|
114 inline ::aiVectorKey max (const ::aiVectorKey& a, const ::aiVectorKey& b) {
|
nuclear@0
|
115 return ::aiVectorKey (max(a.mTime,b.mTime),max(a.mValue,b.mValue));
|
nuclear@0
|
116 }
|
nuclear@0
|
117
|
nuclear@0
|
118 // std::min for aiQuatKey
|
nuclear@0
|
119 inline ::aiQuatKey min (const ::aiQuatKey& a, const ::aiQuatKey& b) {
|
nuclear@0
|
120 return ::aiQuatKey (min(a.mTime,b.mTime),min(a.mValue,b.mValue));
|
nuclear@0
|
121 }
|
nuclear@0
|
122
|
nuclear@0
|
123 // std::max for aiQuatKey
|
nuclear@0
|
124 inline ::aiQuatKey max (const ::aiQuatKey& a, const ::aiQuatKey& b) {
|
nuclear@0
|
125 return ::aiQuatKey (max(a.mTime,b.mTime),max(a.mValue,b.mValue));
|
nuclear@0
|
126 }
|
nuclear@0
|
127
|
nuclear@0
|
128 // std::min for aiVertexWeight
|
nuclear@0
|
129 inline ::aiVertexWeight min (const ::aiVertexWeight& a, const ::aiVertexWeight& b) {
|
nuclear@0
|
130 return ::aiVertexWeight (min(a.mVertexId,b.mVertexId),min(a.mWeight,b.mWeight));
|
nuclear@0
|
131 }
|
nuclear@0
|
132
|
nuclear@0
|
133 // std::max for aiVertexWeight
|
nuclear@0
|
134 inline ::aiVertexWeight max (const ::aiVertexWeight& a, const ::aiVertexWeight& b) {
|
nuclear@0
|
135 return ::aiVertexWeight (max(a.mVertexId,b.mVertexId),max(a.mWeight,b.mWeight));
|
nuclear@0
|
136 }
|
nuclear@0
|
137
|
nuclear@0
|
138 } // end namespace std
|
nuclear@0
|
139 #endif // !! C++
|
nuclear@0
|
140
|
nuclear@0
|
141 namespace Assimp {
|
nuclear@0
|
142
|
nuclear@0
|
143 // -------------------------------------------------------------------------------
|
nuclear@0
|
144 // Start points for ArrayBounds<T> for all supported Ts
|
nuclear@0
|
145 template <typename T>
|
nuclear@0
|
146 struct MinMaxChooser;
|
nuclear@0
|
147
|
nuclear@0
|
148 template <> struct MinMaxChooser<float> {
|
nuclear@0
|
149 void operator ()(float& min,float& max) {
|
nuclear@0
|
150 max = -1e10f;
|
nuclear@0
|
151 min = 1e10f;
|
nuclear@0
|
152 }};
|
nuclear@0
|
153 template <> struct MinMaxChooser<double> {
|
nuclear@0
|
154 void operator ()(double& min,double& max) {
|
nuclear@0
|
155 max = -1e10;
|
nuclear@0
|
156 min = 1e10;
|
nuclear@0
|
157 }};
|
nuclear@0
|
158 template <> struct MinMaxChooser<unsigned int> {
|
nuclear@0
|
159 void operator ()(unsigned int& min,unsigned int& max) {
|
nuclear@0
|
160 max = 0;
|
nuclear@0
|
161 min = (1u<<(sizeof(unsigned int)*8-1));
|
nuclear@0
|
162 }};
|
nuclear@0
|
163
|
nuclear@0
|
164 template <typename T> struct MinMaxChooser< aiVector3t<T> > {
|
nuclear@0
|
165 void operator ()(aiVector3t<T>& min,aiVector3t<T>& max) {
|
nuclear@0
|
166 max = aiVector3t<T>(-1e10f,-1e10f,-1e10f);
|
nuclear@0
|
167 min = aiVector3t<T>( 1e10f, 1e10f, 1e10f);
|
nuclear@0
|
168 }};
|
nuclear@0
|
169 template <typename T> struct MinMaxChooser< aiVector2t<T> > {
|
nuclear@0
|
170 void operator ()(aiVector2t<T>& min,aiVector2t<T>& max) {
|
nuclear@0
|
171 max = aiVector2t<T>(-1e10f,-1e10f);
|
nuclear@0
|
172 min = aiVector2t<T>( 1e10f, 1e10f);
|
nuclear@0
|
173 }};
|
nuclear@0
|
174 template <typename T> struct MinMaxChooser< aiColor4t<T> > {
|
nuclear@0
|
175 void operator ()(aiColor4t<T>& min,aiColor4t<T>& max) {
|
nuclear@0
|
176 max = aiColor4t<T>(-1e10f,-1e10f,-1e10f,-1e10f);
|
nuclear@0
|
177 min = aiColor4t<T>( 1e10f, 1e10f, 1e10f, 1e10f);
|
nuclear@0
|
178 }};
|
nuclear@0
|
179
|
nuclear@0
|
180 template <typename T> struct MinMaxChooser< aiQuaterniont<T> > {
|
nuclear@0
|
181 void operator ()(aiQuaterniont<T>& min,aiQuaterniont<T>& max) {
|
nuclear@0
|
182 max = aiQuaterniont<T>(-1e10f,-1e10f,-1e10f,-1e10f);
|
nuclear@0
|
183 min = aiQuaterniont<T>( 1e10f, 1e10f, 1e10f, 1e10f);
|
nuclear@0
|
184 }};
|
nuclear@0
|
185
|
nuclear@0
|
186 template <> struct MinMaxChooser<aiVectorKey> {
|
nuclear@0
|
187 void operator ()(aiVectorKey& min,aiVectorKey& max) {
|
nuclear@0
|
188 MinMaxChooser<double>()(min.mTime,max.mTime);
|
nuclear@0
|
189 MinMaxChooser<aiVector3D>()(min.mValue,max.mValue);
|
nuclear@0
|
190 }};
|
nuclear@0
|
191 template <> struct MinMaxChooser<aiQuatKey> {
|
nuclear@0
|
192 void operator ()(aiQuatKey& min,aiQuatKey& max) {
|
nuclear@0
|
193 MinMaxChooser<double>()(min.mTime,max.mTime);
|
nuclear@0
|
194 MinMaxChooser<aiQuaternion>()(min.mValue,max.mValue);
|
nuclear@0
|
195 }};
|
nuclear@0
|
196
|
nuclear@0
|
197 template <> struct MinMaxChooser<aiVertexWeight> {
|
nuclear@0
|
198 void operator ()(aiVertexWeight& min,aiVertexWeight& max) {
|
nuclear@0
|
199 MinMaxChooser<unsigned int>()(min.mVertexId,max.mVertexId);
|
nuclear@0
|
200 MinMaxChooser<float>()(min.mWeight,max.mWeight);
|
nuclear@0
|
201 }};
|
nuclear@0
|
202
|
nuclear@0
|
203 // -------------------------------------------------------------------------------
|
nuclear@0
|
204 /** @brief Find the min/max values of an array of Ts
|
nuclear@0
|
205 * @param in Input array
|
nuclear@0
|
206 * @param size Numebr of elements to process
|
nuclear@0
|
207 * @param[out] min minimum value
|
nuclear@0
|
208 * @param[out] max maximum value
|
nuclear@0
|
209 */
|
nuclear@0
|
210 template <typename T>
|
nuclear@0
|
211 inline void ArrayBounds(const T* in, unsigned int size, T& min, T& max)
|
nuclear@0
|
212 {
|
nuclear@0
|
213 MinMaxChooser<T> ()(min,max);
|
nuclear@0
|
214 for (unsigned int i = 0; i < size;++i) {
|
nuclear@0
|
215 min = std::min(in[i],min);
|
nuclear@0
|
216 max = std::max(in[i],max);
|
nuclear@0
|
217 }
|
nuclear@0
|
218 }
|
nuclear@0
|
219
|
nuclear@0
|
220
|
nuclear@0
|
221 // -------------------------------------------------------------------------------
|
nuclear@0
|
222 /** Little helper function to calculate the quadratic difference
|
nuclear@0
|
223 * of two colours.
|
nuclear@0
|
224 * @param pColor1 First color
|
nuclear@0
|
225 * @param pColor2 second color
|
nuclear@0
|
226 * @return Quadratic color difference */
|
nuclear@0
|
227 inline float GetColorDifference( const aiColor4D& pColor1, const aiColor4D& pColor2)
|
nuclear@0
|
228 {
|
nuclear@0
|
229 const aiColor4D c (pColor1.r - pColor2.r, pColor1.g - pColor2.g, pColor1.b - pColor2.b, pColor1.a - pColor2.a);
|
nuclear@0
|
230 return c.r*c.r + c.g*c.g + c.b*c.b + c.a*c.a;
|
nuclear@0
|
231 }
|
nuclear@0
|
232
|
nuclear@0
|
233
|
nuclear@0
|
234 // -------------------------------------------------------------------------------
|
nuclear@0
|
235 /** @brief Extract single strings from a list of identifiers
|
nuclear@0
|
236 * @param in Input string list.
|
nuclear@0
|
237 * @param out Receives a list of clean output strings
|
nuclear@0
|
238 * @sdee #AI_CONFIG_PP_OG_EXCLUDE_LIST */
|
nuclear@0
|
239 void ConvertListToStrings(const std::string& in, std::list<std::string>& out);
|
nuclear@0
|
240
|
nuclear@0
|
241
|
nuclear@0
|
242 // -------------------------------------------------------------------------------
|
nuclear@0
|
243 /** @brief Compute the AABB of a mesh after applying a given transform
|
nuclear@0
|
244 * @param mesh Input mesh
|
nuclear@0
|
245 * @param[out] min Receives minimum transformed vertex
|
nuclear@0
|
246 * @param[out] max Receives maximum transformed vertex
|
nuclear@0
|
247 * @param m Transformation matrix to be applied */
|
nuclear@0
|
248 void FindAABBTransformed (const aiMesh* mesh, aiVector3D& min, aiVector3D& max, const aiMatrix4x4& m);
|
nuclear@0
|
249
|
nuclear@0
|
250
|
nuclear@0
|
251 // -------------------------------------------------------------------------------
|
nuclear@0
|
252 /** @brief Helper function to determine the 'real' center of a mesh
|
nuclear@0
|
253 *
|
nuclear@0
|
254 * That is the center of its axis-aligned bounding box.
|
nuclear@0
|
255 * @param mesh Input mesh
|
nuclear@0
|
256 * @param[out] min Minimum vertex of the mesh
|
nuclear@0
|
257 * @param[out] max maximum vertex of the mesh
|
nuclear@0
|
258 * @param[out] out Center point */
|
nuclear@0
|
259 void FindMeshCenter (aiMesh* mesh, aiVector3D& out, aiVector3D& min, aiVector3D& max);
|
nuclear@0
|
260
|
nuclear@0
|
261
|
nuclear@0
|
262 // -------------------------------------------------------------------------------
|
nuclear@0
|
263 // Helper function to determine the 'real' center of a mesh after applying a given transform
|
nuclear@0
|
264 void FindMeshCenterTransformed (aiMesh* mesh, aiVector3D& out, aiVector3D& min,aiVector3D& max, const aiMatrix4x4& m);
|
nuclear@0
|
265
|
nuclear@0
|
266
|
nuclear@0
|
267 // -------------------------------------------------------------------------------
|
nuclear@0
|
268 // Helper function to determine the 'real' center of a mesh
|
nuclear@0
|
269 void FindMeshCenter (aiMesh* mesh, aiVector3D& out);
|
nuclear@0
|
270
|
nuclear@0
|
271
|
nuclear@0
|
272 // -------------------------------------------------------------------------------
|
nuclear@0
|
273 // Helper function to determine the 'real' center of a mesh after applying a given transform
|
nuclear@0
|
274 void FindMeshCenterTransformed (aiMesh* mesh, aiVector3D& out,const aiMatrix4x4& m);
|
nuclear@0
|
275
|
nuclear@0
|
276
|
nuclear@0
|
277 // -------------------------------------------------------------------------------
|
nuclear@0
|
278 // Compute a good epsilon value for position comparisons on a mesh
|
nuclear@0
|
279 float ComputePositionEpsilon(const aiMesh* pMesh);
|
nuclear@0
|
280
|
nuclear@0
|
281
|
nuclear@0
|
282 // -------------------------------------------------------------------------------
|
nuclear@0
|
283 // Compute a good epsilon value for position comparisons on a array of meshes
|
nuclear@0
|
284 float ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num);
|
nuclear@0
|
285
|
nuclear@0
|
286
|
nuclear@0
|
287 // -------------------------------------------------------------------------------
|
nuclear@0
|
288 // Compute an unique value for the vertex format of a mesh
|
nuclear@0
|
289 unsigned int GetMeshVFormatUnique(const aiMesh* pcMesh);
|
nuclear@0
|
290
|
nuclear@0
|
291
|
nuclear@0
|
292 // defs for ComputeVertexBoneWeightTable()
|
nuclear@0
|
293 typedef std::pair <unsigned int,float> PerVertexWeight;
|
nuclear@0
|
294 typedef std::vector <PerVertexWeight> VertexWeightTable;
|
nuclear@0
|
295
|
nuclear@0
|
296 // -------------------------------------------------------------------------------
|
nuclear@0
|
297 // Compute a per-vertex bone weight table
|
nuclear@0
|
298 VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh);
|
nuclear@0
|
299
|
nuclear@0
|
300
|
nuclear@0
|
301 // -------------------------------------------------------------------------------
|
nuclear@0
|
302 // Get a string for a given aiTextureType
|
nuclear@0
|
303 const char* TextureTypeToString(aiTextureType in);
|
nuclear@0
|
304
|
nuclear@0
|
305
|
nuclear@0
|
306 // -------------------------------------------------------------------------------
|
nuclear@0
|
307 // Get a string for a given aiTextureMapping
|
nuclear@0
|
308 const char* MappingTypeToString(aiTextureMapping in);
|
nuclear@0
|
309
|
nuclear@0
|
310
|
nuclear@0
|
311 // flags for MakeSubmesh()
|
nuclear@0
|
312 #define AI_SUBMESH_FLAGS_SANS_BONES 0x1
|
nuclear@0
|
313
|
nuclear@0
|
314 // -------------------------------------------------------------------------------
|
nuclear@0
|
315 // Split a mesh given a list of faces to be contained in the sub mesh
|
nuclear@0
|
316 aiMesh* MakeSubmesh(const aiMesh *superMesh, const std::vector<unsigned int> &subMeshFaces, unsigned int subFlags);
|
nuclear@0
|
317
|
nuclear@0
|
318 // -------------------------------------------------------------------------------
|
nuclear@0
|
319 // Utility postprocess step to share the spatial sort tree between
|
nuclear@0
|
320 // all steps which use it to speedup its computations.
|
nuclear@0
|
321 class ComputeSpatialSortProcess : public BaseProcess
|
nuclear@0
|
322 {
|
nuclear@0
|
323 bool IsActive( unsigned int pFlags) const
|
nuclear@0
|
324 {
|
nuclear@0
|
325 return NULL != shared && 0 != (pFlags & (aiProcess_CalcTangentSpace |
|
nuclear@0
|
326 aiProcess_GenNormals | aiProcess_JoinIdenticalVertices));
|
nuclear@0
|
327 }
|
nuclear@0
|
328
|
nuclear@0
|
329 void Execute( aiScene* pScene)
|
nuclear@0
|
330 {
|
nuclear@0
|
331 typedef std::pair<SpatialSort, float> _Type;
|
nuclear@0
|
332 DefaultLogger::get()->debug("Generate spatially-sorted vertex cache");
|
nuclear@0
|
333
|
nuclear@0
|
334 std::vector<_Type>* p = new std::vector<_Type>(pScene->mNumMeshes);
|
nuclear@0
|
335 std::vector<_Type>::iterator it = p->begin();
|
nuclear@0
|
336
|
nuclear@0
|
337 for (unsigned int i = 0; i < pScene->mNumMeshes; ++i, ++it) {
|
nuclear@0
|
338 aiMesh* mesh = pScene->mMeshes[i];
|
nuclear@0
|
339 _Type& blubb = *it;
|
nuclear@0
|
340 blubb.first.Fill(mesh->mVertices,mesh->mNumVertices,sizeof(aiVector3D));
|
nuclear@0
|
341 blubb.second = ComputePositionEpsilon(mesh);
|
nuclear@0
|
342 }
|
nuclear@0
|
343
|
nuclear@0
|
344 shared->AddProperty(AI_SPP_SPATIAL_SORT,p);
|
nuclear@0
|
345 }
|
nuclear@0
|
346 };
|
nuclear@0
|
347
|
nuclear@0
|
348 // -------------------------------------------------------------------------------
|
nuclear@0
|
349 // ... and the same again to cleanup the whole stuff
|
nuclear@0
|
350 class DestroySpatialSortProcess : public BaseProcess
|
nuclear@0
|
351 {
|
nuclear@0
|
352 bool IsActive( unsigned int pFlags) const
|
nuclear@0
|
353 {
|
nuclear@0
|
354 return NULL != shared && 0 != (pFlags & (aiProcess_CalcTangentSpace |
|
nuclear@0
|
355 aiProcess_GenNormals | aiProcess_JoinIdenticalVertices));
|
nuclear@0
|
356 }
|
nuclear@0
|
357
|
nuclear@0
|
358 void Execute( aiScene* /*pScene*/)
|
nuclear@0
|
359 {
|
nuclear@0
|
360 shared->RemoveProperty(AI_SPP_SPATIAL_SORT);
|
nuclear@0
|
361 }
|
nuclear@0
|
362 };
|
nuclear@0
|
363
|
nuclear@0
|
364
|
nuclear@0
|
365
|
nuclear@0
|
366 } // ! namespace Assimp
|
nuclear@0
|
367 #endif // !! AI_PROCESS_HELPER_H_INCLUDED
|