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/webgl/texture.js
DELETED
@@ -1,312 +0,0 @@
|
|
1
|
-
Jax.NORMAL_MAP = 1;
|
2
|
-
|
3
|
-
|
4
|
-
/**
|
5
|
-
* class Jax.Texture
|
6
|
-
* Creates a managed WebGL texture.
|
7
|
-
**/
|
8
|
-
Jax.Texture = (function() {
|
9
|
-
function imageFailed(self, image) {
|
10
|
-
throw new Error("Texture image '"+self.image.src+"' failed to load!");
|
11
|
-
}
|
12
|
-
|
13
|
-
function isPoT(s) {
|
14
|
-
return s && (s & -s) == s;
|
15
|
-
}
|
16
|
-
|
17
|
-
function imageLoaded(self, isImageArray, img) {
|
18
|
-
var onload = self.options.onload || self.onload;
|
19
|
-
|
20
|
-
if (!isPoT(img.width) || !isPoT(img.height)) {
|
21
|
-
self.options.mag_filter = GL_LINEAR;
|
22
|
-
self.options.min_filter = GL_LINEAR;
|
23
|
-
self.options.wrap_s = GL_CLAMP_TO_EDGE;
|
24
|
-
self.options.wrap_t = GL_CLAMP_TO_EDGE;
|
25
|
-
self.options.generate_mipmap = false;
|
26
|
-
}
|
27
|
-
|
28
|
-
if (!isImageArray) {
|
29
|
-
if (onload) onload.call(self, self.image);
|
30
|
-
self.loaded = true;
|
31
|
-
} else {
|
32
|
-
self.images.load_count++;
|
33
|
-
if (self.images.load_count == self.images.length) {
|
34
|
-
/* all done */
|
35
|
-
if (onload) onload.call(self, self.image);
|
36
|
-
self.loaded = true;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
function build(self, context) {
|
42
|
-
self.handles[context.id] = context.glCreateTexture();
|
43
|
-
}
|
44
|
-
|
45
|
-
function generateTexture(context, self) {
|
46
|
-
var data_type = self.options.data_type, format = self.options.format, target = self.options.target;
|
47
|
-
if (self.image) {
|
48
|
-
switch(target) {
|
49
|
-
case GL_TEXTURE_2D:
|
50
|
-
context.glTexImage2D(target, 0, format, format, data_type, self.image);
|
51
|
-
break;
|
52
|
-
case GL_TEXTURE_CUBE_MAP:
|
53
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, format, format, data_type, self.image);
|
54
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, format, format, data_type, self.image);
|
55
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, format, format, data_type, self.image);
|
56
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, format, format, data_type, self.image);
|
57
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, format, format, data_type, self.image);
|
58
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, format, format, data_type, self.image);
|
59
|
-
break;
|
60
|
-
default: throw new Error("Unexpected texture target "+target+"; use GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP");
|
61
|
-
}
|
62
|
-
} else if (self.images) {
|
63
|
-
switch(target) {
|
64
|
-
case GL_TEXTURE_2D:
|
65
|
-
context.glTexImage2D(target, 0, format, format, data_type, self.images[0]);
|
66
|
-
break;
|
67
|
-
case GL_TEXTURE_CUBE_MAP:
|
68
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_POSITIVE_X] || self.images[0]);
|
69
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_POSITIVE_Y] || self.images[1]);
|
70
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_POSITIVE_Z] || self.images[2]);
|
71
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_NEGATIVE_X] || self.images[3]);
|
72
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_NEGATIVE_Y] || self.images[4]);
|
73
|
-
context.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, format, format, data_type, self.images[GL_TEXTURE_CUBE_MAP_NEGATIVE_Z] || self.images[5]);
|
74
|
-
break;
|
75
|
-
default: throw new Error("Unexpected texture target "+target+"; use GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP");
|
76
|
-
}
|
77
|
-
} else {
|
78
|
-
// no images at all -- load the texture with empty data; it's probably for a framebuffer
|
79
|
-
var width = self.options.width, height = self.options.height;
|
80
|
-
if (!width || !height) throw new Error("Can't build an empty texture without at least a width and height");
|
81
|
-
|
82
|
-
function ti2d(glEnum) {
|
83
|
-
try {
|
84
|
-
context.glTexImage2D(glEnum, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, null);
|
85
|
-
} catch (e) {
|
86
|
-
var tex = new Uint8Array(width*height*Jax.Util.sizeofFormat(format));
|
87
|
-
context.glTexImage2D(glEnum, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, tex);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
switch(target) {
|
92
|
-
case GL_TEXTURE_2D:
|
93
|
-
ti2d(GL_TEXTURE_2D);
|
94
|
-
break;
|
95
|
-
case GL_TEXTURE_CUBE_MAP:
|
96
|
-
ti2d(GL_TEXTURE_CUBE_MAP_POSITIVE_X);
|
97
|
-
ti2d(GL_TEXTURE_CUBE_MAP_POSITIVE_Y);
|
98
|
-
ti2d(GL_TEXTURE_CUBE_MAP_POSITIVE_Z);
|
99
|
-
ti2d(GL_TEXTURE_CUBE_MAP_NEGATIVE_X);
|
100
|
-
ti2d(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y);
|
101
|
-
ti2d(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
|
102
|
-
break;
|
103
|
-
default: throw new Error("Unexpected texture target "+target+"; use GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP");
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
/* pushLevel/popLevel are used for automatic management of glActiveTexture's.
|
109
|
-
The general concept is that you can do something like:
|
110
|
-
|
111
|
-
tex1.bind(context, function() {
|
112
|
-
tex2.bind(context, function() {
|
113
|
-
// render stuff.
|
114
|
-
// tex1 => GL_TEXTURE0, tex1.textureLevel => 0
|
115
|
-
// tex2 => GL_TEXTURE1, tex2.textureLevel => 1
|
116
|
-
|
117
|
-
tex3.bind(context, 5, function() {
|
118
|
-
// tex3 => GL_TEXTURE5, tex3.textureLevel => 5
|
119
|
-
});
|
120
|
-
});
|
121
|
-
});
|
122
|
-
*/
|
123
|
-
function pushLevel(self, level, context) {
|
124
|
-
if (level == null) level = Jax.Texture._level++;
|
125
|
-
self.textureLevel = level;
|
126
|
-
context.glActiveTexture(GL_TEXTURES[level]);
|
127
|
-
}
|
128
|
-
|
129
|
-
function popLevel(self, context) {
|
130
|
-
Jax.Texture._level = self.textureLevel - 1;
|
131
|
-
if (Jax.Texture._level < 0) Jax.Texture._level = 0;
|
132
|
-
delete self.textureLevel;
|
133
|
-
}
|
134
|
-
|
135
|
-
return Jax.Class.create({
|
136
|
-
/**
|
137
|
-
* new Jax.Texture(url[, options])
|
138
|
-
* - url (String): the URL or relative path to the image to be loaded.
|
139
|
-
* - options (Object): a generic object optionally consisting of the following properties:
|
140
|
-
* new Jax.Texture(urls[, options])
|
141
|
-
* - urls (Array): an array of URLs or relative paths to the images to be loaded. This is intended
|
142
|
-
* for use with cube maps. If used with a cube map, 6 paths must be provided.
|
143
|
-
* If used with a standard 2D texture, only the first path in the array will be used.
|
144
|
-
* - options (Object): a generic object optionally consisting of the following properties:
|
145
|
-
* new Jax.Texture(options)
|
146
|
-
* - options (Object): a generic object optionally consisting of the following properties, plus a mandatory
|
147
|
-
* _width_ and _height_ in pixels:
|
148
|
-
*
|
149
|
-
* * min_filter: GL_NEAREST
|
150
|
-
* * mag_filter: GL_NEARETS
|
151
|
-
* * generate_mipmap: true
|
152
|
-
* * mipmap_hint: GL_DONT_CARE
|
153
|
-
* * format: GL_RGBA
|
154
|
-
* * target: GL_TEXTURE_2D
|
155
|
-
* * data_type: GL_UNSIGNED_BYTE
|
156
|
-
* * wrap_s: GL_REPEAT
|
157
|
-
* * wrap_t: GL_REPEAT
|
158
|
-
* * flip_y: false
|
159
|
-
* * premultiply_alpha: false
|
160
|
-
* * colorspace_conversion: true
|
161
|
-
* * onload: null - a function to be called after the image has been loaded. This function
|
162
|
-
* will not be called if the image fails to load.
|
163
|
-
*
|
164
|
-
**/
|
165
|
-
initialize: function(path_or_array, options) {
|
166
|
-
this.handles = {};
|
167
|
-
this.loaded = false;
|
168
|
-
this.valid = [];
|
169
|
-
|
170
|
-
if (!options && typeof(path_or_array) == "object" && path_or_array.length == undefined) {
|
171
|
-
options = path_or_array;
|
172
|
-
path_or_array = options.path || null;
|
173
|
-
delete options.path;
|
174
|
-
}
|
175
|
-
|
176
|
-
var self = this;
|
177
|
-
this.options = Jax.Util.normalizeOptions(options, {
|
178
|
-
min_filter: GL_NEAREST,
|
179
|
-
mag_filter: GL_NEAREST,
|
180
|
-
generate_mipmap: true,
|
181
|
-
mipmap_hint: GL_DONT_CARE,
|
182
|
-
format: GL_RGBA,
|
183
|
-
target: GL_TEXTURE_2D,
|
184
|
-
data_type: GL_UNSIGNED_BYTE,
|
185
|
-
wrap_s: GL_REPEAT,
|
186
|
-
wrap_t: GL_REPEAT,
|
187
|
-
flip_y: false,
|
188
|
-
premultiply_alpha: false,
|
189
|
-
colorspace_conversion: true,
|
190
|
-
onload: null
|
191
|
-
});
|
192
|
-
|
193
|
-
var i;
|
194
|
-
var enums = ['min_filter', 'mag_filter', 'mipmap_hint', 'format', 'target', 'data_type', 'wrap_s', 'wrap_t'];
|
195
|
-
for (i = 0; i < enums.length; i++)
|
196
|
-
if (typeof(this.options[enums[i]]) == "string")
|
197
|
-
this.options[enums[i]] = window[this.options[enums[i]]];
|
198
|
-
|
199
|
-
if (path_or_array) {
|
200
|
-
if (typeof(path_or_array) == "string") {
|
201
|
-
this.image = new Image();
|
202
|
-
this.image.onload = function() { imageLoaded(self, false, this); };
|
203
|
-
this.image.onerror = this.image.onabort = function() { imageFailed(self, this); };
|
204
|
-
this.image.src = path_or_array;
|
205
|
-
} else {
|
206
|
-
var onload = function() { imageLoaded(self, true, this); };
|
207
|
-
this.images = [];
|
208
|
-
this.images.load_count = 0;
|
209
|
-
for (i = 0; i < path_or_array.length; i++) {
|
210
|
-
this.images[i] = new Image();
|
211
|
-
this.images[i].onload = onload;
|
212
|
-
this.images[i].onerror = this.images[i].onabort = function() { imageFailed(self, this); };
|
213
|
-
this.images[i].src = path_or_array[i];
|
214
|
-
}
|
215
|
-
}
|
216
|
-
}
|
217
|
-
else {
|
218
|
-
// nothing to load
|
219
|
-
this.options.generate_mipmap = !!(options && options.generate_mipmap);
|
220
|
-
this.loaded = true;
|
221
|
-
}
|
222
|
-
},
|
223
|
-
|
224
|
-
getTarget: function() { return this.options.target; },
|
225
|
-
getMinFilter: function() { return this.options.min_filter; },
|
226
|
-
getMagFilter: function() { return this.options.mag_filter; },
|
227
|
-
getGeneratesMipmaps: function() { return this.options.generate_mipmap; },
|
228
|
-
getMipmapHint: function() { return this.options.mipmap_hint; },
|
229
|
-
getFormat: function() { return this.options.format; },
|
230
|
-
getDataType: function() { return this.options.data_type; },
|
231
|
-
getWrapS: function() { return this.options.wrap_s; },
|
232
|
-
getWrapT: function() { return this.options.wrap_t; },
|
233
|
-
getFlipY: function() { return this.options.flip_y; },
|
234
|
-
getPremultipliesAlpha: function() { return this.options.premultiply_alpha; },
|
235
|
-
getDoesColorspaceConversion: function() { return this.options.colorspace_conversion; },
|
236
|
-
getOnloadFunc: function() { return this.options.onload; },
|
237
|
-
|
238
|
-
refresh: function(context) {
|
239
|
-
if (!this.ready()) return;
|
240
|
-
|
241
|
-
context.glBindTexture(this.options.target, this.getHandle(context));
|
242
|
-
generateTexture(context, this);
|
243
|
-
context.glTexParameteri(this.options.target, GL_TEXTURE_MAG_FILTER, this.options.mag_filter);
|
244
|
-
context.glTexParameteri(this.options.target, GL_TEXTURE_MIN_FILTER, this.options.min_filter);
|
245
|
-
context.glTexParameteri(this.options.target, GL_TEXTURE_WRAP_S, this.options.wrap_s);
|
246
|
-
context.glTexParameteri(this.options.target, GL_TEXTURE_WRAP_T, this.options.wrap_t);
|
247
|
-
context.glPixelStorei(GL_UNPACK_FLIP_Y_WEBGL, this.options.flip_y);
|
248
|
-
context.glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.options.premultiply_alpha);
|
249
|
-
context.glPixelStorei(GL_UNPACK_COLORSPACE_CONVERSION_WEBGL, this.options.colorspace_conversion ? GL_BROWSER_DEFAULT_WEBGL : GL_NONE);
|
250
|
-
|
251
|
-
if (this.options.generate_mipmap) {
|
252
|
-
this.generateMipmap(context);
|
253
|
-
}
|
254
|
-
|
255
|
-
context.glBindTexture(this.options.target, null);
|
256
|
-
this.valid[context.id] = true;
|
257
|
-
},
|
258
|
-
|
259
|
-
generateMipmap: function(context) {
|
260
|
-
// FIXME why does this raise 1280 invalid enum?
|
261
|
-
// context.glHint(GL_GENERATE_MIPMAP_HINT, this.options.mipmap_hint);
|
262
|
-
context.glGenerateMipmap(this.options.target);
|
263
|
-
},
|
264
|
-
|
265
|
-
invalidate: function() { this.valid.clear(); },
|
266
|
-
|
267
|
-
dispose: function(context) {
|
268
|
-
context.glDeleteTexture(getHandle(context));
|
269
|
-
delete this.handles[context.id];
|
270
|
-
},
|
271
|
-
|
272
|
-
getHandle: function(context) {
|
273
|
-
if (!this.handles[context.id]) {
|
274
|
-
build(this, context);
|
275
|
-
this.refresh(context);
|
276
|
-
}
|
277
|
-
return this.handles[context.id];
|
278
|
-
},
|
279
|
-
|
280
|
-
isValid: function(context) {
|
281
|
-
return !!this.valid[context.id];
|
282
|
-
},
|
283
|
-
|
284
|
-
bind: function(context, level, callback) {
|
285
|
-
if (!this.ready()) return; // no texture to display, yet... but not worth crashing over.
|
286
|
-
if (!this.isValid(context)) this.refresh(context);
|
287
|
-
|
288
|
-
if (typeof(level) == "number")
|
289
|
-
pushLevel(this, level, context);
|
290
|
-
else if (typeof(level) == "function") { callback = level; pushLevel(this, null, context); }
|
291
|
-
|
292
|
-
context.glBindTexture(this.options.target, this.getHandle(context));
|
293
|
-
if (callback)
|
294
|
-
{
|
295
|
-
callback.call(this, this.textureLevel);
|
296
|
-
this.unbind(context);
|
297
|
-
}
|
298
|
-
},
|
299
|
-
|
300
|
-
unbind: function(context) {
|
301
|
-
if (this.textureLevel != undefined) context.glActiveTexture(GL_TEXTURES[this.textureLevel]);
|
302
|
-
context.glBindTexture(this.options.target, null);
|
303
|
-
popLevel(this, context);
|
304
|
-
},
|
305
|
-
|
306
|
-
ready: function() {
|
307
|
-
return this.loaded;
|
308
|
-
}
|
309
|
-
});
|
310
|
-
})();
|
311
|
-
|
312
|
-
Jax.Texture._level = 0;
|
data/src/jax/webgl/world.js
DELETED
@@ -1,240 +0,0 @@
|
|
1
|
-
//= require "scene"
|
2
|
-
|
3
|
-
/**
|
4
|
-
* class Jax.World
|
5
|
-
*
|
6
|
-
* A +Jax.World+ represents a scene in the graphics engine. All objects to be rendered (or at least,
|
7
|
-
* all objects that you do not want to manually control!) should be added to the world. Each instance
|
8
|
-
* of +Jax.Context+ has its own +Jax.World+, and the currently-active +Jax.World+ is delegated into
|
9
|
-
* controllers and views as the +this.world+ property.
|
10
|
-
*
|
11
|
-
**/
|
12
|
-
Jax.World = (function() {
|
13
|
-
function getPickBuffer(self) {
|
14
|
-
if (self.pickBuffer) return self.pickBuffer;
|
15
|
-
return self.pickBuffer = new Jax.Framebuffer({
|
16
|
-
width:self.context.canvas.width,
|
17
|
-
height:self.context.canvas.height
|
18
|
-
});
|
19
|
-
}
|
20
|
-
|
21
|
-
return Jax.Class.create({
|
22
|
-
initialize: function(context) {
|
23
|
-
this.context = context;
|
24
|
-
this.lighting = new Jax.Scene.LightManager(context);
|
25
|
-
this.objects = [];
|
26
|
-
this.shadow_casters = [];
|
27
|
-
},
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Jax.World#addLightSource(light) -> Jax.Scene.LightSource
|
31
|
-
* - light (Jax.Scene.LightSource) : the instance of Jax.Scene.LightSource to add to this world.
|
32
|
-
*
|
33
|
-
* Adds the light to the world and then returns the light itself unchanged.
|
34
|
-
**/
|
35
|
-
addLightSource: function(light) { this.lighting.add(light); },
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Jax.World#addObject(object) -> Jax.Model
|
39
|
-
* - object (Jax.Model) : the instance of Jax.Model to add to this world.
|
40
|
-
*
|
41
|
-
* Adds the model to the world and then returns the model itself unchanged.
|
42
|
-
*
|
43
|
-
**/
|
44
|
-
addObject: function(object) {
|
45
|
-
this.objects.push(object);
|
46
|
-
if (object.isLit() || object.isShadowCaster())
|
47
|
-
this.lighting.addObject(object);
|
48
|
-
return object;
|
49
|
-
},
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Jax.World#getObject(index) -> Jax.Model
|
53
|
-
* - index (Number) : the world index of this object
|
54
|
-
*
|
55
|
-
* Returns the object with the specified world index, or undefined.
|
56
|
-
**/
|
57
|
-
getObject: function(index) { return this.objects[index]; },
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Jax.World#removeObject(object_or_index) -> Jax.Model
|
61
|
-
* - object_or_index (Number|Jax.Model) : the model instance to remove, or its world index
|
62
|
-
*
|
63
|
-
* If the model or its index cannot be found, nothing happens and the return value is undefined.
|
64
|
-
* Otherwise, the object is removed from this World and then returned.
|
65
|
-
**/
|
66
|
-
removeObject: function(object_or_index) {
|
67
|
-
if (this.objects[object_or_index]) {
|
68
|
-
var obj = this.objects[object_or_index];
|
69
|
-
this.objects.splice(object_or_index, 1);
|
70
|
-
this.lighting.removeObject(obj);
|
71
|
-
return obj;
|
72
|
-
}
|
73
|
-
else
|
74
|
-
for (var i = 0; i < this.objects.length; i++)
|
75
|
-
if (this.objects[i] == object_or_index)
|
76
|
-
{
|
77
|
-
this.objects.splice(i, 1);
|
78
|
-
this.lighting.removeObject(this.objects[i]);
|
79
|
-
return this.objects[i];
|
80
|
-
}
|
81
|
-
},
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Jax.World#pickRegionalIndices(x1, y1, x2, y2[, ary]) -> Array
|
85
|
-
* - x1 (Number): the screen X coordinate of the first corner of the 2D rectangle within which to pick
|
86
|
-
* - y1 (Number): the screen Y coordinate of the first corner of the 2D rectangle within which to pick
|
87
|
-
* - x2 (Number): the screen X coordinate of the second corner of the 2D rectangle within which to pick
|
88
|
-
* - y2 (Number): the screen Y coordinate of the second corner of the 2D rectangle within which to pick
|
89
|
-
* - ary (Array): an optional array to populate. A new one will be created if this is not specified.
|
90
|
-
* (Note: the array's contents will be cleared.)
|
91
|
-
*
|
92
|
-
* Picks all visible object indices within the specified rectangular regions and returns them as elements in
|
93
|
-
* an array.
|
94
|
-
*
|
95
|
-
* An object's index matches its position in the world's object list. That is, the following code is
|
96
|
-
* valid:
|
97
|
-
*
|
98
|
-
* this.world.getObjects(this.world.pickRegionalIDs(0,0, 100,100));
|
99
|
-
*
|
100
|
-
**/
|
101
|
-
pickRegionalIndices: function(x1, y1, x2, y2, ary) {
|
102
|
-
var w = Math.abs(x2 - x1), h = Math.abs(y2 - y1);
|
103
|
-
if (ary) ary.clear();
|
104
|
-
else ary = new Array();
|
105
|
-
var world = this, pickBuffer = getPickBuffer(this), context = this.context;
|
106
|
-
var data = new Uint8Array(w*h*4);
|
107
|
-
|
108
|
-
pickBuffer.bind(context, function() {
|
109
|
-
pickBuffer.viewport(context);
|
110
|
-
context.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
111
|
-
context.glDisable(GL_BLEND);
|
112
|
-
world.render({material:"picking"});
|
113
|
-
// read it back in
|
114
|
-
context.glReadPixels(x1, y1, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
115
|
-
if (data.data) data = data.data;
|
116
|
-
});
|
117
|
-
|
118
|
-
// restore the visible viewport and blending
|
119
|
-
context.glViewport(0, 0, context.canvas.width, context.canvas.height);
|
120
|
-
context.glEnable(GL_BLEND);
|
121
|
-
|
122
|
-
var index;
|
123
|
-
for (var i = 2; i < data.length; i += 4) {
|
124
|
-
if (data[i] > 0) { // blue key exists, we've found an object
|
125
|
-
index = Jax.Util.decodePickingColor(data[i-2], data[i-1], data[i], data[i+1]);
|
126
|
-
if (index != undefined) {
|
127
|
-
ary.push(index);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
return ary;
|
133
|
-
},
|
134
|
-
|
135
|
-
/**
|
136
|
-
* Jax.World#pickRegion(x1, y1, x2, y2) -> Array
|
137
|
-
* - x1 (Number): the screen X coordinate of the first corner of the 2D rectangle within which to pick
|
138
|
-
* - y1 (Number): the screen Y coordinate of the first corner of the 2D rectangle within which to pick
|
139
|
-
* - x2 (Number): the screen X coordinate of the second corner of the 2D rectangle within which to pick
|
140
|
-
* - y2 (Number): the screen Y coordinate of the second corner of the 2D rectangle within which to pick
|
141
|
-
* - ary (Array): an optional array to populate. A new one will be created if this is not specified.
|
142
|
-
* (Note: the array's contents will be cleared.)
|
143
|
-
*
|
144
|
-
* Picks all visible objects within the specified rectangular regions and returns them as elements in
|
145
|
-
* an array.
|
146
|
-
**/
|
147
|
-
pickRegion: function(x1, y1, x2, y2, ary) {
|
148
|
-
var result = this.pickRegionalIndices(x1, y1, x2, y2);
|
149
|
-
for (var i = 0; i < result.length; i++)
|
150
|
-
result[i] = this.getObject(i);
|
151
|
-
return result;
|
152
|
-
},
|
153
|
-
|
154
|
-
/**
|
155
|
-
* Jax.World#pickIndex(x, y) -> Number | undefined
|
156
|
-
* - x (Number): the screen X coordinate to pick at
|
157
|
-
* - y (Number): the screen Y coordinate to pick at
|
158
|
-
*
|
159
|
-
* Picks the visible object at the specified position and returns its index as used by
|
160
|
-
* +Jax.World#getObject+. If no object is visible at the given position, the special value
|
161
|
-
* +undefined+ is returned.
|
162
|
-
**/
|
163
|
-
pickIndex: function(x, y) {
|
164
|
-
this._pick_ary = this._pick_ary || new Array();
|
165
|
-
return this.pickRegionalIndices(x, y, x+1, y+1, this._pick_ary)[0];
|
166
|
-
},
|
167
|
-
|
168
|
-
/**
|
169
|
-
* Jax.World#pick(x, y) -> Jax.Model | undefined
|
170
|
-
* - x (Number): the screen X coordinate to pick at
|
171
|
-
* - y (Number): the screen Y coordinate to pick at
|
172
|
-
*
|
173
|
-
* Picks the visible object at the specified position and returns it. If no object is visible
|
174
|
-
* at the given position, the special value +undefined+ is returned.
|
175
|
-
**/
|
176
|
-
pick: function(x, y) {
|
177
|
-
var index = this.pickIndex(x, y);
|
178
|
-
if (index != undefined)
|
179
|
-
return this.getObject(index);
|
180
|
-
return index;
|
181
|
-
},
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Jax.World#countObjects() -> Number
|
185
|
-
* Returns the number of objects currently registered with this World.
|
186
|
-
**/
|
187
|
-
countObjects: function() {
|
188
|
-
return this.objects.length;
|
189
|
-
},
|
190
|
-
|
191
|
-
getShadowCasters: function() { return this.lighting.getShadowCasters(); },//return this.shadow_casters; },
|
192
|
-
|
193
|
-
render: function(options) {
|
194
|
-
var i;
|
195
|
-
|
196
|
-
/* this.current_pass is used by the material */
|
197
|
-
|
198
|
-
this.context.current_pass = Jax.Scene.AMBIENT_PASS;
|
199
|
-
this.context.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
200
|
-
var unlit = Jax.Util.normalizeOptions(options, {unlit:true});
|
201
|
-
|
202
|
-
if (this.lighting.isEnabled() && (!unlit.material || unlit.material.supportsLighting())) {
|
203
|
-
/* ambient pass - unlit objects only because lit objects get ambient+diffuse+specular in one pass */
|
204
|
-
for (i = 0; i < this.objects.length; i++)
|
205
|
-
if (!this.objects[i].isLit()) {
|
206
|
-
unlit.model_index = i;
|
207
|
-
this.objects[i].render(this.context, unlit);
|
208
|
-
}
|
209
|
-
|
210
|
-
/* illumination pass */
|
211
|
-
this.context.current_pass = Jax.Scene.ILLUMINATION_PASS;
|
212
|
-
this.lighting.illuminate(this.context, options);
|
213
|
-
} else {
|
214
|
-
for (i = 0; i < this.objects.length; i++) {
|
215
|
-
unlit.model_index = i;
|
216
|
-
this.objects[i].render(this.context, unlit);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
},
|
220
|
-
|
221
|
-
update: function(timechange) {
|
222
|
-
for (var i = this.objects.length-1; i >= 0; i--)
|
223
|
-
if (this.objects[i].update)
|
224
|
-
this.objects[i].update(timechange);
|
225
|
-
},
|
226
|
-
|
227
|
-
dispose: function() {
|
228
|
-
var i, o;
|
229
|
-
|
230
|
-
for (i = this.objects.length-1; i >= 0; i--)
|
231
|
-
/*
|
232
|
-
actually, we may not want to dispose the objects just yet. What if the user has a handle to them?
|
233
|
-
Maybe better to let JS GC take care of this one.
|
234
|
-
*/
|
235
|
-
(o = this.objects.pop());// && o.dispose();
|
236
|
-
|
237
|
-
this.lighting = new Jax.Scene.LightManager(this.context);
|
238
|
-
}
|
239
|
-
});
|
240
|
-
})();
|