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/mesh.js
DELETED
@@ -1,427 +0,0 @@
|
|
1
|
-
//= require "core"
|
2
|
-
|
3
|
-
/**
|
4
|
-
* class Jax.Mesh
|
5
|
-
*
|
6
|
-
* Example:
|
7
|
-
*
|
8
|
-
* var mesh = new Jax.Mesh({
|
9
|
-
* init: function(vertices, colors, textureCoords, normals, indices) {
|
10
|
-
* // all of the arguments are arrays. If you don't intend to use one,
|
11
|
-
* // simply don't populate it with data. For instance, if your mesh
|
12
|
-
* // does not use vertex indices, don't add any data to the indices
|
13
|
-
* // array.
|
14
|
-
*
|
15
|
-
* // Colors will default to white if they are not populated.
|
16
|
-
*
|
17
|
-
* // A simple, red, opaque quad:
|
18
|
-
* vertices.push(-1, -1, 0); colors.push(1, 0, 0, 1);
|
19
|
-
* vertices.push(-1, 1, 0); colors.push(1, 0, 0, 1);
|
20
|
-
* vertices.push( 1, 1, 0); colors.push(1, 0, 0, 1);
|
21
|
-
* vertices.push( 1, -1, 0); colors.push(1, 0, 0, 1);
|
22
|
-
* }
|
23
|
-
* });
|
24
|
-
*
|
25
|
-
* You can also subclass Mesh directly:
|
26
|
-
*
|
27
|
-
* var Quad = Jax.Class.create(Jax.Mesh, {
|
28
|
-
* init: function(vertices, colors, textureCoords, normals, indices) {
|
29
|
-
* // ...
|
30
|
-
* }
|
31
|
-
* });
|
32
|
-
**/
|
33
|
-
Jax.Mesh = (function() {
|
34
|
-
function setColorCoords(self, count, color, coords) {
|
35
|
-
var i, j;
|
36
|
-
var num_colors = color.length;
|
37
|
-
if (num_colors > 4) throw new Error("Color should have at most 4 components");
|
38
|
-
for (i = 0; i < count*4; i += 4)
|
39
|
-
{
|
40
|
-
for (j = 0; j < num_colors; j++)
|
41
|
-
coords[i+j] = color[j];
|
42
|
-
for (j = num_colors; j < 4; j++) {
|
43
|
-
coords[i+j] = 1;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
function makeTangentBuffer(self) {
|
49
|
-
var normals = self.getNormalBuffer();
|
50
|
-
var vertices = self.getVertexBuffer();
|
51
|
-
var texcoords = self.getTextureCoordsBuffer();
|
52
|
-
var indices = self.getIndexBuffer();
|
53
|
-
if (!normals || !vertices || !texcoords) return null;
|
54
|
-
|
55
|
-
var tangentBuffer = self.buffers.tangent_buffer;
|
56
|
-
normals = normals.js;
|
57
|
-
vertices = vertices.js;
|
58
|
-
texcoords = texcoords.js;
|
59
|
-
if (indices) indices = indices.js;
|
60
|
-
|
61
|
-
var tangents = tangentBuffer ? tangentBuffer.js : [];
|
62
|
-
var tan1 = [], tan2 = [], a;
|
63
|
-
var v1 = vec3.create(), v2 = vec3.create(), v3 = vec3.create();
|
64
|
-
var w1 = [], w2 = [], w3 = [];
|
65
|
-
var vertcount;
|
66
|
-
var x1, x2, y1, y2, z1, z2, s1, s2, t1, t2, r;
|
67
|
-
var dif = [];
|
68
|
-
var sdir = vec3.create(), tdir = vec3.create();
|
69
|
-
|
70
|
-
function setv(v, a) { v[0] = vertices[a*3]; v[1] = vertices[a*3+1]; v[2] = vertices[a*3+2]; }
|
71
|
-
function setw(w, a) { w[0] = texcoords[a*2]; w[1] = texcoords[a*2+1]; }
|
72
|
-
function sett1(a) { tan1[a] = tan1[a] || vec3.create(); vec3.add(tan1[a], sdir, tan1[a]); }
|
73
|
-
function sett2(a) { tan2[a] = tan2[a] || vec3.create(); vec3.add(tan2[a], tdir, tan2[a]); }
|
74
|
-
function findTangentVector(a1, a2, a3) {
|
75
|
-
if (indices) { a1 = indices[a1]; a2 = indices[a2]; a3 = indices[a3]; }
|
76
|
-
|
77
|
-
setv(v1, a1); setv(v2, a2); setv(v3, a3);
|
78
|
-
setw(w1, a1); setw(w2, a2); setw(w3, a3);
|
79
|
-
x1 = v2[0] - v1[0]; x2 = v3[0] - v1[0];
|
80
|
-
y1 = v2[1] - v1[1]; y2 = v3[1] - v1[1];
|
81
|
-
z1 = v2[2] - v1[2]; z2 = v3[2] - v1[2];
|
82
|
-
s1 = w2[0] - w1[0]; s2 = w3[0] - w1[0];
|
83
|
-
t1 = w2[1] - w1[1]; t2 = w3[1] - w1[1];
|
84
|
-
r = 1.0 / (s1 * t2 - s2 * t1);
|
85
|
-
|
86
|
-
sdir[0] = (t2 * x1 - t1 * x2) * r; sdir[1] = (t2 * y1 - t1 * y2) * r; sdir[2] = (t2 * z1 - t1 * z2) * r;
|
87
|
-
tdir[0] = (s1 * x2 - s2 * x1) * r; tdir[1] = (s1 * y2 - s2 * y1) * r; tdir[2] = (s1 * z2 - s2 * z1) * r;
|
88
|
-
if (isNaN(sdir[0]) || isNaN(sdir[1]) || isNaN(sdir[2]) ||
|
89
|
-
isNaN(tdir[0]) || isNaN(tdir[1]) || isNaN(tdir[2]) )
|
90
|
-
{
|
91
|
-
// this only seems to happen when dealing with degenerate triangles
|
92
|
-
// ...which seems to be fairly common. So, let's see what happens if
|
93
|
-
// we just set the offending vectors to zero.
|
94
|
-
sdir[0] = sdir[1] = sdir[2] = tdir[0] = tdir[1] = tdir[2] = 0;
|
95
|
-
}
|
96
|
-
sett1(a1); sett1(a2); sett1(a3);
|
97
|
-
sett2(a1); sett2(a2); sett2(a3);
|
98
|
-
}
|
99
|
-
|
100
|
-
vertcount = indices ? indices.length : normals.length / 3;
|
101
|
-
/* we need to pass the vertices into findTangentVector differently depending on draw mode */
|
102
|
-
switch(self.draw_mode) {
|
103
|
-
case GL_TRIANGLE_STRIP:
|
104
|
-
for (a = 2; a < vertcount; a += 2) {
|
105
|
-
findTangentVector(a-2, a-1, a);
|
106
|
-
findTangentVector(a, a-1, a+1);
|
107
|
-
}
|
108
|
-
break;
|
109
|
-
case GL_TRIANGLES:
|
110
|
-
for (a = 0; a < vertcount; a += 3)
|
111
|
-
findTangentVector(a, a+1, a+2);
|
112
|
-
break;
|
113
|
-
case GL_TRIANGLE_FAN:
|
114
|
-
for (a = 2; a < vertcount; a++)
|
115
|
-
findTangentVector(0, a-1, a);
|
116
|
-
break;
|
117
|
-
default:
|
118
|
-
throw new Error("Cannot calculate tangent space for draw mode: "+Jax.Util.enumName(self.draw_mode));
|
119
|
-
}
|
120
|
-
|
121
|
-
var normal = vec3.create();
|
122
|
-
|
123
|
-
// remove any tangents left over from earlier builds (this should be pretty rare)
|
124
|
-
while (tangents.length > vertcount) tangents.pop();
|
125
|
-
|
126
|
-
var b;
|
127
|
-
for (b = 0; b < vertcount; b++) {
|
128
|
-
|
129
|
-
if (indices) a = indices[b];
|
130
|
-
else a = b;
|
131
|
-
|
132
|
-
// Gram-Schmidt orthogonalize: (t - n * dot(n, t)).normalize()
|
133
|
-
normal[0] = normals[a*3]; normal[1] = normals[a*3+1]; normal[2] = normals[a*3+2];
|
134
|
-
vec3.scale(normal, vec3.dot(normal, tan1[a]), dif);
|
135
|
-
vec3.subtract(tan1[a], dif, dif);
|
136
|
-
vec3.normalize(dif);
|
137
|
-
|
138
|
-
tangents[a*4] = dif[0];
|
139
|
-
tangents[a*4+1] = dif[1];
|
140
|
-
tangents[a*4+2] = dif[2];
|
141
|
-
// calc handedness
|
142
|
-
tangents[a*4+3] = (vec3.dot(vec3.cross(normal, tan1[a]), tan2[a])) < 0.0 ? -1.0 : 1.0;
|
143
|
-
}
|
144
|
-
|
145
|
-
if (tangentBuffer)
|
146
|
-
self.buffers.tangent_buffer.refresh();
|
147
|
-
else
|
148
|
-
self.buffers.tangent_buffer = new Jax.NormalBuffer(tangents);
|
149
|
-
return self.buffers.tangent_buffer;
|
150
|
-
}
|
151
|
-
|
152
|
-
function findMaterial(name_or_instance) {
|
153
|
-
if (typeof(name_or_instance) == "string")
|
154
|
-
return Jax.Material.find(name_or_instance);
|
155
|
-
else if (name_or_instance.isKindOf && name_or_instance.isKindOf(Jax.Material))
|
156
|
-
return name_or_instance;
|
157
|
-
|
158
|
-
throw new Error("Material must be an instance of Jax.Material, or "+
|
159
|
-
"a string representing a material in the Jax material registry");
|
160
|
-
}
|
161
|
-
|
162
|
-
function calculateBounds(self, vertices) {
|
163
|
-
self.bounds = {left:null,right:null,top:null,bottom:null,front:null,back:null,width:null,height:null,depth:null};
|
164
|
-
var i, v;
|
165
|
-
|
166
|
-
for (i = 0; i < vertices.length; i++)
|
167
|
-
{
|
168
|
-
// x, i % 3 == 0
|
169
|
-
v = vertices[i];
|
170
|
-
if (self.bounds.left == null || v < self.bounds.left) self.bounds.left = v;
|
171
|
-
if (self.bounds.right == null || v > self.bounds.right) self.bounds.right = v;
|
172
|
-
|
173
|
-
// y, i % 3 == 1
|
174
|
-
v = vertices[++i];
|
175
|
-
if (self.bounds.bottom== null || v < self.bounds.bottom) self.bounds.bottom = v;
|
176
|
-
if (self.bounds.top == null || v > self.bounds.top) self.bounds.top = v;
|
177
|
-
|
178
|
-
// z, i % 3 == 2
|
179
|
-
v = vertices[++i];
|
180
|
-
if (self.bounds.front == null || v < self.bounds.front) self.bounds.front = v;
|
181
|
-
if (self.bounds.back == null || v > self.bounds.back) self.bounds.back = v;
|
182
|
-
}
|
183
|
-
|
184
|
-
self.bounds.width = self.bounds.right - self.bounds.left;
|
185
|
-
self.bounds.height= self.bounds.top - self.bounds.bottom;
|
186
|
-
self.bounds.depth = self.bounds.front - self.bounds.back;
|
187
|
-
}
|
188
|
-
|
189
|
-
function ensureBuilt(self) {
|
190
|
-
if (!self.isValid()) self.rebuild();
|
191
|
-
}
|
192
|
-
|
193
|
-
return Jax.Class.create({
|
194
|
-
initialize: function(options) {
|
195
|
-
this.buffers = {};
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Jax.Mesh#material -> String | Jax.Material
|
199
|
-
* This property represents the material that will be used to render this mesh. If
|
200
|
-
* it is a string, Jax will find the material with this name in the material registry
|
201
|
-
* using:
|
202
|
-
*
|
203
|
-
* Jax.Material.find(...).
|
204
|
-
*
|
205
|
-
* If not specified, Jax.Mesh#default_material will be used instead.
|
206
|
-
**/
|
207
|
-
|
208
|
-
/**
|
209
|
-
* Jax.Mesh#default_material -> String | Jax.Material
|
210
|
-
* This property represents the material that will be used to render this mesh if #material
|
211
|
-
* isn't given a value and the render options don't override the material. If
|
212
|
-
* it is a string, Jax will find the material with this name in the material registry
|
213
|
-
* using:
|
214
|
-
*
|
215
|
-
* Jax.Material.find(...).
|
216
|
-
*
|
217
|
-
* This property can also be specified as a render option in order to specify a default
|
218
|
-
* for a particular pass.
|
219
|
-
**/
|
220
|
-
this.default_material = "default";
|
221
|
-
|
222
|
-
for (var i in options)
|
223
|
-
this[i] = options[i];
|
224
|
-
|
225
|
-
if (!this.draw_mode)
|
226
|
-
this.draw_mode = GL_TRIANGLES;
|
227
|
-
},
|
228
|
-
|
229
|
-
/**
|
230
|
-
* Jax.Mesh#setColor(red, green, blue, alpha) -> Jax.Mesh
|
231
|
-
* Sets the color of this mesh. This will set the color at each vertex, regardless
|
232
|
-
* of the original color of that vertex. The result will be that the entire mesh
|
233
|
-
* takes on the specified color (not just a particular vertex).
|
234
|
-
**/
|
235
|
-
setColor: function(red, green, blue, alpha) {
|
236
|
-
var buf = this.getColorBuffer();
|
237
|
-
for (var i = 0; i < buf.js.length; i += 4) {
|
238
|
-
buf.js[i] = red;
|
239
|
-
buf.js[i+1] = green;
|
240
|
-
buf.js[i+2] = blue;
|
241
|
-
buf.js[i+3] = alpha;
|
242
|
-
}
|
243
|
-
buf.refresh();
|
244
|
-
return this;
|
245
|
-
},
|
246
|
-
|
247
|
-
/**
|
248
|
-
* Jax.Mesh#dispose() -> undefined
|
249
|
-
* Frees the various buffers used by this mesh.
|
250
|
-
**/
|
251
|
-
dispose: function() {
|
252
|
-
while (this.faces && this.faces.length) this.faces.pop();
|
253
|
-
while (this.edges && this.edges.length) this.edges.pop();
|
254
|
-
for (var i in this.buffers) {
|
255
|
-
this.buffers[i].dispose();
|
256
|
-
delete this.buffers[i];
|
257
|
-
}
|
258
|
-
this.built = false;
|
259
|
-
},
|
260
|
-
|
261
|
-
/**
|
262
|
-
* Jax.Mesh#getFaceVertices(face) -> Array
|
263
|
-
* - face (Jax.Core.Face): the face whose vertices you wish to retrieve
|
264
|
-
*
|
265
|
-
* Returns the current vertex data for the specified face.
|
266
|
-
**/
|
267
|
-
getFaceVertices: function(face) {
|
268
|
-
return [
|
269
|
-
[this.getVertexBuffer().js[face.vertexIndices[0]*3+0],
|
270
|
-
this.getVertexBuffer().js[face.vertexIndices[0]*3+1],
|
271
|
-
this.getVertexBuffer().js[face.vertexIndices[0]*3+2]
|
272
|
-
],
|
273
|
-
[this.getVertexBuffer().js[face.vertexIndices[1]*3+0],
|
274
|
-
this.getVertexBuffer().js[face.vertexIndices[1]*3+1],
|
275
|
-
this.getVertexBuffer().js[face.vertexIndices[1]*3+2]
|
276
|
-
],
|
277
|
-
[this.getVertexBuffer().js[face.vertexIndices[2]*3+0],
|
278
|
-
this.getVertexBuffer().js[face.vertexIndices[2]*3+1],
|
279
|
-
this.getVertexBuffer().js[face.vertexIndices[2]*3+2]
|
280
|
-
]
|
281
|
-
];
|
282
|
-
},
|
283
|
-
|
284
|
-
/**
|
285
|
-
* Jax.Mesh#getEdgeVertices(edge) -> Array
|
286
|
-
* - edge (Jax.Core.Edge): the edge whose vertices you wish to retrieve
|
287
|
-
*
|
288
|
-
* Returns the current vertex data for the specified edge.
|
289
|
-
**/
|
290
|
-
getEdgeVertices: function(edge) {
|
291
|
-
return [
|
292
|
-
[this.getVertexBuffer().js[edge.vertexIndices[0]*3+0],
|
293
|
-
this.getVertexBuffer().js[edge.vertexIndices[0]*3+1],
|
294
|
-
this.getVertexBuffer().js[edge.vertexIndices[0]*3+2]
|
295
|
-
],
|
296
|
-
[this.getVertexBuffer().js[edge.vertexIndices[1]*3+0],
|
297
|
-
this.getVertexBuffer().js[edge.vertexIndices[1]*3+1],
|
298
|
-
this.getVertexBuffer().js[edge.vertexIndices[1]*3+2]
|
299
|
-
]
|
300
|
-
];
|
301
|
-
},
|
302
|
-
|
303
|
-
/**
|
304
|
-
* Jax.Mesh#render(context[, options]) -> undefined
|
305
|
-
* - context (Jax.Context): the Jax context to render this object to
|
306
|
-
* - options (Object): a set of custom render options to override the defaults for this Mesh.
|
307
|
-
*
|
308
|
-
* Options include:
|
309
|
-
* * *draw_mode* : a GL rendering enum, such as GL_TRIANGLES or GL_LINE_STRIP.
|
310
|
-
* * *material* : an instance of Jax.Material, or the name of a registered Jax material, to override
|
311
|
-
* the material associated with this mesh.
|
312
|
-
**/
|
313
|
-
render: function(context, options) {
|
314
|
-
if (!this.isValid()) this.rebuild();
|
315
|
-
options = this.getNormalizedRenderOptions(options);
|
316
|
-
options.material.render(context, this, options);
|
317
|
-
},
|
318
|
-
|
319
|
-
getNormalizedRenderOptions: function(options) {
|
320
|
-
var result = Jax.Util.normalizeOptions(options, {
|
321
|
-
material: this.material,
|
322
|
-
default_material: this.default_material,
|
323
|
-
draw_mode: this.draw_mode || GL_TRIANGLES
|
324
|
-
});
|
325
|
-
|
326
|
-
if (!result.material) result.material = result.default_material;
|
327
|
-
|
328
|
-
result.material = findMaterial(result.material);
|
329
|
-
|
330
|
-
return result;
|
331
|
-
},
|
332
|
-
|
333
|
-
/**
|
334
|
-
* Jax.Mesh#getVertexBuffer() -> Jax.VertexBuffer
|
335
|
-
**/
|
336
|
-
getVertexBuffer: function() { ensureBuilt(this); return this.buffers.vertex_buffer; },
|
337
|
-
/**
|
338
|
-
* Jax.Mesh#getColorBuffer() -> Jax.ColorBuffer
|
339
|
-
**/
|
340
|
-
getColorBuffer: function() { ensureBuilt(this); return this.buffers.color_buffer; },
|
341
|
-
/**
|
342
|
-
* Jax.Mesh#getIndexBuffer() -> Jax.ElementArrayBuffer
|
343
|
-
**/
|
344
|
-
getIndexBuffer: function() { ensureBuilt(this); return this.buffers.index_buffer; },
|
345
|
-
/**
|
346
|
-
* Jax.Mesh#getNormalBuffer() -> Jax.NormalBuffer
|
347
|
-
**/
|
348
|
-
getNormalBuffer: function() { ensureBuilt(this); return this.buffers.normal_buffer; },
|
349
|
-
/**
|
350
|
-
* Jax.Mesh#getTextureCoordsBuffer() -> Jax.TextureCoordsBuffer
|
351
|
-
**/
|
352
|
-
getTextureCoordsBuffer: function() { ensureBuilt(this); return this.buffers.texture_coords; },
|
353
|
-
/**
|
354
|
-
* Jax.Mesh#getTangentBuffer() -> Jax.NormalBuffer
|
355
|
-
* Returns tangent normals for each normal in this Mesh. Used for normal / bump mapping.
|
356
|
-
**/
|
357
|
-
getTangentBuffer: function() {
|
358
|
-
if (this.buffers.tangent_buffer) return this.buffers.tangent_buffer;
|
359
|
-
return makeTangentBuffer(this);
|
360
|
-
},
|
361
|
-
|
362
|
-
/**
|
363
|
-
* Jax.Mesh#rebuildTangentBuffer() -> Jax.NormalBuffer
|
364
|
-
* Forces an immediate rebuild of the tangent buffer for this Mesh. Use this if you've changed
|
365
|
-
* the vertex, normal or texture information to update the tangent vectors. If this step is
|
366
|
-
* skipped, you'll notice strange artifacts when using bump mapping (because the tangents will
|
367
|
-
* be pointing in the wrong direction).
|
368
|
-
**/
|
369
|
-
rebuildTangentBuffer: function() {
|
370
|
-
return makeTangentBuffer(this);
|
371
|
-
},
|
372
|
-
|
373
|
-
/**
|
374
|
-
* Jax.Mesh#isValid() -> Boolean
|
375
|
-
*
|
376
|
-
* Returns true if this mesh is valid. If the mesh is invalid, it will be rebuilt during the next call to
|
377
|
-
* Jax.Mesh#render().
|
378
|
-
**/
|
379
|
-
isValid: function() { return !!this.built; },
|
380
|
-
|
381
|
-
/**
|
382
|
-
* Jax.Mesh#rebuild() -> undefined
|
383
|
-
*
|
384
|
-
* Forces Jax to rebuild this mesh immediately. This will dispose of any WebGL buffers
|
385
|
-
* and reinitialize them with a new call to this mesh's data init method. Note that this
|
386
|
-
* is a very expensive operation and is *usually not* what you want.
|
387
|
-
*
|
388
|
-
* If, for instance, you want to update the mesh with new vertex positions (say, for animation)
|
389
|
-
* then you'd be much better off doing something like this:
|
390
|
-
*
|
391
|
-
* var vbuf = mesh.getVertexBuffer();
|
392
|
-
* vbuf.js.clear();
|
393
|
-
* for (var i = 0; i < newVertexData.length; i++)
|
394
|
-
* vbuf.push(newVertexData[i]);
|
395
|
-
* vbuf.refresh();
|
396
|
-
*
|
397
|
-
**/
|
398
|
-
rebuild: function() {
|
399
|
-
this.dispose();
|
400
|
-
|
401
|
-
var vertices = [], colors = [], textureCoords = [], normals = [], indices = [];
|
402
|
-
if (this.init)
|
403
|
-
this.init(vertices, colors, textureCoords, normals, indices);
|
404
|
-
|
405
|
-
if (this.color)
|
406
|
-
setColorCoords(this, vertices.length / 3, this.color, colors);
|
407
|
-
|
408
|
-
if (colors.length == 0) // still no colors?? default to white
|
409
|
-
setColorCoords(this, vertices.length / 3, [1,1,1,1], colors);
|
410
|
-
|
411
|
-
if (vertices.length > 0)
|
412
|
-
{
|
413
|
-
this.buffers.vertex_buffer = new Jax.VertexBuffer(vertices);
|
414
|
-
calculateBounds(this, vertices);
|
415
|
-
}
|
416
|
-
|
417
|
-
if (colors.length > 0) this.buffers.color_buffer = new Jax.ColorBuffer(colors);
|
418
|
-
if (indices.length> 0) this.buffers.index_buffer = new Jax.ElementArrayBuffer(indices);
|
419
|
-
if (normals.length> 0) this.buffers.normal_buffer= new Jax.NormalBuffer(normals);
|
420
|
-
if (textureCoords.length > 0) this.buffers.texture_coords = new Jax.TextureCoordsBuffer(textureCoords);
|
421
|
-
|
422
|
-
this.built = true;
|
423
|
-
|
424
|
-
if (this.after_initialize) this.after_initialize();
|
425
|
-
}
|
426
|
-
});
|
427
|
-
})();
|
data/src/jax/webgl/scene.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
Jax.Scene = {};
|
2
|
-
|
3
|
-
/* used by some shaders to determine what kind of shading is to be done.
|
4
|
-
* This is stored in context.world.current_pass.
|
5
|
-
*/
|
6
|
-
Jax.Scene.ILLUMINATION_PASS = 1;
|
7
|
-
Jax.Scene.AMBIENT_PASS = 2;
|
8
|
-
Jax.Scene.SHADOWMAP_PASS = 3;
|
9
|
-
|
10
|
-
//= require "scene/frustum"
|
11
|
-
//= require "scene/light_manager"
|
@@ -1,260 +0,0 @@
|
|
1
|
-
//= require "../../geometry"
|
2
|
-
|
3
|
-
Jax.Scene.Frustum = (function() {
|
4
|
-
var RIGHT = 0, LEFT = 1, BOTTOM = 2, TOP = 3, FAR = 4, NEAR = 5;
|
5
|
-
var OUTSIDE = Jax.Geometry.Plane.BACK, INTERSECT = Jax.Geometry.Plane.INTERSECT, INSIDE = Jax.Geometry.Plane.FRONT;
|
6
|
-
|
7
|
-
function extents(self)
|
8
|
-
{
|
9
|
-
/* TODO see how this can be combined with Camera#unproject */
|
10
|
-
function extent(x, y, z)
|
11
|
-
{
|
12
|
-
var inf = [];
|
13
|
-
var mm = self.mv, pm = self.p;
|
14
|
-
|
15
|
-
//Calculation for inverting a matrix, compute projection x modelview; then compute the inverse
|
16
|
-
var m = mat4.set(mm, mat4.create());
|
17
|
-
|
18
|
-
mat4.inverse(m, m); // WHY do I have to do this? --see Jax.Context#reloadMatrices
|
19
|
-
mat4.multiply(pm, m, m);
|
20
|
-
mat4.inverse(m, m);
|
21
|
-
|
22
|
-
// Transformation of normalized coordinates between -1 and 1
|
23
|
-
inf[0]=x;//*2.0-1.0; /* x*2-1 translates x from 0..1 to -1..1 */
|
24
|
-
inf[1]=y;//*2.0-1.0;
|
25
|
-
inf[2]=z;//*2.0-1.0;
|
26
|
-
inf[3]=1.0;
|
27
|
-
|
28
|
-
//Objects coordinates
|
29
|
-
var out = mat4.multiplyVec4(m, inf);
|
30
|
-
if(out[3]==0.0)
|
31
|
-
return [0,0,0];//null;
|
32
|
-
|
33
|
-
out[3]=1.0/out[3];
|
34
|
-
return [out[0]*out[3], out[1]*out[3], out[2]*out[3]];
|
35
|
-
}
|
36
|
-
|
37
|
-
var ntl = extent(-1,1,-1), ntr = extent(1,1,-1), nbl = extent(-1,-1,-1), nbr = extent(1,-1,-1),
|
38
|
-
ftl = extent(-1,1,1), ftr = extent(1,1,1), fbl = extent(-1,-1,1), fbr = extent(1,-1,1);
|
39
|
-
|
40
|
-
return {ntl:ntl, ntr:ntr, nbl:nbl, nbr:nbr, ftl:ftl, ftr:ftr, fbl:fbl, fbr:fbr};
|
41
|
-
}
|
42
|
-
|
43
|
-
function varcube(self, position, w, h, d)
|
44
|
-
{
|
45
|
-
if (!self.mv || !self.p) return INSIDE;
|
46
|
-
var p, c, c2 = 0, plane;
|
47
|
-
|
48
|
-
w = w / 2.0;
|
49
|
-
h = h / 2.0;
|
50
|
-
d = d / 2.0;
|
51
|
-
|
52
|
-
var xp = position[0]+w, xm=position[0]-w, yp=position[1]+h, ym=position[1]-h, zp=position[2]+d, zm=position[2]-d;
|
53
|
-
|
54
|
-
for (p in self.planes)
|
55
|
-
{
|
56
|
-
plane = self.planes[p];
|
57
|
-
c = 0;
|
58
|
-
if (plane.distance(xp, yp, zp) > 0) c++;
|
59
|
-
if (plane.distance(xm, yp, zp) > 0) c++;
|
60
|
-
if (plane.distance(xp, ym, zp) > 0) c++;
|
61
|
-
if (plane.distance(xm, ym, zp) > 0) c++;
|
62
|
-
if (plane.distance(xp, yp, zm) > 0) c++;
|
63
|
-
if (plane.distance(xm, yp, zm) > 0) c++;
|
64
|
-
if (plane.distance(xp, ym, zm) > 0) c++;
|
65
|
-
if (plane.distance(xm, ym, zm) > 0) c++;
|
66
|
-
if (c == 0) return OUTSIDE;
|
67
|
-
if (c == 8) c2++;
|
68
|
-
}
|
69
|
-
|
70
|
-
return (c2 == 6) ? INSIDE : INTERSECT;
|
71
|
-
}
|
72
|
-
|
73
|
-
function extractFrustum(self)
|
74
|
-
{
|
75
|
-
var frustum = self.planes;
|
76
|
-
var e = extents(self);
|
77
|
-
|
78
|
-
frustum[TOP].set(e.ntr, e.ntl, e.ftl);
|
79
|
-
frustum[BOTTOM].set(e.nbl,e.nbr,e.fbr);
|
80
|
-
frustum[LEFT].set(e.ntl,e.nbl,e.fbl);
|
81
|
-
frustum[RIGHT].set(e.nbr,e.ntr,e.fbr);
|
82
|
-
frustum[NEAR].set(e.ntl,e.ntr,e.nbr);
|
83
|
-
frustum[FAR].set(e.ftr,e.ftl,e.fbl);
|
84
|
-
}
|
85
|
-
|
86
|
-
var klass = Jax.Class.create({
|
87
|
-
initialize: function(modelview, projection) {
|
88
|
-
this.listeners = {update:[]};
|
89
|
-
this.callbacks = this.listeners;
|
90
|
-
this.planes = {};
|
91
|
-
for (var i = 0; i < 6; i++) this.planes[i] = new Jax.Geometry.Plane();
|
92
|
-
this.setMatrices(modelview, projection);
|
93
|
-
},
|
94
|
-
|
95
|
-
update: function() { if (this.mv && this.p) { extractFrustum(this); this.fireListeners('update'); } },
|
96
|
-
setModelviewMatrix: function(mv) { this.setMatrices(mv, this.p); },
|
97
|
-
setProjectionMatrix: function(p) { this.setMatrices(this.mv, p); },
|
98
|
-
|
99
|
-
setMatrices: function(mv, p) {
|
100
|
-
this.mv = mv;
|
101
|
-
this.p = p;
|
102
|
-
this.update();
|
103
|
-
},
|
104
|
-
|
105
|
-
point: function(point) {
|
106
|
-
if (!this.mv || !this.p) return INSIDE;
|
107
|
-
if (arguments.length == 3) point = [arguments[0], arguments[1], arguments[2]];
|
108
|
-
|
109
|
-
for(var i=0; i < 6; i++)
|
110
|
-
{
|
111
|
-
if (this.planes[i].distance(point) < 0)
|
112
|
-
return OUTSIDE;
|
113
|
-
}
|
114
|
-
return INSIDE;
|
115
|
-
},
|
116
|
-
|
117
|
-
sphere: function(center, radius)
|
118
|
-
{
|
119
|
-
if (!this.mv || !this.p) return INSIDE;
|
120
|
-
if (arguments.length == 4) { center = [arguments[0], arguments[1], arguments[2]]; radius = arguments[3]; }
|
121
|
-
|
122
|
-
var result = INSIDE, distance;
|
123
|
-
for (var i = 0; i < 6; i++)
|
124
|
-
{
|
125
|
-
distance = this.planes[i].distance(center);
|
126
|
-
if (distance < -radius) return OUTSIDE;
|
127
|
-
else if (distance < radius) result = INTERSECT;
|
128
|
-
}
|
129
|
-
return result;
|
130
|
-
},
|
131
|
-
|
132
|
-
/* Arguments can either be an array of indices, or a position array [x,y,z] followed by width, height and depth.
|
133
|
-
Examples:
|
134
|
-
var cube = new Cube(...);
|
135
|
-
frustum.cube(cube.getCorners());
|
136
|
-
frustub.cube(cube.orientation.getPosition(), 1);
|
137
|
-
frustub.cube(cube.orientation.getPosition(), 1, 2, 3);
|
138
|
-
*/
|
139
|
-
cube: function(corners)
|
140
|
-
{
|
141
|
-
if (arguments.length == 2) { return varcube(this, arguments[0], arguments[1], arguments[1], arguments[1]); }
|
142
|
-
if (arguments.length == 4) { return varcube(this, arguments[0], arguments[1], arguments[2], arguments[3]); }
|
143
|
-
|
144
|
-
if (!this.mv || !this.p) return INSIDE;
|
145
|
-
if (arguments.length > 1) { corners = arguments; }
|
146
|
-
var p, c, c2 = 0, i, num_corners = corners.length, plane;
|
147
|
-
for (p in this.planes)
|
148
|
-
{
|
149
|
-
plane = this.planes[p];
|
150
|
-
c = 0;
|
151
|
-
for (i = 0; i < num_corners; i++)
|
152
|
-
if (plane.distance(corners[i]) > 0)
|
153
|
-
c++;
|
154
|
-
if (c == 0) return OUTSIDE;
|
155
|
-
if (c == num_corners) c2++;
|
156
|
-
}
|
157
|
-
|
158
|
-
return (c2 == 6) ? INSIDE : INTERSECT;
|
159
|
-
},
|
160
|
-
|
161
|
-
addUpdateListener: function(callback) { this.listeners.update.push(callback); },
|
162
|
-
sphereVisible: function(center, radius) { return this.sphere.apply(this, arguments) != OUTSIDE; },
|
163
|
-
pointVisible: function(center) { return this.point.apply(this, arguments) != OUTSIDE; },
|
164
|
-
cubeVisible: function(corners) { return this.cube.apply(this, arguments) != OUTSIDE; },
|
165
|
-
|
166
|
-
fireListeners: function(name) {
|
167
|
-
for (var i = 0; i < this.listeners[name].length; i++)
|
168
|
-
this.listeners[name][i]();
|
169
|
-
},
|
170
|
-
|
171
|
-
isValid: function() { return this.p && this.mv; },
|
172
|
-
|
173
|
-
getRenderable: function()
|
174
|
-
{
|
175
|
-
if (this.renderable) return this.renderable;
|
176
|
-
|
177
|
-
var renderable = this.renderable = new Jax.Model({mesh: new Jax.Mesh()});
|
178
|
-
renderable.upToDate = false;
|
179
|
-
var frustum = this;
|
180
|
-
|
181
|
-
function addVertices(e, vertices)
|
182
|
-
{
|
183
|
-
// near quad
|
184
|
-
vertices.push(e.ntl[0], e.ntl[1], e.ntl[2]);
|
185
|
-
vertices.push(e.ntr[0], e.ntr[1], e.ntr[2]);
|
186
|
-
|
187
|
-
vertices.push(e.ntr[0], e.ntr[1], e.ntr[2]);
|
188
|
-
vertices.push(e.nbr[0], e.nbr[1], e.nbr[2]);
|
189
|
-
|
190
|
-
vertices.push(e.nbr[0], e.nbr[1], e.nbr[2]);
|
191
|
-
vertices.push(e.nbl[0], e.nbl[1], e.nbl[2]);
|
192
|
-
|
193
|
-
vertices.push(e.nbl[0], e.nbl[1], e.nbl[2]);
|
194
|
-
vertices.push(e.ntl[0], e.ntl[1], e.ntl[2]);
|
195
|
-
|
196
|
-
// far quad
|
197
|
-
vertices.push(e.ftl[0], e.ftl[1], e.ftl[2]);
|
198
|
-
vertices.push(e.ftr[0], e.ftr[1], e.ftr[2]);
|
199
|
-
|
200
|
-
vertices.push(e.ftr[0], e.ftr[1], e.ftr[2]);
|
201
|
-
vertices.push(e.fbr[0], e.fbr[1], e.fbr[2]);
|
202
|
-
|
203
|
-
vertices.push(e.fbr[0], e.fbr[1], e.fbr[2]);
|
204
|
-
vertices.push(e.fbl[0], e.fbl[1], e.fbl[2]);
|
205
|
-
|
206
|
-
vertices.push(e.fbl[0], e.fbl[1], e.fbl[2]);
|
207
|
-
vertices.push(e.ftl[0], e.ftl[1], e.ftl[2]);
|
208
|
-
|
209
|
-
// left side
|
210
|
-
vertices.push(e.ntl[0], e.ntl[1], e.ntl[2]);
|
211
|
-
vertices.push(e.ftl[0], e.ftl[1], e.ftl[2]);
|
212
|
-
|
213
|
-
vertices.push(e.nbl[0], e.nbl[1], e.nbl[2]);
|
214
|
-
vertices.push(e.fbl[0], e.fbl[1], e.fbl[2]);
|
215
|
-
|
216
|
-
// right side
|
217
|
-
vertices.push(e.ntr[0], e.ntr[1], e.ntr[2]);
|
218
|
-
vertices.push(e.ftr[0], e.ftr[1], e.ftr[2]);
|
219
|
-
|
220
|
-
vertices.push(e.nbr[0], e.nbr[1], e.nbr[2]);
|
221
|
-
vertices.push(e.fbr[0], e.fbr[1], e.fbr[2]);
|
222
|
-
}
|
223
|
-
|
224
|
-
renderable.mesh.init = function(vertices, colors) {
|
225
|
-
this.draw_mode = GL_LINES;
|
226
|
-
|
227
|
-
for (var i = 0; i < 24; i++)
|
228
|
-
{
|
229
|
-
vertices.push(0,0,0);
|
230
|
-
colors.push(1,1,0,1);
|
231
|
-
}
|
232
|
-
};
|
233
|
-
|
234
|
-
renderable.update = null;
|
235
|
-
|
236
|
-
frustum.addUpdateListener(function() {
|
237
|
-
if (!frustum.isValid()) { return; }
|
238
|
-
|
239
|
-
renderable.upToDate = true;
|
240
|
-
var buf = renderable.mesh.getVertexBuffer();
|
241
|
-
if (!buf) return;
|
242
|
-
var vertices = buf.js;
|
243
|
-
vertices.clear();
|
244
|
-
var e = extents(frustum);//{ntl:ntl, ntr:ntr, nbl:nbl, nbr:nbr, ftl:ftl, ftr:ftr, fbl:fbl, fbr:fbr};
|
245
|
-
|
246
|
-
addVertices(e, vertices);
|
247
|
-
|
248
|
-
buf.refresh();
|
249
|
-
});
|
250
|
-
|
251
|
-
return renderable;
|
252
|
-
}
|
253
|
-
});
|
254
|
-
|
255
|
-
klass.INSIDE = INSIDE;
|
256
|
-
klass.OUTSIDE = OUTSIDE;
|
257
|
-
klass.INTERSECT = INTERSECT;
|
258
|
-
|
259
|
-
return klass;
|
260
|
-
})();
|