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.
- data/CHANGELOG +6 -0
- data/jax.gemspec +6 -2
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +1 -1
- data/lib/jax/version.rb +1 -1
- metadata +3 -533
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/getting_started/clean_passing_jasmine_suite.png +0 -0
- data/guides/assets/images/getting_started/dungeon-complete.png +0 -0
- data/guides/assets/images/getting_started/dungeon-normal-map.png +0 -0
- data/guides/assets/images/getting_started/dungeon-rainbow-textured.png +0 -0
- data/guides/assets/images/getting_started/dungeon-rainbow.png +0 -0
- data/guides/assets/images/getting_started/dungeon-textured-lighting.png +0 -0
- data/guides/assets/images/getting_started/dungeon-textured.png +0 -0
- data/guides/assets/images/getting_started/rock.png +0 -0
- data/guides/assets/images/getting_started/rock_normal.png +0 -0
- data/guides/assets/images/getting_started/teapot-red-directional-point.png +0 -0
- data/guides/assets/images/getting_started/teapot-red-directional.png +0 -0
- data/guides/assets/images/getting_started/teapot-red-nolight.png +0 -0
- data/guides/assets/images/getting_started/teapot-red-spot-point-directional.png +0 -0
- data/guides/assets/images/getting_started/teapot-white.png +0 -0
- data/guides/assets/images/getting_started/teapot-with-model.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/icons/README +0 -5
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/javascripts/guides.js +0 -7
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +0 -125
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +0 -17
- data/guides/assets/stylesheets/fixes.css +0 -16
- data/guides/assets/stylesheets/main.css +0 -445
- data/guides/assets/stylesheets/print.css +0 -52
- data/guides/assets/stylesheets/reset.css +0 -43
- data/guides/assets/stylesheets/style.css +0 -13
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +0 -226
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeJaxGuides.css +0 -116
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
- data/guides/jax_guides.rb +0 -41
- data/guides/jax_guides/common.rb +0 -7
- data/guides/jax_guides/generator.rb +0 -287
- data/guides/jax_guides/helpers.rb +0 -29
- data/guides/jax_guides/indexer.rb +0 -69
- data/guides/jax_guides/levenshtein.rb +0 -31
- data/guides/jax_guides/textile_extensions.rb +0 -61
- data/guides/partials/_top_nav.html.erb +0 -17
- data/guides/source/getting_started.textile +0 -1210
- data/guides/source/index.html.erb +0 -61
- data/guides/source/layout.html.erb +0 -147
- data/guides/source/lighting.textile +0 -5
- data/guides/source/materials.textile +0 -5
- data/guides/source/matrices.textile +0 -5
- data/guides/source/shaders.textile +0 -499
- data/guides/source/testing.textile +0 -5
- data/guides/w3c_validator.rb +0 -91
- data/public/images/brickwall.jpg +0 -0
- data/public/images/jacks.jpg +0 -0
- data/public/images/normal_map.jpg +0 -0
- data/public/images/rock.png +0 -0
- data/public/images/rockNormal.png +0 -0
- data/public/images/rss.png +0 -0
- data/public/webgl_not_supported.html +0 -26
- data/spec/example_app/Gemfile +0 -1
- data/spec/example_app/Rakefile +0 -15
- data/spec/example_app/app/controllers/application_controller.js +0 -5
- data/spec/example_app/app/controllers/courthouse_controller.js +0 -24
- data/spec/example_app/app/controllers/lighting_controller.js +0 -67
- data/spec/example_app/app/controllers/noise_controller.js +0 -50
- data/spec/example_app/app/controllers/picking_controller.js +0 -32
- data/spec/example_app/app/controllers/shadows_controller.js +0 -130
- data/spec/example_app/app/controllers/textures_controller.js +0 -52
- data/spec/example_app/app/helpers/application_helper.js +0 -3
- data/spec/example_app/app/helpers/noise_helper.js +0 -3
- data/spec/example_app/app/helpers/picking_helper.js +0 -3
- data/spec/example_app/app/helpers/textures_helper.js +0 -3
- data/spec/example_app/app/models/blob.js +0 -38
- data/spec/example_app/app/models/character.js +0 -23
- data/spec/example_app/app/models/door.js +0 -10
- data/spec/example_app/app/models/scene.js +0 -19
- data/spec/example_app/app/resources/blobs/default.yml +0 -2
- data/spec/example_app/app/resources/characters/judge.yml +0 -3
- data/spec/example_app/app/resources/doors/courthouse_door.yml +0 -5
- data/spec/example_app/app/resources/light_sources/directional_light.yml +0 -13
- data/spec/example_app/app/resources/light_sources/point_light.yml +0 -31
- data/spec/example_app/app/resources/light_sources/spot_light.yml +0 -15
- data/spec/example_app/app/resources/light_sources/sun.yml +0 -7
- data/spec/example_app/app/resources/light_sources/textures_point.yml +0 -34
- data/spec/example_app/app/resources/materials/blob.yml +0 -28
- data/spec/example_app/app/resources/materials/bricks.yml +0 -36
- data/spec/example_app/app/resources/materials/lighting_with_shadows.yml +0 -27
- data/spec/example_app/app/resources/scenes/courthouse.yml +0 -4
- data/spec/example_app/app/shaders/blob/common.ejs +0 -13
- data/spec/example_app/app/shaders/blob/fragment.ejs +0 -8
- data/spec/example_app/app/shaders/blob/manifest.yml +0 -15
- data/spec/example_app/app/shaders/blob/material.js +0 -51
- data/spec/example_app/app/shaders/blob/vertex.ejs +0 -40
- data/spec/example_app/app/views/courthouse/index.js +0 -4
- data/spec/example_app/app/views/lighting/index.js +0 -4
- data/spec/example_app/app/views/noise/index.js +0 -4
- data/spec/example_app/app/views/picking/index.js +0 -4
- data/spec/example_app/app/views/shadows/index.js +0 -6
- data/spec/example_app/app/views/textures/index.js +0 -4
- data/spec/example_app/config/application.rb +0 -6
- data/spec/example_app/config/boot.rb +0 -13
- data/spec/example_app/config/routes.rb +0 -8
- data/spec/example_app/public/images/185__normalmap.png +0 -0
- data/spec/example_app/public/images/face_norm.jpg +0 -0
- data/spec/example_app/public/images/rock.png +0 -0
- data/spec/example_app/public/images/rockNormal.png +0 -0
- data/spec/example_app/public/images/rss.png +0 -0
- data/spec/example_app/public/webgl_not_supported.html +0 -26
- data/spec/example_app/script/jax +0 -7
- data/spec/example_app/spec/javascripts/controllers/noise_controller_spec.js +0 -11
- data/spec/example_app/spec/javascripts/controllers/picking_controller_spec.js +0 -11
- data/spec/example_app/spec/javascripts/controllers/textures_controller_spec.js +0 -11
- data/spec/example_app/spec/javascripts/helpers/application_helper_spec.js +0 -12
- data/spec/example_app/spec/javascripts/helpers/noise_helper_spec.js +0 -12
- data/spec/example_app/spec/javascripts/helpers/picking_helper_spec.js +0 -12
- data/spec/example_app/spec/javascripts/models/blob_spec.js +0 -11
- data/spec/example_app/spec/javascripts/resources/directional_light_spec.js +0 -16
- data/spec/example_app/spec/javascripts/resources/point_light_spec.js +0 -17
- data/spec/example_app/spec/javascripts/resources/spot_light_spec.js +0 -18
- data/spec/example_app/spec/javascripts/shaders/blob_spec.js +0 -27
- data/spec/example_app/spec/javascripts/support/jasmine.yml +0 -89
- data/spec/example_app/spec/javascripts/support/jasmine_runner.rb +0 -32
- data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +0 -33
- data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js +0 -93
- data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +0 -111
- data/spec/javascripts/helpers/jax_spec_environment_helper.js +0 -33
- data/spec/javascripts/helpers/jax_spec_helper.js +0 -216
- data/spec/javascripts/jax/builtin/meshes/cube_spec.js +0 -10
- data/spec/javascripts/jax/builtin/meshes/plane_spec.js +0 -8
- data/spec/javascripts/jax/builtin/meshes/quad_spec.js +0 -8
- data/spec/javascripts/jax/builtin/meshes/sphere_spec.js +0 -8
- data/spec/javascripts/jax/builtin/meshes/teapot_spec.js +0 -8
- data/spec/javascripts/jax/builtin/meshes/torus_spec.js +0 -8
- data/spec/javascripts/jax/compatibility_spec.js +0 -50
- data/spec/javascripts/jax/context_spec.js +0 -82
- data/spec/javascripts/jax/controller_spec.js +0 -145
- data/spec/javascripts/jax/core/delegation_spec.js +0 -48
- data/spec/javascripts/jax/core/events_spec.js +0 -17
- data/spec/javascripts/jax/core/matrix_stack_spec.js +0 -28
- data/spec/javascripts/jax/core/utils_spec.js +0 -275
- data/spec/javascripts/jax/helper_spec.js +0 -33
- data/spec/javascripts/jax/model_spec.js +0 -97
- data/spec/javascripts/jax/optimizations/material_limitations_spec.js +0 -87
- data/spec/javascripts/jax/optimizations/shaders/basic_spec.js +0 -68
- data/spec/javascripts/jax/prototype/extensions_spec.js +0 -34
- data/spec/javascripts/jax/route_set_spec.js +0 -67
- data/spec/javascripts/jax/view_manager_spec.js +0 -17
- data/spec/javascripts/jax/webgl/camera_spec.js +0 -159
- data/spec/javascripts/jax/webgl/framebuffer_spec.js +0 -46
- data/spec/javascripts/jax/webgl/lighting_spec.js +0 -61
- data/spec/javascripts/jax/webgl/material_spec.js +0 -118
- data/spec/javascripts/jax/webgl/mesh_spec.js +0 -86
- data/spec/javascripts/jax/webgl/shader/manifest_spec.js +0 -60
- data/spec/javascripts/jax/webgl/shader_chain_spec.js +0 -192
- data/spec/javascripts/jax/webgl/shader_spec.js +0 -276
- data/spec/javascripts/jax/webgl/tangent_space_spec.js +0 -142
- data/spec/javascripts/jax/webgl/texture_spec.js +0 -162
- data/spec/javascripts/jax/webgl_spec.js +0 -5
- data/spec/javascripts/jax/world_spec.js +0 -161
- data/spec/javascripts/jax_spec.js +0 -27
- data/spec/javascripts/shaders/core_materials_spec.js +0 -42
- data/spec/javascripts/shaders/fog_spec.js +0 -19
- data/spec/javascripts/shaders/lighting_spec.js +0 -19
- data/spec/javascripts/shaders/normal_map_spec.js +0 -19
- data/spec/javascripts/shaders/paraboloid_spec.js +0 -37
- data/spec/javascripts/shaders/preprocessor_spec.js +0 -50
- data/spec/javascripts/shaders/shadow_map_spec.js +0 -19
- data/spec/javascripts/shaders/texture_spec.js +0 -40
- data/src/constants.yml +0 -1
- data/src/constants.yml.erb +0 -1
- data/src/jax.js +0 -119
- data/src/jax/anim_frame.js +0 -51
- data/src/jax/builtin/all.js +0 -7
- data/src/jax/builtin/meshes/cube.js +0 -83
- data/src/jax/builtin/meshes/plane.js +0 -63
- data/src/jax/builtin/meshes/quad.js +0 -86
- data/src/jax/builtin/meshes/sphere.js +0 -65
- data/src/jax/builtin/meshes/teapot.js +0 -48
- data/src/jax/builtin/meshes/torus.js +0 -64
- data/src/jax/compatibility.js +0 -303
- data/src/jax/context.js +0 -420
- data/src/jax/core.js +0 -42
- data/src/jax/core/math.js +0 -55
- data/src/jax/core/matrix_stack.js +0 -311
- data/src/jax/core/util.js +0 -253
- data/src/jax/events.js +0 -234
- data/src/jax/geometry.js +0 -7
- data/src/jax/geometry/plane.js +0 -113
- data/src/jax/mvc/controller.js +0 -195
- data/src/jax/mvc/helper.js +0 -35
- data/src/jax/mvc/model.js +0 -302
- data/src/jax/mvc/route_set.js +0 -125
- data/src/jax/mvc/view.js +0 -43
- data/src/jax/mvc/view_manager.js +0 -47
- data/src/jax/noise.js +0 -206
- data/src/jax/prototype/class.js +0 -81
- data/src/jax/prototype/core.js +0 -112
- data/src/jax/prototype/extensions.js +0 -142
- data/src/jax/vendor/ejs.js +0 -4
- data/src/jax/vendor/glMatrix.js +0 -3
- data/src/jax/webgl.js +0 -98
- data/src/jax/webgl/camera.js +0 -526
- data/src/jax/webgl/core.js +0 -6
- data/src/jax/webgl/core/buffer.js +0 -161
- data/src/jax/webgl/core/edge.js +0 -6
- data/src/jax/webgl/core/events.js +0 -25
- data/src/jax/webgl/core/face.js +0 -8
- data/src/jax/webgl/core/framebuffer.js +0 -211
- data/src/jax/webgl/material.js +0 -392
- data/src/jax/webgl/mesh.js +0 -427
- data/src/jax/webgl/scene.js +0 -11
- data/src/jax/webgl/scene/frustum.js +0 -260
- data/src/jax/webgl/scene/light_manager.js +0 -136
- data/src/jax/webgl/scene/light_source.js +0 -294
- data/src/jax/webgl/shader.js +0 -296
- data/src/jax/webgl/shader/delegator.js +0 -13
- data/src/jax/webgl/shader/delegator/attribute.js +0 -53
- data/src/jax/webgl/shader/delegator/uniform.js +0 -71
- data/src/jax/webgl/shader/manifest.js +0 -64
- data/src/jax/webgl/shader/program.js +0 -140
- data/src/jax/webgl/shader_chain.js +0 -264
- data/src/jax/webgl/texture.js +0 -312
- data/src/jax/webgl/world.js +0 -240
- data/vendor/ejs/.svn/all-wcprops +0 -17
- data/vendor/ejs/.svn/entries +0 -114
- data/vendor/ejs/.svn/text-base/Eratta.txt.svn-base +0 -3
- data/vendor/ejs/.svn/text-base/license.txt.svn-base +0 -21
- data/vendor/ejs/Eratta.txt +0 -3
- data/vendor/ejs/example/.svn/all-wcprops +0 -29
- data/vendor/ejs/example/.svn/entries +0 -164
- data/vendor/ejs/example/.svn/prop-base/ejs.gif.svn-base +0 -5
- data/vendor/ejs/example/.svn/text-base/demo.html.svn-base +0 -54
- data/vendor/ejs/example/.svn/text-base/ejs.gif.svn-base +0 -0
- data/vendor/ejs/example/.svn/text-base/example.css.svn-base +0 -31
- data/vendor/ejs/example/.svn/text-base/example.js.svn-base +0 -88
- data/vendor/ejs/example/demo.html +0 -54
- data/vendor/ejs/example/ejs.gif +0 -0
- data/vendor/ejs/example/example.css +0 -31
- data/vendor/ejs/example/example.js +0 -88
- data/vendor/ejs/lib/.svn/all-wcprops +0 -11
- data/vendor/ejs/lib/.svn/entries +0 -62
- data/vendor/ejs/lib/.svn/text-base/ejs_fulljslint.js.svn-base +0 -3774
- data/vendor/ejs/lib/ejs_fulljslint.js +0 -3774
- data/vendor/ejs/license.txt +0 -21
- data/vendor/ejs/script/.svn/all-wcprops +0 -17
- data/vendor/ejs/script/.svn/entries +0 -96
- data/vendor/ejs/script/.svn/prop-base/yuicompressor-2.2.4.jar.svn-base +0 -5
- data/vendor/ejs/script/.svn/text-base/production.bat.svn-base +0 -4
- data/vendor/ejs/script/.svn/text-base/yuicompressor-2.2.4.jar.svn-base +0 -0
- data/vendor/ejs/script/production.bat +0 -4
- data/vendor/ejs/script/yuicompressor-2.2.4.jar +0 -0
- data/vendor/ejs/src/.svn/all-wcprops +0 -17
- data/vendor/ejs/src/.svn/entries +0 -96
- data/vendor/ejs/src/.svn/text-base/ejs.js.svn-base +0 -505
- data/vendor/ejs/src/.svn/text-base/view.js.svn-base +0 -200
- data/vendor/ejs/src/ejs.js +0 -505
- data/vendor/ejs/src/view.js +0 -200
- data/vendor/ejs/test/.svn/all-wcprops +0 -23
- data/vendor/ejs/test/.svn/entries +0 -139
- data/vendor/ejs/test/.svn/text-base/index.html.svn-base +0 -18
- data/vendor/ejs/test/.svn/text-base/setup_test.html.svn-base +0 -44
- data/vendor/ejs/test/.svn/text-base/sidebar.html.svn-base +0 -28
- data/vendor/ejs/test/included/.svn/all-wcprops +0 -23
- data/vendor/ejs/test/included/.svn/entries +0 -130
- data/vendor/ejs/test/included/.svn/text-base/prototype.js.svn-base +0 -4184
- data/vendor/ejs/test/included/.svn/text-base/test.css.svn-base +0 -44
- data/vendor/ejs/test/included/.svn/text-base/unittest.js.svn-base +0 -564
- data/vendor/ejs/test/included/prototype.js +0 -4184
- data/vendor/ejs/test/included/test.css +0 -44
- data/vendor/ejs/test/included/unittest.js +0 -564
- data/vendor/ejs/test/index.html +0 -18
- data/vendor/ejs/test/setup_test.html +0 -44
- data/vendor/ejs/test/sidebar.html +0 -28
- data/vendor/ejs/test/templates/.svn/all-wcprops +0 -11
- data/vendor/ejs/test/templates/.svn/entries +0 -62
- data/vendor/ejs/test/templates/.svn/text-base/test.ejs.svn-base +0 -3
- data/vendor/ejs/test/templates/test.ejs +0 -3
- data/vendor/ejs/test/tests/.svn/all-wcprops +0 -23
- data/vendor/ejs/test/tests/.svn/entries +0 -130
- data/vendor/ejs/test/tests/.svn/text-base/rendering.js.svn-base +0 -94
- data/vendor/ejs/test/tests/.svn/text-base/templating.js.svn-base +0 -43
- data/vendor/ejs/test/tests/.svn/text-base/views.js.svn-base +0 -100
- data/vendor/ejs/test/tests/rendering.js +0 -94
- data/vendor/ejs/test/tests/templating.js +0 -43
- data/vendor/ejs/test/tests/views.js +0 -100
- data/vendor/glmatrix/benchmark/js/CanvasMatrix.js +0 -722
- data/vendor/glmatrix/benchmark/js/EWGL_math.js +0 -742
- data/vendor/glmatrix/benchmark/js/mjs.js +0 -1230
- data/vendor/glmatrix/benchmark/matrix_benchmark.html +0 -419
- data/vendor/glmatrix/glMatrix-min.js +0 -32
- data/vendor/glmatrix/glMatrix.js +0 -1772
- data/vendor/glmatrix/unit tests/glMatrix-test.js +0 -74
- data/vendor/glmatrix/unit tests/qunit.css +0 -119
- data/vendor/glmatrix/unit tests/qunit.js +0 -1069
- data/vendor/glmatrix/unit tests/test_glMatrix.html +0 -21
- data/vendor/pdoc_template/html/assets/images/pdoc/alias.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constant.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constructor.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/description.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/information.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/mixin.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/namespace.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/related_to.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/search-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/subclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/superclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/utility.png +0 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/application.js +0 -478
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/prototype.js +0 -4874
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/tabs.js +0 -506
- data/vendor/pdoc_template/html/assets/stylesheets/jax.css +0 -30
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/api.css +0 -681
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/pygments.css +0 -62
- data/vendor/pdoc_template/html/helpers.rb +0 -35
- data/vendor/pdoc_template/html/index.erb +0 -18
- data/vendor/pdoc_template/html/item_index.js.erb +0 -6
- data/vendor/pdoc_template/html/layout.erb +0 -67
- data/vendor/pdoc_template/html/leaf.erb +0 -22
- data/vendor/pdoc_template/html/node.erb +0 -30
- data/vendor/pdoc_template/html/partials/class_relationships.erb +0 -19
- data/vendor/pdoc_template/html/partials/classes.erb +0 -7
- data/vendor/pdoc_template/html/partials/constructor.erb +0 -5
- data/vendor/pdoc_template/html/partials/description.erb +0 -5
- data/vendor/pdoc_template/html/partials/link_list.erb +0 -1
- data/vendor/pdoc_template/html/partials/method_signatures.erb +0 -14
- data/vendor/pdoc_template/html/partials/methodized_note.erb +0 -9
- data/vendor/pdoc_template/html/partials/mixins.erb +0 -7
- data/vendor/pdoc_template/html/partials/namespaces.erb +0 -7
- data/vendor/pdoc_template/html/partials/related_utilities.erb +0 -5
- data/vendor/pdoc_template/html/partials/relationships.erb +0 -11
- data/vendor/pdoc_template/html/partials/short_description_list.erb +0 -7
- data/vendor/pdoc_template/html/partials/title.erb +0 -24
- data/vendor/pdoc_template/html/section.erb +0 -18
- data/vendor/yuicompressor-2.4.2.jar +0 -0
data/src/jax/events.js
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Jax.EVENT_METHODS -> Object
|
3
|
-
* Contains event handling methods which are added to +Jax.Context+.
|
4
|
-
**/
|
5
|
-
Jax.EVENT_METHODS = (function() {
|
6
|
-
function getCumulativeOffset(element) {
|
7
|
-
var valueT = 0, valueL = 0;
|
8
|
-
do {
|
9
|
-
valueT += element.offsetTop || 0;
|
10
|
-
valueL += element.offsetLeft || 0;
|
11
|
-
valueT += Jax.Compatibility.offsetTop;
|
12
|
-
valueL += Jax.Compatibility.offsetLeft;
|
13
|
-
element = element.offsetParent;
|
14
|
-
} while (element);
|
15
|
-
|
16
|
-
var result = [valueL, valueT];
|
17
|
-
result.left = valueL;
|
18
|
-
result.top = valueT;
|
19
|
-
return result;
|
20
|
-
}
|
21
|
-
|
22
|
-
function buildKeyEvent(self, evt) {
|
23
|
-
var keyboard = self.keyboard;
|
24
|
-
|
25
|
-
evt = evt || window.event || {};
|
26
|
-
// we don't really need these since controllers have this.context
|
27
|
-
// evt.context = self;
|
28
|
-
// evt.canvas = self.canvas;
|
29
|
-
keyboard.last = evt;
|
30
|
-
|
31
|
-
/*
|
32
|
-
TODO track all keypresses and whatnot via @keyboard, so all keys can be queried at any given time
|
33
|
-
*/
|
34
|
-
|
35
|
-
return evt;
|
36
|
-
}
|
37
|
-
|
38
|
-
function fixEvent(event) {
|
39
|
-
// this borrowed from jQuery
|
40
|
-
// store a copy of the original event object
|
41
|
-
// and "clone" to set read-only properties
|
42
|
-
var originalEvent = event;
|
43
|
-
event = {type:originalEvent.type};
|
44
|
-
var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");
|
45
|
-
|
46
|
-
for ( var i = props.length, prop; i; ) {
|
47
|
-
prop = props[ --i ];
|
48
|
-
event[ prop ] = originalEvent[ prop ];
|
49
|
-
}
|
50
|
-
|
51
|
-
// Fix target property, if necessary
|
52
|
-
if ( !event.target ) {
|
53
|
-
// Fixes #1925 where srcElement might not be defined either
|
54
|
-
event.target = event.srcElement || document;
|
55
|
-
}
|
56
|
-
|
57
|
-
// check if target is a textnode (safari)
|
58
|
-
if ( event.target.nodeType === 3 ) {
|
59
|
-
event.target = event.target.parentNode;
|
60
|
-
}
|
61
|
-
|
62
|
-
// Add relatedTarget, if necessary
|
63
|
-
if ( !event.relatedTarget && event.fromElement ) {
|
64
|
-
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
|
65
|
-
}
|
66
|
-
|
67
|
-
// Calculate pageX/Y if missing and clientX/Y available
|
68
|
-
if ( event.pageX == null && event.clientX != null ) {
|
69
|
-
var eventDocument = event.target.ownerDocument || document,
|
70
|
-
doc = eventDocument.documentElement,
|
71
|
-
body = eventDocument.body;
|
72
|
-
|
73
|
-
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
74
|
-
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
75
|
-
}
|
76
|
-
|
77
|
-
// Add which for key events
|
78
|
-
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
|
79
|
-
event.which = event.charCode != null ? event.charCode : event.keyCode;
|
80
|
-
}
|
81
|
-
|
82
|
-
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
83
|
-
if ( !event.metaKey && event.ctrlKey ) {
|
84
|
-
event.metaKey = event.ctrlKey;
|
85
|
-
}
|
86
|
-
|
87
|
-
// Add which for click: 1 === left; 2 === middle; 3 === right
|
88
|
-
// Note: button is not normalized, so don't use it
|
89
|
-
if ( !event.which && event.button !== undefined ) {
|
90
|
-
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
|
91
|
-
}
|
92
|
-
|
93
|
-
return event;
|
94
|
-
}
|
95
|
-
|
96
|
-
function buildMouseEvent(self, evt) {
|
97
|
-
var mouse = self.mouse;
|
98
|
-
|
99
|
-
evt = fixEvent(evt || window.event);
|
100
|
-
evt.context = self;
|
101
|
-
evt.canvas = self.canvas;
|
102
|
-
evt.offsetx = mouse.x;
|
103
|
-
evt.offsety = mouse.y;
|
104
|
-
evt.mouse = mouse;
|
105
|
-
|
106
|
-
mouse.offsetx = evt.offsetx || 0;
|
107
|
-
mouse.offsety = evt.offsety || 0;
|
108
|
-
|
109
|
-
var cumulativeOffset = getCumulativeOffset(self.canvas);
|
110
|
-
mouse.x = evt.pageX - cumulativeOffset[0];
|
111
|
-
mouse.y = evt.pageY - cumulativeOffset[1];
|
112
|
-
mouse.y = self.canvas.height - mouse.y; // invert y
|
113
|
-
|
114
|
-
// calculate differences, useful for checking movement relative to last position
|
115
|
-
mouse.diffx = mouse.x - mouse.offsetx;
|
116
|
-
mouse.diffy = mouse.y - mouse.offsety;
|
117
|
-
|
118
|
-
// check for button presses
|
119
|
-
if (evt.type == "mousedown" || evt.type == "onmousedown") {
|
120
|
-
mouse.down = mouse.down || {count:0};
|
121
|
-
mouse.down["button"+evt.which] = {at:[mouse.x,mouse.y]};
|
122
|
-
} else if (evt.type == "mouseup" || evt.type == "onmouseup") {
|
123
|
-
if (mouse.down)
|
124
|
-
{
|
125
|
-
mouse.down.count--;
|
126
|
-
if (mouse.down.count <= 0) mouse.down = null;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
evt.x = mouse.x;
|
131
|
-
evt.y = mouse.y;
|
132
|
-
evt.diffx = mouse.diffx;
|
133
|
-
evt.diffy = mouse.diffy;
|
134
|
-
evt.down = mouse.down;
|
135
|
-
|
136
|
-
return evt;
|
137
|
-
}
|
138
|
-
|
139
|
-
function dispatchEvent(self, evt) {
|
140
|
-
var type = evt.type.toString();
|
141
|
-
if (type.indexOf("on") == 0) type = type.substring(2, type.length);
|
142
|
-
type = type.toLowerCase();
|
143
|
-
var target;
|
144
|
-
switch(type) {
|
145
|
-
case "click": target = "mouse_clicked"; break;
|
146
|
-
case "mousemove":
|
147
|
-
if (evt.move_type == 'mousemove') target = "mouse_moved";
|
148
|
-
else target = "mouse_dragged";
|
149
|
-
break;
|
150
|
-
case "mousedown": target = "mouse_pressed"; break;
|
151
|
-
case "mouseout": target = "mouse_exited"; break;
|
152
|
-
case "mouseover": target = "mouse_entered"; break;
|
153
|
-
case "mouseup": target = "mouse_released";break;
|
154
|
-
case "keydown": target = "key_pressed"; break;
|
155
|
-
case "keypress": target = "key_typed"; break;
|
156
|
-
case "keyup": target = "key_released"; break;
|
157
|
-
default: return true; // don't dispatch this event to the controller
|
158
|
-
}
|
159
|
-
|
160
|
-
if (self.current_controller[target]) {
|
161
|
-
var result = self.current_controller[target](evt);
|
162
|
-
if (result != undefined) return result;
|
163
|
-
}
|
164
|
-
return true;
|
165
|
-
}
|
166
|
-
|
167
|
-
// Tag names which, when active, should cause key input to be IGNORED. The implication is that while
|
168
|
-
// one of these tags has focus, the user doesn't want to be controlling his character because s/he is
|
169
|
-
// trying to type something.
|
170
|
-
var ignoreKeyTagNames = [
|
171
|
-
'input', 'form', 'textarea', 'label', 'fieldset', 'legend', 'select', 'optgroup', 'option', 'button'
|
172
|
-
];
|
173
|
-
|
174
|
-
return {
|
175
|
-
setupEventListeners: function() {
|
176
|
-
this.keyboard = {};
|
177
|
-
this.mouse = {};
|
178
|
-
|
179
|
-
var canvas = this.canvas;
|
180
|
-
var self = this;
|
181
|
-
|
182
|
-
var mousefunc = function(evt) {
|
183
|
-
if (!self.current_controller) return;
|
184
|
-
evt = buildMouseEvent(self, evt);
|
185
|
-
return dispatchEvent(self, evt);
|
186
|
-
};
|
187
|
-
var mousemovefunc = function(evt) {
|
188
|
-
if (!self.current_controller) return;
|
189
|
-
evt = buildMouseEvent(self, evt);
|
190
|
-
if (self.mouse && self.mouse.down == null) // mouse is not being dragged
|
191
|
-
evt.move_type = "mousemove";
|
192
|
-
else
|
193
|
-
evt.move_type = "mousedrag";
|
194
|
-
return dispatchEvent(self, evt);
|
195
|
-
};
|
196
|
-
var keyfunc = function(evt) {
|
197
|
-
if (evt.which) evt.str = String.fromCharCode(evt.which);
|
198
|
-
if (document.activeElement) {
|
199
|
-
if (ignoreKeyTagNames.indexOf(document.activeElement.tagName) != -1)
|
200
|
-
{ // user is probably trying to type, so don't capture this input
|
201
|
-
return;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
if (!self.current_controller) return;
|
205
|
-
evt = buildKeyEvent(self, evt);
|
206
|
-
return dispatchEvent(self, evt);
|
207
|
-
};
|
208
|
-
|
209
|
-
if (canvas.addEventListener) {
|
210
|
-
/* W3 */
|
211
|
-
canvas.addEventListener('click', mousefunc, false);
|
212
|
-
canvas.addEventListener('mousedown', mousefunc, false);
|
213
|
-
canvas.addEventListener('mousemove', mousemovefunc, false);
|
214
|
-
canvas.addEventListener('mouseout', mousefunc, false);
|
215
|
-
canvas.addEventListener('mouseover', mousefunc, false);
|
216
|
-
canvas.addEventListener('mouseup', mousefunc, false);
|
217
|
-
document.addEventListener('keydown', keyfunc, false);
|
218
|
-
document.addEventListener('keypress', keyfunc, false);
|
219
|
-
document.addEventListener('keyup', keyfunc, false);
|
220
|
-
} else {
|
221
|
-
/* IE */
|
222
|
-
canvas.attachEvent('onclick', mousefunc );
|
223
|
-
canvas.attachEvent('onmousedown', mousefunc );
|
224
|
-
canvas.attachEvent('onmousemove', mousemovefunc);
|
225
|
-
canvas.attachEvent('onmouseout', mousefunc );
|
226
|
-
canvas.attachEvent('onmouseover', mousefunc );
|
227
|
-
canvas.attachEvent('onmouseup', mousefunc );
|
228
|
-
document.attachEvent('onkeydown', keyfunc );
|
229
|
-
document.attachEvent('onkeypress', keyfunc );
|
230
|
-
document.attachEvent('onkeyup', keyfunc );
|
231
|
-
}
|
232
|
-
}
|
233
|
-
};
|
234
|
-
})();
|
data/src/jax/geometry.js
DELETED
data/src/jax/geometry/plane.js
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* class Jax.Geometry.Plane
|
3
|
-
*
|
4
|
-
* Represents a plane in 3 dimensions.
|
5
|
-
*
|
6
|
-
* Examples:
|
7
|
-
*
|
8
|
-
* new Jax.Geometry.Plane([0,0,0], [0,1,0], [1,0,0]);
|
9
|
-
* new Jax.Geometry.Plane([[0,0,0], [0,1,0], [1,0,0]]);
|
10
|
-
* new Jax.Geometry.Plane();
|
11
|
-
*
|
12
|
-
**/
|
13
|
-
Jax.Geometry.Plane = (function() {
|
14
|
-
function innerProduct(a, x, y, z) {
|
15
|
-
return (a[0]*x + a[1]*y + a[2]*z);
|
16
|
-
}
|
17
|
-
|
18
|
-
return Jax.Class.create({
|
19
|
-
initialize: function(points) {
|
20
|
-
if (points) this.set.apply(this, arguments);
|
21
|
-
},
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Jax.Geometry.Plane#set(points) -> Jax.Geometry.Plane
|
25
|
-
* - points (Array): an array of 3 vectors.
|
26
|
-
* Jax.Geometry.Plane#set(point0, point1, point2) -> Jax.Geometry.Plane
|
27
|
-
* - point0 (vec3): the first of 3 vectors.
|
28
|
-
* - point1 (vec3): the second of 3 vectors.
|
29
|
-
* - point2 (vec3): the third of 3 vectors.
|
30
|
-
*
|
31
|
-
* Sets this plane's coefficients based off of a set of three 3D points.
|
32
|
-
*
|
33
|
-
* This plane is returned.
|
34
|
-
**/
|
35
|
-
set: function(points) {
|
36
|
-
if (arguments.length == 3) points = [arguments[0], arguments[1], arguments[2]];
|
37
|
-
|
38
|
-
this.normal = vec3.create();
|
39
|
-
var vec = vec3.create();
|
40
|
-
vec3.subtract(points[1], points[0], this.normal);
|
41
|
-
vec3.subtract(points[2], points[0], vec);
|
42
|
-
vec3.cross(this.normal, vec, this.normal);
|
43
|
-
vec3.normalize(this.normal);
|
44
|
-
|
45
|
-
this.point = points[1];
|
46
|
-
this.d = -innerProduct(this.normal, this.point[0], this.point[1], this.point[2]);
|
47
|
-
|
48
|
-
return this;
|
49
|
-
},
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Jax.Geometry.Plane#setCoefficients(a, b, c, d) -> Jax.Geometry.Plane
|
53
|
-
*
|
54
|
-
* Sets the four coefficients A, B, C, D for this plane.
|
55
|
-
*
|
56
|
-
* Returns this plane.
|
57
|
-
**/
|
58
|
-
setCoefficients: function(a, b, c, d) {
|
59
|
-
var len = Math.sqrt(a*a+b*b+c*c);
|
60
|
-
this.normal[0] = a/len;
|
61
|
-
this.normal[1] = b/len;
|
62
|
-
this.normal[2] = c/len;
|
63
|
-
this.d = d/len;
|
64
|
-
return this;
|
65
|
-
},
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Jax.Geometry.Plane#distance(point) -> Number
|
69
|
-
* - point (vec3): A 3D vector. Can be any type with values for indices [0..2] (e.g. an Array).
|
70
|
-
*
|
71
|
-
* Given a 3D point, returns the distance from this plane to the point. The point is expected
|
72
|
-
* to lie in the same 3D space as this plane.
|
73
|
-
**/
|
74
|
-
distance: function(point)
|
75
|
-
{
|
76
|
-
var x, y, z;
|
77
|
-
if (arguments.length == 3) { x = arguments[0]; y = arguments[1]; z = arguments[2]; }
|
78
|
-
else { x = point[0]; y = point[1]; z = point[2]; }
|
79
|
-
// same as ax + by + cz + d
|
80
|
-
return this.d + innerProduct(this.normal, x, y, z);
|
81
|
-
},
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Jax.Geometry.Plane#whereis(point) -> Number
|
85
|
-
* - point (vec3): A 3D vector. Can be any type with values for indices [0..2] (e.g. an Array).
|
86
|
-
*
|
87
|
-
* Given a point in 3D space, returns one of the following values based on the position
|
88
|
-
* of the point relative to this plane:
|
89
|
-
*
|
90
|
-
* Jax.Geometry.Plane.FRONT
|
91
|
-
* Jax.Geometry.Plane.BACK
|
92
|
-
* Jax.Geometry.Plane.INTERSECT
|
93
|
-
*
|
94
|
-
* FRONT represents a point lying somewhere in the direction of the plane's normal.
|
95
|
-
* BACK represents the opposite, and INTERSECT represents a point lying directly
|
96
|
-
* parallel to this plane.
|
97
|
-
*
|
98
|
-
* The point is expected to lie in the same 3D space as this plane.
|
99
|
-
**/
|
100
|
-
whereis: function(point)
|
101
|
-
{
|
102
|
-
if (arguments.length == 3) point = [arguments[0], arguments[1], arguments[2]];
|
103
|
-
var d = this.distance(point);
|
104
|
-
if (d > 0) return Jax.Geometry.Plane.FRONT;
|
105
|
-
if (d < 0) return Jax.Geometry.Plane.BACK;
|
106
|
-
return Jax.Geometry.Plane.INTERSECT;
|
107
|
-
}
|
108
|
-
});
|
109
|
-
})();
|
110
|
-
|
111
|
-
Jax.Geometry.Plane.FRONT = 1;
|
112
|
-
Jax.Geometry.Plane.BACK = 2;
|
113
|
-
Jax.Geometry.Plane.INTERSECT = 3;
|
data/src/jax/mvc/controller.js
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* class Jax.Controller
|
3
|
-
*
|
4
|
-
* Controllers are a major component of the Jax framework, because they are in
|
5
|
-
* charge of receiving input from the user, setting up a scene, tearing it down,
|
6
|
-
* and deciding when is the right time to transition to a different controller.
|
7
|
-
*
|
8
|
-
* Controllers need to be either registered with Jax.routes or invoked using
|
9
|
-
* Jax.Controller.invoke(). They are not intended to be instantiated directly,
|
10
|
-
* so you should avoid doing this in your code and instead rely on the route set.
|
11
|
-
*
|
12
|
-
* Methods added to controllers are called actions. You can name actions whatever
|
13
|
-
* you want, but some action names serve special purposes. They are as follows:
|
14
|
-
*
|
15
|
-
* * *index* - called when the action name is omitted from a route.
|
16
|
-
* * *destroy* - called when leaving the current controller.
|
17
|
-
* * *mouse_clicked* - called when the mouse is clicked within the canvas.
|
18
|
-
* * *mouse_entered* - called when the mouse enters the canvas.
|
19
|
-
* * *mouse_exited* - called when the mouse exits the canvas.
|
20
|
-
* * *mouse_moved* - called when the mouse is moved, unless a button is pressed.
|
21
|
-
* * *mouse_dragged* - called when the mouse is moved while a button is pressed.
|
22
|
-
* * *mouse_pressed* - called when a mouse button has been pressed.
|
23
|
-
* * *mouse_released* - called when a mouse button has been released.
|
24
|
-
* * *mouse_clicked* - called when a mouse button has been clicked.
|
25
|
-
* * *key_pressed* - called when a keyboard button has been pressed.
|
26
|
-
* * *key_released* - called when a keyboard button has been released.
|
27
|
-
* * *key_typed* - called when a keyboard button has been typed.
|
28
|
-
* * *update* - called (approximately) every 60 milliseconds for as long
|
29
|
-
* as a controller is active. Time difference in seconds is passed as an arguments.
|
30
|
-
*
|
31
|
-
* Example:
|
32
|
-
*
|
33
|
-
* var WelcomeController = Jax.Controller.Create("welcome", ApplicationController, {
|
34
|
-
* index: function() {
|
35
|
-
* // ...
|
36
|
-
* },
|
37
|
-
*
|
38
|
-
* mouse_clicked: function(event) {
|
39
|
-
* // ...
|
40
|
-
* },
|
41
|
-
*
|
42
|
-
* update: function(timechange) {
|
43
|
-
* // it's been [timechange] seconds since last update
|
44
|
-
* }
|
45
|
-
* });
|
46
|
-
*
|
47
|
-
* With the exception of event actions, which will be fired every time an event occurs,
|
48
|
-
* controller actions are only triggered once for a given controller unless they
|
49
|
-
* explicitly trigger other actions by calling them directly. They differ from their
|
50
|
-
* corresponding views (see Jax.View) in this way, as a view is rendered many times
|
51
|
-
* -- up to a target rate of 60 passes per second.
|
52
|
-
*
|
53
|
-
**/
|
54
|
-
(function() {
|
55
|
-
var protected_instance_method_names = [
|
56
|
-
'initialize', 'toString', 'getControllerName', 'constructor', 'isKindOf', 'fireAction',
|
57
|
-
'eraseResult'
|
58
|
-
];
|
59
|
-
|
60
|
-
function is_protected(method_name) {
|
61
|
-
for (var i = 0; i < protected_instance_method_names.length; i++)
|
62
|
-
if (protected_instance_method_names[i] == method_name)
|
63
|
-
return true;
|
64
|
-
return false;
|
65
|
-
}
|
66
|
-
|
67
|
-
Jax.Controller = (function() {
|
68
|
-
function setViewKey(self) {
|
69
|
-
self.view_key = self.getControllerName()+"/"+self.action_name;
|
70
|
-
self.rendered_or_redirected = true;
|
71
|
-
}
|
72
|
-
|
73
|
-
return Jax.Class.create({
|
74
|
-
/**
|
75
|
-
* Jax.Controller#fireAction(action_name) -> Jax.Controller
|
76
|
-
*
|
77
|
-
* Erases the results of the last action, then calls the specified action. If it doesn't exist,
|
78
|
-
* an error is raised. Finally, unless the action redirects to a different action or renders
|
79
|
-
* a different action directly, the specified action becomes the focus of the current view.
|
80
|
-
*
|
81
|
-
* Returns this controller.
|
82
|
-
**/
|
83
|
-
fireAction: function(action_name) {
|
84
|
-
this.eraseResult();
|
85
|
-
this.action_name = action_name;
|
86
|
-
|
87
|
-
if (this[action_name])
|
88
|
-
this[action_name].call(this, []);
|
89
|
-
else throw new Error("Call to missing action: '"+action_name+"' in controller '"+this.getControllerName()+"'");
|
90
|
-
|
91
|
-
if (!this.rendered_or_redirected)
|
92
|
-
setViewKey(this);
|
93
|
-
return this;
|
94
|
-
},
|
95
|
-
|
96
|
-
/**
|
97
|
-
* Jax.Controller#eraseResults() -> Jax.Controller
|
98
|
-
*
|
99
|
-
* Erases the results of the most recent render action. That is, whether or not it rendered
|
100
|
-
* a different action or caused a redirect to a different action or controller is reset, and
|
101
|
-
* the current view is set to +null+, indicating that no view will be rendered.
|
102
|
-
*
|
103
|
-
* Returns this controller.
|
104
|
-
**/
|
105
|
-
eraseResult: function() {
|
106
|
-
this.rendered_or_redirected = false;
|
107
|
-
this.view_key = null;
|
108
|
-
return this;
|
109
|
-
}
|
110
|
-
});
|
111
|
-
})();
|
112
|
-
|
113
|
-
var controller_class_methods = {
|
114
|
-
/**
|
115
|
-
* Jax.Controller.invoke(action_name, context) -> Jax.Controller
|
116
|
-
* - action_name (String): The name of the action to fire after initialization
|
117
|
-
* - context (Jax.Context): The context to attach to the instantiated controller
|
118
|
-
*
|
119
|
-
* Creates a new instance of the specified controller, sets up its references to
|
120
|
-
* +this.context+, +this.world+, and so on; and finally, fires the action given by
|
121
|
-
* +action_name+.
|
122
|
-
*
|
123
|
-
* Returns the newly-constructed controller.
|
124
|
-
**/
|
125
|
-
invoke: function(action_name, context) {
|
126
|
-
var instance = new this();
|
127
|
-
instance.context = context;
|
128
|
-
instance.world = context && context.world;
|
129
|
-
instance.player = context && context.player;
|
130
|
-
instance.fireAction(action_name);
|
131
|
-
return instance;
|
132
|
-
}
|
133
|
-
};
|
134
|
-
|
135
|
-
/**
|
136
|
-
* Jax.Controller.create(controllerName, methods) -> Class
|
137
|
-
* Jax.Controller.create(controllerName, superclass, methods) -> Class
|
138
|
-
* - controllerName (String): the short name of this controller
|
139
|
-
* - superclass (Class): a parent class to inherit from
|
140
|
-
* - methods (Object): a set of methods to be added to the Class
|
141
|
-
*
|
142
|
-
* The controllerName must be the short name of the controller, as represented
|
143
|
-
* in Jax.RouteSet. An example controller name for a WelcomeController would be
|
144
|
-
* "welcome".
|
145
|
-
*
|
146
|
-
* If superclass is not given, Jax.Controller is used as the superclass instead.
|
147
|
-
*
|
148
|
-
* The methods object follows the same structure as Prototype.
|
149
|
-
*
|
150
|
-
* Example:
|
151
|
-
*
|
152
|
-
* var WelcomeController = Jax.Controller.Create("welcome", ApplicationController, {
|
153
|
-
* index: function() {
|
154
|
-
* // ...
|
155
|
-
* },
|
156
|
-
*
|
157
|
-
* mouse_clicked: function(event) {
|
158
|
-
* // ...
|
159
|
-
* }
|
160
|
-
* });
|
161
|
-
**/
|
162
|
-
Jax.Controller.create = function(controller_name, superclass, inner) {
|
163
|
-
if (typeof(controller_name) != "string")
|
164
|
-
{
|
165
|
-
inner = superclass;
|
166
|
-
superclass = controller_name;
|
167
|
-
controller_name = "generic";
|
168
|
-
}
|
169
|
-
|
170
|
-
var klass;
|
171
|
-
if (inner) klass = Jax.Class.create(superclass, inner);
|
172
|
-
else klass = Jax.Class.create(Jax.Controller, superclass);
|
173
|
-
|
174
|
-
/**
|
175
|
-
* Jax.Controller.getControllerName() -> String
|
176
|
-
*
|
177
|
-
* Returns the name of the controller in question, as it is represented in +Jax.routes+.
|
178
|
-
**/
|
179
|
-
Object.extend(klass, controller_class_methods);
|
180
|
-
Object.extend(klass, { getControllerName: function() { return controller_name; } });
|
181
|
-
klass.addMethods({getControllerName: function() { return controller_name; } });
|
182
|
-
|
183
|
-
// we already know the controller name and all its actions, so may as well
|
184
|
-
// set up routing here.
|
185
|
-
for (var method_name in klass.prototype)
|
186
|
-
{
|
187
|
-
if (!is_protected(method_name)) {
|
188
|
-
// it's not a protected name, so treat it as an action
|
189
|
-
Jax.routes.map(controller_name+"/"+method_name, klass, method_name);
|
190
|
-
}
|
191
|
-
}
|
192
|
-
|
193
|
-
return klass;
|
194
|
-
};
|
195
|
-
})();
|