manual.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
  7. <title></title>
  8. <style type="text/css">
  9. /*
  10. :Author: David Goodger ([email protected])
  11. :Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
  12. :Copyright: This stylesheet has been placed in the public domain.
  13. Default cascading style sheet for the HTML output of Docutils.
  14. See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
  15. customize this style sheet.
  16. */
  17. /* used to remove borders from tables and images */
  18. .borderless, table.borderless td, table.borderless th {
  19. border: 0 }
  20. table.borderless td, table.borderless th {
  21. /* Override padding for "table.docutils td" with "! important".
  22. The right padding separates the table cells. */
  23. padding: 0 0.5em 0 0 ! important }
  24. .first {
  25. /* Override more specific margin styles with "! important". */
  26. margin-top: 0 ! important }
  27. .last, .with-subtitle {
  28. margin-bottom: 0 ! important }
  29. .hidden {
  30. display: none }
  31. a.toc-backref {
  32. text-decoration: none ;
  33. color: black }
  34. blockquote.epigraph {
  35. margin: 2em 5em ; }
  36. dl.docutils dd {
  37. margin-bottom: 0.5em }
  38. /* Uncomment (and remove this text!) to get bold-faced definition list terms
  39. dl.docutils dt {
  40. font-weight: bold }
  41. */
  42. div.abstract {
  43. margin: 2em 5em }
  44. div.abstract p.topic-title {
  45. font-weight: bold ;
  46. text-align: center }
  47. div.admonition, div.attention, div.caution, div.danger, div.error,
  48. div.hint, div.important, div.note, div.tip, div.warning {
  49. margin: 2em ;
  50. border: medium outset ;
  51. padding: 1em }
  52. div.admonition p.admonition-title, div.hint p.admonition-title,
  53. div.important p.admonition-title, div.note p.admonition-title,
  54. div.tip p.admonition-title {
  55. font-weight: bold ;
  56. font-family: sans-serif }
  57. div.attention p.admonition-title, div.caution p.admonition-title,
  58. div.danger p.admonition-title, div.error p.admonition-title,
  59. div.warning p.admonition-title {
  60. color: red ;
  61. font-weight: bold ;
  62. font-family: sans-serif }
  63. /* Uncomment (and remove this text!) to get reduced vertical space in
  64. compound paragraphs.
  65. div.compound .compound-first, div.compound .compound-middle {
  66. margin-bottom: 0.5em }
  67. div.compound .compound-last, div.compound .compound-middle {
  68. margin-top: 0.5em }
  69. */
  70. div.dedication {
  71. margin: 2em 5em ;
  72. text-align: center ;
  73. font-style: italic }
  74. div.dedication p.topic-title {
  75. font-weight: bold ;
  76. font-style: normal }
  77. div.figure {
  78. margin-left: 2em ;
  79. margin-right: 2em }
  80. div.footer, div.header {
  81. clear: both;
  82. font-size: smaller }
  83. div.line-block {
  84. display: block ;
  85. margin-top: 1em ;
  86. margin-bottom: 1em }
  87. div.line-block div.line-block {
  88. margin-top: 0 ;
  89. margin-bottom: 0 ;
  90. margin-left: 1.5em }
  91. div.sidebar {
  92. margin: 0 0 0.5em 1em ;
  93. border: medium outset ;
  94. padding: 1em ;
  95. background-color: #ffffee ;
  96. width: 40% ;
  97. float: right ;
  98. clear: right }
  99. div.sidebar p.rubric {
  100. font-family: sans-serif ;
  101. font-size: medium }
  102. div.system-messages {
  103. margin: 5em }
  104. div.system-messages h1 {
  105. color: red }
  106. div.system-message {
  107. border: medium outset ;
  108. padding: 1em }
  109. div.system-message p.system-message-title {
  110. color: red ;
  111. font-weight: bold }
  112. div.topic {
  113. margin: 2em }
  114. h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
  115. h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  116. margin-top: 0.4em }
  117. h1.title {
  118. text-align: center }
  119. h2.subtitle {
  120. text-align: center }
  121. hr.docutils {
  122. width: 75% }
  123. img.align-left {
  124. clear: left }
  125. img.align-right {
  126. clear: right }
  127. ol.simple, ul.simple {
  128. margin-bottom: 1em }
  129. ol.arabic {
  130. list-style: decimal }
  131. ol.loweralpha {
  132. list-style: lower-alpha }
  133. ol.upperalpha {
  134. list-style: upper-alpha }
  135. ol.lowerroman {
  136. list-style: lower-roman }
  137. ol.upperroman {
  138. list-style: upper-roman }
  139. p.attribution {
  140. text-align: right ;
  141. margin-left: 50% }
  142. p.caption {
  143. font-style: italic }
  144. p.credits {
  145. font-style: italic ;
  146. font-size: smaller }
  147. p.label {
  148. white-space: nowrap }
  149. p.rubric {
  150. font-weight: bold ;
  151. font-size: larger ;
  152. color: maroon ;
  153. text-align: center }
  154. p.sidebar-title {
  155. font-family: sans-serif ;
  156. font-weight: bold ;
  157. font-size: larger }
  158. p.sidebar-subtitle {
  159. font-family: sans-serif ;
  160. font-weight: bold }
  161. p.topic-title {
  162. font-weight: bold }
  163. pre.address {
  164. margin-bottom: 0 ;
  165. margin-top: 0 ;
  166. font-family: serif ;
  167. font-size: 100% }
  168. pre.literal-block, pre.doctest-block {
  169. margin-left: 2em ;
  170. margin-right: 2em }
  171. span.classifier {
  172. font-family: sans-serif ;
  173. font-style: oblique }
  174. span.classifier-delimiter {
  175. font-family: sans-serif ;
  176. font-weight: bold }
  177. span.interpreted {
  178. font-family: sans-serif }
  179. span.option {
  180. white-space: nowrap }
  181. span.pre {
  182. white-space: pre }
  183. span.problematic {
  184. color: red }
  185. span.section-subtitle {
  186. /* font-size relative to parent (h1..h6 element) */
  187. font-size: 80% }
  188. table.citation {
  189. border-left: solid 1px gray;
  190. margin-left: 1px }
  191. table.docinfo {
  192. margin: 2em 4em }
  193. table.docutils {
  194. margin-top: 0.5em ;
  195. margin-bottom: 0.5em }
  196. table.footnote {
  197. border-left: solid 1px black;
  198. margin-left: 1px }
  199. table.docutils td, table.docutils th,
  200. table.docinfo td, table.docinfo th {
  201. padding-left: 0.5em ;
  202. padding-right: 0.5em ;
  203. vertical-align: top }
  204. table.docutils th.field-name, table.docinfo th.docinfo-name {
  205. font-weight: bold ;
  206. text-align: left ;
  207. white-space: nowrap ;
  208. padding-left: 0 }
  209. h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
  210. h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  211. font-size: 100% }
  212. ul.auto-toc {
  213. list-style-type: none }
  214. </style>
  215. </head>
  216. <body>
  217. <div class="document">
  218. <p><strong>AnKi 3D Engine</strong></p>
  219. <p>Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos</p>
  220. <p><a class="reference external" href="http://www.ancient-ritual.com">http://www.ancient-ritual.com</a></p>
  221. <p><a class="reference external" href="mailto:godlike&#64;ancient-ritual.com">godlike&#64;ancient-ritual.com</a></p>
  222. <div class="contents topic" id="table-of-contents">
  223. <p class="topic-title first">Table of Contents</p>
  224. <ul class="simple">
  225. <li><a class="reference internal" href="#license" id="id1">License</a></li>
  226. <li><a class="reference internal" href="#building" id="id2">Building</a><ul>
  227. <li><a class="reference internal" href="#required-external-libraries" id="id3">Required external libraries</a></li>
  228. <li><a class="reference internal" href="#building-anki-and-optionally-generating-makefiles" id="id4">Building AnKi and optionally generating makefiles</a></li>
  229. </ul>
  230. </li>
  231. <li><a class="reference internal" href="#assets" id="id5">Assets</a></li>
  232. <li><a class="reference internal" href="#system-requirements" id="id6">System requirements</a></li>
  233. <li><a class="reference internal" href="#generating-source-code-documentation-doxygen" id="id7">Generating source code documentation (doxygen)</a></li>
  234. <li><a class="reference internal" href="#coding-style" id="id8">Coding style</a><ul>
  235. <li><a class="reference internal" href="#types" id="id9">Types</a></li>
  236. <li><a class="reference internal" href="#functions-variables" id="id10">Functions &amp; variables</a></li>
  237. <li><a class="reference internal" href="#constants-macros-enumerators" id="id11">Constants, macros &amp; enumerators</a></li>
  238. <li><a class="reference internal" href="#parenthesis-braces-comas-operators" id="id12">Parenthesis, braces, comas &amp; operators</a></li>
  239. <li><a class="reference internal" href="#order-in-class-definitions" id="id13">Order in class definitions</a></li>
  240. <li><a class="reference internal" href="#naming-shortcuts" id="id14">Naming shortcuts</a></li>
  241. <li><a class="reference internal" href="#controllers" id="id15">Controllers</a></li>
  242. <li><a class="reference internal" href="#submitting-patches" id="id16">Submitting patches</a></li>
  243. </ul>
  244. </li>
  245. <li><a class="reference internal" href="#todo-list" id="id17">ToDo list</a></li>
  246. </ul>
  247. </div>
  248. <div class="section" id="license">
  249. <h1><a class="toc-backref" href="#id1">License</a></h1>
  250. <p>Anki is dual licensed. The first option is GLPv3 and the second commercial
  251. license. If you want to use* AnKi to make opensource software (licensed under
  252. GLPv3) then AnKi is provited to you for free but if you want to use it* for
  253. non-GPLv3 licensed software then you have to apply for a commercial license.</p>
  254. <p>*: as a whole or parts of the source</p>
  255. </div>
  256. <div class="section" id="building">
  257. <h1><a class="toc-backref" href="#id2">Building</a></h1>
  258. <p>AnKi build system is very Linux specific (GNU make only) at the moment. It
  259. also requires a few extra development libraries.</p>
  260. <p>To download the latest version of AnKi from the SVN repository type:</p>
  261. <p>$ svn checkout <a class="reference external" href="http://anki-3d-engine.googlecode.com/svn/trunk/">http://anki-3d-engine.googlecode.com/svn/trunk/</a> anki</p>
  262. <div class="section" id="required-external-libraries">
  263. <h2><a class="toc-backref" href="#id3">Required external libraries</a></h2>
  264. <p>AnKi requires a few up to date versions of some libraries. The libraries are:</p>
  265. <ul class="simple">
  266. <li>Bullet Physics 2.77</li>
  267. <li>SDL 1.3</li>
  268. <li>GLEW 1.5.5</li>
  269. <li>boost 1.4</li>
  270. <li>libpng 1.2</li>
  271. <li>libjpeg 6b</li>
  272. <li>libpython 2.6</li>
  273. </ul>
  274. <p>Normally, in order to build AnKi you need to have all of the above libraries.
  275. Some of them are not provided from the most Linux distros or they are older
  276. versions. The libraries you have to download and build for yourself are Bullet,
  277. SDL and GLEW. The other are pretty common and you can find them almost anywhere.</p>
  278. <p>To ease the building process and to save you some time <strong>some</strong> of the above
  279. libraries are already backed and placed inside the extern directory. The backed
  280. libraries are for Linux and for x86-64 architecture. If you dont trust my
  281. binaries and/or you want to build the libs yourselves you have to download,
  282. build and install the libs in the extern directory manually. The script
  283. <em>download-externs.sh</em> downloads the libraries (it requires SVN, mercurial,
  284. CMake, autoconf) and the <em>do-externs.sh</em> builds the libraries and installs them
  285. in the extern directory. Open the files and see how it is done.</p>
  286. <p>You wont find any development files for boost, libpng, libjpeg and libpython
  287. inside the extern dir. Get them using your Linux distribution's packet manager.</p>
  288. </div>
  289. <div class="section" id="building-anki-and-optionally-generating-makefiles">
  290. <h2><a class="toc-backref" href="#id4">Building AnKi and optionally generating makefiles</a></h2>
  291. <p>Inside the build directory you can find 4 build targets containing GNU
  292. makefiles. If you want to build AnKi just type &quot;make&quot; from inside a target.</p>
  293. <p><strong>WARNING</strong>: Sometimes I forget to update all the targets. The debug is always
  294. updated though.</p>
  295. <p>AnKi uses a build system that generates the above makefiles. This build system
  296. is no longer part of AnKi and its located in a different repository. This tool
  297. is called gBuildSystem and you can find it in
  298. <a class="reference external" href="http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem">http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem</a>. Downloaded it
  299. using SVN:</p>
  300. <p>$ svn checkout <a class="reference external" href="http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem">http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem</a></p>
  301. <p>gBuildSystem only purpose is to re-generate these makefiles in case you have
  302. made changes in code structure (renaming/moving/deleting/adding files) or in the
  303. includes (#include) or your have the external libs in different paths.
  304. gBuildSystem requires the gen.cfg.py files (something like CMakeLists.txt).
  305. gen.cfg.py format is pretty straightforward and minimal.</p>
  306. <p>If you want to generate the makefile for the debug target (for example) do the
  307. following:</p>
  308. <ol class="arabic simple">
  309. <li>$ cd &lt;path to anki&gt;/build/debug</li>
  310. <li>$ &lt;path to gBuildSystem&gt;/gbs.py</li>
  311. </ol>
  312. <p>To build:</p>
  313. <p>$ make</p>
  314. <p>And the build process will begin.</p>
  315. </div>
  316. </div>
  317. <div class="section" id="assets">
  318. <h1><a class="toc-backref" href="#id5">Assets</a></h1>
  319. <p>Currently there are no assets (models, textures, materials etc) so even if you
  320. build it, the application will fail to run.</p>
  321. </div>
  322. <div class="section" id="system-requirements">
  323. <h1><a class="toc-backref" href="#id6">System requirements</a></h1>
  324. <p>The engine requires:</p>
  325. <ul class="simple">
  326. <li>GPU with shader model 4</li>
  327. <li>Linux OS</li>
  328. <li>Proprietary GPU drivers</li>
  329. </ul>
  330. <p>Development rig: Ubuntu 10.04, AMD Radeon 4870 w/ Catalyst 10.04. So it should
  331. be working on similar systems.</p>
  332. </div>
  333. <div class="section" id="generating-source-code-documentation-doxygen">
  334. <h1><a class="toc-backref" href="#id7">Generating source code documentation (doxygen)</a></h1>
  335. <p>The AnKi source code uses doxygen style comments in almost every file. To
  336. generate the documentation you need doxygen (<a class="reference external" href="http://www.doxygen.org/">http://www.doxygen.org/</a>). From a
  337. terminal type:</p>
  338. <ol class="arabic simple">
  339. <li>$ cd docs</li>
  340. <li>$ doxygen doxyfile</li>
  341. </ol>
  342. <p>Then open doxygen.html to see it.</p>
  343. </div>
  344. <div class="section" id="coding-style">
  345. <h1><a class="toc-backref" href="#id8">Coding style</a></h1>
  346. <p>Every project has some rules and here are some things to remember while coding
  347. AnKi.</p>
  348. <div class="section" id="types">
  349. <h2><a class="toc-backref" href="#id9">Types</a></h2>
  350. <p>The classes, structs, typedefs, enums etc must be capitalized eg <em>ThisIsAClass</em></p>
  351. </div>
  352. <div class="section" id="functions-variables">
  353. <h2><a class="toc-backref" href="#id10">Functions &amp; variables</a></h2>
  354. <p>All functions (including class methods) and all variables are mixed case.</p>
  355. <p>All functions should have a verb inside them eg <em>doSomething()</em></p>
  356. <p>All variables should not have verbs eg <em>oneVariable</em></p>
  357. </div>
  358. <div class="section" id="constants-macros-enumerators">
  359. <h2><a class="toc-backref" href="#id11">Constants, macros &amp; enumerators</a></h2>
  360. <p>All constants, macros and enumerators are capital with undercores eg <em>#define
  361. MACRO(x)</em> or <em>const int ONE_INT = 10;</em></p>
  362. <p>All the constants should be defined without using the preprocessor eg dont write
  363. <em>#define ONE_INT 10</em></p>
  364. <p>All enumerators have the first letters of the enum as prefix eg
  365. <em>enum CarColors { CC_BLUE, CC_GREEN };</em></p>
  366. </div>
  367. <div class="section" id="parenthesis-braces-comas-operators">
  368. <h2><a class="toc-backref" href="#id12">Parenthesis, braces, comas &amp; operators</a></h2>
  369. <p>After opening parenthesis and before closing it there is no spaces, same for
  370. square brackets. Before and after an operator there is always a space</p>
  371. <p>eg <em>((mat1 * 10) + 10)</em> or <em>setWidth(100)</em> or <em>int arr[100 + 1];</em></p>
  372. <p>After a coma there is a space eg <em>setSize(10, 20)</em></p>
  373. </div>
  374. <div class="section" id="order-in-class-definitions">
  375. <h2><a class="toc-backref" href="#id13">Order in class definitions</a></h2>
  376. <p>class</p>
  377. <p>{</p>
  378. <blockquote>
  379. <p>friends</p>
  380. <p>pre-nested (very rare)</p>
  381. <p>nested</p>
  382. <p>properties</p>
  383. <p>public</p>
  384. <p>protected</p>
  385. <p>private</p>
  386. </blockquote>
  387. <p>}</p>
  388. <p>inlines</p>
  389. </div>
  390. <div class="section" id="naming-shortcuts">
  391. <h2><a class="toc-backref" href="#id14">Naming shortcuts</a></h2>
  392. <p>This list contains some of the naming shortcuts we use in AnKi. This is because
  393. we are bored to type:</p>
  394. <ul class="simple">
  395. <li>Array : arr</li>
  396. <li>Animation : anim</li>
  397. <li>Application : app</li>
  398. <li>Buffer : buff</li>
  399. <li>Camera : cam</li>
  400. <li>Color : col</li>
  401. <li>Controller : ctrl</li>
  402. <li>Current : crnt</li>
  403. <li>Feature : feat</li>
  404. <li>Fragment : frag</li>
  405. <li>Framebuffer Attachable Image : fai</li>
  406. <li>Geometry : geom</li>
  407. <li>Location : loc</li>
  408. <li>Material : mtl</li>
  409. <li>Matrix : mat</li>
  410. <li>Number : num</li>
  411. <li>Physics : phy</li>
  412. <li>Position : pos</li>
  413. <li>Property : prop</li>
  414. <li>Quadrilateral : quad</li>
  415. <li>Quaternion : quat</li>
  416. <li>Resource : rsrc</li>
  417. <li>Rotation : rot</li>
  418. <li>Shader : shdr</li>
  419. <li>Shader Program : shaderProg or sProg</li>
  420. <li>Skeletal Animation : sAnim</li>
  421. <li>Skeleton : skel</li>
  422. <li>Text : txt</li>
  423. <li>Texture : tex</li>
  424. <li>Transformation : trf</li>
  425. <li>Transform Feedback : trffb</li>
  426. <li>Translation : tsl</li>
  427. <li>Triangle : tri</li>
  428. <li>Utility : util</li>
  429. <li>Variable : var</li>
  430. <li>Vector : vec</li>
  431. <li>Vertex : vert</li>
  432. </ul>
  433. <p>Anything else should be typed full.</p>
  434. </div>
  435. <div class="section" id="controllers">
  436. <h2><a class="toc-backref" href="#id15">Controllers</a></h2>
  437. <p>The controllers are part of the scene node objects. They control the node's
  438. behaviour.</p>
  439. <p>They have an input (script, animation, etc) and they control a scene node. The
  440. naming convention of the controllers is:</p>
  441. <p>&lt;what the controller controls&gt;&lt;the input of the contoller&gt;Ctrl</p>
  442. <p>For Example:</p>
  443. <p>MeshSkelNodeCtrl A Mesh is controlled by a SkelNode</p>
  444. </div>
  445. <div class="section" id="submitting-patches">
  446. <h2><a class="toc-backref" href="#id16">Submitting patches</a></h2>
  447. <p>If you want to update/patch a file (for example Main.cpp) do:</p>
  448. <ul class="simple">
  449. <li>Make the changes on that file</li>
  450. <li>Save the differences in a file using &quot;svn diff Main.cpp &gt; /tmp/diff&quot;</li>
  451. <li>E-mail the &quot;diff&quot; file with subject &quot;[PATCH] Main.cpp updates&quot;</li>
  452. </ul>
  453. </div>
  454. </div>
  455. <div class="section" id="todo-list">
  456. <h1><a class="toc-backref" href="#id17">ToDo list</a></h1>
  457. <ul>
  458. <li><p class="first">Continue working on the new coding style in shaders</p>
  459. </li>
  460. <li><p class="first">Changes in the blending objects problem. The BS will become one stage and the
  461. PPS will be divided in two steps. The first will apply the SSAO and the EdgeAA
  462. in the IS_FAI and the second will do the rest</p>
  463. </li>
  464. <li><p class="first">The second Physics demo: Create a box that is geting moved by the user. It has
  465. to interact with the other boxes</p>
  466. </li>
  467. <li><p class="first">Set the gravity of a certain body to a lower value and see how it behaves</p>
  468. </li>
  469. <li><p class="first">In the Ragdoll bullet demo try to change the distances of the bodies</p>
  470. </li>
  471. <li><dl class="first docutils">
  472. <dt>Ask in the bullet forum:</dt>
  473. <dd><ul class="first last simple">
  474. <li>How to make floating particles like smoke. But first try with one body and
  475. manualy setting the gravity</li>
  476. <li>What the btCollisionObject::setActivationState takes as parameter?</li>
  477. </ul>
  478. </dd>
  479. </dl>
  480. </li>
  481. <li><p class="first">Re-enable the stencil tex in Ms.cpp and replace all the stencil buffers with
  482. that (Smo, Bs) to save memory</p>
  483. </li>
  484. <li><p class="first">See if the restrictions in FBOs (all FAIs same size) still apply</p>
  485. </li>
  486. <li><p class="first">See what happens if I write <em>#pragma anki attribute &lt;randName&gt; 10</em> where
  487. randName does not exist. Do the same for tranform feedback varyings</p>
  488. </li>
  489. </ul>
  490. </div>
  491. </div>
  492. </body>
  493. </html>