manual.rst 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. **AnKi 3D Engine**
  2. Copyright (C) 2009-2011 Panayiotis Christopoulos-Charitos
  3. http://www.anki3d.org
  4. [email protected]
  5. .. contents:: Table of Contents
  6. =======
  7. License
  8. =======
  9. Anki is dual licensed. The first option is GLPv3 and the second commercial
  10. license. If you want to use* AnKi to make opensource software (licensed under
  11. GLPv3) then AnKi is provited to you for free but if you want to use it* for
  12. non-GPLv3 licensed software then you have to apply for a commercial license.
  13. \*: as a whole or parts of the source
  14. ========
  15. Building
  16. ========
  17. AnKi build system is very Linux specific (GNU make only) at the moment. It
  18. also requires a few extra development libraries.
  19. To download the latest version of AnKi from the SVN repository type:
  20. $ svn checkout http://anki-3d-engine.googlecode.com/svn/trunk/ anki
  21. Required external libraries
  22. ---------------------------
  23. AnKi requires a few up to date versions of some libraries. The libraries are:
  24. - Bullet Physics 2.77
  25. - SDL 1.3
  26. - GLEW 1.5.5
  27. - boost 1.4
  28. - libpng 1.2
  29. - libjpeg 6b
  30. - libpython 2.6
  31. Normally, in order to build AnKi you need to have all of the above libraries.
  32. Some of them are not provided from the most Linux distros or they are older
  33. versions. The libraries you have to download and build for yourself are Bullet,
  34. SDL and GLEW. The other are pretty common and you can find them almost anywhere.
  35. To ease the building process and to save you some time **some** of the above
  36. libraries are already backed and placed inside the extern directory. The backed
  37. libraries are for Linux and for x86-64 architecture. If you dont trust my
  38. binaries and/or you want to build the libs yourselves you have to download,
  39. build and install the libs in the extern directory manually. The script
  40. *download-externs.sh* downloads the libraries (it requires SVN, mercurial,
  41. CMake, autoconf) and the *do-externs.sh* builds the libraries and installs them
  42. in the extern directory. Open the files and see how it is done.
  43. You wont find any development files for boost, libpng, libjpeg and libpython
  44. inside the extern dir. Get them using your Linux distribution's packet manager.
  45. Building AnKi and optionally generating makefiles
  46. -------------------------------------------------
  47. Inside the build directory you can find 4 build targets containing GNU
  48. makefiles. If you want to build AnKi just type "make" from inside a target.
  49. **WARNING**: Sometimes I forget to update all the targets. The debug is always
  50. updated though.
  51. AnKi uses a build system that generates the above makefiles. This build system
  52. is no longer part of AnKi and its located in a different repository. This tool
  53. is called gBuildSystem and you can find it in
  54. http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem. Downloaded it
  55. using SVN:
  56. $ svn checkout http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem
  57. gBuildSystem only purpose is to re-generate these makefiles in case you have
  58. made changes in the code structure (renaming/moving/deleting/adding files) or in
  59. the included header files (#include) or your have the external libs in different
  60. paths. gBuildSystem requires the gen.cfg.py files (something like
  61. CMakeLists.txt). gen.cfg.py format is pretty straightforward and minimal.
  62. If you want to generate the makefile for the debug target (for example) do the
  63. following:
  64. #) $ cd <path to anki>/build/debug
  65. #) $ <path to gBuildSystem>/gbs.py
  66. To build:
  67. $ make
  68. And the build process will begin.
  69. ======
  70. Assets
  71. ======
  72. Currently there are no assets (models, textures, materials etc) so even if you
  73. build it, the application will fail to run.
  74. ===================
  75. System requirements
  76. ===================
  77. The engine requires:
  78. - GPU with shader model 4
  79. - Linux OS
  80. - Proprietary GPU drivers
  81. Development rig: Ubuntu 10.10, AMD Radeon 4870 w/ Catalyst 10.10. So it should
  82. be working on similar systems.
  83. ==============================================
  84. Generating source code documentation (doxygen)
  85. ==============================================
  86. The AnKi source code uses doxygen style comments in almost every file. To
  87. generate the documentation you need doxygen (http://www.doxygen.org/). From a
  88. terminal type:
  89. #) $ cd docs
  90. #) $ doxygen doxyfile
  91. Then open doxygen.html to see it.
  92. ============
  93. Coding style
  94. ============
  95. Every project has some rules and here are some things to remember while coding
  96. AnKi.
  97. Types
  98. -----
  99. The classes, structs, typedefs, enums etc must be capitalized eg *ThisIsAClass*
  100. Functions & variables
  101. ---------------------
  102. All functions (including class methods) and all variables are mixed case.
  103. All functions should have a verb inside them eg *doSomething()*
  104. All variables should not have verbs eg *oneVariable*
  105. Constants, macros & enumerators
  106. -------------------------------
  107. All constants, macros and enumerators are capital with undercores eg *#define
  108. MACRO(x)* or *const int ONE_INT = 10;*
  109. All the constants should be defined without using the preprocessor eg dont write
  110. *#define ONE_INT 10*
  111. All enumerators have the first letters of the enum as prefix eg
  112. *enum CarColors { CC_BLUE, CC_GREEN };*
  113. Parenthesis, braces, comas & operators
  114. --------------------------------------
  115. After opening parenthesis and before closing it there is no spaces, same for
  116. square brackets. Before and after an operator there is always a space
  117. eg *((mat1 * 10) + 10)* or *setWidth(100)* or *int arr[100 + 1];*
  118. After a coma there is a space eg *setSize(10, 20)*
  119. Order in class definitions
  120. --------------------------
  121. class
  122. {
  123. friends
  124. pre-nested (very rare)
  125. nested
  126. properties
  127. public
  128. protected
  129. private
  130. }
  131. inlines
  132. Naming shortcuts
  133. ----------------
  134. This list contains some of the naming shortcuts we use in AnKi. This is because
  135. we are bored to type:
  136. - Array : arr
  137. - Animation : anim
  138. - Application : app
  139. - Buffer : buff
  140. - Camera : cam
  141. - Color : col
  142. - Controller : ctrl
  143. - Current : crnt
  144. - Feature : feat
  145. - Fragment : frag
  146. - Framebuffer Attachable Image : fai
  147. - Geometry : geom
  148. - Location : loc
  149. - Material : mtl
  150. - Matrix : mat
  151. - Number : num
  152. - Physics : phy
  153. - Position : pos
  154. - Property : prop
  155. - Quadrilateral : quad
  156. - Quaternion : quat
  157. - Resource : rsrc
  158. - Rotation : rot
  159. - Shader : shdr
  160. - Shader Program : shaderProg or sProg
  161. - Skeletal Animation : sAnim
  162. - Skeleton : skel
  163. - Text : txt
  164. - Texture : tex
  165. - Transformation : trf
  166. - Transform Feedback : trffb
  167. - Translation : tsl
  168. - Triangle : tri
  169. - Utility : util
  170. - Variable : var
  171. - Vector : vec
  172. - Vertex : vert
  173. Anything else should be typed full.
  174. Controllers
  175. -----------
  176. The controllers are part of the scene node objects. They control the node's
  177. behaviour.
  178. They have an input (script, animation, etc) and they control a scene node. The
  179. naming convention of the controllers is:
  180. <what the controller controls><the input of the contoller>Ctrl
  181. For Example:
  182. MeshSkelNodeCtrl A Mesh is controlled by a SkelNode
  183. GLSL shaders
  184. ------------
  185. The same rules apply to GLSL shaders but with a few changes:
  186. All the vars you can find in a GLSL shader program are either attributes,
  187. uniforms or in/out vars (varyings) and everything else. The attributes and
  188. uniforms are mixed case. The in/out vars are mixed case as well but they have a
  189. prefix string that indicates their output. For example if a var is output from
  190. the vertex shader it will have a 'v' before its name. The In detail:
  191. v: Vertex shader
  192. tc: Tessellation control shader
  193. te: Tessellation evaluation shader
  194. g: Geometry shader
  195. f: Fragment shader
  196. All the other variables (locals and globals) inside the code are mixed case but
  197. with a leading and a following underscore.
  198. Submitting patches
  199. ------------------
  200. If you want to update/patch a file (for example Main.cpp) do:
  201. - Make the changes on that file
  202. - Save the differences in a file using "svn diff Main.cpp > /tmp/diff"
  203. - E-mail the "diff" file with subject "[PATCH] Main.cpp updates"
  204. =========
  205. ToDo list
  206. =========
  207. - Continue working on the new coding style in shaders
  208. - Changes in the blending objects problem. The BS will become one stage and the
  209. PPS will be divided in two steps. The first will apply the SSAO and the EdgeAA
  210. in the IS_FAI and the second will do the rest
  211. - The second Physics demo: Create a box that is geting moved by the user. It has
  212. to interact with the other boxes
  213. - Set the gravity of a certain body to a lower value and see how it behaves
  214. - In the Ragdoll bullet demo try to change the distances of the bodies
  215. - Ask in the bullet forum:
  216. - How to make floating particles like smoke. But first try with one body and
  217. manualy setting the gravity
  218. - What the btCollisionObject::setActivationState takes as parameter?
  219. - Re-enable the stencil tex in Ms.cpp and replace all the stencil buffers with
  220. that (Smo, Bs) to save memory
  221. - See if the restrictions in FBOs (all FAIs same size) still apply
  222. - See what happens if I write *#pragma anki attribute <randName> 10* where
  223. randName does not exist. Do the same for tranform feedback varyings