You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /** @file dox_cmd.h
  2. * @brief General documentation for assimp_cmd
  3. */
  4. //----------------------------------------------------------------------------------------------
  5. // ASSIMP CMD MAINPAGE
  6. /**
  7. @mainpage ASSIMP Command-line tools
  8. <img src="dragonsplash.png"></img>
  9. @section intro Introduction
  10. This document describes the usage of assimp's command line tools.
  11. This is *not* the SDK reference and programming-related stuff is not covered here.
  12. <br><br>
  13. <b>NOTE</b>: For simplicity, the following sections are written with Windows in mind. However
  14. it's not different for Linux/Mac at all, except there's probably no assimp.exe ...
  15. @section basic_use Basic use
  16. Open a command prompt and navigate to the directory where assimp.exe resides. The basic command line is:
  17. @code
  18. assimp [command] [parameters]
  19. @endcode
  20. The following commands are available:
  21. <table border="1">
  22. <tr>
  23. <td><b>@link version version @endlink</b></td>
  24. <td>Retrieve the current version of assimp</td>
  25. </tr>
  26. <tr>
  27. <td><b>@link help help @endlink</b></td>
  28. <td>Get a list of all commands (yes, it's this list ...)</td>
  29. </tr>
  30. <tr>
  31. <td><b>@link dump dump @endlink</b></td>
  32. <td>Generate a human-readable text dump of a model</td>
  33. </tr>
  34. <tr>
  35. <td><b>@link extract extract @endlink</b></td>
  36. <td>Extract an embedded texture image</td>
  37. </tr>
  38. <tr>
  39. <td><b>@link iinfo info @endlink</b></td>
  40. <td>Load a model and print basic statistics</td>
  41. </tr>
  42. <tr>
  43. <td><b>@link cmpdump cmpdump @endlink</b></td>
  44. <td>Regression checking tool</td>
  45. </tr>
  46. </table>
  47. If you use assimp's command line frequently, consider adding assimp to your PATH
  48. environment.
  49. */
  50. /**
  51. @page version 'version'-Command
  52. Display the version/revision of Assimp used.
  53. */
  54. /**
  55. @page help 'help'-Command
  56. Display a really helpful text.
  57. */
  58. //----------------------------------------------------------------------------------------------
  59. // ASSIMP INFO
  60. /**
  61. @page iinfo 'info'-Command
  62. Load a model file and print basic statistics. Full postprocessing is applied unless the <tt>-r</tt> switch is specified. Sample output (<tt>assimp info ./test/models/3DS/mar_rifle.3ds</tt>):
  63. @verbatim
  64. Launching model import ... OK
  65. Validating postprocessing flags ... OK
  66. Importing file ... OK
  67. import took approx. 0.02400 seconds
  68. Memory consumption: 69444 B
  69. Nodes: 2
  70. Maximum depth 2
  71. Meshes: 1
  72. Animations: 0
  73. Textures (embed.): 0
  74. Materials: 1
  75. Cameras: 0
  76. Lights: 0
  77. Vertices: 843
  78. Faces: 572
  79. Bones: 0
  80. Animation Channels: 0
  81. Primitive Types: triangles
  82. Average faces/mesh 572
  83. Average verts/mesh 843
  84. Minimum point (-3.522588 -11.573204 -40.340359)
  85. Maximum point (3.522622 30.196556 75.941292)
  86. Center point (0.000017 9.311676 17.800467)
  87. Named Materials:
  88. 'mat1'
  89. Texture Refs:
  90. 'm_rifl.bmp'
  91. Node hierarchy:
  92. '<3DSRoot>', meshes: 0
  93. -- 'm_rifle', meshes: 1
  94. <--
  95. @endverbatim
  96. <h3>Syntax:</h3>
  97. @code
  98. assimp info file [-r]
  99. @endcode
  100. <h3>Parameters:</h3>
  101. <p>
  102. <tt>
  103. file<br></tt><br>
  104. Required. Input file.
  105. </p>
  106. <p>
  107. <tt>
  108. -r</tt><br>
  109. Optional. Don't perform any postprocessing. The long form of this parameter is <tt>--raw</tt>.
  110. </p>
  111. */
  112. //----------------------------------------------------------------------------------------------
  113. // ASSIMP CMPDUMP
  114. /**
  115. @page cmpdump 'cmpdump'-Command
  116. <b>Used for Assimp's internal regression testing.</b> Compare two mini dumps (produced using <tt>assimp dump .. -b -s</tt>) and
  117. report any differences. In the regression test suite, this facility is used to build a database of
  118. 'known-to-be-fine' mini dumps, which are regularly compared against current results to detect regressions.
  119. <h3>Syntax:</h3>
  120. @code
  121. assimp cmpdmp actual expected
  122. @endcode
  123. <h3>Parameters:</h3>
  124. <p>
  125. <tt>
  126. actual<br></tt><br>
  127. Required. Mini dump now.
  128. </p>
  129. <p>
  130. <tt>
  131. expected<br></tt><br>
  132. Required. Archived dump from some point in the past.
  133. </p>
  134. */
  135. //----------------------------------------------------------------------------------------------
  136. // ASSIMP DUMP
  137. /**
  138. @page dump 'dump'-Command
  139. Generate a text or binary dump of a model. This is the core component of Assimp's internal
  140. regression test suite but it could also be useful for other developers to quickly
  141. examine the contents of a model. Note that text dumps are not intended to be used as
  142. intermediate format, Assimp is not able to read them again, nor is the file format
  143. stable or well-defined. It may change with every revision without notice.
  144. Binary dumps (*.assbin) are backwards- and forwards-compatible.
  145. <h3>Syntax:</h3>
  146. @code
  147. assimp dump <model> [<out>] [-b] [-s] [common parameters]
  148. @endcode
  149. <h3>Parameters:</h3>
  150. <p>
  151. <tt>
  152. model<br></tt><br>
  153. Required. Relative or absolute path to the input model.
  154. </p>
  155. <p>
  156. <tt>
  157. out<br></tt><br>
  158. Optional. Relative or absolute path to write the output dump to. If it is omitted,
  159. the dump is written to <tt>&lt;model&gt;-dump.txt</tt>
  160. </p>
  161. <p>
  162. <tt>-b<br>
  163. </tt><br>
  164. Optional. If this switch is specified, the dumb is written in binary format.
  165. The long form of this parameter is <tt>--binary</tt>.
  166. </p>
  167. <p>
  168. <tt>-s&lt;n&gt;<br>
  169. </tt><br>
  170. Optional. If this switch is specified, the dumb is shortened to include only
  171. min/max values for all vertex components and animation channels. The resulting
  172. file is much smaller, but the original model can't be reconstructed from it. This is
  173. used by Assimp's regression test suite, comparing those minidumps provides
  174. a fast way to verify whether a loader works correctly or not.
  175. The long form of this parameter is <tt>--short</tt>.
  176. </p>
  177. <p>
  178. <tt>
  179. common parameters<br></tt><br>
  180. Optional. Import configuration & postprocessing.
  181. See the @link common common parameters page @endlink for more information.
  182. </p>
  183. <hr>
  184. <h3>Sample:</h3>
  185. @code
  186. assimp dump test.3ds test.txt -l -cfull
  187. assimp dump test.3ds test.txt -include-log -config=full
  188. @endcode
  189. Dumps 'test.3ds' to 'test.txt' after executing full post-processing on tehe imported data.
  190. The log output is included with the dump.
  191. @code
  192. assimp dump files\*.*
  193. assimp dump files\*.*
  194. @endcode
  195. Dumps all loadable model files in the 'files' subdir. The output dumps are named
  196. <tt><mode-file>-dump.txt</tt>. The log is not included.
  197. */
  198. //----------------------------------------------------------------------------------------------
  199. // ASSIMP EXTRACT
  200. /**
  201. @page extract 'extract'-Command
  202. Extracts one or more embedded texture images from models.
  203. <h3>Syntax:</h3>
  204. @code
  205. assimp extract <model> [<out>] [-t<n>] [-f<fmt>] [-ba] [-s] [common parameters]
  206. @endcode
  207. <h3>Parameters:</h3>
  208. <p>
  209. <tt>
  210. model<br></tt><br>
  211. Required. Relative or absolute path to the input model.
  212. </p>
  213. <p>
  214. <tt>
  215. out<br></tt><br>
  216. Optional. Relative or absolute path to write the output images to. If the file name is
  217. omitted the output images are named <tt><model-filename></tt><br>
  218. The suffix <tt>_img&lt;n&gt;</tt> is appended to the file name if the -s switch is not specified
  219. (where <tt>&lt;n&gt;</tt> is the zero-based index of the texture in the model file).<br>
  220. The output file format is determined from the given file extension. Supported
  221. formats are BMP and TGA. If the file format can't be determined,
  222. the value specified with the -f switch is taken.
  223. <br>
  224. Format settings are ignored for compressed embedded textures. They're always
  225. written in their native file format (e.g. jpg).
  226. </p>
  227. <p>
  228. <tt>-t&lt;n&gt;<br>
  229. </tt><br>
  230. Optional. Specifies the (zero-based) index of the embedded texture to be extracted from
  231. the model. If this option is *not* specified all textures found are exported.
  232. The long form of this parameter is <tt>--texture=&lt;n&gt;</tt>.
  233. </p>
  234. <p>
  235. <tt>-ba&lt;n&gt;<br>
  236. </tt><br>
  237. Optional. Specifies whether output BMPs contain an alpha channel or not.
  238. The long form of this parameter is <tt>--bmp-with-alpha=&lt;n&gt;</tt>.
  239. </p>
  240. <p>
  241. <tt>-f&lt;n&gt;<br>
  242. </tt><br>
  243. Optional. Specifies the output file format. Supported
  244. formats are BMP and TGA. The default value is BMP (if a full output filename is
  245. specified, the output file format is taken from its extension, not from here).
  246. The long form of this parameter is <tt>--format=&lt;n&gt;</tt>.
  247. </p>
  248. <p>
  249. <tt>-s&lt;n&gt;<br>
  250. </tt><br>
  251. Optional. Prevents the tool from adding the <tt>_img&lt;n&gt;</tt> suffix to all filenames. This option
  252. must be specified together with -t to ensure that just one image is written.
  253. The long form of this parameter is <tt>--nosuffix</tt>.
  254. </p>
  255. <p>
  256. <tt>
  257. common parameters<br></tt><br>
  258. Optional. Import configuration & postprocessing. Most postprocessing-steps don't affect
  259. embedded texture images, configuring too much is probably senseless here.
  260. See the @link common common parameters page @endlink for more information.
  261. </p>
  262. <hr>
  263. <h3>Sample:</h3>
  264. @code
  265. assimp extract test.mdl test.bmp --texture=0 --validate-data-structure
  266. assimp extract test.mdl test.bmp -t=0 -vds
  267. @endcode
  268. Extracts the first embedded texture (if any) from test.mdl after validating the
  269. imported data structure and writes it to <tt>test_img0.bmp</tt>.
  270. @code
  271. assimp extract files\*.mdl *.bmp
  272. assimp extract files\*.mdl *.bmp
  273. @endcode
  274. Extracts all embedded textures from all loadable .mdl files in the 'files' subdirectory
  275. and writes them to bitmaps which are named <tt><model-file>_img<image-index>.bmp</tt>
  276. */
  277. //----------------------------------------------------------------------------------------------
  278. // ASSIMP COMMON PARAMETERS
  279. /**
  280. @page common Common parameters
  281. The parameters described on this page are commonly used by almost every assimp command. They
  282. specify how the library will postprocess the imported data. This is done by several
  283. configurable pipeline stages, called 'post processing steps'. Below you can find a list
  284. of all supported steps along with short descriptions of what they're doing. <br><b>Programmers</b>:
  285. more information can be found in the <tt>aiPostProcess.h</tt> header.
  286. <table border="1">
  287. <tr>
  288. <th>Parameter</th>
  289. <th>Long parameter</th>
  290. <th>Description</th>
  291. </tr>
  292. <tr>
  293. <td><tt>-ptv</tt></td>
  294. <td><tt>--pretransform-vertices</tt></td>
  295. <td>Move all vertices into worldspace and collapse the scene graph. Animation data is lost.
  296. This is intended for applications which don't support scenegraph-oriented rendering.</td>
  297. </tr>
  298. <tr>
  299. <td><tt>-gsn</tt></td>
  300. <td><tt>--gen-smooth-normals</tt></td>
  301. <td>Computes 'smooth' per-vertex normal vectors if necessary. Mutually exclusive with -gn</td>
  302. </tr>
  303. <tr>
  304. <td><tt>-gn</tt></td>
  305. <td><tt>--gen-normals</tt></td>
  306. <td>Computes 'hard' per-face normal vectors if necessary. Mutually exclusive with -gsn</td>
  307. </tr>
  308. <tr>
  309. <td><tt>-cts</tt></td>
  310. <td><tt>--calc-tangent-space</tt></td>
  311. <td>If one UV channel and normal vectors are given, compute tangents and bitangents</td>
  312. </tr>
  313. <tr>
  314. <td><tt>-jiv</tt></td>
  315. <td><tt>--join-identical-vertices</tt></td>
  316. <td>Optimize the index buffer. If this flag is not specified all vertices are referenced once.</td>
  317. </tr>
  318. <tr>
  319. <td><tt>-rrm</tt></td>
  320. <td><tt>--remove-redundant-materials</tt></td>
  321. <td>Remove redundant materials from the imported data.</td>
  322. </tr>
  323. <tr>
  324. <td><tt>-fd</tt></td>
  325. <td><tt>--find-degenerates</tt></td>
  326. <td>Find and process degenerates primitives.</td>
  327. </tr>
  328. <tr>
  329. <td><tt>-slm</tt></td>
  330. <td><tt>--split-large-meshes</tt></td>
  331. <td>Split large meshes over a specific threshold in smaller sub meshes. The default vertex & face limit is 1000000</td>
  332. </tr>
  333. <tr>
  334. <td><tt>-lbw</tt></td>
  335. <td><tt>--limit-bone-weights</tt></td>
  336. <td>Limit the number of bones influencing a single vertex. The default limit is 4.</td>
  337. </tr>
  338. <tr>
  339. <td><tt>-vds</tt></td>
  340. <td><tt>--validate-data-structure</tt></td>
  341. <td>Performs a full validation of the imported data structure. Recommended to avoid crashes if
  342. an import plugin produces rubbish</td>
  343. </tr>
  344. <tr>
  345. <td><tt>-icl</tt></td>
  346. <td><tt>--improve-cache-locality</tt></td>
  347. <td>Improve the cache locality of the vertex buffer by reordering the index buffer
  348. to achieve a lower ACMR (average post-transform vertex cache miss ratio)</td>
  349. </tr>
  350. <tr>
  351. <td><tt>-sbpt</tt></td>
  352. <td><tt>--sort-by-ptype</tt></td>
  353. <td>Splits meshes which consist of more than one kind of primitives (e.g. lines and triangles mixed up)
  354. in 'clean' submeshes. </td>
  355. </tr>
  356. <tr>
  357. <td><tt>-lh</tt></td>
  358. <td><tt>--convert-to-lh</tt></td>
  359. <td>Converts the imported data to left-handed coordinate space</td>
  360. </tr>
  361. <tr>
  362. <td><tt>-fuv</tt></td>
  363. <td><tt>--flip-uv</tt></td>
  364. <td>Flip UV coordinates from upper-left origin to lower-left origin</td>
  365. </tr>
  366. <tr>
  367. <td><tt>-fwo</tt></td>
  368. <td><tt>--flip-winding-order</tt></td>
  369. <td>Flip face winding order from CCW to CW</td>
  370. </tr>
  371. <tr>
  372. <td><tt>-ett</tt></td>
  373. <td><tt>--evaluate-texture-transform</tt></td>
  374. <td>Evaluate per-texture UV transformations (e.g scaling, offset) and build pretransformed UV channels</td>
  375. </tr>
  376. <tr>
  377. <td><tt>-guv</tt></td>
  378. <td><tt>--gen-uvcoords</tt></td>
  379. <td>Replace abstract mapping descriptions, such as 'spherical' or 'cylindrical' with proper UV channels</td>
  380. </tr>
  381. <tr>
  382. <td><tt>-fixn</tt></td>
  383. <td><tt>--fix-normals</tt></td>
  384. <td>Run a heuristic algorithm to detect meshes with wrong face winding order/normals. </td>
  385. </tr>
  386. <tr>
  387. <td><tt>-tri</tt></td>
  388. <td><tt>--triangulate</tt></td>
  389. <td>Triangulate poylgons with 4 and more points. Lines, points and triangles are not affected. </td>
  390. </tr>
  391. <tr>
  392. <td><tt>-fi</tt></td>
  393. <td><tt>--find-instances</tt></td>
  394. <td>Search the data structure for instanced meshes and replace them by references. This can
  395. reduce vertex/face counts but the postprocessing-step takes some time.</td>
  396. </tr>
  397. <tr>
  398. <td><tt>-og</tt></td>
  399. <td><tt>--optimize-graph</tt></td>
  400. <td>Simplify and optimize the scenegraph. Use it with care, all hierarchy information could be lost.
  401. Animations remain untouched. </td>
  402. </tr>
  403. <tr>
  404. <td><tt>-om</tt></td>
  405. <td><tt>--optimize-mesh</tt></td>
  406. <td>Optimize mesh usage. Meshes are merged, if possible. Very effective in combination with <tt>--optimize-graph</tt></td>
  407. </tr>
  408. </table>
  409. For convenience some default postprocessing configurations are provided.
  410. The corresponding command line parameter is <tt>-c&lt;name&gt;</tt> (or <tt>--config=&lt;name&gt;</tt>).
  411. <table border="1">
  412. <tr>
  413. <th>Name</th>
  414. <th>Description</th>
  415. <th>List of steps executed</th>
  416. </tr>
  417. <tr>
  418. <td>fast</td>
  419. <td>Fast post processing config, performs some essential optimizations and computes tangents</td>
  420. <td><tt>-cts, -gn, -jiv, -tri, -guv, -sbpt</tt></td>
  421. </tr>
  422. <tr>
  423. <td>default</td>
  424. <td>Balanced post processing config; performs most optimizations</td>
  425. <td><tt>-cts, -gsn, -jiv, -icl, -lbw, -rrm, -slm, -tri, -guv, -sbpt, -fd, -fiv</tt></td>
  426. </tr>
  427. <tr>
  428. <td>full</td>
  429. <td>Full post processing. May take a while but results in best output quality for most purposes</td>
  430. <td><tt>-cts, -gsn, -jiv, -icl, -lbw, -rrm, -slm, -tri, -guv, -sbpt, -fd, -fiv, -fi, -vds -om</tt></td>
  431. </tr>
  432. </table>
  433. The <tt>-tuv, -ptv, -og</tt> flags always need to be enabled manually.
  434. There are also some common flags to customize Assimp's logging behaviour:
  435. <table border="1">
  436. <tr>
  437. <th>Name</th>
  438. <th>Description</th>
  439. </tr>
  440. <tr>
  441. <td><tt>-l</tt> or <tt>--show-log</tt></td>
  442. <td>Show log file on console window (stderr)</td>
  443. </tr>
  444. <tr>
  445. <td><tt>-lo&lt;file&gt;</tt> or <tt>--log-out=&lt;file&gt;</tt></td>
  446. <td>Streams the log to &lt;file&gt;</td>
  447. </tr>
  448. <tr>
  449. <td><tt>-v</tt> or <tt>--verbose</tt></td>
  450. <td>Enables verbose logging. Debug messages will be produced too. This might
  451. decrease loading performance and result in *very* long logs ... use with caution if you experience strange issues.</td>
  452. </tr>
  453. </table>
  454. */