manual.rst 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. **AnKi 3D Engine**
  2. Copyright (C) 2009-2013 Panagiotis Christopoulos-Charitos
  3. http://www.anki3d.org
  4. [email protected]
  5. .. contents:: Table of Contents
  6. =======
  7. License
  8. =======
  9. Anki is dual licensed. Simply put, you can use* it freely to create opensource
  10. software under GPLv3 and if you want to use* it for commercial you need to
  11. apply for a commercial licence.
  12. \*: as a whole or parts of the source
  13. ========
  14. Building
  15. ========
  16. AnKi build system is build over the popular CMake.
  17. To download the latest version of AnKi from the SVN repository type: ::
  18. svn checkout http://anki-3d-engine.googlecode.com/svn/trunk/ anki
  19. to build: ::
  20. cd path/to/anki
  21. cd build
  22. cmake -DCMAKE_BUILD_TYPE=Release ..
  23. make
  24. to build the doxygen documentation: ::
  25. make doc
  26. Required external libraries
  27. ---------------------------
  28. A great effort was made to keep the number of external dependencies to minimum
  29. so the only prerequisites are the following:
  30. - X11 development files (Package name under Ubuntu: libx11-dev)
  31. - Mesa GL development files (Package name under Ubuntu: mesa-common-dev)
  32. All the other libraries are inside the source tree and you don't have to worry
  33. about them.
  34. ======
  35. Assets
  36. ======
  37. Currently there are no assets (models, textures, materials etc) so even if you
  38. build it, the application will fail to run.
  39. ===================
  40. System requirements
  41. ===================
  42. The engine requires:
  43. - GPU with shader model 4
  44. - Linux OS
  45. - Proprietary GPU drivers
  46. Development rig: Ubuntu 11.10, nVidia 560 Ti. So it should be working on
  47. similar systems.
  48. ============
  49. Coding style
  50. ============
  51. Every project has some rules and here are some things to remember while coding
  52. AnKi.
  53. Types
  54. -----
  55. The classes, structs, typedefs, enums etc must be capitalized eg *ThisIsAClass*
  56. Functions & variables
  57. ---------------------
  58. All functions (including class methods) and all variables are mixed case.
  59. All functions should have a verb inside them eg *doSomething()*
  60. All variables should not have verbs eg *oneVariable*
  61. Constants, macros & enumerators
  62. -------------------------------
  63. All constants, macros and enumerators are capital with undercores eg *#define
  64. MACRO(x)* or *const int ONE_INT = 10;*
  65. All the constants should be defined without using the preprocessor eg dont write
  66. *#define ONE_INT 10*
  67. All enumerators have the first letters of the enum as prefix eg
  68. *enum CarColors { CC_BLUE, CC_GREEN };*
  69. Parenthesis, braces, comas & operators
  70. --------------------------------------
  71. After opening parenthesis and before closing it there is no spaces, same for
  72. square brackets. Before and after an operator there is always a space
  73. eg *((mat1 * 10) + 10)* or *setWidth(100)* or *int arr[100 + 1];*
  74. After a coma there is a space eg *setSize(10, 20)*
  75. Order in class definitions
  76. --------------------------
  77. class
  78. {
  79. friends
  80. pre-nested (very rare)
  81. nested
  82. properties
  83. public
  84. protected
  85. private
  86. }
  87. inlines
  88. Naming shortcuts
  89. ----------------
  90. This list contains some of the naming shortcuts we use in AnKi. This is because
  91. we are bored to type:
  92. - Array : arr
  93. - Animation : anim
  94. - Application : app
  95. - Buffer : buff
  96. - Camera : cam
  97. - Color : col
  98. - Controller : ctrl
  99. - Current : crnt
  100. - Feature : feat
  101. - Fragment : frag
  102. - Framebuffer Attachable Image : fai
  103. - Geometry : geom
  104. - Location : loc
  105. - Material : mtl
  106. - Matrix : mat
  107. - Number : num
  108. - Physics : phy
  109. - Position : pos
  110. - Property : prop
  111. - Quadrilateral : quad
  112. - Quaternion : quat
  113. - Resource : rsrc
  114. - Rotation : rot
  115. - Shader : shdr
  116. - Shader Program : shaderProg or sProg
  117. - Skeletal Animation : sAnim
  118. - Skeleton : skel
  119. - Text : txt
  120. - Texture : tex
  121. - Transformation : trf
  122. - Transform Feedback : trffb
  123. - Translation : tsl
  124. - Triangle : tri
  125. - Utility : util
  126. - Variable : var
  127. - Vector : vec
  128. - Vertex : vert
  129. Anything else should be typed full.
  130. Controllers
  131. -----------
  132. The controllers are part of the scene node objects. They control the node's
  133. behaviour.
  134. They have an input (script, animation, etc) and they control a scene node. The
  135. naming convention of the controllers is:
  136. <what the controller controls><the input of the contoller>Ctrl
  137. For Example:
  138. MeshSkelNodeCtrl A Mesh is controlled by a SkelNode
  139. GLSL shaders
  140. ------------
  141. The same rules apply to GLSL shaders but with a few changes:
  142. All the vars you can find in a GLSL shader program are either attributes,
  143. uniforms or in/out vars (varyings) and everything else. The attributes and
  144. uniforms are mixed case. The in/out vars are mixed case as well but they have a
  145. prefix string that indicates their output. For example if a var is output from
  146. the vertex shader it will have a 'v' before its name. The In detail:
  147. v: Vertex shader
  148. tc: Tessellation control shader
  149. te: Tessellation evaluation shader
  150. g: Geometry shader
  151. f: Fragment shader
  152. All the other variables (locals and globals) inside the code are mixed case but
  153. with a leading and a following underscore.
  154. Submitting patches
  155. ------------------
  156. If you want to update/patch a file (for example Main.cpp) do:
  157. - Make the changes on that file
  158. - Save the differences in a file using "svn diff Main.cpp > /tmp/diff"
  159. - E-mail the "diff" file with subject "[PATCH] Main.cpp updates"
  160. =========
  161. ToDo list
  162. =========
  163. - Continue working on the new coding style in shaders
  164. - Changes in the blending objects problem. The BS will become one stage and the
  165. PPS will be divided in two steps. The first will apply the SSAO and the EdgeAA
  166. in the IS_FAI and the second will do the rest
  167. - The second Physics demo: Create a box that is geting moved by the user. It has
  168. to interact with the other boxes
  169. - Set the gravity of a certain body to a lower value and see how it behaves
  170. - In the Ragdoll bullet demo try to change the distances of the bodies
  171. - Ask in the bullet forum:
  172. - How to make floating particles like smoke. But first try with one body and
  173. manualy setting the gravity
  174. - What the btCollisionObject::setActivationState takes as parameter?
  175. - Re-enable the stencil tex in Ms.cpp and replace all the stencil buffers with
  176. that (Smo, Bs) to save memory
  177. - See if the restrictions in FBOs (all FAIs same size) still apply
  178. - See what happens if I write *#pragma anki attribute <randName> 10* where
  179. randName does not exist. Do the same for tranform feedback varyings