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,1230 +0,0 @@
1
- /* -*- Mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
2
- /*
3
- * Copyright (c) 2010 Mozilla Corporation
4
- * Copyright (c) 2010 Vladimir Vukicevic
5
- *
6
- * Permission is hereby granted, free of charge, to any person
7
- * obtaining a copy of this software and associated documentation
8
- * files (the "Software"), to deal in the Software without
9
- * restriction, including without limitation the rights to use,
10
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the
12
- * Software is furnished to do so, subject to the following
13
- * conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be
16
- * included in all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
- * OTHER DEALINGS IN THE SOFTWARE.
26
- */
27
-
28
- /*
29
- * File: mjs
30
- *
31
- * Vector and Matrix math utilities for JavaScript, optimized for WebGL.
32
- */
33
-
34
- /*
35
- * Constant: MJS_VERSION
36
- *
37
- * mjs version number aa.bb.cc, encoded as an integer of the form:
38
- * 0xaabbcc.
39
- */
40
- const MJS_VERSION = 0x000000;
41
-
42
- /*
43
- * Constant: MJS_DO_ASSERT
44
- *
45
- * Enables or disables runtime assertions.
46
- *
47
- * For potentially more performance, the assert methods can be
48
- * commented out in each place where they are called.
49
- */
50
- const MJS_DO_ASSERT = true;
51
-
52
- // Some hacks for running in both the shell and browser,
53
- // and for supporting F32 and WebGLFloat arrays
54
- try { WebGLFloatArray; } catch (x) { WebGLFloatArray = Float32Array; }
55
-
56
- /*
57
- * Constant: MJS_FLOAT_ARRAY_TYPE
58
- *
59
- * The base float array type. By default, WebGLFloatArray.
60
- *
61
- * mjs can work with any array-like elements, but if an array
62
- * creation is requested, it will create an array of the type
63
- * MJS_FLOAT_ARRAY_TYPE. Also, the builtin constants such as (M4x4.I)
64
- * will be of this type.
65
- */
66
- const MJS_FLOAT_ARRAY_TYPE = WebGLFloatArray;
67
- //const MJS_FLOAT_ARRAY_TYPE = Float32Array;
68
- //const MJS_FLOAT_ARRAY_TYPE = Float64Array;
69
- //const MJS_FLOAT_ARRAY_TYPE = Array;
70
-
71
- if (MJS_DO_ASSERT) {
72
- function MathUtils_assert(cond, msg) {
73
- if (!cond)
74
- throw "Assertion failed: " + msg;
75
- }
76
- } else {
77
- function MathUtils_assert() { }
78
- }
79
-
80
- /*
81
- * Class: V3
82
- *
83
- * Methods for working with 3-element vectors. A vector is represented by a 3-element array.
84
- * Any valid JavaScript array type may be used, but if new
85
- * vectors are created they are created using the configured MJS_FLOAT_ARRAY_TYPE.
86
- */
87
-
88
- var V3 = { };
89
-
90
- V3._temp1 = new MJS_FLOAT_ARRAY_TYPE(3);
91
- V3._temp2 = new MJS_FLOAT_ARRAY_TYPE(3);
92
- V3._temp3 = new MJS_FLOAT_ARRAY_TYPE(3);
93
-
94
- if (MJS_FLOAT_ARRAY_TYPE == Array) {
95
- V3.x = [1.0, 0.0, 0.0];
96
- V3.y = [0.0, 1.0, 0.0];
97
- V3.z = [0.0, 0.0, 1.0];
98
-
99
- V3.$ = function V3_$(x, y, z) {
100
- return [x, y, z];
101
- };
102
-
103
- V3.clone = function V3_clone(a) {
104
- //MathUtils_assert(a.length == 3, "a.length == 3");
105
- return [a[0], a[1], a[2]];
106
- };
107
- } else {
108
- V3.x = new MJS_FLOAT_ARRAY_TYPE([1.0, 0.0, 0.0]);
109
- V3.y = new MJS_FLOAT_ARRAY_TYPE([0.0, 1.0, 0.0]);
110
- V3.z = new MJS_FLOAT_ARRAY_TYPE([0.0, 0.0, 1.0]);
111
-
112
- /*
113
- * Function: V3.$
114
- *
115
- * Creates a new 3-element vector with the given values.
116
- *
117
- * Parameters:
118
- *
119
- * x,y,z - the 3 elements of the new vector.
120
- *
121
- * Returns:
122
- *
123
- * A new vector containing with the given argument values.
124
- */
125
-
126
- V3.$ = function V3_$(x, y, z) {
127
- return new MJS_FLOAT_ARRAY_TYPE([x, y, z]);
128
- };
129
-
130
- /*
131
- * Function: V3.clone
132
- *
133
- * Clone the given 3-element vector.
134
- *
135
- * Parameters:
136
- *
137
- * a - the 3-element vector to clone
138
- *
139
- * Returns:
140
- *
141
- * A new vector with the same values as the passed-in one.
142
- */
143
-
144
- V3.clone = function V3_clone(a) {
145
- //MathUtils_assert(a.length == 3, "a.length == 3");
146
- return new MJS_FLOAT_ARRAY_TYPE(a);
147
- };
148
- }
149
-
150
- V3.u = V3.x;
151
- V3.v = V3.y;
152
-
153
- /*
154
- * Function: V3.add
155
- *
156
- * Perform r = a + b.
157
- *
158
- * Parameters:
159
- *
160
- * a - the first vector operand
161
- * b - the second vector operand
162
- * r - optional vector to store the result in
163
- *
164
- * Returns:
165
- *
166
- * If r is specified, returns r after performing the operation.
167
- * Otherwise, returns a new 3-element vector with the result.
168
- */
169
- V3.add = function V3_add(a, b, r) {
170
- //MathUtils_assert(a.length == 3, "a.length == 3");
171
- //MathUtils_assert(b.length == 3, "b.length == 3");
172
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
173
-
174
- if (r == undefined)
175
- r = new MJS_FLOAT_ARRAY_TYPE(3);
176
- r[0] = a[0] + b[0];
177
- r[1] = a[1] + b[1];
178
- r[2] = a[2] + b[2];
179
- return r;
180
- };
181
-
182
- /*
183
- * Function: V3.sub
184
- *
185
- * Perform
186
- * r = a - b.
187
- *
188
- * Parameters:
189
- *
190
- * a - the first vector operand
191
- * b - the second vector operand
192
- * r - optional vector to store the result in
193
- *
194
- * Returns:
195
- *
196
- * If r is specified, returns r after performing the operation.
197
- * Otherwise, returns a new 3-element vector with the result.
198
- */
199
- V3.sub = function V3_sub(a, b, r) {
200
- //MathUtils_assert(a.length == 3, "a.length == 3");
201
- //MathUtils_assert(b.length == 3, "b.length == 3");
202
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
203
-
204
- if (r == undefined)
205
- r = new MJS_FLOAT_ARRAY_TYPE(3);
206
- r[0] = a[0] - b[0];
207
- r[1] = a[1] - b[1];
208
- r[2] = a[2] - b[2];
209
- return r;
210
- };
211
-
212
- /*
213
- * Function: V3.neg
214
- *
215
- * Perform
216
- * r = - a.
217
- *
218
- * Parameters:
219
- *
220
- * a - the vector operand
221
- * r - optional vector to store the result in
222
- *
223
- * Returns:
224
- *
225
- * If r is specified, returns r after performing the operation.
226
- * Otherwise, returns a new 3-element vector with the result.
227
- */
228
- V3.neg = function V3_neg(a, r) {
229
- //MathUtils_assert(a.length == 3, "a.length == 3");
230
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
231
-
232
- if (r == undefined)
233
- r = new MJS_FLOAT_ARRAY_TYPE(3);
234
- r[0] = - a[0];
235
- r[1] = - a[1];
236
- r[2] = - a[2];
237
- return r;
238
- };
239
-
240
- /*
241
- * Function: V3.direction
242
- *
243
- * Perform
244
- * r = (a - b) / |a - b|. The result is the normalized
245
- * direction from a to b.
246
- *
247
- * Parameters:
248
- *
249
- * a - the first vector operand
250
- * b - the second vector operand
251
- * r - optional vector to store the result in
252
- *
253
- * Returns:
254
- *
255
- * If r is specified, returns r after performing the operation.
256
- * Otherwise, returns a new 3-element vector with the result.
257
- */
258
- V3.direction = function V3_direction(a, b, r) {
259
- //MathUtils_assert(a.length == 3, "a.length == 3");
260
- //MathUtils_assert(b.length == 3, "b.length == 3");
261
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
262
-
263
- if (r == undefined)
264
- r = new MJS_FLOAT_ARRAY_TYPE(3);
265
- return V3.normalize(V3.sub(a, b, r), r);
266
- };
267
-
268
- /*
269
- * Function: V3.length
270
- *
271
- * Perform r = |a|.
272
- *
273
- * Parameters:
274
- *
275
- * a - the vector operand
276
- *
277
- * Returns:
278
- *
279
- * The length of the given vector.
280
- */
281
- V3.length = function V3_length(a) {
282
- //MathUtils_assert(a.length == 3, "a.length == 3");
283
-
284
- return Math.sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
285
- };
286
-
287
- /*
288
- * Function: V3.lengthSquard
289
- *
290
- * Perform r = |a|*|a|.
291
- *
292
- * Parameters:
293
- *
294
- * a - the vector operand
295
- *
296
- * Returns:
297
- *
298
- * The square of the length of the given vector.
299
- */
300
- V3.lengthSquared = function V3_lengthSquared(a) {
301
- //MathUtils_assert(a.length == 3, "a.length == 3");
302
-
303
- return a[0]*a[0] + a[1]*a[1] + a[2]*a[2];
304
- };
305
-
306
- /*
307
- * Function: V3.normalize
308
- *
309
- * Perform r = a / |a|.
310
- *
311
- * Parameters:
312
- *
313
- * a - the vector operand
314
- * r - optional vector to store the result in
315
- *
316
- * Returns:
317
- *
318
- * If r is specified, returns r after performing the operation.
319
- * Otherwise, returns a new 3-element vector with the result.
320
- */
321
- V3.normalize = function V3_normalize(a, r) {
322
- //MathUtils_assert(a.length == 3, "a.length == 3");
323
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
324
-
325
- if (r == undefined)
326
- r = new MJS_FLOAT_ARRAY_TYPE(3);
327
- var im = 1.0 / V3.length(a);
328
- r[0] = a[0] * im;
329
- r[1] = a[1] * im;
330
- r[2] = a[2] * im;
331
- return r;
332
- };
333
-
334
- /*
335
- * Function: V3.scale
336
- *
337
- * Perform r = a * k.
338
- *
339
- * Parameters:
340
- *
341
- * a - the vector operand
342
- * k - a scalar value
343
- * r - optional vector to store the result in
344
- *
345
- * Returns:
346
- *
347
- * If r is specified, returns r after performing the operation.
348
- * Otherwise, returns a new 3-element vector with the result.
349
- */
350
- V3.scale = function V3_scale(a, k, r) {
351
- //MathUtils_assert(a.length == 3, "a.length == 3");
352
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
353
-
354
- if (r == undefined)
355
- r = new MJS_FLOAT_ARRAY_TYPE(3);
356
- r[0] = a[0] * k;
357
- r[1] = a[1] * k;
358
- r[2] = a[2] * k;
359
- return r;
360
- }
361
-
362
- /*
363
- * Function: V3.dot
364
- *
365
- * Perform
366
- * r = dot(a, b).
367
- *
368
- * Parameters:
369
- *
370
- * a - the first vector operand
371
- * b - the second vector operand
372
- *
373
- * Returns:
374
- *
375
- * The dot product of a and b.
376
- */
377
- V3.dot = function V3_dot(a, b) {
378
- //MathUtils_assert(a.length == 3, "a.length == 3");
379
- //MathUtils_assert(b.length == 3, "b.length == 3");
380
-
381
- return a[0] * b[0] +
382
- a[1] * b[1] +
383
- a[2] * b[2];
384
- };
385
-
386
- /*
387
- * Function: V3.cross
388
- *
389
- * Perform r = a x b.
390
- *
391
- * Parameters:
392
- *
393
- * a - the first vector operand
394
- * b - the second vector operand
395
- * r - optional vector to store the result in
396
- *
397
- * Returns:
398
- *
399
- * If r is specified, returns r after performing the operation.
400
- * Otherwise, returns a new 3-element vector with the result.
401
- */
402
- V3.cross = function V3_cross(a, b, r) {
403
- //MathUtils_assert(a.length == 3, "a.length == 3");
404
- //MathUtils_assert(b.length == 3, "b.length == 3");
405
- //MathUtils_assert(r == undefined || r.length == 3, "r == undefined || r.length == 3");
406
-
407
- if (r == undefined)
408
- r = new MJS_FLOAT_ARRAY_TYPE(3);
409
- r[0] = a[1]*b[2] - a[2]*b[1];
410
- r[1] = a[2]*b[0] - a[0]*b[2];
411
- r[2] = a[0]*b[1] - a[1]*b[0];
412
- return r;
413
- };
414
-
415
- /*
416
- * Class: M4x4
417
- *
418
- * Methods for working with 4x4 matrices. A matrix is represented by a 16-element array
419
- * in column-major order. Any valid JavaScript array type may be used, but if new
420
- * matrices are created they are created using the configured MJS_FLOAT_ARRAY_TYPE.
421
- */
422
-
423
- var M4x4 = { };
424
-
425
- M4x4._temp1 = new MJS_FLOAT_ARRAY_TYPE(16);
426
- M4x4._temp2 = new MJS_FLOAT_ARRAY_TYPE(16);
427
-
428
- if (MJS_FLOAT_ARRAY_TYPE == Array) {
429
- M4x4.I = [1.0, 0.0, 0.0, 0.0,
430
- 0.0, 1.0, 0.0, 0.0,
431
- 0.0, 0.0, 1.0, 0.0,
432
- 0.0, 0.0, 0.0, 1.0];
433
-
434
- M4x4.$ = function M4x4_$(m00, m01, m02, m03,
435
- m04, m05, m06, m07,
436
- m08, m09, m10, m11,
437
- m12, m13, m14, m15)
438
- {
439
- return [m00, m01, m02, m03,
440
- m04, m05, m06, m07,
441
- m08, m09, m10, m11,
442
- m12, m13, m14, m15];
443
- };
444
-
445
- M4x4.clone = function M4x4_clone(m) {
446
- //MathUtils_assert(m.length == 16, "m.length == 16");
447
- return new [m[0], m[1], m[2], m[3],
448
- m[4], m[5], m[6], m[7],
449
- m[8], m[9], m[10], m[11]];
450
- };
451
- } else {
452
- M4x4.I = new MJS_FLOAT_ARRAY_TYPE([1.0, 0.0, 0.0, 0.0,
453
- 0.0, 1.0, 0.0, 0.0,
454
- 0.0, 0.0, 1.0, 0.0,
455
- 0.0, 0.0, 0.0, 1.0]);
456
-
457
- /*
458
- * Function: M4x4.$
459
- *
460
- * Creates a new 4x4 matrix with the given values.
461
- *
462
- * Parameters:
463
- *
464
- * m00..m15 - the 16 elements of the new matrix.
465
- *
466
- * Returns:
467
- *
468
- * A new matrix filled with the given argument values.
469
- */
470
- M4x4.$ = function M4x4_$(m00, m01, m02, m03,
471
- m04, m05, m06, m07,
472
- m08, m09, m10, m11,
473
- m12, m13, m14, m15)
474
- {
475
- return new MJS_FLOAT_ARRAY_TYPE([m00, m01, m02, m03,
476
- m04, m05, m06, m07,
477
- m08, m09, m10, m11,
478
- m12, m13, m14, m15]);
479
- };
480
-
481
- /*
482
- * Function: M4x4.clone
483
- *
484
- * Clone the given 4x4 matrix.
485
- *
486
- * Parameters:
487
- *
488
- * m - the 4x4 matrix to clone
489
- *
490
- * Returns:
491
- *
492
- * A new matrix with the same values as the passed-in one.
493
- */
494
- M4x4.clone = function M4x4_clone(m) {
495
- //MathUtils_assert(m.length == 16, "m.length == 16");
496
- return new MJS_FLOAT_ARRAY_TYPE(m);
497
- };
498
- }
499
-
500
- M4x4.identity = M4x4.I;
501
-
502
- /*
503
- * Function: M4x4.topLeft3x3
504
- *
505
- * Return the top left 3x3 matrix from the given 4x4 matrix m.
506
- *
507
- * Parameters:
508
- *
509
- * m - the matrix
510
- * r - optional 3x3 matrix to store the result in
511
- *
512
- * Returns:
513
- *
514
- * If r is specified, returns r after performing the operation.
515
- * Otherwise, returns a new 3x3 matrix with the result.
516
- */
517
- M4x4.topLeft3x3 = function M4x4_topLeft3x3(m, r) {
518
- //MathUtils_assert(m.length == 16, "m.length == 16");
519
- //MathUtils_assert(r == undefined || r.length == 9, "r == undefined || r.length == 9");
520
-
521
- if (r == undefined)
522
- r = new MJS_FLOAT_ARRAY_TYPE(9);
523
- r[0] = m[0]; r[1] = m[1]; r[2] = m[2];
524
- r[3] = m[4]; r[4] = m[5]; r[5] = m[6];
525
- r[6] = m[8]; r[7] = m[9]; r[8] = m[10];
526
- return r;
527
- };
528
-
529
- /*
530
- * Function: M4x4.inverseOrthonormal
531
- *
532
- * Computes the inverse of the given matrix m, assuming that
533
- * the matrix is orthonormal.
534
- *
535
- * Parameters:
536
- *
537
- * m - the matrix
538
- * r - optional 4x4 matrix to store the result in
539
- *
540
- * Returns:
541
- *
542
- * If r is specified, returns r after performing the operation.
543
- * Otherwise, returns a new 4x4 matrix with the result.
544
- */
545
- M4x4.inverseOrthonormal = function M4x4_inverseOrthonormal(m, r) {
546
- //MathUtils_assert(m.length == 16, "m.length == 16");
547
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
548
- //MathUtils_assert(m != r, "m != r");
549
-
550
- if (r == undefined)
551
- r = new MJS_FLOAT_ARRAY_TYPE(16);
552
- M4x4.transpose(m, r);
553
- var t = [m[12], m[13], m[14]];
554
- r[3] = r[7] = r[11] = 0;
555
- r[12] = -V3.dot([r[0], r[4], r[8]], t);
556
- r[13] = -V3.dot([r[1], r[5], r[9]], t);
557
- r[14] = -V3.dot([r[2], r[6], r[10]], t);
558
- return r;
559
- }
560
-
561
- /*
562
- * Function: M4x4.inverseTo3x3
563
- *
564
- * Computes the inverse of the given matrix m, but calculates
565
- * only the top left 3x3 values of the result.
566
- *
567
- * Parameters:
568
- *
569
- * m - the matrix
570
- * r - optional 3x3 matrix to store the result in
571
- *
572
- * Returns:
573
- *
574
- * If r is specified, returns r after performing the operation.
575
- * Otherwise, returns a new 3x3 matrix with the result.
576
- */
577
- M4x4.inverseTo3x3 = function M4x4_inverseTo3x3(m, r) {
578
- //MathUtils_assert(m.length == 16, "m.length == 16");
579
- //MathUtils_assert(r == undefined || r.length == 9, "r == undefined || r.length == 9");
580
-
581
- if (r == undefined)
582
- r = new MJS_FLOAT_ARRAY_TYPE(9);
583
-
584
- var a11 = m[10]*m[5]-m[6]*m[9],
585
- a21 = -m[10]*m[1]+m[2]*m[9],
586
- a31 = m[6]*m[1]-m[2]*m[5],
587
- a12 = -m[10]*m[4]+m[6]*m[8],
588
- a22 = m[10]*m[0]-m[2]*m[8],
589
- a32 = -m[6]*m[0]+m[2]*m[4],
590
- a13 = m[9]*m[4]-m[5]*m[8],
591
- a23 = -m[9]*m[0]+m[1]*m[8],
592
- a33 = m[5]*m[0]-m[1]*m[4];
593
- var det = m[0]*(a11) + m[1]*(a12) + m[2]*(a13);
594
- if (det == 0) // no inverse
595
- throw "matrix not invertible";
596
- var idet = 1.0 / det;
597
-
598
- r[0] = idet*a11;
599
- r[1] = idet*a21;
600
- r[2] = idet*a31;
601
- r[3] = idet*a12;
602
- r[4] = idet*a22;
603
- r[5] = idet*a32;
604
- r[6] = idet*a13;
605
- r[7] = idet*a23;
606
- r[8] = idet*a33;
607
-
608
- return r;
609
- };
610
-
611
- /*
612
- * Function: M4x4.makeFrustum
613
- *
614
- * Creates a matrix for a projection frustum with the given parameters.
615
- *
616
- * Parameters:
617
- *
618
- * left - the left coordinate of the frustum
619
- * right- the right coordinate of the frustum
620
- * bottom - the bottom coordinate of the frustum
621
- * top - the top coordinate of the frustum
622
- * znear - the near z distance of the frustum
623
- * zfar - the far z distance of the frustum
624
- * r - optional 4x4 matrix to store the result in
625
- *
626
- * Returns:
627
- *
628
- * If r is specified, returns r after creating the projection matrix.
629
- * Otherwise, returns a new 4x4 matrix.
630
- */
631
- M4x4.makeFrustum = function M4x4_makeFrustum(left, right, bottom, top, znear, zfar, r) {
632
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
633
-
634
- if (r == undefined)
635
- r = new MJS_FLOAT_ARRAY_TYPE(16);
636
-
637
- var X = 2*znear/(right-left);
638
- var Y = 2*znear/(top-bottom);
639
- var A = (right+left)/(right-left);
640
- var B = (top+bottom)/(top-bottom);
641
- var C = -(zfar+znear)/(zfar-znear);
642
- var D = -2*zfar*znear/(zfar-znear);
643
-
644
- r[0] = 2*znear/(right-left);
645
- r[1] = 0;
646
- r[2] = 0;
647
- r[3] = 0;
648
- r[4] = 0;
649
- r[5] = 2*znear/(top-bottom);
650
- r[6] = 0;
651
- r[7] = 0;
652
- r[8] = (right+left)/(right-left);
653
- r[9] = (top+bottom)/(top-bottom);
654
- r[10] = -(zfar+znear)/(zfar-znear);
655
- r[11] = -1;
656
- r[12] = 0;
657
- r[13] = 0;
658
- r[14] = -2*zfar*znear/(zfar-znear);
659
- r[15] = 0;
660
-
661
- return r;
662
- };
663
-
664
- /*
665
- * Function: M4x4.makePerspective
666
- *
667
- * Creates a matrix for a perspective projection with the given parameters.
668
- *
669
- * Parameters:
670
- *
671
- * fovy - field of view in the y axis, in degrees
672
- * aspect - aspect ratio
673
- * znear - the near z distance of the projection
674
- * zfar - the far z distance of the projection
675
- * r - optional 4x4 matrix to store the result in
676
- *
677
- * Returns:
678
- *
679
- * If r is specified, returns r after creating the projection matrix.
680
- * Otherwise, returns a new 4x4 matrix.
681
- */
682
- M4x4.makePerspective = function M4x4_makePerspective (fovy, aspect, znear, zfar, r) {
683
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
684
-
685
- var ymax = znear * Math.tan(fovy * Math.PI / 360.0);
686
- var ymin = -ymax;
687
- var xmin = ymin * aspect;
688
- var xmax = ymax * aspect;
689
-
690
- return M4x4.makeFrustum(xmin, xmax, ymin, ymax, znear, zfar, r);
691
- };
692
-
693
- /*
694
- * Function: M4x4.makeOrtho
695
- *
696
- * Creates a matrix for an orthogonal frustum projection with the given parameters.
697
- *
698
- * Parameters:
699
- *
700
- * left - the left coordinate of the frustum
701
- * right- the right coordinate of the frustum
702
- * bottom - the bottom coordinate of the frustum
703
- * top - the top coordinate of the frustum
704
- * znear - the near z distance of the frustum
705
- * zfar - the far z distance of the frustum
706
- * r - optional 4x4 matrix to store the result in
707
- *
708
- * Returns:
709
- *
710
- * If r is specified, returns r after creating the projection matrix.
711
- * Otherwise, returns a new 4x4 matrix.
712
- */
713
- M4x4.makeOrtho = function M4x4_makeOrtho (left, right, bottom, top, znear, zfar, r) {
714
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
715
-
716
- if (r == undefined)
717
- r = new MJS_FLOAT_ARRAY_TYPE(16);
718
-
719
- var tX = -(right+left)/(right-left);
720
- var tY = -(top+bottom)/(top-bottom);
721
- var tZ = -(zfar+znear)/(zfar-znear);
722
- var X = 2 / (right-left);
723
- var Y = 2 / (top-bottom);
724
- var Z = -2 / (zfar-znear);
725
-
726
- r[0] = 2 / (right-left);
727
- r[1] = 0;
728
- r[2] = 0;
729
- r[3] = 0;
730
- r[4] = 0;
731
- r[5] = 2 / (top-bottom);
732
- r[6] = 0;
733
- r[7] = 0;
734
- r[8] = 0;
735
- r[9] = 0;
736
- r[10] = -2 / (zfar-znear);
737
- r[11] = 0;
738
- r[12] = -(right+left)/(right-left);
739
- r[13] = -(top+bottom)/(top-bottom);
740
- r[14] = -(zfar+znear)/(zfar-znear);
741
- r[15] = 0;
742
-
743
- return r;
744
- };
745
-
746
- /*
747
- * Function: M4x4.makeOrtho
748
- *
749
- * Creates a matrix for a 2D orthogonal frustum projection with the given parameters.
750
- * znear and zfar are assumed to be -1 and 1, respectively.
751
- *
752
- * Parameters:
753
- *
754
- * left - the left coordinate of the frustum
755
- * right- the right coordinate of the frustum
756
- * bottom - the bottom coordinate of the frustum
757
- * top - the top coordinate of the frustum
758
- * r - optional 4x4 matrix to store the result in
759
- *
760
- * Returns:
761
- *
762
- * If r is specified, returns r after creating the projection matrix.
763
- * Otherwise, returns a new 4x4 matrix.
764
- */
765
- M4x4.makeOrtho2D = function M4x4_makeOrtho2D (left, right, bottom, top, r) {
766
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
767
-
768
- return M4x4.makeOrtho(left, right, bottom, top, -1, 1, r);
769
- };
770
-
771
- /*
772
- * Function: M4x4.mul
773
- *
774
- * Performs r = a * b.
775
- *
776
- * Parameters:
777
- *
778
- * a - the first matrix operand
779
- * b - the second matrix operand
780
- * r - optional 4x4 matrix to store the result in
781
- *
782
- * Returns:
783
- *
784
- * If r is specified, returns r after performing the operation.
785
- * Otherwise, returns a new 4x4 matrix with the result.
786
- */
787
- M4x4.mul = function M4x4_mul(a, b, r) {
788
- //MathUtils_assert(a.length == 16, "a.length == 16");
789
- //MathUtils_assert(b.length == 16, "b.length == 16");
790
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
791
- //MathUtils_assert(a != r && b != r, "a != r && b != r");
792
-
793
- if (r == undefined)
794
- r = new MJS_FLOAT_ARRAY_TYPE(16);
795
-
796
- r[0] =
797
- b[0] * a[0] +
798
- b[0+1] * a[4] +
799
- b[0+2] * a[8] +
800
- b[0+3] * a[12];
801
- r[0+1] =
802
- b[0] * a[1] +
803
- b[0+1] * a[5] +
804
- b[0+2] * a[9] +
805
- b[0+3] * a[13];
806
- r[0+2] =
807
- b[0] * a[2] +
808
- b[0+1] * a[6] +
809
- b[0+2] * a[10] +
810
- b[0+3] * a[14];
811
- r[0+3] =
812
- b[0] * a[3] +
813
- b[0+1] * a[7] +
814
- b[0+2] * a[11] +
815
- b[0+3] * a[15];
816
- r[4] =
817
- b[4] * a[0] +
818
- b[4+1] * a[4] +
819
- b[4+2] * a[8] +
820
- b[4+3] * a[12];
821
- r[4+1] =
822
- b[4] * a[1] +
823
- b[4+1] * a[5] +
824
- b[4+2] * a[9] +
825
- b[4+3] * a[13];
826
- r[4+2] =
827
- b[4] * a[2] +
828
- b[4+1] * a[6] +
829
- b[4+2] * a[10] +
830
- b[4+3] * a[14];
831
- r[4+3] =
832
- b[4] * a[3] +
833
- b[4+1] * a[7] +
834
- b[4+2] * a[11] +
835
- b[4+3] * a[15];
836
- r[8] =
837
- b[8] * a[0] +
838
- b[8+1] * a[4] +
839
- b[8+2] * a[8] +
840
- b[8+3] * a[12];
841
- r[8+1] =
842
- b[8] * a[1] +
843
- b[8+1] * a[5] +
844
- b[8+2] * a[9] +
845
- b[8+3] * a[13];
846
- r[8+2] =
847
- b[8] * a[2] +
848
- b[8+1] * a[6] +
849
- b[8+2] * a[10] +
850
- b[8+3] * a[14];
851
- r[8+3] =
852
- b[8] * a[3] +
853
- b[8+1] * a[7] +
854
- b[8+2] * a[11] +
855
- b[8+3] * a[15];
856
- r[12] =
857
- b[12] * a[0] +
858
- b[12+1] * a[4] +
859
- b[12+2] * a[8] +
860
- b[12+3] * a[12];
861
- r[12+1] =
862
- b[12] * a[1] +
863
- b[12+1] * a[5] +
864
- b[12+2] * a[9] +
865
- b[12+3] * a[13];
866
- r[12+2] =
867
- b[12] * a[2] +
868
- b[12+1] * a[6] +
869
- b[12+2] * a[10] +
870
- b[12+3] * a[14];
871
- r[12+3] =
872
- b[12] * a[3] +
873
- b[12+1] * a[7] +
874
- b[12+2] * a[11] +
875
- b[12+3] * a[15];
876
- return r;
877
- };
878
-
879
- /*
880
- * Function: M4x4.makeRotate
881
- *
882
- * Creates a transformation matrix for rotation by angle radians about the 3-element vector axis.
883
- *
884
- * Parameters:
885
- *
886
- * angle - the angle of rotation, in radians
887
- * axis - the axis around which the rotation is performed, a 3-element vector
888
- * r - optional 4x4 matrix to store the result in
889
- *
890
- * Returns:
891
- *
892
- * If r is specified, returns r after creating the matrix.
893
- * Otherwise, returns a new 4x4 matrix with the result.
894
- */
895
- M4x4.makeRotate = function M4x4_makeRotate(angle, axis, r) {
896
- //MathUtils_assert(angle.length == 3, "angle.length == 3");
897
- //MathUtils_assert(axis.length == 3, "axis.length == 3");
898
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
899
-
900
- if (r == undefined)
901
- r = new MJS_FLOAT_ARRAY_TYPE(16);
902
-
903
- axis = V3.normalize(axis, V3._temp1);
904
- var x = axis[0], y = axis[1], z = axis[2];
905
- var c = Math.cos(angle);
906
- var c1 = 1-c;
907
- var s = Math.sin(angle);
908
-
909
- r[0] = x*x*c1+c;
910
- r[1] = y*x*c1+z*s;
911
- r[2] = z*x*c1-y*s;
912
- r[3] = 0;
913
- r[4] = x*y*c1-z*s;
914
- r[5] = y*y*c1+c;
915
- r[6] = y*z*c1+x*s;
916
- r[7] = 0;
917
- r[8] = x*z*c1+y*s;
918
- r[9] = y*z*c1-x*s;
919
- r[10] = z*z*c1+c;
920
- r[11] = 0;
921
- r[12] = 0;
922
- r[13] = 0;
923
- r[14] = 0;
924
- r[15] = 1;
925
-
926
- return r;
927
- };
928
-
929
- /*
930
- * Function: M4x4.rotate
931
- *
932
- * Concatenates a rotation of angle radians about the axis to the give matrix m.
933
- *
934
- * Parameters:
935
- *
936
- * angle - the angle of rotation, in radians
937
- * axis - the axis around which the rotation is performed, a 3-element vector
938
- * m - the matrix to concatenate the rotation to
939
- * r - optional 4x4 matrix to store the result in
940
- *
941
- * Returns:
942
- *
943
- * If r is specified, returns r after performing the operation.
944
- * Otherwise, returns a new 4x4 matrix with the result.
945
- */
946
- M4x4.rotate = function M4x4_rotate(angle, axis, m, r) {
947
- //MathUtils_assert(angle.length == 3, "angle.length == 3");
948
- //MathUtils_assert(axis.length == 3, "axis.length == 3");
949
- //MathUtils_assert(m.length == 16, "m.length == 16");
950
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
951
-
952
- M4x4.makeRotate(angle, axis, M4x4._temp1);
953
- return M4x4.mul(m, M4x4._temp1, r);
954
- };
955
-
956
- /*
957
- * Function: M4x4.makeScale3
958
- *
959
- * Creates a transformation matrix for scaling by 3 scalar values, one for
960
- * each of the x, y, and z directions.
961
- *
962
- * Parameters:
963
- *
964
- * x - the scale for the x axis
965
- * y - the scale for the y axis
966
- * z - the scale for the z axis
967
- * r - optional 4x4 matrix to store the result in
968
- *
969
- * Returns:
970
- *
971
- * If r is specified, returns r after creating the matrix.
972
- * Otherwise, returns a new 4x4 matrix with the result.
973
- */
974
- M4x4.makeScale3 = function M4x4_makeScale3(x, y, z, r) {
975
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
976
-
977
- if (r == undefined)
978
- r = new MJS_FLOAT_ARRAY_TYPE(16);
979
-
980
- r[0] = x;
981
- r[1] = 0;
982
- r[2] = 0;
983
- r[3] = 0;
984
- r[4] = 0;
985
- r[5] = y;
986
- r[6] = 0;
987
- r[7] = 0;
988
- r[8] = 0;
989
- r[9] = 0;
990
- r[10] = z;
991
- r[11] = 0;
992
- r[12] = 0;
993
- r[13] = 0;
994
- r[14] = 0;
995
- r[15] = 1;
996
-
997
- return r;
998
- };
999
-
1000
- /*
1001
- * Function: M4x4.makeScale1
1002
- *
1003
- * Creates a transformation matrix for a uniform scale by a single scalar value.
1004
- *
1005
- * Parameters:
1006
- *
1007
- * k - the scale factor
1008
- * r - optional 4x4 matrix to store the result in
1009
- *
1010
- * Returns:
1011
- *
1012
- * If r is specified, returns r after creating the matrix.
1013
- * Otherwise, returns a new 4x4 matrix with the result.
1014
- */
1015
- M4x4.makeScale1 = function M4x4_makeScale1(k, r) {
1016
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1017
-
1018
- return M4x4.makeScale3(k, k, k, r);
1019
- };
1020
-
1021
- /*
1022
- * Function: M4x4.makeScale
1023
- *
1024
- * Creates a transformation matrix for scaling each of the x, y, and z axes by the amount
1025
- * given in the corresponding element of the 3-element vector.
1026
- *
1027
- * Parameters:
1028
- *
1029
- * v - the 3-element vector containing the scale factors
1030
- * r - optional 4x4 matrix to store the result in
1031
- *
1032
- * Returns:
1033
- *
1034
- * If r is specified, returns r after creating the matrix.
1035
- * Otherwise, returns a new 4x4 matrix with the result.
1036
- */
1037
- M4x4.makeScale = function M4x4_makeScale(v, r) {
1038
- //MathUtils_assert(v.length == 3, "v.length == 3");
1039
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1040
-
1041
- return M4x4.makeScale3(v[0], v[1], v[2], r);
1042
- };
1043
-
1044
- /*
1045
- * Function: M4x4.scale3
1046
- */
1047
- M4x4.scale3 = function M4x4_scale3(x, y, z, m, r) {
1048
- //MathUtils_assert(m.length == 16, "m.length == 16");
1049
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1050
-
1051
- M4x4.makeScale3(x, y, z, M4x4._temp1);
1052
- return M4x4.mul(m, M4x4._temp1, r);
1053
- };
1054
-
1055
- /*
1056
- * Function: M4x4.scale1
1057
- */
1058
- M4x4.scale1 = function M4x4_scale1(k, m, r) {
1059
- //MathUtils_assert(m.length == 16, "m.length == 16");
1060
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1061
-
1062
- M4x4.makeScale3(k, k, k, M4x4._temp1);
1063
- return M4x4.mul(m, M4x4._temp1, r);
1064
- };
1065
-
1066
- /*
1067
- * Function: M4x4.scale1
1068
- */
1069
- M4x4.scale = function M4x4_scale(v, m, r) {
1070
- //MathUtils_assert(v.length == 3, "v.length == 3");
1071
- //MathUtils_assert(m.length == 16, "m.length == 16");
1072
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1073
-
1074
- M4x4.makeScale3(v[0], v[1], v[2], M4x4._temp1);
1075
- return M4x4.mul(m, M4x4._temp1, r);
1076
- };
1077
-
1078
- /*
1079
- * Function: M4x4.makeTranslate3
1080
- */
1081
- M4x4.makeTranslate3 = function M4x4_makeTranslate3(x, y, z, r) {
1082
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1083
-
1084
- if (r == undefined)
1085
- r = new MJS_FLOAT_ARRAY_TYPE(16);
1086
-
1087
- r[0] = 1;
1088
- r[1] = 0;
1089
- r[2] = 0;
1090
- r[3] = 0;
1091
- r[4] = 0;
1092
- r[5] = 1;
1093
- r[6] = 0;
1094
- r[7] = 0;
1095
- r[8] = 0;
1096
- r[9] = 0;
1097
- r[10] = 1;
1098
- r[11] = 0;
1099
- r[12] = x;
1100
- r[13] = y;
1101
- r[14] = z;
1102
- r[15] = 1;
1103
-
1104
- return r;
1105
- };
1106
-
1107
- /*
1108
- * Function: M4x4.makeTranslate1
1109
- */
1110
- M4x4.makeTranslate1 = function M4x4_makeTranslate1 (k, r) {
1111
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1112
-
1113
- return M4x4.makeTranslate3(k, k, k, r);
1114
- };
1115
-
1116
- /*
1117
- * Function: M4x4.makeTranslate
1118
- */
1119
- M4x4.makeTranslate = function M4x4_makeTranslate (v, r) {
1120
- //MathUtils_assert(v.length == 3, "v.length == 3");
1121
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1122
-
1123
- return M4x4.makeTranslate3(v[0], v[1], v[2], r);
1124
- };
1125
-
1126
- /*
1127
- * Function: M4x4.translate3
1128
- */
1129
- M4x4.translate3 = function M4x4_translate3 (x, y, z, m, r) {
1130
- //MathUtils_assert(m.length == 16, "m.length == 16");
1131
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1132
-
1133
- M4x4.makeTranslate3(x, y, z, M4x4._temp1);
1134
- return M4x4.mul(m, M4x4._temp1, r);
1135
- };
1136
-
1137
- /*
1138
- * Function: M4x4.translate1
1139
- */
1140
- M4x4.translate1 = function M4x4_translate1 (k, m, r) {
1141
- //MathUtils_assert(m.length == 16, "m.length == 16");
1142
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1143
-
1144
- M4x4.makeTranslate3(k, k, k, M4x4._temp1);
1145
- return M4x4.mul(m, M4x4._temp1, r);
1146
- };
1147
-
1148
- /*
1149
- * Function: M4x4.translate
1150
- */
1151
- M4x4.translate = function M4x4_translate (v, m, r) {
1152
- //MathUtils_assert(v.length == 3, "v.length == 3");
1153
- //MathUtils_assert(m.length == 16, "m.length == 16");
1154
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1155
-
1156
- M4x4.makeTranslate3(v[0], v[1], v[2], M4x4._temp1);
1157
- return M4x4.mul(m, M4x4._temp1, r);
1158
- };
1159
-
1160
- /*
1161
- * Function: M4x4.makeLookAt
1162
- */
1163
- M4x4.makeLookAt = function M4x4_makeLookAt (eye, center, up, r) {
1164
- //MathUtils_assert(eye.length == 3, "eye.length == 3");
1165
- //MathUtils_assert(center.length == 3, "center.length == 3");
1166
- //MathUtils_assert(up.length == 3, "up.length == 3");
1167
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1168
-
1169
- var z = V3.direction(eye, center, V3._temp1);
1170
- var x = V3.normalize(V3.cross(up, z, V3._temp2), V3._temp2);
1171
- var y = V3.normalize(V3.cross(z, x, V3._temp3), V3._temp3);
1172
-
1173
- var tm1 = M4x4._temp1;
1174
- var tm2 = M4x4._temp2;
1175
-
1176
- tm1[0] = x[0];
1177
- tm1[1] = y[0];
1178
- tm1[2] = z[0];
1179
- tm1[3] = 0;
1180
- tm1[4] = x[1];
1181
- tm1[5] = y[1];
1182
- tm1[6] = z[1];
1183
- tm1[7] = 0;
1184
- tm1[8] = x[2];
1185
- tm1[9] = y[2];
1186
- tm1[10] = z[2];
1187
- tm1[11] = 0;
1188
- tm1[12] = 0;
1189
- tm1[13] = 0;
1190
- tm1[14] = 0;
1191
- tm1[15] = 1;
1192
-
1193
- tm2[0] = 1; tm2[1] = 0; tm2[2] = 0; tm2[3] = 0;
1194
- tm2[4] = 0; tm2[5] = 1; tm2[6] = 0; tm2[7] = 0;
1195
- tm2[8] = 0; tm2[9] = 0; tm2[10] = 1; tm2[3] = 0;
1196
- tm2[0] = -eye[0]; tm2[1] = -eye[1]; tm2[2] = -eye[2]; tm2[3] = 0;
1197
-
1198
- if (r == undefined)
1199
- r = new MJS_FLOAT_ARRAY_TYPE(16);
1200
- return M4x4.mul(tm1, tm2, r);
1201
- };
1202
-
1203
- /*
1204
- * Function: M4x4.transpose
1205
- */
1206
- M4x4.transpose = function M4x4_transpose (m, r) {
1207
- //MathUtils_assert(m.length == 16, "m.length == 16");
1208
- //MathUtils_assert(r == undefined || r.length == 16, "r == undefined || r.length == 16");
1209
-
1210
- if (m == r) {
1211
- var tmp = 0.0;
1212
- tmp = m[1]; m[1] = m[4]; m[4] = tmp;
1213
- tmp = m[2]; m[2] = m[8]; m[8] = tmp;
1214
- tmp = m[3]; m[3] = m[12]; m[12] = tmp;
1215
- tmp = m[6]; m[6] = m[9]; m[9] = tmp;
1216
- tmp = m[7]; m[7] = m[13]; m[13] = tmp;
1217
- tmp = m[11]; m[11] = m[14]; m[14] = tmp;
1218
- return m;
1219
- }
1220
-
1221
- if (r == undefined)
1222
- r = new MJS_FLOAT_ARRAY_TYPE(16);
1223
-
1224
- r[0] = m[0]; r[1] = m[4]; r[2] = m[8]; r[3] = m[12];
1225
- r[4] = m[1]; r[5] = m[5]; r[6] = m[9]; r[7] = m[13];
1226
- r[8] = m[2]; r[9] = m[6]; r[10] = m[10]; r[11] = m[14];
1227
- r[12] = m[3]; r[13] = m[7]; r[14] = m[11]; r[15] = m[15];
1228
-
1229
- return r;
1230
- };