postprocess.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2024, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file postprocess.h
  34. * @brief Definitions for import post processing steps
  35. */
  36. #pragma once
  37. #ifndef AI_POSTPROCESS_H_INC
  38. #define AI_POSTPROCESS_H_INC
  39. #include <assimp/types.h>
  40. #ifdef __GNUC__
  41. # pragma GCC system_header
  42. #endif
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. // -----------------------------------------------------------------------------------
  47. /** @enum aiPostProcessSteps
  48. * @brief Defines the flags for all possible post processing steps.
  49. *
  50. * @note Some steps are influenced by properties set on the Assimp::Importer itself
  51. *
  52. * @see Assimp::Importer::ReadFile()
  53. * @see Assimp::Importer::SetPropertyInteger()
  54. * @see aiImportFile
  55. * @see aiImportFileEx
  56. */
  57. // -----------------------------------------------------------------------------------
  58. enum aiPostProcessSteps
  59. {
  60. // -------------------------------------------------------------------------
  61. /** <hr>Calculates the tangents and bitangents for the imported meshes.
  62. *
  63. * Does nothing if a mesh does not have normals. You might want this post
  64. * processing step to be executed if you plan to use tangent space calculations
  65. * such as normal mapping applied to the meshes. There's an importer property,
  66. * <tt>#AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE</tt>, which allows you to specify
  67. * a maximum smoothing angle for the algorithm. However, usually you'll
  68. * want to leave it at the default value.
  69. */
  70. aiProcess_CalcTangentSpace = 0x1,
  71. // -------------------------------------------------------------------------
  72. /** <hr>Identifies and joins identical vertex data sets within all
  73. * imported meshes.
  74. *
  75. * After this step is run, each mesh contains unique vertices,
  76. * so a vertex may be used by multiple faces. You usually want
  77. * to use this post processing step. If your application deals with
  78. * indexed geometry, this step is compulsory or you'll just waste rendering
  79. * time. <b>If this flag is not specified</b>, no vertices are referenced by
  80. * more than one face and <b>no index buffer is required</b> for rendering.
  81. * Unless the importer (like ply) had to split vertices. Then you need one regardless.
  82. */
  83. aiProcess_JoinIdenticalVertices = 0x2,
  84. // -------------------------------------------------------------------------
  85. /** <hr>Converts all the imported data to a left-handed coordinate space.
  86. *
  87. * By default the data is returned in a right-handed coordinate space (which
  88. * OpenGL prefers). In this space, +X points to the right,
  89. * +Z points towards the viewer, and +Y points upwards. In the DirectX
  90. * coordinate space +X points to the right, +Y points upwards, and +Z points
  91. * away from the viewer.
  92. *
  93. * You'll probably want to consider this flag if you use Direct3D for
  94. * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
  95. * setting and bundles all conversions typically required for D3D-based
  96. * applications.
  97. */
  98. aiProcess_MakeLeftHanded = 0x4,
  99. // -------------------------------------------------------------------------
  100. /** <hr>Triangulates all faces of all meshes.
  101. *
  102. * By default the imported mesh data might contain faces with more than 3
  103. * indices. For rendering you'll usually want all faces to be triangles.
  104. * This post processing step splits up faces with more than 3 indices into
  105. * triangles. Line and point primitives are *not* modified! If you want
  106. * 'triangles only' with no other kinds of primitives, try the following
  107. * solution:
  108. * <ul>
  109. * <li>Specify both #aiProcess_Triangulate and #aiProcess_SortByPType </li>
  110. * <li>Ignore all point and line meshes when you process assimp's output</li>
  111. * </ul>
  112. */
  113. aiProcess_Triangulate = 0x8,
  114. // -------------------------------------------------------------------------
  115. /** <hr>Removes some parts of the data structure (animations, materials,
  116. * light sources, cameras, textures, vertex components).
  117. *
  118. * The components to be removed are specified in a separate
  119. * importer property, <tt>#AI_CONFIG_PP_RVC_FLAGS</tt>. This is quite useful
  120. * if you don't need all parts of the output structure. Vertex colors
  121. * are rarely used today for example... Calling this step to remove unneeded
  122. * data from the pipeline as early as possible results in increased
  123. * performance and a more optimized output data structure.
  124. * This step is also useful if you want to force Assimp to recompute
  125. * normals or tangents. The corresponding steps don't recompute them if
  126. * they're already there (loaded from the source asset). By using this
  127. * step you can make sure they are NOT there.
  128. *
  129. * This flag is a poor one, mainly because its purpose is usually
  130. * misunderstood. Consider the following case: a 3D model has been exported
  131. * from a CAD app, and it has per-face vertex colors. Vertex positions can't be
  132. * shared, thus the #aiProcess_JoinIdenticalVertices step fails to
  133. * optimize the data because of these nasty little vertex colors.
  134. * Most apps don't even process them, so it's all for nothing. By using
  135. * this step, unneeded components are excluded as early as possible
  136. * thus opening more room for internal optimizations.
  137. */
  138. aiProcess_RemoveComponent = 0x10,
  139. // -------------------------------------------------------------------------
  140. /** <hr>Generates normals for all faces of all meshes.
  141. *
  142. * This is ignored if normals are already there at the time this flag
  143. * is evaluated. Model importers try to load them from the source file, so
  144. * they're usually already there. Face normals are shared between all points
  145. * of a single face, so a single point can have multiple normals, which
  146. * forces the library to duplicate vertices in some cases.
  147. * #aiProcess_JoinIdenticalVertices is *senseless* then.
  148. *
  149. * This flag may not be specified together with #aiProcess_GenSmoothNormals.
  150. */
  151. aiProcess_GenNormals = 0x20,
  152. // -------------------------------------------------------------------------
  153. /** <hr>Generates smooth normals for all vertices in the mesh.
  154. *
  155. * This is ignored if normals are already there at the time this flag
  156. * is evaluated. Model importers try to load them from the source file, so
  157. * they're usually already there.
  158. *
  159. * This flag may not be specified together with
  160. * #aiProcess_GenNormals. There's a importer property,
  161. * <tt>#AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE</tt> which allows you to specify
  162. * an angle maximum for the normal smoothing algorithm. Normals exceeding
  163. * this limit are not smoothed, resulting in a 'hard' seam between two faces.
  164. * Using a decent angle here (e.g. 80 degrees) results in very good visual
  165. * appearance.
  166. */
  167. aiProcess_GenSmoothNormals = 0x40,
  168. // -------------------------------------------------------------------------
  169. /** <hr>Splits large meshes into smaller sub-meshes.
  170. *
  171. * This is quite useful for real-time rendering, where the number of triangles
  172. * which can be maximally processed in a single draw-call is limited
  173. * by the video driver/hardware. The maximum vertex buffer is usually limited
  174. * too. Both requirements can be met with this step: you may specify both a
  175. * triangle and vertex limit for a single mesh.
  176. *
  177. * The split limits can (and should!) be set through the
  178. * <tt>#AI_CONFIG_PP_SLM_VERTEX_LIMIT</tt> and <tt>#AI_CONFIG_PP_SLM_TRIANGLE_LIMIT</tt>
  179. * importer properties. The default values are <tt>#AI_SLM_DEFAULT_MAX_VERTICES</tt> and
  180. * <tt>#AI_SLM_DEFAULT_MAX_TRIANGLES</tt>.
  181. *
  182. * Note that splitting is generally a time-consuming task, but only if there's
  183. * something to split. The use of this step is recommended for most users.
  184. */
  185. aiProcess_SplitLargeMeshes = 0x80,
  186. // -------------------------------------------------------------------------
  187. /** <hr>Removes the node graph and pre-transforms all vertices with
  188. * the local transformation matrices of their nodes.
  189. *
  190. * If the resulting scene can be reduced to a single mesh, with a single
  191. * material, no lights, and no cameras, then the output scene will contain
  192. * only a root node (with no children) that references the single mesh.
  193. * Otherwise, the output scene will be reduced to a root node with a single
  194. * level of child nodes, each one referencing one mesh, and each mesh
  195. * referencing one material.
  196. *
  197. * In either case, for rendering, you can
  198. * simply render all meshes in order - you don't need to pay
  199. * attention to local transformations and the node hierarchy.
  200. * Animations are removed during this step.
  201. * This step is intended for applications without a scenegraph.
  202. * The step CAN cause some problems: if e.g. a mesh of the asset
  203. * contains normals and another, using the same material index, does not,
  204. * they will be brought together, but the first meshes's part of
  205. * the normal list is zeroed. However, these artifacts are rare.
  206. * @note The <tt>#AI_CONFIG_PP_PTV_NORMALIZE</tt> configuration property
  207. * can be set to normalize the scene's spatial dimension to the -1...1
  208. * range.
  209. */
  210. aiProcess_PreTransformVertices = 0x100,
  211. // -------------------------------------------------------------------------
  212. /** <hr>Limits the number of bones simultaneously affecting a single vertex
  213. * to a maximum value.
  214. *
  215. * If any vertex is affected by more than the maximum number of bones, the least
  216. * important vertex weights are removed and the remaining vertex weights are
  217. * renormalized so that the weights still sum up to 1.
  218. * The default bone weight limit is 4 (defined as <tt>#AI_LMW_MAX_WEIGHTS</tt> in
  219. * config.h), but you can use the <tt>#AI_CONFIG_PP_LBW_MAX_WEIGHTS</tt> importer
  220. * property to supply your own limit to the post processing step.
  221. *
  222. * If you intend to perform the skinning in hardware, this post processing
  223. * step might be of interest to you.
  224. */
  225. aiProcess_LimitBoneWeights = 0x200,
  226. // -------------------------------------------------------------------------
  227. /** <hr>Validates the imported scene data structure.
  228. * This makes sure that all indices are valid, all animations and
  229. * bones are linked correctly, all material references are correct .. etc.
  230. *
  231. * It is recommended that you capture Assimp's log output if you use this flag,
  232. * so you can easily find out what's wrong if a file fails the
  233. * validation. The validator is quite strict and will find *all*
  234. * inconsistencies in the data structure... It is recommended that plugin
  235. * developers use it to debug their loaders. There are two types of
  236. * validation failures:
  237. * <ul>
  238. * <li>Error: There's something wrong with the imported data. Further
  239. * postprocessing is not possible and the data is not usable at all.
  240. * The import fails. #Importer::GetErrorString() or #aiGetErrorString()
  241. * carry the error message around.</li>
  242. * <li>Warning: There are some minor issues (e.g. 1000000 animation
  243. * keyframes with the same time), but further postprocessing and use
  244. * of the data structure is still safe. Warning details are written
  245. * to the log file, <tt>#AI_SCENE_FLAGS_VALIDATION_WARNING</tt> is set
  246. * in #aiScene::mFlags</li>
  247. * </ul>
  248. *
  249. * This post-processing step is not time-consuming. Its use is not
  250. * compulsory, but recommended.
  251. */
  252. aiProcess_ValidateDataStructure = 0x400,
  253. // -------------------------------------------------------------------------
  254. /** <hr>Reorders triangles for better vertex cache locality.
  255. *
  256. * The step tries to improve the ACMR (average post-transform vertex cache
  257. * miss ratio) for all meshes. The implementation runs in O(n) and is
  258. * roughly based on the 'tipsify' algorithm (see <a href="
  259. * http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf">this
  260. * paper</a>).
  261. *
  262. * If you intend to render huge models in hardware, this step might
  263. * be of interest to you. The <tt>#AI_CONFIG_PP_ICL_PTCACHE_SIZE</tt>
  264. * importer property can be used to fine-tune the cache optimization.
  265. */
  266. aiProcess_ImproveCacheLocality = 0x800,
  267. // -------------------------------------------------------------------------
  268. /** <hr>Searches for redundant/unreferenced materials and removes them.
  269. *
  270. * This is especially useful in combination with the
  271. * #aiProcess_PreTransformVertices and #aiProcess_OptimizeMeshes flags.
  272. * Both join small meshes with equal characteristics, but they can't do
  273. * their work if two meshes have different materials. Because several
  274. * material settings are lost during Assimp's import filters,
  275. * (and because many exporters don't check for redundant materials), huge
  276. * models often have materials which are are defined several times with
  277. * exactly the same settings.
  278. *
  279. * Several material settings not contributing to the final appearance of
  280. * a surface are ignored in all comparisons (e.g. the material name).
  281. * So, if you're passing additional information through the
  282. * content pipeline (probably using *magic* material names), don't
  283. * specify this flag. Alternatively take a look at the
  284. * <tt>#AI_CONFIG_PP_RRM_EXCLUDE_LIST</tt> importer property.
  285. */
  286. aiProcess_RemoveRedundantMaterials = 0x1000,
  287. // -------------------------------------------------------------------------
  288. /** <hr>This step tries to determine which meshes have normal vectors
  289. * that are facing inwards and inverts them.
  290. *
  291. * The algorithm is simple but effective:
  292. * the bounding box of all vertices + their normals is compared against
  293. * the volume of the bounding box of all vertices without their normals.
  294. * This works well for most objects, problems might occur with planar
  295. * surfaces. However, the step tries to filter such cases.
  296. * The step inverts all in-facing normals. Generally it is recommended
  297. * to enable this step, although the result is not always correct.
  298. */
  299. aiProcess_FixInfacingNormals = 0x2000,
  300. // -------------------------------------------------------------------------
  301. /**
  302. * This step generically populates aiBone->mArmature and aiBone->mNode generically
  303. * The point of these is it saves you later having to calculate these elements
  304. * This is useful when handling rest information or skin information
  305. * If you have multiple armatures on your models we strongly recommend enabling this
  306. * Instead of writing your own multi-root, multi-armature lookups we have done the
  307. * hard work for you :)
  308. */
  309. aiProcess_PopulateArmatureData = 0x4000,
  310. // -------------------------------------------------------------------------
  311. /** <hr>This step splits meshes with more than one primitive type in
  312. * homogeneous sub-meshes.
  313. *
  314. * The step is executed after the triangulation step. After the step
  315. * returns, just one bit is set in aiMesh::mPrimitiveTypes. This is
  316. * especially useful for real-time rendering where point and line
  317. * primitives are often ignored or rendered separately.
  318. * You can use the <tt>#AI_CONFIG_PP_SBP_REMOVE</tt> importer property to
  319. * specify which primitive types you need. This can be used to easily
  320. * exclude lines and points, which are rarely used, from the import.
  321. */
  322. aiProcess_SortByPType = 0x8000,
  323. // -------------------------------------------------------------------------
  324. /** <hr>This step searches all meshes for degenerate primitives and
  325. * converts them to proper lines or points.
  326. *
  327. * A face is 'degenerate' if one or more of its points are identical.
  328. * To have the degenerate stuff not only detected and collapsed but
  329. * removed, try one of the following procedures:
  330. * <br><b>1.</b> (if you support lines and points for rendering but don't
  331. * want the degenerates)<br>
  332. * <ul>
  333. * <li>Specify the #aiProcess_FindDegenerates flag.
  334. * </li>
  335. * <li>Set the <tt>#AI_CONFIG_PP_FD_REMOVE</tt> importer property to
  336. * 1. This will cause the step to remove degenerate triangles from the
  337. * import as soon as they're detected. They won't pass any further
  338. * pipeline steps.
  339. * </li>
  340. * </ul>
  341. * <br><b>2.</b>(if you don't support lines and points at all)<br>
  342. * <ul>
  343. * <li>Specify the #aiProcess_FindDegenerates flag.
  344. * </li>
  345. * <li>Specify the #aiProcess_SortByPType flag. This moves line and
  346. * point primitives to separate meshes.
  347. * </li>
  348. * <li>Set the <tt>#AI_CONFIG_PP_SBP_REMOVE</tt> importer property to
  349. * @code aiPrimitiveType_POINT | aiPrimitiveType_LINE
  350. * @endcode to cause SortByPType to reject point
  351. * and line meshes from the scene.
  352. * </li>
  353. * </ul>
  354. *
  355. * This step also removes very small triangles with a surface area smaller
  356. * than 10^-6. If you rely on having these small triangles, or notice holes
  357. * in your model, set the property <tt>#AI_CONFIG_PP_FD_CHECKAREA</tt> to
  358. * false.
  359. * @note Degenerate polygons are not necessarily evil and that's why
  360. * they're not removed by default. There are several file formats which
  361. * don't support lines or points, and some exporters bypass the
  362. * format specification and write them as degenerate triangles instead.
  363. */
  364. aiProcess_FindDegenerates = 0x10000,
  365. // -------------------------------------------------------------------------
  366. /** <hr>This step searches all meshes for invalid data, such as zeroed
  367. * normal vectors or invalid UV coords and removes/fixes them. This is
  368. * intended to get rid of some common exporter errors.
  369. *
  370. * This is especially useful for normals. If they are invalid, and
  371. * the step recognizes this, they will be removed and can later
  372. * be recomputed, i.e. by the #aiProcess_GenSmoothNormals flag.<br>
  373. * The step will also remove meshes that are infinitely small and reduce
  374. * animation tracks consisting of hundreds if redundant keys to a single
  375. * key. The <tt>AI_CONFIG_PP_FID_ANIM_ACCURACY</tt> config property decides
  376. * the accuracy of the check for duplicate animation tracks.
  377. */
  378. aiProcess_FindInvalidData = 0x20000,
  379. // -------------------------------------------------------------------------
  380. /** <hr>This step converts non-UV mappings (such as spherical or
  381. * cylindrical mapping) to proper texture coordinate channels.
  382. *
  383. * Most applications will support UV mapping only, so you will
  384. * probably want to specify this step in every case. Note that Assimp is not
  385. * always able to match the original mapping implementation of the
  386. * 3D app which produced a model perfectly. It's always better to let the
  387. * modelling app compute the UV channels - 3ds max, Maya, Blender,
  388. * LightWave, and Modo do this for example.
  389. *
  390. * @note If this step is not requested, you'll need to process the
  391. * <tt>#AI_MATKEY_MAPPING</tt> material property in order to display all assets
  392. * properly.
  393. */
  394. aiProcess_GenUVCoords = 0x40000,
  395. // -------------------------------------------------------------------------
  396. /** <hr>This step applies per-texture UV transformations and bakes
  397. * them into stand-alone vtexture coordinate channels.
  398. *
  399. * UV transformations are specified per-texture - see the
  400. * <tt>#AI_MATKEY_UVTRANSFORM</tt> material key for more information.
  401. * This step processes all textures with
  402. * transformed input UV coordinates and generates a new (pre-transformed) UV channel
  403. * which replaces the old channel. Most applications won't support UV
  404. * transformations, so you will probably want to specify this step.
  405. *
  406. * @note UV transformations are usually implemented in real-time apps by
  407. * transforming texture coordinates at vertex shader stage with a 3x3
  408. * (homogeneous) transformation matrix.
  409. */
  410. aiProcess_TransformUVCoords = 0x80000,
  411. // -------------------------------------------------------------------------
  412. /** <hr>This step searches for duplicate meshes and replaces them
  413. * with references to the first mesh.
  414. *
  415. * This step takes a while, so don't use it if speed is a concern.
  416. * Its main purpose is to workaround the fact that many export
  417. * file formats don't support instanced meshes, so exporters need to
  418. * duplicate meshes. This step removes the duplicates again. Please
  419. * note that Assimp does not currently support per-node material
  420. * assignment to meshes, which means that identical meshes with
  421. * different materials are currently *not* joined, although this is
  422. * planned for future versions.
  423. */
  424. aiProcess_FindInstances = 0x100000,
  425. // -------------------------------------------------------------------------
  426. /** <hr>A post-processing step to reduce the number of meshes.
  427. *
  428. * This will, in fact, reduce the number of draw calls.
  429. *
  430. * This is a very effective optimization and is recommended to be used
  431. * together with #aiProcess_OptimizeGraph, if possible. The flag is fully
  432. * compatible with both #aiProcess_SplitLargeMeshes and #aiProcess_SortByPType.
  433. */
  434. aiProcess_OptimizeMeshes = 0x200000,
  435. // -------------------------------------------------------------------------
  436. /** <hr>A post-processing step to optimize the scene hierarchy.
  437. *
  438. * Nodes without animations, bones, lights or cameras assigned are
  439. * collapsed and joined.
  440. *
  441. * Node names can be lost during this step. If you use special 'tag nodes'
  442. * to pass additional information through your content pipeline, use the
  443. * <tt>#AI_CONFIG_PP_OG_EXCLUDE_LIST</tt> importer property to specify a
  444. * list of node names you want to be kept. Nodes matching one of the names
  445. * in this list won't be touched or modified.
  446. *
  447. * Use this flag with caution. Most simple files will be collapsed to a
  448. * single node, so complex hierarchies are usually completely lost. This is not
  449. * useful for editor environments, but probably a very effective
  450. * optimization if you just want to get the model data, convert it to your
  451. * own format, and render it as fast as possible.
  452. *
  453. * This flag is designed to be used with #aiProcess_OptimizeMeshes for best
  454. * results.
  455. *
  456. * @note 'Crappy' scenes with thousands of extremely small meshes packed
  457. * in deeply nested nodes exist for almost all file formats.
  458. * #aiProcess_OptimizeMeshes in combination with #aiProcess_OptimizeGraph
  459. * usually fixes them all and makes them renderable.
  460. */
  461. aiProcess_OptimizeGraph = 0x400000,
  462. // -------------------------------------------------------------------------
  463. /** <hr>This step flips all UV coordinates along the y-axis and adjusts
  464. * material settings and bitangents accordingly.
  465. *
  466. * <b>Output UV coordinate system:</b>
  467. * @code
  468. * 0y|0y ---------- 1x|0y
  469. * | |
  470. * | |
  471. * | |
  472. * 0x|1y ---------- 1x|1y
  473. * @endcode
  474. *
  475. * You'll probably want to consider this flag if you use Direct3D for
  476. * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this
  477. * setting and bundles all conversions typically required for D3D-based
  478. * applications.
  479. */
  480. aiProcess_FlipUVs = 0x800000,
  481. // -------------------------------------------------------------------------
  482. /** <hr>This step adjusts the output face winding order to be CW.
  483. *
  484. * The default face winding order is counter clockwise (CCW).
  485. *
  486. * <b>Output face order:</b>
  487. * @code
  488. * x2
  489. *
  490. * x0
  491. * x1
  492. * @endcode
  493. */
  494. aiProcess_FlipWindingOrder = 0x1000000,
  495. // -------------------------------------------------------------------------
  496. /** <hr>This step splits meshes with many bones into sub-meshes so that each
  497. * sub-mesh has fewer or as many bones as a given limit.
  498. */
  499. aiProcess_SplitByBoneCount = 0x2000000,
  500. // -------------------------------------------------------------------------
  501. /** <hr>This step removes bones losslessly or according to some threshold.
  502. *
  503. * In some cases (i.e. formats that require it) exporters are forced to
  504. * assign dummy bone weights to otherwise static meshes assigned to
  505. * animated meshes. Full, weight-based skinning is expensive while
  506. * animating nodes is extremely cheap, so this step is offered to clean up
  507. * the data in that regard.
  508. *
  509. * Use <tt>#AI_CONFIG_PP_DB_THRESHOLD</tt> to control this.
  510. * Use <tt>#AI_CONFIG_PP_DB_ALL_OR_NONE</tt> if you want bones removed if and
  511. * only if all bones within the scene qualify for removal.
  512. */
  513. aiProcess_Debone = 0x4000000,
  514. // -------------------------------------------------------------------------
  515. /** <hr>This step will perform a global scale of the model.
  516. *
  517. * Some importers are providing a mechanism to define a scaling unit for the
  518. * model. This post processing step can be used to do so. You need to get the
  519. * global scaling from your importer settings like in FBX. Use the flag
  520. * AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY from the global property table to configure this.
  521. *
  522. * Use <tt>#AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY</tt> to setup the global scaling factor.
  523. */
  524. aiProcess_GlobalScale = 0x8000000,
  525. // -------------------------------------------------------------------------
  526. /** <hr>A postprocessing step to embed of textures.
  527. *
  528. * This will remove external data dependencies for textures.
  529. * If a texture's file does not exist at the specified path
  530. * (due, for instance, to an absolute path generated on another system),
  531. * it will check if a file with the same name exists at the root folder
  532. * of the imported model. And if so, it uses that.
  533. */
  534. aiProcess_EmbedTextures = 0x10000000,
  535. // aiProcess_GenEntityMeshes = 0x100000,
  536. // aiProcess_OptimizeAnimations = 0x200000
  537. // aiProcess_FixTexturePaths = 0x200000
  538. aiProcess_ForceGenNormals = 0x20000000,
  539. // -------------------------------------------------------------------------
  540. /** <hr>Drops normals for all faces of all meshes.
  541. *
  542. * This is ignored if no normals are present.
  543. * Face normals are shared between all points of a single face,
  544. * so a single point can have multiple normals, which
  545. * forces the library to duplicate vertices in some cases.
  546. * #aiProcess_JoinIdenticalVertices is *senseless* then.
  547. * This process gives sense back to aiProcess_JoinIdenticalVertices
  548. */
  549. aiProcess_DropNormals = 0x40000000,
  550. // -------------------------------------------------------------------------
  551. /**
  552. */
  553. aiProcess_GenBoundingBoxes = 0x80000000
  554. };
  555. // ---------------------------------------------------------------------------------------
  556. /** @def aiProcess_ConvertToLeftHanded
  557. * @brief Shortcut flag for Direct3D-based applications.
  558. *
  559. * Supersedes the #aiProcess_MakeLeftHanded and #aiProcess_FlipUVs and
  560. * #aiProcess_FlipWindingOrder flags.
  561. * The output data matches Direct3D's conventions: left-handed geometry, upper-left
  562. * origin for UV coordinates and finally clockwise face order, suitable for CCW culling.
  563. *
  564. * @deprecated
  565. */
  566. #define aiProcess_ConvertToLeftHanded ( \
  567. aiProcess_MakeLeftHanded | \
  568. aiProcess_FlipUVs | \
  569. aiProcess_FlipWindingOrder | \
  570. 0 )
  571. // ---------------------------------------------------------------------------------------
  572. /** @def aiProcessPreset_TargetRealtime_Fast
  573. * @brief Default postprocess configuration optimizing the data for real-time rendering.
  574. *
  575. * Applications would want to use this preset to load models on end-user PCs,
  576. * maybe for direct use in game.
  577. *
  578. * If you're using DirectX, don't forget to combine this value with
  579. * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  580. * in your application apply the #aiProcess_TransformUVCoords step, too.
  581. * @note Please take the time to read the docs for the steps enabled by this preset.
  582. * Some of them offer further configurable properties, while some of them might not be of
  583. * use for you so it might be better to not specify them.
  584. */
  585. #define aiProcessPreset_TargetRealtime_Fast ( \
  586. aiProcess_CalcTangentSpace | \
  587. aiProcess_GenNormals | \
  588. aiProcess_JoinIdenticalVertices | \
  589. aiProcess_Triangulate | \
  590. aiProcess_GenUVCoords | \
  591. aiProcess_SortByPType | \
  592. 0 )
  593. // ---------------------------------------------------------------------------------------
  594. /** @def aiProcessPreset_TargetRealtime_Quality
  595. * @brief Default postprocess configuration optimizing the data for real-time rendering.
  596. *
  597. * Unlike #aiProcessPreset_TargetRealtime_Fast, this configuration
  598. * performs some extra optimizations to improve rendering speed and
  599. * to minimize memory usage. It could be a good choice for a level editor
  600. * environment where import speed is not so important.
  601. *
  602. * If you're using DirectX, don't forget to combine this value with
  603. * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  604. * in your application apply the #aiProcess_TransformUVCoords step, too.
  605. * @note Please take the time to read the docs for the steps enabled by this preset.
  606. * Some of them offer further configurable properties, while some of them might not be
  607. * of use for you so it might be better to not specify them.
  608. */
  609. #define aiProcessPreset_TargetRealtime_Quality ( \
  610. aiProcess_CalcTangentSpace | \
  611. aiProcess_GenSmoothNormals | \
  612. aiProcess_JoinIdenticalVertices | \
  613. aiProcess_ImproveCacheLocality | \
  614. aiProcess_LimitBoneWeights | \
  615. aiProcess_RemoveRedundantMaterials | \
  616. aiProcess_SplitLargeMeshes | \
  617. aiProcess_Triangulate | \
  618. aiProcess_GenUVCoords | \
  619. aiProcess_SortByPType | \
  620. aiProcess_FindDegenerates | \
  621. aiProcess_FindInvalidData | \
  622. 0 )
  623. // ---------------------------------------------------------------------------------------
  624. /** @def aiProcessPreset_TargetRealtime_MaxQuality
  625. * @brief Default postprocess configuration optimizing the data for real-time rendering.
  626. *
  627. * This preset enables almost every optimization step to achieve perfectly
  628. * optimized data. It's your choice for level editor environments where import speed
  629. * is not important.
  630. *
  631. * If you're using DirectX, don't forget to combine this value with
  632. * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations
  633. * in your application, apply the #aiProcess_TransformUVCoords step, too.
  634. * @note Please take the time to read the docs for the steps enabled by this preset.
  635. * Some of them offer further configurable properties, while some of them might not be
  636. * of use for you so it might be better to not specify them.
  637. */
  638. #define aiProcessPreset_TargetRealtime_MaxQuality ( \
  639. aiProcessPreset_TargetRealtime_Quality | \
  640. aiProcess_FindInstances | \
  641. aiProcess_ValidateDataStructure | \
  642. aiProcess_OptimizeMeshes | \
  643. 0 )
  644. #ifdef __cplusplus
  645. } // end of extern "C"
  646. #endif
  647. #endif // AI_POSTPROCESS_H_INC