jax 0.0.0.9 → 0.0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. data/CHANGELOG +6 -0
  2. data/jax.gemspec +6 -2
  3. data/lib/jax/generators/app/templates/public/javascripts/jax.js +1 -1
  4. data/lib/jax/version.rb +1 -1
  5. metadata +3 -533
  6. data/guides/assets/images/book_icon.gif +0 -0
  7. data/guides/assets/images/bullet.gif +0 -0
  8. data/guides/assets/images/chapters_icon.gif +0 -0
  9. data/guides/assets/images/check_bullet.gif +0 -0
  10. data/guides/assets/images/credits_pic_blank.gif +0 -0
  11. data/guides/assets/images/edge_badge.png +0 -0
  12. data/guides/assets/images/feature_tile.gif +0 -0
  13. data/guides/assets/images/footer_tile.gif +0 -0
  14. data/guides/assets/images/getting_started/clean_passing_jasmine_suite.png +0 -0
  15. data/guides/assets/images/getting_started/dungeon-complete.png +0 -0
  16. data/guides/assets/images/getting_started/dungeon-normal-map.png +0 -0
  17. data/guides/assets/images/getting_started/dungeon-rainbow-textured.png +0 -0
  18. data/guides/assets/images/getting_started/dungeon-rainbow.png +0 -0
  19. data/guides/assets/images/getting_started/dungeon-textured-lighting.png +0 -0
  20. data/guides/assets/images/getting_started/dungeon-textured.png +0 -0
  21. data/guides/assets/images/getting_started/rock.png +0 -0
  22. data/guides/assets/images/getting_started/rock_normal.png +0 -0
  23. data/guides/assets/images/getting_started/teapot-red-directional-point.png +0 -0
  24. data/guides/assets/images/getting_started/teapot-red-directional.png +0 -0
  25. data/guides/assets/images/getting_started/teapot-red-nolight.png +0 -0
  26. data/guides/assets/images/getting_started/teapot-red-spot-point-directional.png +0 -0
  27. data/guides/assets/images/getting_started/teapot-white.png +0 -0
  28. data/guides/assets/images/getting_started/teapot-with-model.png +0 -0
  29. data/guides/assets/images/grey_bullet.gif +0 -0
  30. data/guides/assets/images/header_backdrop.png +0 -0
  31. data/guides/assets/images/header_tile.gif +0 -0
  32. data/guides/assets/images/icons/README +0 -5
  33. data/guides/assets/images/icons/callouts/1.png +0 -0
  34. data/guides/assets/images/icons/callouts/10.png +0 -0
  35. data/guides/assets/images/icons/callouts/11.png +0 -0
  36. data/guides/assets/images/icons/callouts/12.png +0 -0
  37. data/guides/assets/images/icons/callouts/13.png +0 -0
  38. data/guides/assets/images/icons/callouts/14.png +0 -0
  39. data/guides/assets/images/icons/callouts/15.png +0 -0
  40. data/guides/assets/images/icons/callouts/2.png +0 -0
  41. data/guides/assets/images/icons/callouts/3.png +0 -0
  42. data/guides/assets/images/icons/callouts/4.png +0 -0
  43. data/guides/assets/images/icons/callouts/5.png +0 -0
  44. data/guides/assets/images/icons/callouts/6.png +0 -0
  45. data/guides/assets/images/icons/callouts/7.png +0 -0
  46. data/guides/assets/images/icons/callouts/8.png +0 -0
  47. data/guides/assets/images/icons/callouts/9.png +0 -0
  48. data/guides/assets/images/icons/caution.png +0 -0
  49. data/guides/assets/images/icons/example.png +0 -0
  50. data/guides/assets/images/icons/home.png +0 -0
  51. data/guides/assets/images/icons/important.png +0 -0
  52. data/guides/assets/images/icons/next.png +0 -0
  53. data/guides/assets/images/icons/note.png +0 -0
  54. data/guides/assets/images/icons/prev.png +0 -0
  55. data/guides/assets/images/icons/tip.png +0 -0
  56. data/guides/assets/images/icons/up.png +0 -0
  57. data/guides/assets/images/icons/warning.png +0 -0
  58. data/guides/assets/images/nav_arrow.gif +0 -0
  59. data/guides/assets/images/tab_grey.gif +0 -0
  60. data/guides/assets/images/tab_info.gif +0 -0
  61. data/guides/assets/images/tab_note.gif +0 -0
  62. data/guides/assets/images/tab_red.gif +0 -0
  63. data/guides/assets/images/tab_yellow.gif +0 -0
  64. data/guides/assets/images/tab_yellow.png +0 -0
  65. data/guides/assets/javascripts/guides.js +0 -7
  66. data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
  67. data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
  68. data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
  69. data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
  70. data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
  71. data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +0 -125
  72. data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
  73. data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
  74. data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
  75. data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
  76. data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
  77. data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
  78. data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
  79. data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
  80. data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
  81. data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
  82. data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
  83. data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
  84. data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
  85. data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
  86. data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
  87. data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
  88. data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
  89. data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
  90. data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
  91. data/guides/assets/javascripts/syntaxhighlighter/shCore.js +0 -17
  92. data/guides/assets/stylesheets/fixes.css +0 -16
  93. data/guides/assets/stylesheets/main.css +0 -445
  94. data/guides/assets/stylesheets/print.css +0 -52
  95. data/guides/assets/stylesheets/reset.css +0 -43
  96. data/guides/assets/stylesheets/style.css +0 -13
  97. data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +0 -226
  98. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
  99. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
  100. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
  101. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
  102. data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  103. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
  104. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
  105. data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
  106. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
  107. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
  108. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
  109. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
  110. data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  111. data/guides/assets/stylesheets/syntaxhighlighter/shThemeJaxGuides.css +0 -116
  112. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
  113. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
  114. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
  115. data/guides/jax_guides.rb +0 -41
  116. data/guides/jax_guides/common.rb +0 -7
  117. data/guides/jax_guides/generator.rb +0 -287
  118. data/guides/jax_guides/helpers.rb +0 -29
  119. data/guides/jax_guides/indexer.rb +0 -69
  120. data/guides/jax_guides/levenshtein.rb +0 -31
  121. data/guides/jax_guides/textile_extensions.rb +0 -61
  122. data/guides/partials/_top_nav.html.erb +0 -17
  123. data/guides/source/getting_started.textile +0 -1210
  124. data/guides/source/index.html.erb +0 -61
  125. data/guides/source/layout.html.erb +0 -147
  126. data/guides/source/lighting.textile +0 -5
  127. data/guides/source/materials.textile +0 -5
  128. data/guides/source/matrices.textile +0 -5
  129. data/guides/source/shaders.textile +0 -499
  130. data/guides/source/testing.textile +0 -5
  131. data/guides/w3c_validator.rb +0 -91
  132. data/public/images/brickwall.jpg +0 -0
  133. data/public/images/jacks.jpg +0 -0
  134. data/public/images/normal_map.jpg +0 -0
  135. data/public/images/rock.png +0 -0
  136. data/public/images/rockNormal.png +0 -0
  137. data/public/images/rss.png +0 -0
  138. data/public/webgl_not_supported.html +0 -26
  139. data/spec/example_app/Gemfile +0 -1
  140. data/spec/example_app/Rakefile +0 -15
  141. data/spec/example_app/app/controllers/application_controller.js +0 -5
  142. data/spec/example_app/app/controllers/courthouse_controller.js +0 -24
  143. data/spec/example_app/app/controllers/lighting_controller.js +0 -67
  144. data/spec/example_app/app/controllers/noise_controller.js +0 -50
  145. data/spec/example_app/app/controllers/picking_controller.js +0 -32
  146. data/spec/example_app/app/controllers/shadows_controller.js +0 -130
  147. data/spec/example_app/app/controllers/textures_controller.js +0 -52
  148. data/spec/example_app/app/helpers/application_helper.js +0 -3
  149. data/spec/example_app/app/helpers/noise_helper.js +0 -3
  150. data/spec/example_app/app/helpers/picking_helper.js +0 -3
  151. data/spec/example_app/app/helpers/textures_helper.js +0 -3
  152. data/spec/example_app/app/models/blob.js +0 -38
  153. data/spec/example_app/app/models/character.js +0 -23
  154. data/spec/example_app/app/models/door.js +0 -10
  155. data/spec/example_app/app/models/scene.js +0 -19
  156. data/spec/example_app/app/resources/blobs/default.yml +0 -2
  157. data/spec/example_app/app/resources/characters/judge.yml +0 -3
  158. data/spec/example_app/app/resources/doors/courthouse_door.yml +0 -5
  159. data/spec/example_app/app/resources/light_sources/directional_light.yml +0 -13
  160. data/spec/example_app/app/resources/light_sources/point_light.yml +0 -31
  161. data/spec/example_app/app/resources/light_sources/spot_light.yml +0 -15
  162. data/spec/example_app/app/resources/light_sources/sun.yml +0 -7
  163. data/spec/example_app/app/resources/light_sources/textures_point.yml +0 -34
  164. data/spec/example_app/app/resources/materials/blob.yml +0 -28
  165. data/spec/example_app/app/resources/materials/bricks.yml +0 -36
  166. data/spec/example_app/app/resources/materials/lighting_with_shadows.yml +0 -27
  167. data/spec/example_app/app/resources/scenes/courthouse.yml +0 -4
  168. data/spec/example_app/app/shaders/blob/common.ejs +0 -13
  169. data/spec/example_app/app/shaders/blob/fragment.ejs +0 -8
  170. data/spec/example_app/app/shaders/blob/manifest.yml +0 -15
  171. data/spec/example_app/app/shaders/blob/material.js +0 -51
  172. data/spec/example_app/app/shaders/blob/vertex.ejs +0 -40
  173. data/spec/example_app/app/views/courthouse/index.js +0 -4
  174. data/spec/example_app/app/views/lighting/index.js +0 -4
  175. data/spec/example_app/app/views/noise/index.js +0 -4
  176. data/spec/example_app/app/views/picking/index.js +0 -4
  177. data/spec/example_app/app/views/shadows/index.js +0 -6
  178. data/spec/example_app/app/views/textures/index.js +0 -4
  179. data/spec/example_app/config/application.rb +0 -6
  180. data/spec/example_app/config/boot.rb +0 -13
  181. data/spec/example_app/config/routes.rb +0 -8
  182. data/spec/example_app/public/images/185__normalmap.png +0 -0
  183. data/spec/example_app/public/images/face_norm.jpg +0 -0
  184. data/spec/example_app/public/images/rock.png +0 -0
  185. data/spec/example_app/public/images/rockNormal.png +0 -0
  186. data/spec/example_app/public/images/rss.png +0 -0
  187. data/spec/example_app/public/webgl_not_supported.html +0 -26
  188. data/spec/example_app/script/jax +0 -7
  189. data/spec/example_app/spec/javascripts/controllers/noise_controller_spec.js +0 -11
  190. data/spec/example_app/spec/javascripts/controllers/picking_controller_spec.js +0 -11
  191. data/spec/example_app/spec/javascripts/controllers/textures_controller_spec.js +0 -11
  192. data/spec/example_app/spec/javascripts/helpers/application_helper_spec.js +0 -12
  193. data/spec/example_app/spec/javascripts/helpers/noise_helper_spec.js +0 -12
  194. data/spec/example_app/spec/javascripts/helpers/picking_helper_spec.js +0 -12
  195. data/spec/example_app/spec/javascripts/models/blob_spec.js +0 -11
  196. data/spec/example_app/spec/javascripts/resources/directional_light_spec.js +0 -16
  197. data/spec/example_app/spec/javascripts/resources/point_light_spec.js +0 -17
  198. data/spec/example_app/spec/javascripts/resources/spot_light_spec.js +0 -18
  199. data/spec/example_app/spec/javascripts/shaders/blob_spec.js +0 -27
  200. data/spec/example_app/spec/javascripts/support/jasmine.yml +0 -89
  201. data/spec/example_app/spec/javascripts/support/jasmine_runner.rb +0 -32
  202. data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +0 -33
  203. data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js +0 -93
  204. data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +0 -111
  205. data/spec/javascripts/helpers/jax_spec_environment_helper.js +0 -33
  206. data/spec/javascripts/helpers/jax_spec_helper.js +0 -216
  207. data/spec/javascripts/jax/builtin/meshes/cube_spec.js +0 -10
  208. data/spec/javascripts/jax/builtin/meshes/plane_spec.js +0 -8
  209. data/spec/javascripts/jax/builtin/meshes/quad_spec.js +0 -8
  210. data/spec/javascripts/jax/builtin/meshes/sphere_spec.js +0 -8
  211. data/spec/javascripts/jax/builtin/meshes/teapot_spec.js +0 -8
  212. data/spec/javascripts/jax/builtin/meshes/torus_spec.js +0 -8
  213. data/spec/javascripts/jax/compatibility_spec.js +0 -50
  214. data/spec/javascripts/jax/context_spec.js +0 -82
  215. data/spec/javascripts/jax/controller_spec.js +0 -145
  216. data/spec/javascripts/jax/core/delegation_spec.js +0 -48
  217. data/spec/javascripts/jax/core/events_spec.js +0 -17
  218. data/spec/javascripts/jax/core/matrix_stack_spec.js +0 -28
  219. data/spec/javascripts/jax/core/utils_spec.js +0 -275
  220. data/spec/javascripts/jax/helper_spec.js +0 -33
  221. data/spec/javascripts/jax/model_spec.js +0 -97
  222. data/spec/javascripts/jax/optimizations/material_limitations_spec.js +0 -87
  223. data/spec/javascripts/jax/optimizations/shaders/basic_spec.js +0 -68
  224. data/spec/javascripts/jax/prototype/extensions_spec.js +0 -34
  225. data/spec/javascripts/jax/route_set_spec.js +0 -67
  226. data/spec/javascripts/jax/view_manager_spec.js +0 -17
  227. data/spec/javascripts/jax/webgl/camera_spec.js +0 -159
  228. data/spec/javascripts/jax/webgl/framebuffer_spec.js +0 -46
  229. data/spec/javascripts/jax/webgl/lighting_spec.js +0 -61
  230. data/spec/javascripts/jax/webgl/material_spec.js +0 -118
  231. data/spec/javascripts/jax/webgl/mesh_spec.js +0 -86
  232. data/spec/javascripts/jax/webgl/shader/manifest_spec.js +0 -60
  233. data/spec/javascripts/jax/webgl/shader_chain_spec.js +0 -192
  234. data/spec/javascripts/jax/webgl/shader_spec.js +0 -276
  235. data/spec/javascripts/jax/webgl/tangent_space_spec.js +0 -142
  236. data/spec/javascripts/jax/webgl/texture_spec.js +0 -162
  237. data/spec/javascripts/jax/webgl_spec.js +0 -5
  238. data/spec/javascripts/jax/world_spec.js +0 -161
  239. data/spec/javascripts/jax_spec.js +0 -27
  240. data/spec/javascripts/shaders/core_materials_spec.js +0 -42
  241. data/spec/javascripts/shaders/fog_spec.js +0 -19
  242. data/spec/javascripts/shaders/lighting_spec.js +0 -19
  243. data/spec/javascripts/shaders/normal_map_spec.js +0 -19
  244. data/spec/javascripts/shaders/paraboloid_spec.js +0 -37
  245. data/spec/javascripts/shaders/preprocessor_spec.js +0 -50
  246. data/spec/javascripts/shaders/shadow_map_spec.js +0 -19
  247. data/spec/javascripts/shaders/texture_spec.js +0 -40
  248. data/src/constants.yml +0 -1
  249. data/src/constants.yml.erb +0 -1
  250. data/src/jax.js +0 -119
  251. data/src/jax/anim_frame.js +0 -51
  252. data/src/jax/builtin/all.js +0 -7
  253. data/src/jax/builtin/meshes/cube.js +0 -83
  254. data/src/jax/builtin/meshes/plane.js +0 -63
  255. data/src/jax/builtin/meshes/quad.js +0 -86
  256. data/src/jax/builtin/meshes/sphere.js +0 -65
  257. data/src/jax/builtin/meshes/teapot.js +0 -48
  258. data/src/jax/builtin/meshes/torus.js +0 -64
  259. data/src/jax/compatibility.js +0 -303
  260. data/src/jax/context.js +0 -420
  261. data/src/jax/core.js +0 -42
  262. data/src/jax/core/math.js +0 -55
  263. data/src/jax/core/matrix_stack.js +0 -311
  264. data/src/jax/core/util.js +0 -253
  265. data/src/jax/events.js +0 -234
  266. data/src/jax/geometry.js +0 -7
  267. data/src/jax/geometry/plane.js +0 -113
  268. data/src/jax/mvc/controller.js +0 -195
  269. data/src/jax/mvc/helper.js +0 -35
  270. data/src/jax/mvc/model.js +0 -302
  271. data/src/jax/mvc/route_set.js +0 -125
  272. data/src/jax/mvc/view.js +0 -43
  273. data/src/jax/mvc/view_manager.js +0 -47
  274. data/src/jax/noise.js +0 -206
  275. data/src/jax/prototype/class.js +0 -81
  276. data/src/jax/prototype/core.js +0 -112
  277. data/src/jax/prototype/extensions.js +0 -142
  278. data/src/jax/vendor/ejs.js +0 -4
  279. data/src/jax/vendor/glMatrix.js +0 -3
  280. data/src/jax/webgl.js +0 -98
  281. data/src/jax/webgl/camera.js +0 -526
  282. data/src/jax/webgl/core.js +0 -6
  283. data/src/jax/webgl/core/buffer.js +0 -161
  284. data/src/jax/webgl/core/edge.js +0 -6
  285. data/src/jax/webgl/core/events.js +0 -25
  286. data/src/jax/webgl/core/face.js +0 -8
  287. data/src/jax/webgl/core/framebuffer.js +0 -211
  288. data/src/jax/webgl/material.js +0 -392
  289. data/src/jax/webgl/mesh.js +0 -427
  290. data/src/jax/webgl/scene.js +0 -11
  291. data/src/jax/webgl/scene/frustum.js +0 -260
  292. data/src/jax/webgl/scene/light_manager.js +0 -136
  293. data/src/jax/webgl/scene/light_source.js +0 -294
  294. data/src/jax/webgl/shader.js +0 -296
  295. data/src/jax/webgl/shader/delegator.js +0 -13
  296. data/src/jax/webgl/shader/delegator/attribute.js +0 -53
  297. data/src/jax/webgl/shader/delegator/uniform.js +0 -71
  298. data/src/jax/webgl/shader/manifest.js +0 -64
  299. data/src/jax/webgl/shader/program.js +0 -140
  300. data/src/jax/webgl/shader_chain.js +0 -264
  301. data/src/jax/webgl/texture.js +0 -312
  302. data/src/jax/webgl/world.js +0 -240
  303. data/vendor/ejs/.svn/all-wcprops +0 -17
  304. data/vendor/ejs/.svn/entries +0 -114
  305. data/vendor/ejs/.svn/text-base/Eratta.txt.svn-base +0 -3
  306. data/vendor/ejs/.svn/text-base/license.txt.svn-base +0 -21
  307. data/vendor/ejs/Eratta.txt +0 -3
  308. data/vendor/ejs/example/.svn/all-wcprops +0 -29
  309. data/vendor/ejs/example/.svn/entries +0 -164
  310. data/vendor/ejs/example/.svn/prop-base/ejs.gif.svn-base +0 -5
  311. data/vendor/ejs/example/.svn/text-base/demo.html.svn-base +0 -54
  312. data/vendor/ejs/example/.svn/text-base/ejs.gif.svn-base +0 -0
  313. data/vendor/ejs/example/.svn/text-base/example.css.svn-base +0 -31
  314. data/vendor/ejs/example/.svn/text-base/example.js.svn-base +0 -88
  315. data/vendor/ejs/example/demo.html +0 -54
  316. data/vendor/ejs/example/ejs.gif +0 -0
  317. data/vendor/ejs/example/example.css +0 -31
  318. data/vendor/ejs/example/example.js +0 -88
  319. data/vendor/ejs/lib/.svn/all-wcprops +0 -11
  320. data/vendor/ejs/lib/.svn/entries +0 -62
  321. data/vendor/ejs/lib/.svn/text-base/ejs_fulljslint.js.svn-base +0 -3774
  322. data/vendor/ejs/lib/ejs_fulljslint.js +0 -3774
  323. data/vendor/ejs/license.txt +0 -21
  324. data/vendor/ejs/script/.svn/all-wcprops +0 -17
  325. data/vendor/ejs/script/.svn/entries +0 -96
  326. data/vendor/ejs/script/.svn/prop-base/yuicompressor-2.2.4.jar.svn-base +0 -5
  327. data/vendor/ejs/script/.svn/text-base/production.bat.svn-base +0 -4
  328. data/vendor/ejs/script/.svn/text-base/yuicompressor-2.2.4.jar.svn-base +0 -0
  329. data/vendor/ejs/script/production.bat +0 -4
  330. data/vendor/ejs/script/yuicompressor-2.2.4.jar +0 -0
  331. data/vendor/ejs/src/.svn/all-wcprops +0 -17
  332. data/vendor/ejs/src/.svn/entries +0 -96
  333. data/vendor/ejs/src/.svn/text-base/ejs.js.svn-base +0 -505
  334. data/vendor/ejs/src/.svn/text-base/view.js.svn-base +0 -200
  335. data/vendor/ejs/src/ejs.js +0 -505
  336. data/vendor/ejs/src/view.js +0 -200
  337. data/vendor/ejs/test/.svn/all-wcprops +0 -23
  338. data/vendor/ejs/test/.svn/entries +0 -139
  339. data/vendor/ejs/test/.svn/text-base/index.html.svn-base +0 -18
  340. data/vendor/ejs/test/.svn/text-base/setup_test.html.svn-base +0 -44
  341. data/vendor/ejs/test/.svn/text-base/sidebar.html.svn-base +0 -28
  342. data/vendor/ejs/test/included/.svn/all-wcprops +0 -23
  343. data/vendor/ejs/test/included/.svn/entries +0 -130
  344. data/vendor/ejs/test/included/.svn/text-base/prototype.js.svn-base +0 -4184
  345. data/vendor/ejs/test/included/.svn/text-base/test.css.svn-base +0 -44
  346. data/vendor/ejs/test/included/.svn/text-base/unittest.js.svn-base +0 -564
  347. data/vendor/ejs/test/included/prototype.js +0 -4184
  348. data/vendor/ejs/test/included/test.css +0 -44
  349. data/vendor/ejs/test/included/unittest.js +0 -564
  350. data/vendor/ejs/test/index.html +0 -18
  351. data/vendor/ejs/test/setup_test.html +0 -44
  352. data/vendor/ejs/test/sidebar.html +0 -28
  353. data/vendor/ejs/test/templates/.svn/all-wcprops +0 -11
  354. data/vendor/ejs/test/templates/.svn/entries +0 -62
  355. data/vendor/ejs/test/templates/.svn/text-base/test.ejs.svn-base +0 -3
  356. data/vendor/ejs/test/templates/test.ejs +0 -3
  357. data/vendor/ejs/test/tests/.svn/all-wcprops +0 -23
  358. data/vendor/ejs/test/tests/.svn/entries +0 -130
  359. data/vendor/ejs/test/tests/.svn/text-base/rendering.js.svn-base +0 -94
  360. data/vendor/ejs/test/tests/.svn/text-base/templating.js.svn-base +0 -43
  361. data/vendor/ejs/test/tests/.svn/text-base/views.js.svn-base +0 -100
  362. data/vendor/ejs/test/tests/rendering.js +0 -94
  363. data/vendor/ejs/test/tests/templating.js +0 -43
  364. data/vendor/ejs/test/tests/views.js +0 -100
  365. data/vendor/glmatrix/benchmark/js/CanvasMatrix.js +0 -722
  366. data/vendor/glmatrix/benchmark/js/EWGL_math.js +0 -742
  367. data/vendor/glmatrix/benchmark/js/mjs.js +0 -1230
  368. data/vendor/glmatrix/benchmark/matrix_benchmark.html +0 -419
  369. data/vendor/glmatrix/glMatrix-min.js +0 -32
  370. data/vendor/glmatrix/glMatrix.js +0 -1772
  371. data/vendor/glmatrix/unit tests/glMatrix-test.js +0 -74
  372. data/vendor/glmatrix/unit tests/qunit.css +0 -119
  373. data/vendor/glmatrix/unit tests/qunit.js +0 -1069
  374. data/vendor/glmatrix/unit tests/test_glMatrix.html +0 -21
  375. data/vendor/pdoc_template/html/assets/images/pdoc/alias.png +0 -0
  376. data/vendor/pdoc_template/html/assets/images/pdoc/class.png +0 -0
  377. data/vendor/pdoc_template/html/assets/images/pdoc/class_deprecated.png +0 -0
  378. data/vendor/pdoc_template/html/assets/images/pdoc/class_method.png +0 -0
  379. data/vendor/pdoc_template/html/assets/images/pdoc/class_property.png +0 -0
  380. data/vendor/pdoc_template/html/assets/images/pdoc/constant.png +0 -0
  381. data/vendor/pdoc_template/html/assets/images/pdoc/constructor.png +0 -0
  382. data/vendor/pdoc_template/html/assets/images/pdoc/deprecated.png +0 -0
  383. data/vendor/pdoc_template/html/assets/images/pdoc/description.png +0 -0
  384. data/vendor/pdoc_template/html/assets/images/pdoc/information.png +0 -0
  385. data/vendor/pdoc_template/html/assets/images/pdoc/instance_method.png +0 -0
  386. data/vendor/pdoc_template/html/assets/images/pdoc/instance_property.png +0 -0
  387. data/vendor/pdoc_template/html/assets/images/pdoc/method.png +0 -0
  388. data/vendor/pdoc_template/html/assets/images/pdoc/method_deprecated.png +0 -0
  389. data/vendor/pdoc_template/html/assets/images/pdoc/mixin.png +0 -0
  390. data/vendor/pdoc_template/html/assets/images/pdoc/namespace.png +0 -0
  391. data/vendor/pdoc_template/html/assets/images/pdoc/property.png +0 -0
  392. data/vendor/pdoc_template/html/assets/images/pdoc/related_to.png +0 -0
  393. data/vendor/pdoc_template/html/assets/images/pdoc/search-background.png +0 -0
  394. data/vendor/pdoc_template/html/assets/images/pdoc/section-background.png +0 -0
  395. data/vendor/pdoc_template/html/assets/images/pdoc/section.png +0 -0
  396. data/vendor/pdoc_template/html/assets/images/pdoc/selected-section-background.png +0 -0
  397. data/vendor/pdoc_template/html/assets/images/pdoc/subclass.png +0 -0
  398. data/vendor/pdoc_template/html/assets/images/pdoc/superclass.png +0 -0
  399. data/vendor/pdoc_template/html/assets/images/pdoc/utility.png +0 -0
  400. data/vendor/pdoc_template/html/assets/javascripts/pdoc/application.js +0 -478
  401. data/vendor/pdoc_template/html/assets/javascripts/pdoc/prototype.js +0 -4874
  402. data/vendor/pdoc_template/html/assets/javascripts/pdoc/tabs.js +0 -506
  403. data/vendor/pdoc_template/html/assets/stylesheets/jax.css +0 -30
  404. data/vendor/pdoc_template/html/assets/stylesheets/pdoc/api.css +0 -681
  405. data/vendor/pdoc_template/html/assets/stylesheets/pdoc/pygments.css +0 -62
  406. data/vendor/pdoc_template/html/helpers.rb +0 -35
  407. data/vendor/pdoc_template/html/index.erb +0 -18
  408. data/vendor/pdoc_template/html/item_index.js.erb +0 -6
  409. data/vendor/pdoc_template/html/layout.erb +0 -67
  410. data/vendor/pdoc_template/html/leaf.erb +0 -22
  411. data/vendor/pdoc_template/html/node.erb +0 -30
  412. data/vendor/pdoc_template/html/partials/class_relationships.erb +0 -19
  413. data/vendor/pdoc_template/html/partials/classes.erb +0 -7
  414. data/vendor/pdoc_template/html/partials/constructor.erb +0 -5
  415. data/vendor/pdoc_template/html/partials/description.erb +0 -5
  416. data/vendor/pdoc_template/html/partials/link_list.erb +0 -1
  417. data/vendor/pdoc_template/html/partials/method_signatures.erb +0 -14
  418. data/vendor/pdoc_template/html/partials/methodized_note.erb +0 -9
  419. data/vendor/pdoc_template/html/partials/mixins.erb +0 -7
  420. data/vendor/pdoc_template/html/partials/namespaces.erb +0 -7
  421. data/vendor/pdoc_template/html/partials/related_utilities.erb +0 -5
  422. data/vendor/pdoc_template/html/partials/relationships.erb +0 -11
  423. data/vendor/pdoc_template/html/partials/short_description_list.erb +0 -7
  424. data/vendor/pdoc_template/html/partials/title.erb +0 -24
  425. data/vendor/pdoc_template/html/section.erb +0 -18
  426. data/vendor/yuicompressor-2.4.2.jar +0 -0
