manual 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. **AnKi 3D Engine**
  2. Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos
  3. http://www.ancient-ritual.com
  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 release from the SVN repository type:
  20. $ svn checkout http://anki-3d-engine.googlecode.com/svn/trunk/ anki
  21. Required libraries
  22. ------------------
  23. AnKi requires a few up to date versions of some libraries. The libraries are:
  24. - Bullet Physics
  25. - SDL ver 1.3
  26. - SDL_image
  27. - GLEW
  28. - boost
  29. So before generating makefiles and building AnKi you have to download (from
  30. the revision control repositories) and build some of the above libraries.
  31. Instructions follow. You can alternately use the script
  32. *download-and-build-externals.sh*
  33. Bullet Physics
  34. ~~~~~~~~~~~~~~
  35. From now on the AnKi requires the Bullet physics library. You need CMake and
  36. SVN installed.
  37. #) $ cd <path to anki>
  38. #) $ cd ..
  39. #) $ svn checkout http://bullet.googlecode.com/svn/trunk/ bullet
  40. #) $ cd bullet
  41. #) $ cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
  42. #) $ make
  43. SDL ver 1.3
  44. ~~~~~~~~~~~
  45. We need SDL ver 1.3 for creating OpenGL 3.x context. You need to have the
  46. Mercurial and autoconf installed.
  47. #) $ cd <path to anki>
  48. #) $ cd ..
  49. #) $ hg clone http://hg.libsdl.org/SDL SDL
  50. #) $ cd SDL
  51. #) $ ./autogen.sh
  52. #) $ ./configure
  53. #) $ make
  54. SDL_image
  55. ~~~~~~~~~
  56. SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
  57. SDL_image needs Mercurial and autoconf installed.
  58. #) $ cd <path to anki>
  59. #) $ cd ..
  60. #) $ hg clone http://hg.libsdl.org/SDL_image SDL_image
  61. #) $ cd SDL_image
  62. #) $ ./autogen.sh
  63. #) $ ./configure
  64. #) $ make
  65. GLEW
  66. ~~~~
  67. The latest GLEW provides us with OpenGL 3 and 4 extensions. Needs SVN and a
  68. Unix environment (for step 5).
  69. #) $ cd <path to anki>
  70. #) $ cd ..
  71. #) $ svn co https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew glew
  72. #) $ cd glew
  73. #) $ make extensions
  74. #) $ make
  75. boost
  76. ~~~~~
  77. Boost is pretty big to download and build from SVN, also it doesnt need to be in
  78. the lattest version. The Linux distribution's version will do the trick so
  79. install it using the packet manager of your choice.
  80. In Ubuntu type: $ sudo apt-get install libboost<version>-dev-all
  81. Building AnKi and optionally generating makefiles
  82. -------------------------------------------------
  83. Inside the build directory you can find 4 build targets containing GNU
  84. makefiles. If you want to build AnKi just type "make".
  85. **WARNING**: Sometimes I forget to update all the targets. The debug is always
  86. updated though.
  87. AnKi uses a build system that generates the above makefiles. This build system
  88. is no longer part of AnKi and its located in a different repository. This tool
  89. is called gBuildSystem and you can find it in
  90. http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem. Downloaded it
  91. using SVN:
  92. $ svn checkout http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem
  93. gBuildSystem only purpose is to re-generate these makefiles in case you have
  94. made changes in code structure (renaming/moving/deleting/adding files) or in the
  95. includes (#include) or your have the external libs in different paths.
  96. gBuildSystem requires the gen.cfg.py files (something like CMakeLists.txt).
  97. gen.cfg.py format is pretty straightforward and minimal.
  98. If you want to generate the makefile for the debug target (for example) do the
  99. following:
  100. #) $ cd <path to anki>/build/debug
  101. #) $ <path to gBuildSystem>/gbs.py
  102. #) $ make
  103. And the build process will begin.
  104. ======
  105. Assets
  106. ======
  107. Currently there are no assets (models, textures, materials etc) so even if you
  108. build it, the application will fail to run.
  109. ===================
  110. System requirements
  111. ===================
  112. The engine requires:
  113. - GPU with shader model 4
  114. - Linux OS
  115. - Proprietary GPU drivers
  116. Development rig: Ubuntu 10.04, AMD Radeon 4870 w/ Catalyst 10.04. So it should
  117. be working on similar systems.
  118. ==============================================
  119. Generating source code documentation (doxygen)
  120. ==============================================
  121. The AnKi source code uses doxygen style comments in almost every file. To
  122. generate the documentation you need doxygen (http://www.doxygen.org/). From a
  123. terminal type:
  124. #) $ cd docs
  125. #) $ doxygen doxyfile
  126. Then open doxygen.html to see it.
  127. ============
  128. Coding style
  129. ============
  130. Every project has some rules and here are some things to remember while coding
  131. AnKi.
  132. Types
  133. -----
  134. The classes, structs, typedefs, enums etc must be capitalized eg *ThisIsAClass*
  135. Functions & variables
  136. ---------------------
  137. All functions (including class methods) and all variables are mixed case.
  138. All functions should have a verb inside them eg *doSomething()*
  139. All variables should not have verbs eg *oneVariable*
  140. Constants, macros & enumerators
  141. -------------------------------
  142. All constants, macros and enumerators are capital with undercores eg *#define
  143. MACRO(x)* or *const int ONE_INT = 10;*
  144. All the constants should be defined without using the preprocessor eg dont write
  145. *#define ONE_INT 10*
  146. All enumerators have the first letters of the enum as prefix eg
  147. *enum CarColors { CC_BLUE, CC_GREEN };*
  148. Parenthesis, braces, comas & operators
  149. --------------------------------------
  150. After opening parenthesis and before closing it there is no spaces, same for
  151. square brackets. Before and after an operator there is always a space
  152. eg *((mat1 * 10) + 10)* or *setWidth(100)* or *int arr[100 + 1];*
  153. After a coma there is a space eg *setSize(10, 20)*
  154. Order in class definitions
  155. --------------------------
  156. class
  157. {
  158. friends
  159. pre-nested (very rare)
  160. nested
  161. properties
  162. public
  163. protected
  164. private
  165. }
  166. inlines
  167. Material shader program naming
  168. ------------------------------
  169. dnspgke:
  170. - diffuse mapping
  171. - normal mapping
  172. - specular mapping
  173. - parallax mapping
  174. - grass like
  175. - hardware skinning
  176. - environment mapping
  177. Naming shortcuts
  178. ----------------
  179. This list contains some of the naming shortcuts we use in AnKi. This is because
  180. we are bored to type:
  181. - Array : arr
  182. - Animation : anim
  183. - Application : app
  184. - Buffer : buff
  185. - Camera : cam
  186. - Color : col
  187. - Controller : ctrl
  188. - Current : crnt
  189. - Feature : feat
  190. - Fragment : frag
  191. - Framebuffer Attachable Image : fai
  192. - Geometry : geom
  193. - Location : loc
  194. - Material : mtl
  195. - Matrix : mat
  196. - Number : num
  197. - Physics : phy
  198. - Position : pos
  199. - Property : prop
  200. - Quadrilateral : quad
  201. - Quaternion : quat
  202. - Resource : rsrc
  203. - Rotation : rot
  204. - Shader : shdr
  205. - Shader Program : shaderProg or sProg
  206. - Skeletal Animation : sAnim
  207. - Skeleton : skel
  208. - Text : txt
  209. - Texture : tex
  210. - Transformation : trf
  211. - Transform Feedback : trffb
  212. - Translation : tsl
  213. - Triangle : tri
  214. - Utility : util
  215. - Variable : var
  216. - Vector : vec
  217. - Vertex : vert
  218. Anything else should be typed full.
  219. Controllers
  220. -----------
  221. The controllers are part of the scene node objects. They control the node's
  222. behaviour.
  223. They have an input (script, animation, etc) and they control a scene node. The
  224. naming convention of the controllers is:
  225. <what the controller controls><the input of the contoller>Ctrl
  226. For Example:
  227. MeshSkelNodeCtrl A Mesh is controlled by a SkelNode
  228. Submitting patches
  229. ------------------
  230. If you want to update/patch a file (for example Main.cpp) do:
  231. - Make the changes on that file
  232. - Save the differences in a file using "svn diff Main.cpp > /tmp/diff"
  233. - E-mail the "diff" file with subject "[PATCH] Main.cpp updates"
  234. =========
  235. ToDo list
  236. =========
  237. - Continue working on the new coding style in shaders
  238. - Changes in the blending objects problem. The BS will become one stage and the
  239. PPS will be divided in two steps. The first will apply the SSAO and the EdgeAA
  240. in the IS_FAI and the second will do the rest
  241. - The second Physics demo: Create a box that is geting moved by the user. It has
  242. to interact with the other boxes
  243. - Set the gravity of a certain body to a lower value and see how it behaves
  244. - In the Ragdoll bullet demo try to change the distances of the bodies
  245. - Ask in the bullet forum:
  246. - How to make floating particles like smoke. But first try with one body and
  247. manualy setting the gravity
  248. - What the btCollisionObject::setActivationState takes as parameter?
  249. - Re-enable the stencil tex in Ms.cpp and replace all the stencil buffers with
  250. that (Smo, Bs) to save memory
  251. - See if the restrictions in FBOs (all FAIs same size) still apply
  252. - See what happens if I write *#pragma anki attribute <randName> 10* where
  253. randName does not exist. Do the same for tranform feedback varyings