@@ -1,61 +0,0 @@
1
- <% content_for :page_title do %>
2
- Jax Guides
3
- <% end %>
4
-
5
- <% content_for :header_section do %>
6
- <h2>Jax Guides</h2>
7
-
8
- <p>
9
- These guides are designed to make you immediately productive with Jax,
10
- and to help you understand how all of the pieces fit together.
11
- </p>
12
- <% end %>
13
-
14
- <% content_for :index_section do %>
15
- <div id="subCol">
16
- <dl>
17
- <dd class="work-in-progress">Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections to the author.</dd>
18
- </dl>
19
- </div>
20
- <% end %>
21
-
22
- <h3>Start Here</h3>
23
-
24
- <dl>
25
- <%= guide('Getting Started with Jax', 'getting_started.html', :work_in_progress => false) do %>
26
- <p>Everything you need to know to install Jax and create your first application.</p>
27
- <% end %>
28
- </dl>
29
-
30
- <h3>Digging Deeper</h3>
31
-
32
- <dl>
33
-
34
- <%= guide("Custom Shaders", 'shaders.html', :work_in_progress => false) do %>
35
- <p>This guide shows how to add and use your own shaders to add advanced custom visual effects.</p>
36
- <% end %>
37
-
38
- <%= guide("Materials", 'materials.html', :work_in_progress => true) do %>
39
- <p>This guide demonstrates how to create, use and dynamically alter Materials in Jax.</p>
40
- <% end %>
41
-
42
- <%= guide("Lighting", 'lighting.html', :work_in_progress => true) do %>
43
- <p>This guide shows how to make the most of lighting support in Jax, and outlines potential caveats. It will also discuss how to prevent certain objects from being lit at all, and in what circumstances you'd want to do this.</p>
44
- <% end %>
45
-
46
- <%= guide("Matrices", "matrices.html", :work_in_progress => true) do%>
47
- <p>This guide explains all of the various matrices and "spaces", and how they relate to one another. It will help you understand the difference between world space, camera space and object space; and how a 3D object goes from a set of vertices in object space to a translated, rotated and scaled image on your computer screen.</p>
48
- <% end %>
49
-
50
- <%= guide("Testing Jax Applications", 'testing.html', :work_in_progress => true) do %>
51
- <p>This is a comprehensive guide to testing a Jax application. It covers everything from &quot;What is a test?&quot; to the testing APIs.</p>
52
- <% end %>
53
-
54
- </dl>
55
-
56
- <h3>API Documentation</h3>
57
-
58
- <dl>
59
- <%=guide("Jax JavaScript API Docs", "api/js/index.html") do%>
60
- <%end%>
61
- </dl>
@@ -1,147 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
-
8
- <title><%= yield(:page_title) || 'Jax guides' %></title>
9
-
10
- <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
11
- <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
12
-
13
- <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
14
- <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeJaxGuides.css" />
15
-
16
- <link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
17
- </head>
18
- <body class="guide">
19
- <% if @edge %>
20
- <div>
21
- <img src="images/edge_badge.png" alt="edge-badge" id="edge-badge" />
22
- </div>
23
- <% end %>
24
- <%= render :partial => '../partials/top_nav' %>
25
- <!--
26
- I want to use a similar index to below, once the Jax guides start to take shape:
27
-
28
- <div id="header">
29
- <div class="wrapper clearfix">
30
- <h1><a href="index.html" title="Return to home page">Guides.jaxgl.com</a></h1>
31
- <p class="hide"><a href="#mainCol">Skip navigation</a>.</p>
32
- <ul class="nav">
33
- <li><a href="index.html">Home</a></li>
34
- <li class="index"><a href="index.html" onclick="guideMenu(); return false;" id="guidesMenu">Guides Index</a>
35
- <div id="guides" class="clearfix" style="display: none;">
36
- <hr />
37
- <dl class="L">
38
- <dt>Start Here</dt>
39
- <dd><a href="getting_started.html">Getting Started with Rails</a></dd>
40
- <dt>Models</dt>
41
- <dd><a href="migrations.html">Rails Database Migrations</a></dd>
42
- <dd><a href="active_record_validations_callbacks.html">Active Record Validations and Callbacks</a></dd>
43
- <dd><a href="association_basics.html">Active Record Associations</a></dd>
44
- <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
45
- <dt>Views</dt>
46
- <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
47
- <dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
48
- <dt>Controllers</dt>
49
- <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
50
- <dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
51
- </dl>
52
- <dl class="R">
53
- <dt>Digging Deeper</dt>
54
- <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
55
- <dd><a href="i18n.html">Rails Internationalization API</a></dd>
56
- <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
57
- <dd><a href="testing.html">Testing Rails Applications</a></dd>
58
- <dd><a href="security.html">Securing Rails Applications</a></dd>
59
- <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
60
- <dd><a href="performance_testing.html">Performance Testing Rails Applications</a></dd>
61
- <dd><a href="configuring.html">Configuring Rails Applications</a></dd>
62
- <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
63
- <dd><a href="caching_with_rails.html">Caching with Rails</a></dd>
64
-
65
- <dt>Extending Rails</dt>
66
- <dd><a href="plugins.html">The Basics of Creating Rails Plugins</a></dd>
67
- <dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
68
- <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
69
-
70
- <dt>Contributing to Ruby on Rails</dt>
71
- <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
72
- <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
73
- <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
74
-
75
- <dt>Release Notes</dt>
76
- <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
77
- <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
78
- <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
79
- </dl>
80
- </div>
81
- </li>
82
- <li><a href="contribute.html">Contribute</a></li>
83
- </ul>
84
- </div>
85
- </div>
86
- -->
87
- <hr class="hide" />
88
-
89
- <div id="feature">
90
- <div class="wrapper">
91
- <%= yield :header_section %>
92
-
93
- <%= yield :index_section %>
94
- </div>
95
- </div>
96
-
97
- <div id="container">
98
- <div class="wrapper">
99
- <div id="mainCol">
100
- <%= yield.html_safe %>
101
-
102
- <h3>Feedback</h3>
103
- <p>
104
- You're encouraged to help improve the quality of this guide.
105
- </p>
106
- <p>
107
- If you see any typos or factual errors you are confident to
108
- patch, please clone <%= link_to 'Jax', 'https://github.com/sinisterchipmunk/jax' %>,
109
- correct the issue and send a pull request.
110
- Your commits will be reviewed, and then merged into master.
111
- </p>
112
- <!--
113
- <p>
114
- You may also find incomplete content, or stuff that is not up to date.
115
- Please do add any missing documentation for master. Check the
116
- <%= link_to 'Jax Guides Guidelines', 'jax_guides_guidelines.html' %>
117
- for style and conventions.
118
- </p>
119
- -->
120
- <p>
121
- Also, any kind of discussion regarding Jax documentation is
122
- very welcome in the <%= link_to 'forums', 'http://blog.jaxgl.com/forum' %>.
123
- </p>
124
- </div>
125
- </div>
126
- </div>
127
-
128
- <hr class="hide" />
129
- <div id="footer">
130
- <div class="wrapper">
131
- <p>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a> License</p>
132
- </div>
133
- </div>
134
-
135
- <script type="text/javascript" src="javascripts/guides.js"></script>
136
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
137
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
138
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
139
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushCss.js"></script>
140
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushCpp.js"></script>
141
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushJScript.js"></script>
142
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
143
- <script type="text/javascript">
144
- SyntaxHighlighter.all()
145
- </script>
146
- </body>
147
- </html>
@@ -1,5 +0,0 @@
1
- h2. This Guide Not Yet Started
2
-
3
- Please come back after I've had time to work on this guide a bit.
4
-
5
- endprologue.
@@ -1,5 +0,0 @@
1
- h2. This Guide Not Yet Started
2
-
3
- Please come back after I've had time to work on this guide a bit.
4
-
5
- endprologue.
@@ -1,5 +0,0 @@
1
- h2. This Guide Not Yet Started
2
-
3
- Please come back after I've had time to work on this guide a bit.
4
-
5
- endprologue.
@@ -1,499 +0,0 @@
1
- h2. Writing Shaders With Jax
2
-
3
- This guide will help you understand the principles of shader design in Jax. It will cover the following topics:
4
-
5
- * Generating a Jax shader and understanding the resultant files
6
- * How your shader interacts with the Jax preprocessor
7
- * How the Jax preprocessor combines multiple shaders
8
- * How Material files use your shaders
9
- * How the Jax preprocessor handles hardware constraints
10
-
11
- endprologue.
12
-
13
-
14
- h3. Assumptions
15
-
16
- This guide is for people who have already read the "Getting Started Guide":getting_started.html and have perhaps run through a few demos of their own, and reached the limits of what the built-in Jax shaders can do for them. It assumes you are familiar with the fundamentals of JavaScript as well as the "OpenGL Shading Language (GLSL)":http://en.wikipedia.org/wiki/GLSL.
17
-
18
- The commands shown in this guide are, unless otherwise noted, executed in the root directory of a Jax application.
19
-
20
-
21
- h3. Generating a Shader
22
-
23
- Generating a shader is very similar to any other generator in Jax. The first step is, of course, deciding on a name for it; that's easier to do if we have an idea of what the shader should produce. In this guide, we'll design a shader called _brick_ that draws a procedural brick-like texture onto whichever objects make use of it.
24
-
25
- <shell>
26
- $ jax generate shader brick
27
-
28
- create app/shaders/brick/common.ejs
29
- create app/shaders/brick/fragment.ejs
30
- create app/shaders/brick/manifest.yml
31
- create app/shaders/brick/material.js
32
- create app/shaders/brick/vertex.ejs
33
- create spec/javascripts/shaders/brick_spec.js
34
- </shell>
35
-
36
- As you can see, six files were generated for us. Two were standard JavaScript files; one was a YAML file; and the remaining three were <em>Embedded JavaScript</em>, or EJS, files. Let's examine them one at a time:
37
-
38
- * +spec/javascripts/shaders/brick_spec.js+ -- this is a test file, or <em>spec file</em>, generated by Jax to unit test our shader. If you open it, you'll see that it's quite complete. By default, it will test the shader under two conditions: as a stand-alone shader, and as part of a group of shaders merged together by the Jax preprocessor. More on that later.
39
- * +app/shaders/brick/manifest.yml+ -- the manifest file contains meta data about your shader. It's not used in the JavaScript that your shader will eventually produce; instead, it is read by the Ruby component of Jax and used primarily for the command-line +material+ generator.
40
- * +app/shaders/brick/common.ejs+ -- the contents of this file are prepended to both the _vertex_ and _fragment_ shaders. It can contain function definitions, uniform and varying variables, constants and global variables. Attribute variables don't belong here, because attributes cannot appear within fragment shaders.
41
- * +app/shaders/brick/vertex.ejs+ -- houses the body of your vertex shader.
42
- * +app/shaders/brick/fragment.ejs+ -- houses the body of your fragment shader.
43
- * +app/shaders/brick/material.js+ -- the interface between JavaScript and your shader, this file is primarily responsible for setting the values of +uniform+ and +attribute+ variables.
44
-
45
-
46
- h3. The Jax Preprocessor
47
-
48
- There are technically two preprocessors at your disposal. The compiler preprocessor is the lower-level one, and is built into WebGL. All WebGL applications support the compiler preprocessor, which is invoked using the '#' character. Directives such as +#ifdef+ and +#version+ make use of the compiler preprocessor.
49
-
50
- The Jax preprocessor operates at a much higher level than the compiler processor, and is essentially a glorified string manipulator.
51
-
52
- INFO: This is why we must make a distinction between the compiler preprocessor and the Jax preprocessor. While the former operates entirely within the OpenGL drivers, the latter is executed in JavaScript and is primarily responsible for building your shader and controlling when and how your shader is merged with other shaders. We'll discuss all of this in detail.
53
-
54
-
55
- h4. Combining Shaders
56
-
57
- WebGL doesn't technically support the arbitrary mixing and matching of shaders. While it does support multiple shader _libraries_, these are analogous to C++ libraries. Lots of files can be plugged in, but only one can define a _main_ function.
58
-
59
- This poses a problem in the realm of reusable code. If you have a shader that supports lighting effects, but you want to run a shader that supports lighting _and_ some other effect (for instance, a brick pattern), you have to write an entirely new shader with its own _main_ function. In the easiest case, you'll have to extract the lighting code into a single reusable function library, and then call those functions from the new shader. The list of shaders you must keep and maintain can easily grow into the hundreds or (for large apps) thousands, mostly due to variations of otherwise similar shaders.
60
-
61
- Jax addresses this problem by directly manipulating the source code for all shaders. It seeks out the _main_ functions, renames them to something unique based on the particular instance of the particular shader, (a process known as <em>"name mangling":http://en.wikipedia.org/wiki/Name_mangling</em>, which is certainly not unique to Jax), and then constructs its own _main_ function just prior to compiling the code.
62
-
63
-
64
- h4. Shared Variables
65
-
66
- The process of combining shaders is entirely automatic and there's no need for the developer to get involved, but it's something the developer _does_ need to be aware of due to the relatively stringent limitations of graphics hardware.
67
-
68
- It would be wasteful (and impossible!) to create exact copies of all variables, such as the modelview matrix, the projection matrix, vertex positions, normals, texture coordinates, colors... the list goes on. Instead, the Jax preprocessor introduces the +shared+ keyword. Whenever you use the +shared+ keyword as part of a variable declaration in the global scope, (for instance, in the +app/shaders/brick/common.ejs+ file), Jax will _not_ name mangle the variable in question. This means that as long as all of the shaders use the same name for the variable, it won't be redeclared when those shaders are combined.
69
-
70
- Here are some examples of the +shared+ keyword, extracted from the +common.ejs+ file:
71
-
72
- <c>
73
- shared uniform mat3 nMatrix;
74
- shared uniform mat4 mvMatrix, pMatrix;
75
-
76
- shared varying vec2 vTexCoords;
77
- shared varying vec3 vNormal;
78
- shared varying vec4 vBaseColor;
79
- </c>
80
-
81
-
82
- h4. Exports and Imports
83
-
84
- Similar to shared variables, _exports_ and _imports_ allow you to share values across shaders. The difference is that they don't need to be predeclared beforehand -- you can use them on-the-fly within your shaders. They also allow you to prepare them with default values in case they haven't been previously exported by another shader.
85
-
86
- h5. Exporting a Value
87
-
88
- When Jax encounters an export, it will be declared in the global scope as long as it hasn't been already.
89
-
90
- There are two ways to export a variable: with an <em>implicit value</em> or with an <em>explicit value</em>. An _implicit_ value simply means that Jax will look for a local variable of the same name as the export, and use it. An _explicit_ value takes the form of a third argument, and represents the value or variable whose value you are assigning. Here are some examples of both:
91
-
92
- <c>
93
- void main(void) {
94
- vec4 ambient = vec4(1,1,1,1);
95
-
96
- // implicit value
97
- export(vec4, ambient);
98
-
99
- // explicit value
100
- export(vec4, GlobalAmbientColor, vec4(ambient.rgb * 0.5, 1));
101
- }
102
- </c>
103
-
104
- h5. Importing a Value
105
-
106
- Shaders can import values previously exported by other shaders. If the value has never been exported, the global variable won't exist and the import will be silently ignored. This makes it very easy to use default values for imports, as you'll see in the next code snippet.
107
-
108
- Imports always take two arguments. The first is the actual name of the variable to be imported; the second is an expression representing what to do with the import if it can be found.
109
-
110
- Here's an example:
111
-
112
- <c>
113
- void main(void) {
114
- vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
115
- import(ambient, color = ambient);
116
- }
117
- </c>
118
-
119
- INFO: When the import exists in the above example, we are effectively assigning a value to the +color+ variable and then immediately overwriting that value. This would be inefficient, but the GLSL compiler will be smart enough to optimize the redundancy away for us so that it is not an issue. If the import does _not_ exist, then the +import()+ call is ignored entirely and the color defaults to white.
120
-
121
-
122
- h4. Requiring Supporting Libraries
123
-
124
- You can create your own libraries of functions and other reusable code. Just put it in a subdirectory of +app/shaders+ (I like to put my functions in +app/shaders/functions+) and be sure to give the file a +.ejs+ extension.
125
-
126
- To make use of your function libraries, use the +require+ directive like so:
127
-
128
- <js>
129
- //= require "functions/name_of_library.ejs"
130
- </js>
131
-
132
- ...where _name_of_library_ represents the name of the function library you're trying to import.
133
-
134
- INFO: Library requires are performed on the Ruby side of life, so this does not result in an AJAX or similar call. Instead, Ruby performs the lookup while building the JavaScript portion of your shader. This yields not only the runtime advantages of avoiding multiple requests, but is more configurable. You can alter the +Jax.application.config.shader_paths+ variable, which is an array of strings, in the Ruby API to tell Ruby where else to look for function libraries.
135
-
136
- INFO: By default, the +Jax.application.config.shader_paths+ variable in Ruby is set to include the +app/shaders+ directory within your own application, as well as the Jax built-in shader path. This allows you to require the various function libraries that ship with Jax for your own use. See "the Wiki":http://github.com/sinisterchipmunk/jax/wiki for more information about what function libraries are available to your shaders, and how to use them.
137
-
138
-
139
- h4. +main+ in the Fragment Shader
140
-
141
- Your fragment shader's +main+ function may accept up to 3 _inout_ arguments: _ambient_, _diffuse_ and _specular_, in that order. Each of these is a +vec4+ representing the named color channel. They default to (1, 1, 1, 1) but may be altered by other shaders before being passed into yours. In this way, you can produce cumulative effects on the color of a given fragment by directly altering the color components they represent.
142
-
143
- If you define your +main+ function to not accept any arguments (that is, its argument definition is +void+), then Jax will assume you intend to write to +gl_FragColor+ directly. In this case, <strong>all color components are ignored</strong>. This has an effect on the entire shader chain, and is generally not recommended unless you understand the tradeoffs.
144
-
145
- WARNING: Most of the built-in shaders are designed to accept the three color components, and these shaders do not pay any attention to +gl_FragColor+.
146
-
147
-
148
- h3. Embedded JavaScript
149
-
150
- Because Jax shaders are composed using Embedded JavaScript (EJS), you can easily insert JavaScript code directly into your shader. The JavaScript code is evaluated before any other preprocessors are run, and can be used to manipulate exactly what will ultimately be compiled.
151
-
152
- Embedding JavaScript into an EJS file is quite simple. Here's how the built-in Perlin noise functions make use of this feature:
153
-
154
- <js>
155
- <% if (shader_type == 'vertex' && Jax.Shader.max_vertex_textures == 0) { %>
156
- // use slower, non-texture-based noise functions
157
- <% } else { %>
158
- // use faster, texture-based noise functions
159
- <% } %>
160
- </js>
161
-
162
- INFO: In this example, Jax first checks the shader type. If it's a vertex shader, then there's a possibility that the vertex shader does not support texture lookups; if this is true, then texture-based noise in the vertex shader is going to fail to compile. Since Jax tries to support all graphics hardware seamlessly, it uses this information to fall back to a slower, but workable, noise solution that does not rely on texture lookups. If the shader type is 'fragment' or if the graphics hardware _does_ support vertex texture lookups, then the faster noise functions are used instead. This allows the Jax noise functions to be extremely flexible by not forcing the developer to manage many different libraries, or to manually query the capabilities of the graphics hardware, or both.
163
-
164
- Another example is for the definition of globals. You can still hard-code global values using the compiler preprocessor like so...
165
-
166
- <c>
167
- #ifndef PI
168
- #define PI 3.14159...
169
- #endif
170
-
171
- void main(void) {
172
- float circle = 2 * PI;
173
- // ...
174
- }
175
- </c>
176
-
177
- Or, you can use Embedded JavaScript to use the values directly in-line while not sacrificing any readability. This allows you to reuse constants at the JavaScript level instead of coding them directly into your shader -- even if you don't necessarily know the exact values of those constants off the top of your head:
178
-
179
- <c>
180
- void main(void) {
181
- float circle = 2 * <%=Math.PI%>;
182
- // ...
183
- }
184
- </c>
185
-
186
- h3. Putting it All Together
187
-
188
- Let's use what we've learned so far to start building our _bricks_ shader.
189
-
190
- h4. Manifest
191
-
192
- The first thing we should look at is the Manifest. Its use will become apparent when we test our shader for the first time. Make it look like this:
193
-
194
- <yaml>
195
- description: |
196
- Adds a simple brick texture to a mesh
197
-
198
- options:
199
- brick_color:
200
- red: 1.0
201
- green: 0.3
202
- blue: 0.2
203
-
204
- mortar_color:
205
- red: 0.85
206
- green: 0.86
207
- blue: 0.84
208
-
209
- brick_size:
210
- x: 0.3
211
- y: 0.15
212
-
213
- brick_pct:
214
- x: 0.9
215
- y: 0.85
216
- </yaml>
217
-
218
- The description should be kept as concise as possible. Try to explain the shader in one sentence -- or less. The options are entirely made up by you, and will be passed into your shader as <tt>uniform</tt>s a little later on.
219
-
220
- NOTE: See the pipe ("|") following the +description+? In case you're not familiar with YAML syntax, that's telling YAML that the description may span several lines. The description can continue until an empty line is encountered. If you remove the pipe, you'll have to fit the entire description into one line. That's not a bad thing, as long as you're aware of the need to do so.
221
-
222
- h4. Common Source
223
-
224
- First, open up the +app/shaders/bricks/common.ejs+ file and make it look like this:
225
-
226
- <c>
227
- varying vec2 MCposition;
228
-
229
- shared uniform mat4 mvMatrix, pMatrix;
230
- </c>
231
-
232
- We are defining a 2D vector called +MCposition+ which will be used to generate the brick texture. Since both the vertex and fragment shader will make use of this, we can put it in the common code to reduce code repetition. This way, if we need to make changes to it later on, we only need to change it once.
233
-
234
- We define +mvMatrix+ and +pMatrix+ for the same reason, but we use the +shared+ preprocessor keyword to tell Jax that these matrices are to be used for _all_ shaders in the chain, and not just this one.
235
-
236
- h4. Vertex Shader Source
237
-
238
- <c>
239
- shared attribute vec4 VERTEX_POSITION;
240
-
241
- void main(void) {
242
- MCposition = VERTEX_POSITION.xy;
243
- gl_Position = pMatrix * mvMatrix * VERTEX_POSITION;
244
- }
245
- </c>
246
-
247
- This is a very simple vertex shader that just passes the X and Y coordinates of +VERTEX_POSITION+ into a varying for use in the fragment shader. Then it sets +gl_Position+, in case no shader before it has done so. We mark +VERTEX_POSITION+ as +shared+ because virtually every shader will make use of +VERTEX_POSITION+, and we don't want Jax to define a new attribute for each shader in the chain.
248
-
249
- h4. Fragment Shader Source
250
-
251
- Finally, open +app/shaders/bricks/fragment.ejs+ and replace its contents with:
252
-
253
- <c>
254
- uniform vec4 BrickColor, MortarColor;
255
- uniform vec2 BrickSize, BrickPct;
256
-
257
- void main(inout vec4 ambient, inout vec4 diffuse, inout vec4 specular) {
258
- vec2 position = MCposition / BrickSize, useBrick;
259
-
260
- if (fract(position.y * 0.5) > 0.5)
261
- position.x += 0.5;
262
-
263
- position = fract(position);
264
- useBrick = step(position, BrickPct);
265
-
266
- vec3 color = mix(MortarColor.rgb, BrickColor.rgb, useBrick.x * useBrick.y);
267
- ambient.rgb *= color;
268
- diffuse.rgb *= color;
269
- }
270
- </c>
271
-
272
- Notice, in this case, that our uniforms are not marked as +shared+. This is because we want the brick color, mortar color, and so on to be unique to this shader. Moreover, we want the colors to be unique to this _instance_ of the shader; that is, if the user decides to use two separate Brick shaders with separate color and size parameters, we don't want the parameters to conflict with each other.
273
-
274
- NOTE: Take notice that we didn't do any lighting calculations. In fact, though we could have simply added <tt>//= require "functions/lights"</tt> and called the Jax lighting functions directly, we decided not to do _any_ lighting whatsoever. Why? This is because Jax already has lighting functions; if you write your own, you're effectively reinventing the wheel. While this is OK to do if you're unhappy with the Jax implementation, you should do so in a completely separate shader so that it's easy to toggle lighting effects on and off. In essence, try to keep a shader as "bare-bones" as possible: it should ideally do what its description says, no more, no less. It can be combined with other shaders later on to maximize code reuse.
275
-
276
- h4. Material File
277
-
278
- The last step before we can test our material out is to tie the uniforms to their actual values. For that, we need to edit the material file in +app/shaders/bricks/material.js+. Make it look like this:
279
-
280
- <js>
281
- Jax.Material.Brick = Jax.Class.create(Jax.Material, {
282
- initialize: function($super, options) {
283
- options = Jax.Util.normalizeOptions(options, {
284
- shader: "brick",
285
- brick_color: [1, 0.3, 0.2],
286
- mortar_color: [0.85, 0.86, 0.84],
287
- brick_size: [0.3, 0.15],
288
- brick_pct: [0.9, 0.85]
289
- });
290
-
291
- options.brick_color = Jax.Util.colorize(options.brick_color);
292
- options.mortar_color = Jax.Util.colorize(options.mortar_color);
293
- options.brick_size = Jax.Util.vectorize(options.brick_size);
294
- options.brick_pct = Jax.Util.vectorize(options.brick_pct);
295
-
296
- $super(options);
297
- },
298
-
299
- setUniforms: function($super, context, mesh, options, uniforms) {
300
- uniforms.set('mvMatrix', context.getModelViewMatrix());
301
- uniforms.set('nMatrix', context.getNormalMatrix());
302
- uniforms.set('pMatrix', context.getProjectionMatrix());
303
- uniforms.set('BrickColor', this.brick_color);
304
- uniforms.set('MortarColor', this.mortar_color);
305
- uniforms.set('BrickSize', this.brick_size);
306
- uniforms.set('BrickPct', this.brick_pct);
307
- },
308
-
309
- setAttributes: function($super, context, mesh, options, attributes) {
310
- attributes.set('VERTEX_POSITION', mesh.getVertexBuffer());
311
- }
312
- });
313
- </js>
314
-
315
- The +vectorize+ and +colorize+ utility methods called from the constructor are used to normalize the various different forms that a vector or color might take, respectively. This lets users use full words like "red", letters like "r", or just a comma-delimited list inside of their material files, and Jax will still interpret the value correctly.
316
-
317
- The rest of the file should be pretty apparent. The +setUniforms+ method is in charge of setting uniform values, while the +setAttributes+ method does the same for attribute values. Both methods are passed a Jax context, mesh, and a set of options built during the render pass.
318
-
319
- h3. Test the Shader
320
-
321
- We're ready to test it out! Before we go generating any materials, try just loading up the Jax application in your browser. We should make sure those two specs that were generated for us way back at the beginning of this guide are still passing.
322
-
323
- All green? Good! Let's generate a controller so we can see our new shader in action!
324
-
325
- <shell>
326
- $ jax generate controller bricks index
327
- </shell>
328
-
329
- IMPORTANT: This is all covered in the "Getting Started Guide":getting_started.html. Don't forget to set the root route in +config/routes.rb+ if you haven't done so already.
330
-
331
- With that done, add the following code to the +index+ action of the newly-generated +app/controllers/bricks_controller.js+:
332
-
333
- <js>
334
- this.world.addObject(new Jax.Model({
335
- position:[0,0,-5],
336
- mesh:new Jax.Mesh.Quad(),
337
- material:Material.find("bricks_demo")
338
- }));
339
- </js>
340
-
341
- h4. Generate a Material
342
-
343
- If you remember the "Getting Started Guide":getting_started.html, then you'll know that the above code will cause your application and its tests to fail. The next thing we need to do is generate the +bricks_demo+ material that we referenced in the controller.
344
-
345
- Before you go typing in the whole command, type just a little bit:
346
-
347
- <shell>
348
- $ jax generate material
349
- ...
350
- - brick : Adds a simple brick texture to a mesh
351
- </shell>
352
-
353
- This is where your +app/shaders/bricks/manifest.yml+ file comes into play. Ruby reads this file in order to know how to help you when you're generating new materials. This becomes very useful when you're dealing with a lot of shaders all at once.
354
-
355
- Now, let's complete the command:
356
-
357
- <shell>
358
- $ jax generate material bricks_demo brick
359
- </shell>
360
-
361
- Open up the generated +app/resources/materials/bricks_demo.yml+ file and, at the bottom, you'll see some more interesting tidbits:
362
-
363
- <yaml>
364
- - type: Brick
365
- brick_color:
366
- red: 1.0
367
- green: 0.3
368
- blue: 0.2
369
- mortar_color:
370
- red: 0.85
371
- green: 0.86
372
- blue: 0.84
373
- brick_size:
374
- x: 0.3
375
- y: 0.15
376
- brick_pct:
377
- x: 0.9
378
- y: 0.85
379
- </yaml>
380
-
381
- These are the options you specified in the manifest file! They are used as defaults for all generated Materials. Users can now edit these options as needed, without having to guess which options are available to them (or refer to documentation).
382
-
383
- h3. Combining Shaders
384
-
385
- You may have noticed in the +app/resources/material/bricks_demo.yml+ file that it listed +Lighting+ as one of the shader layers. This means Jax is implicitly combining both the Lighting shader and our Bricks shader into one program! You can enable lighting effects by simply adding a light source to the scene. This can be done by adding a light source via the +index+ action in the +app/controllers/bricks_controller.js+, which should now look like this:
386
-
387
- <js>
388
- //= require "application_controller"
389
-
390
- var BricksController = (function() {
391
- return Jax.Controller.create("bricks", ApplicationController, {
392
- index: function() {
393
-
394
- this.world.addObject(new Jax.Model({
395
- position:[0,0,-5],
396
- mesh:new Jax.Mesh.Quad({
397
- material:"bricks_demo"
398
- }),
399
- }));
400
-
401
- // add a light to show off the lighting effects that our
402
- // shader has, "for free"
403
- this.world.addLightSource(new Jax.Scene.LightSource({
404
- position:[0.5, 0.5, -4],
405
- attenuation: { linear: 1.25 },
406
- type:Jax.POINT_LIGHT
407
- }));
408
- }
409
- });
410
- })();
411
- </js>
412
-
413
- h4. Falling Back
414
-
415
- Obviously, not all clients are created equal. The sad reality is that you cannot expect everyone to view your application exactly as you do; some devices will perform better than others, and some will have a downright difficult time with apps that include a lot of visual effects.
416
-
417
- Some of this must be chalked up to how you design your application. If it does a lot of number crunching on the CPU or has extremely complicated shaders tying up the GPU for extended periods of time, there's only so much Jax can do to compensate. In general, Jax leaves it up to you, the developer, to decide what type of hardware to target and how to improve performance in individual algorithms. As long as it's theoretically _possible_ to run an application as it was originally coded, Jax will not make any changes.
418
-
419
- On the other hand, Jax is very good at "dumbing down" to clients that have physical hardware constraints that limit their ability to run your application. If, for instance, a given Material requests a set of shaders that, combined, would use too many +varying+ variables, Jax will begin to make changes to the list of shaders that can be used with the material in question.
420
-
421
- h5. Example 1
422
-
423
- Following is a step-by-step example, using our new "bricks with lighting" material (above) to demonstrate.
424
-
425
- IMPORTANT: We're going to pull numbers from a hat in order to make a point; realistically speaking, all of these are much too low. Virtually any graphics hardware on the market today should run the entire example without issue.
426
-
427
- Let's imagine a client visiting our site that has the following specific graphic limitations:
428
-
429
- * Uniforms: 32
430
- * Attributes: 8
431
- * Varyings: 5
432
-
433
- The basic, no-frills, color-only shader for Jax uses 11 uniforms, 5 attributes and 4 varyings. The lighting shader uses 13 uniforms, no additional attributes, and 1 varying. Our own brick shader uses 4 additional uniforms and 1 additional varying. (The rest of the variables are +share+'d with the other shaders, thankfully!)
434
-
435
- This means our current list of shaders is asking for a total of 27 uniforms, 5 attributes and 6 varyings. Our shader list exceeds the number of available +varying+ slots by 1.
436
-
437
- Jax must now look at the list of shaders, and make an educated guess as to which shaders to keep and which ones to drop. The +basic+ shader is part of the core material and therefore cannot be dropped (although this can be modified; we'll talk about this later). That leaves either +lighting+ or +bricks+, which both use exactly 1 varying.
438
-
439
- With little other choice, Jax simply drops the last one to appear in the material: our bricks. But if Jax drops the bricks, then our material becomes a bland, white sheet of plastic! In this case, it's probably desirable to drop lighting in favor of keeping the bricks. We can cause Jax to drop +lighting+ instead of +bricks+ by simply making sure that +bricks+ appears _before_ +lighting+ in the +app/resources/materials/bricks_demo.yml+ file:
440
-
441
- <yaml>
442
- layers:
443
- - type: Brick
444
- brick_color:
445
- # ...
446
-
447
- - type: Lighting
448
- </yaml>
449
-
450
- Now, when Jax has to choose between two perfectly valid candidates, it will drop +lighting+ in favor of +bricks+.
451
-
452
-
453
- h5. Example 2
454
-
455
- Let's take another example, now. Assume that our client has the following hardware limitations:
456
-
457
- * Uniforms: 16
458
- * Attributes: 8
459
- * Varyings: 8
460
-
461
- Now we have an entirely different scenario. It is immediately obvious to Jax that, since it can't drop the +basic+ shader, it is patently impossible to run the +lighting+ shader on the specified material. It just can't be done, period. There aren't enough +uniform+ slots available.
462
-
463
- In this situation, Jax will immediately drop the +lighting+ shader <em>regardless of its position in the material file!</em> By doing so, this opens up just enough +uniform+ slots to make the +brick+ shader run, so Jax stops here.
464
-
465
- h5. Example 3: Worst Case
466
-
467
- If the hardware were even more limited, Jax would now consider dropping both the +brick+ and +lighting+ shaders, and running on pure color support only. This is almost _never_ what you want Jax to do, but it is a last-ditch effort by Jax to try to run your application on hardware your application wasn't intended for.
468
-
469
- Hypothetical numbers:
470
-
471
- * Uniforms: 12
472
- * Attributes: 6
473
- * Varyings: 4
474
-
475
- The +basic+ shader is guaranteed to run on all WebGL-compatible hardware, as long as the hardware follows the OpenGL ES standards for "minimum maximums". However, the +brick+ shader is well within the limits of our latest example <em>if the +basic+ shader is dropped</em>.
476
-
477
- This is where the auto-generated spec for "standalone shaders" comes in handy, because it proves that our shader will, at the very least, _compile_, even if the +basic+ shader is omitted. So how can we tell Jax to omit the +basic+ shader and use the +brick+ shader as the default?
478
-
479
- Easy! Simply move the +brick+ type (as well as all pertinent options) outside of the +layers+ attribute, making them attributes of the core material itself:
480
-
481
- <yaml>
482
- # ...
483
-
484
- type: Brick
485
- brick_color:
486
- red: 1.0
487
- green: 0.3
488
- blue: 0.2
489
- mortar_color:
490
- # ...
491
-
492
- layers:
493
- # remove Lighting to conserve video memory if you don't need/want support for light sources
494
- - type: Lighting
495
- </yaml>
496
-
497
- Done! Jax will now completely omit the +basic+ shader, and the +brick+ shader will be marked as "critical", or un-droppable.
498
-
499
- WARNING: This last option is a good idea _only_ if you have developed a shader that you are sure will run on all hardware! If Jax encounters an un-droppable shader which cannot feasibly run on the client hardware, it will crash and burn in a rather spectacular way. Avoid this situation by developing critical shaders that are compatible with "least common denominator" hardware!