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
@@ -1,136 +0,0 @@
|
|
1
|
-
//= require "light_source"
|
2
|
-
|
3
|
-
Jax.Scene.LightManager = (function() {
|
4
|
-
return Jax.Class.create({
|
5
|
-
initialize: function(context) {
|
6
|
-
this.context = context;
|
7
|
-
this._lights = [];
|
8
|
-
this.objects = [];
|
9
|
-
},
|
10
|
-
|
11
|
-
addObject: function(obj) {
|
12
|
-
this.objects.push(obj);
|
13
|
-
for (var j = 0; j < this._lights.length; j++)
|
14
|
-
if (obj.isShadowCaster())
|
15
|
-
this._lights[j].registerCaster(obj);
|
16
|
-
this.recalculateBoundingRadius();
|
17
|
-
},
|
18
|
-
|
19
|
-
removeObject: function(obj) {
|
20
|
-
if (this.objects[obj]) {
|
21
|
-
var o = this.objects[obj];
|
22
|
-
this.objects.splice(obj, 1);
|
23
|
-
for (var j = 0; j < this._lights.length; j++)
|
24
|
-
if (o.isShadowCaster())
|
25
|
-
this._lights[j].unregisterCaster(o);
|
26
|
-
this.recalculateBoundingRadius();
|
27
|
-
return o;
|
28
|
-
}
|
29
|
-
for (var i = 0; i < this.objects.length; i++)
|
30
|
-
if (this.objects[i] == obj)
|
31
|
-
return this.removeObject(obj);
|
32
|
-
},
|
33
|
-
|
34
|
-
getShadowCasters: function() {
|
35
|
-
var ret = [];
|
36
|
-
for (var i = 0; i < this.objects.length; i++) {
|
37
|
-
if (this.objects[i].isShadowCaster())
|
38
|
-
ret.push(this.objects[i]);
|
39
|
-
}
|
40
|
-
return ret;
|
41
|
-
},
|
42
|
-
|
43
|
-
add: function(light) {
|
44
|
-
if (this._lights.length == Jax.max_lights)
|
45
|
-
throw new Error("Maximum number of light sources in a scene has been exceeded! Try removing some first.");
|
46
|
-
for (var i = 0; i < this.objects.length; i++) {
|
47
|
-
if (this.objects[i].isShadowCaster())
|
48
|
-
light.registerCaster(this.objects[i]);
|
49
|
-
}
|
50
|
-
this._lights.push(light);
|
51
|
-
light.boundingRadius = this.boundingRadius || 0;
|
52
|
-
},
|
53
|
-
|
54
|
-
recalculateBoundingRadius: function() {
|
55
|
-
var boundingRadius = null;
|
56
|
-
var i, j;
|
57
|
-
for (i = 0; i < this.objects.length; i++) {
|
58
|
-
j = vec3.length(this.objects[i].camera.getPosition()) + this.objects[i].getBoundingSphereRadius();
|
59
|
-
if (boundingRadius == null || boundingRadius < j)
|
60
|
-
boundingRadius = j;
|
61
|
-
}
|
62
|
-
this.boundingRadius = boundingRadius = boundingRadius || 0;
|
63
|
-
|
64
|
-
for (i = 0; i < this._lights.length; i++)
|
65
|
-
this._lights[i].boundingRadius = boundingRadius;
|
66
|
-
},
|
67
|
-
|
68
|
-
enable: function() { this.enabled = true; },
|
69
|
-
|
70
|
-
disable: function() { this.enabled = false; },
|
71
|
-
|
72
|
-
isEnabled: function() {
|
73
|
-
if (arguments.length == 1) {
|
74
|
-
if (this._lights.length > arguments[0])
|
75
|
-
return this._lights[arguments[0]].isEnabled();
|
76
|
-
return false;
|
77
|
-
}
|
78
|
-
|
79
|
-
if (this.enabled != undefined)
|
80
|
-
return this.enabled;
|
81
|
-
return this._lights.length > 0;
|
82
|
-
},
|
83
|
-
|
84
|
-
count: function() { return this._lights.length; },
|
85
|
-
|
86
|
-
remove: function(index) {
|
87
|
-
var result = this._lights.splice(index, 1);
|
88
|
-
if (this._lights.length == 0) delete this.enabled;
|
89
|
-
return result;
|
90
|
-
},
|
91
|
-
|
92
|
-
illuminate: function(context, options) {
|
93
|
-
// used by individual light sources
|
94
|
-
options = Jax.Util.normalizeOptions(options, {});
|
95
|
-
|
96
|
-
// Use alpha blending for the first pass, and additive blending for subsequent passes.
|
97
|
-
this.context.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
98
|
-
for (var i = 0; i < this._lights.length; i++) {
|
99
|
-
this._current_light = i;
|
100
|
-
this._lights[i].render(context, this.objects, options);
|
101
|
-
if (i == 0) this.context.glBlendFunc(GL_ONE, GL_ONE);
|
102
|
-
}
|
103
|
-
|
104
|
-
delete this._current_light;
|
105
|
-
},
|
106
|
-
|
107
|
-
getDirection: function(index) { return this.getLight(index).getDirection(); },
|
108
|
-
|
109
|
-
getPosition: function(index) { return this.getLight(index).getPosition(); },
|
110
|
-
|
111
|
-
getLight: function(index) {
|
112
|
-
if (index == undefined)
|
113
|
-
if (this._current_light != undefined) return this._lights[this._current_light];
|
114
|
-
else return (this.default_light = this.default_light || new Jax.Scene.LightSource());
|
115
|
-
return this._lights[index];
|
116
|
-
},
|
117
|
-
|
118
|
-
getType: function(index) { return this.getLight(index).getType(); },
|
119
|
-
|
120
|
-
getDiffuseColor: function(index) { return this.getLight(index).getDiffuseColor(); },
|
121
|
-
|
122
|
-
getSpecularColor: function(index) { return this.getLight(index).getSpecularColor(); },
|
123
|
-
|
124
|
-
getAmbientColor: function(index) { return this.getLight(index).getAmbientColor(); },
|
125
|
-
|
126
|
-
getConstantAttenuation: function(index) { return this.getLight(index).getConstantAttenuation(); },
|
127
|
-
|
128
|
-
getLinearAttenuation: function(index) { return this.getLight(index).getLinearAttenuation(); },
|
129
|
-
|
130
|
-
getQuadraticAttenuation: function(index) { return this.getLight(index).getQuadraticAttenuation(); },
|
131
|
-
|
132
|
-
getSpotCosCutoff: function(index) { return this.getLight(index).getSpotCosCutoff(); },
|
133
|
-
|
134
|
-
getSpotExponent: function(index) { return this.getLight(index).getSpotExponent(); }
|
135
|
-
});
|
136
|
-
})();
|
@@ -1,294 +0,0 @@
|
|
1
|
-
Jax.POINT_LIGHT = 1;
|
2
|
-
Jax.SPOT_LIGHT = 2;
|
3
|
-
Jax.DIRECTIONAL_LIGHT = 3;
|
4
|
-
|
5
|
-
Jax.Scene.LightSource = (function() {
|
6
|
-
function setupProjection(self) {
|
7
|
-
if (self.camera.projection) return;
|
8
|
-
|
9
|
-
switch(self.type) {
|
10
|
-
case Jax.DIRECTIONAL_LIGHT:
|
11
|
-
self.camera.ortho({left:-1,right:1, top:1,bottom:-1, near:-1,far:1 });
|
12
|
-
self.camera.setPosition(0,0,0);
|
13
|
-
break;
|
14
|
-
case Jax.POINT_LIGHT:
|
15
|
-
self.camera.perspective({fov:45,near:0.01,far:500,width:2048,height:2048});
|
16
|
-
break;
|
17
|
-
case Jax.SPOT_LIGHT:
|
18
|
-
self.camera.perspective({near:0.1,far:500,fov:60,width:2048,height:2048});
|
19
|
-
break;
|
20
|
-
default:
|
21
|
-
throw new Error("Unexpected light type: "+self.type);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
return Jax.Model.create({
|
26
|
-
initialize: function($super, data) {
|
27
|
-
data = Jax.Util.normalizeOptions(data, {
|
28
|
-
enabled: true,
|
29
|
-
type: Jax.POINT_LIGHT,
|
30
|
-
color: {
|
31
|
-
ambient: [0,0,0,1],
|
32
|
-
diffuse: [1,1,1,1],
|
33
|
-
specular: [1,1,1,1]
|
34
|
-
},
|
35
|
-
position: [0,0,0],
|
36
|
-
direction: [0,0,-1],
|
37
|
-
angle: Math.PI/6,
|
38
|
-
attenuation: {
|
39
|
-
constant: 0,
|
40
|
-
linear: 0.02,
|
41
|
-
quadratic: 0
|
42
|
-
},
|
43
|
-
spot_exponent: 0,
|
44
|
-
shadowcaster: true
|
45
|
-
});
|
46
|
-
|
47
|
-
if (typeof(data.type) == "string") data.type = Jax[data.type] || data.type;
|
48
|
-
data.color.ambient = Jax.Util.colorize(data.color.ambient);
|
49
|
-
data.color.diffuse = Jax.Util.colorize(data.color.diffuse);
|
50
|
-
data.color.specular= Jax.Util.colorize(data.color.specular);
|
51
|
-
$super(data);
|
52
|
-
|
53
|
-
var self = this;
|
54
|
-
this.camera.addEventListener('matrixUpdated', function() { self.invalidate(); });
|
55
|
-
|
56
|
-
this.spotExponent = this.spot_exponent;
|
57
|
-
delete this.spot_exponent;
|
58
|
-
|
59
|
-
this.shadowMatrix = mat4.create();
|
60
|
-
|
61
|
-
this.framebuffers = [new Jax.Framebuffer({width:2048,height:2048,depth:true,color:GL_RGBA}),
|
62
|
-
new Jax.Framebuffer({width:2048,height:2048,depth:true,color:GL_RGBA})];
|
63
|
-
|
64
|
-
setupProjection(this);
|
65
|
-
},
|
66
|
-
|
67
|
-
format: function() {
|
68
|
-
this._format = this._format || new glMatrixArrayType(Jax.Scene.LightSource.STRUCT_SIZE);
|
69
|
-
var i, j, len = 0, self = this;
|
70
|
-
function push() { for (j = 0; j < arguments.length; j++) self._format[len++] = arguments[j]; }
|
71
|
-
for (i = 0; i < arguments.length; i++) {
|
72
|
-
switch(arguments[i]) {
|
73
|
-
case Jax.Scene.LightSource.POSITION: push.apply(this, this.getPosition()); break;
|
74
|
-
case Jax.Scene.LightSource.DIRECTION: push.apply(this, this.getDirection()); break;
|
75
|
-
case Jax.Scene.LightSource.AMBIENT: push.apply(this, this.getAmbientColor()); break;
|
76
|
-
case Jax.Scene.LightSource.DIFFUSE: push.apply(this, this.getDiffuseColor()); break;
|
77
|
-
case Jax.Scene.LightSource.SPECULAR: push.apply(this, this.getSpecularColor()); break;
|
78
|
-
case Jax.Scene.LightSource.CONSTANT_ATTENUATION: push(this.getConstantAttenuation()); break;
|
79
|
-
case Jax.Scene.LightSource.LINEAR_ATTENUATION: push(this.getLinearAttenuation()); break;
|
80
|
-
case Jax.Scene.LightSource.QUADRATIC_ATTENUATION: push(this.getQuadraticAttenuation()); break;
|
81
|
-
case Jax.Scene.LightSource.SPOTLIGHT_EXPONENT: push(this.getSpotExponent()); break;
|
82
|
-
case Jax.Scene.LightSource.SPOTLIGHT_COS_CUTOFF: push(this.getSpotCosCutoff()); break;
|
83
|
-
default: throw new Error("Unexpected light source format descriptor: "+arguments[i]);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
return this._format;
|
87
|
-
},
|
88
|
-
|
89
|
-
getPosition: function() { setupProjection(this); return this.camera.getPosition(); },
|
90
|
-
getDirection: function() { setupProjection(this); return this.camera.getViewVector(); },
|
91
|
-
|
92
|
-
setEnabled: function(b) { this.enabled = b; },
|
93
|
-
enable: function() { this.setEnabled(true); },
|
94
|
-
disable: function() { this.setEnabled(false); },
|
95
|
-
|
96
|
-
isEnabled: function() { return this.enabled; },
|
97
|
-
getType: function() { return this.type; },
|
98
|
-
|
99
|
-
getDiffuseColor: function() { return this.color.diffuse; },
|
100
|
-
getAmbientColor: function() { return this.color.ambient; },
|
101
|
-
getSpecularColor: function() { return this.color.specular; },
|
102
|
-
getConstantAttenuation: function() { return this.attenuation.constant; },
|
103
|
-
getQuadraticAttenuation: function() { return this.attenuation.quadratic; },
|
104
|
-
getLinearAttenuation: function() { return this.attenuation.linear; },
|
105
|
-
getAngle: function() { return this.angle; },
|
106
|
-
getSpotExponent: function() { return this.spotExponent; },
|
107
|
-
getSpotCosCutoff: function() { return Math.cos(this.angle); },
|
108
|
-
|
109
|
-
getShadowMapTexture: function(context) {
|
110
|
-
setupProjection(this);
|
111
|
-
return this.framebuffers[0].getTextureBuffer(context, 0);
|
112
|
-
// return this.framebuffers[0].getTextureBufferHandle(context, 0);
|
113
|
-
},
|
114
|
-
|
115
|
-
getShadowMapTextures: function(context) {
|
116
|
-
setupProjection(this);
|
117
|
-
return [this.framebuffers[0].getTextureBuffer(context, 0),
|
118
|
-
this.framebuffers[1].getTextureBuffer(context, 0)];
|
119
|
-
// return [this.framebuffers[0].getTextureBufferHandle(context, 0),
|
120
|
-
// this.framebuffers[1].getTextureBufferHandle(context, 0)];
|
121
|
-
},
|
122
|
-
|
123
|
-
isShadowMapEnabled: function() {
|
124
|
-
return !!(this.framebuffers && this.isShadowcaster());
|
125
|
-
},
|
126
|
-
|
127
|
-
getShadowMatrix: function() {
|
128
|
-
return this.shadowMatrix;
|
129
|
-
},
|
130
|
-
|
131
|
-
registerCaster: function(object) {
|
132
|
-
var self = this;
|
133
|
-
function updated() { self.invalidate(); }
|
134
|
-
object.camera.addEventListener('matrixUpdated', updated);
|
135
|
-
this.invalidate();
|
136
|
-
},
|
137
|
-
|
138
|
-
unregisterCaster: function(object) {
|
139
|
-
/* FIXME remove the shadowmap event listener from object's camera matrix */
|
140
|
-
},
|
141
|
-
|
142
|
-
isShadowcaster: function() { return this.shadowcaster; },
|
143
|
-
|
144
|
-
getDPShadowNear: function() { setupProjection(this); return this.camera.projection.near; },
|
145
|
-
|
146
|
-
getDPShadowFar: function() { setupProjection(this); return this.camera.projection.far; },
|
147
|
-
|
148
|
-
invalidate: function() { this.valid = false; },
|
149
|
-
|
150
|
-
render: function(context, objects, options) {
|
151
|
-
if (!this.valid) {
|
152
|
-
var real_pass = context.current_pass;
|
153
|
-
/* shadowgen pass */
|
154
|
-
context.current_pass = Jax.Scene.SHADOWMAP_PASS;
|
155
|
-
this.updateShadowMap(context, this.boundingRadius, objects, options);
|
156
|
-
this.valid = true;
|
157
|
-
context.current_pass = real_pass;
|
158
|
-
}
|
159
|
-
|
160
|
-
for (var j = 0; j < objects.length; j++) {
|
161
|
-
options.model_index = j;
|
162
|
-
|
163
|
-
/* TODO optimization: see if objects[j] is even affected by this light (based on attenuation) */
|
164
|
-
if (objects[j].isLit()) // it could be unlit but still in array if it casts a shadow
|
165
|
-
objects[j].render(context, options);
|
166
|
-
}
|
167
|
-
},
|
168
|
-
|
169
|
-
updateShadowMap: function(context, sceneBoundingRadius, objects, render_options) {
|
170
|
-
// we can't afford to taint the original options
|
171
|
-
render_options = Jax.Util.normalizeOptions(render_options, {});
|
172
|
-
|
173
|
-
setupProjection(this);
|
174
|
-
|
175
|
-
var self = this;
|
176
|
-
var sm = this.shadowMatrix;
|
177
|
-
var lightToSceneDistance = vec3.length(this.camera.getPosition());
|
178
|
-
var nearPlane = lightToSceneDistance - sceneBoundingRadius;
|
179
|
-
if (nearPlane < 0.01) nearPlane = 0.01;
|
180
|
-
|
181
|
-
if (this.type == Jax.DIRECTIONAL_LIGHT) {
|
182
|
-
this.camera.ortho({left:-sceneBoundingRadius,right:sceneBoundingRadius,
|
183
|
-
top:sceneBoundingRadius,bottom:-sceneBoundingRadius,
|
184
|
-
near:-sceneBoundingRadius,far:sceneBoundingRadius
|
185
|
-
});
|
186
|
-
this.camera.setPosition(0,0,0);
|
187
|
-
} else if (this.type == Jax.SPOT_LIGHT) {
|
188
|
-
// Save the depth precision for where it's useful
|
189
|
-
var fieldOfView = Math.radToDeg(2.0 * Math.atan(sceneBoundingRadius / lightToSceneDistance));
|
190
|
-
|
191
|
-
// fieldOfView = Math.radToDeg(this.getAngle());
|
192
|
-
fieldOfView = 60;
|
193
|
-
this.camera.perspective({near:nearPlane,far:nearPlane+(2.0*sceneBoundingRadius),fov:fieldOfView,width:2048,height:2048});
|
194
|
-
} else if (this.type == Jax.POINT_LIGHT) {
|
195
|
-
var paraboloid_depthmap = Jax.Material.find("paraboloid-depthmap");
|
196
|
-
|
197
|
-
context.glDisable(GL_BLEND);
|
198
|
-
context.glEnable(GL_CULL_FACE);
|
199
|
-
context.glCullFace(GL_FRONT);
|
200
|
-
context.glEnable(GL_POLYGON_OFFSET_FILL);
|
201
|
-
context.glPolygonOffset(2.0, 2.0);
|
202
|
-
|
203
|
-
context.pushMatrix(function() {
|
204
|
-
render_options.direction = 1;
|
205
|
-
render_options.material = paraboloid_depthmap;
|
206
|
-
|
207
|
-
self.framebuffers[0].bind(context, function() {
|
208
|
-
// front paraboloid
|
209
|
-
self.framebuffers[0].viewport(context);
|
210
|
-
context.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
211
|
-
context.loadViewMatrix(self.camera.getTransformationMatrix());
|
212
|
-
mat4.set(context.getInverseViewMatrix(), sm);
|
213
|
-
|
214
|
-
for (var i = 0; i < objects.length; i++) {
|
215
|
-
objects[i].render(context, render_options);
|
216
|
-
}
|
217
|
-
});
|
218
|
-
|
219
|
-
render_options.direction = -1;
|
220
|
-
|
221
|
-
self.framebuffers[1].bind(context, function() {
|
222
|
-
// back paraboloid
|
223
|
-
self.framebuffers[1].viewport(context);
|
224
|
-
context.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
225
|
-
context.loadViewMatrix(self.camera.getTransformationMatrix());
|
226
|
-
for (var i = 0; i < objects.length; i++) {
|
227
|
-
objects[i].render(context, render_options);
|
228
|
-
}
|
229
|
-
});
|
230
|
-
|
231
|
-
context.glDisable(GL_POLYGON_OFFSET_FILL);
|
232
|
-
context.glEnable(GL_BLEND);
|
233
|
-
context.glCullFace(GL_BACK);
|
234
|
-
context.glDisable(GL_CULL_FACE);
|
235
|
-
|
236
|
-
// restore the original context viewport
|
237
|
-
context.glViewport(0, 0, context.canvas.width, context.canvas.height);
|
238
|
-
});
|
239
|
-
|
240
|
-
return;
|
241
|
-
}
|
242
|
-
|
243
|
-
render_options.material = "depthmap";
|
244
|
-
|
245
|
-
this.framebuffers[0].bind(context, function() {
|
246
|
-
self.framebuffers[0].viewport(context);
|
247
|
-
context.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
248
|
-
context.pushMatrix(function() {
|
249
|
-
self.framebuffers[0].viewport(context);
|
250
|
-
context.matrix_stack.loadProjectionMatrix(self.camera.getProjectionMatrix());
|
251
|
-
context.matrix_stack.loadViewMatrix(self.camera.getTransformationMatrix());
|
252
|
-
mat4.identity(sm);
|
253
|
-
sm[0] = sm[5] = sm[10] = sm[12] = sm[13] = sm[14] = 0.5;
|
254
|
-
mat4.multiply(sm, context.getModelViewProjectionMatrix());
|
255
|
-
|
256
|
-
context.glEnable(GL_CULL_FACE);
|
257
|
-
context.glCullFace(GL_FRONT);
|
258
|
-
context.glDisable(GL_BLEND);
|
259
|
-
context.glEnable(GL_POLYGON_OFFSET_FILL);
|
260
|
-
context.glPolygonOffset(2.0, 2.0);
|
261
|
-
for (var i = 0; i < objects.length; i++) {
|
262
|
-
objects[i].render(context, render_options);
|
263
|
-
}
|
264
|
-
context.glDisable(GL_POLYGON_OFFSET_FILL);
|
265
|
-
context.glEnable(GL_BLEND);
|
266
|
-
context.glCullFace(GL_BACK);
|
267
|
-
context.glDisable(GL_CULL_FACE);
|
268
|
-
});
|
269
|
-
// restore the original context viewport
|
270
|
-
context.glViewport(0, 0, context.canvas.width, context.canvas.height);
|
271
|
-
});
|
272
|
-
}
|
273
|
-
});
|
274
|
-
})();
|
275
|
-
|
276
|
-
/*
|
277
|
-
Constants used internally when constructing the flat-array format for a light source.
|
278
|
-
This is so we don't need to make redundant glUniform() calls to specify the attributes of a single
|
279
|
-
light source.
|
280
|
-
*/
|
281
|
-
Jax.Scene.LightSource.POSITION = 1;
|
282
|
-
Jax.Scene.LightSource.DIRECTION = 2;
|
283
|
-
Jax.Scene.LightSource.AMBIENT = 3;
|
284
|
-
Jax.Scene.LightSource.DIFFUSE = 4;
|
285
|
-
Jax.Scene.LightSource.SPECULAR = 5;
|
286
|
-
Jax.Scene.LightSource.CONSTANT_ATTENUATION = 6;
|
287
|
-
Jax.Scene.LightSource.LINEAR_ATTENUATION = 7;
|
288
|
-
Jax.Scene.LightSource.QUADRATIC_ATTENUATION = 8;
|
289
|
-
Jax.Scene.LightSource.SPOTLIGHT_EXPONENT = 9;
|
290
|
-
Jax.Scene.LightSource.SPOTLIGHT_COS_CUTOFF = 10;
|
291
|
-
|
292
|
-
/* The size of the light source structure, in float elements */
|
293
|
-
Jax.Scene.LightSource.STRUCT_SIZE = 23;
|
294
|
-
|
data/src/jax/webgl/shader.js
DELETED
@@ -1,296 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* class Jax.Shader
|
3
|
-
*
|
4
|
-
* Wraps around a WebGL shader program.
|
5
|
-
**/
|
6
|
-
Jax.Shader = (function() {
|
7
|
-
function buildStackTrace(context, glShader, source) {
|
8
|
-
source = source.split(/\n/);
|
9
|
-
var log = context.glGetShaderInfoLog(glShader).split(/\n/);
|
10
|
-
|
11
|
-
/* build a detailed backtrace with error information so devs can actually find the error */
|
12
|
-
var current = 1, injected = [], li;
|
13
|
-
function strToInject() { return current+" : "+source[current-1]; }
|
14
|
-
for (li = 0; li < log.length; li++) {
|
15
|
-
var line = log[li];
|
16
|
-
var match = /0:(\d+):(.*)/.exec(line);
|
17
|
-
if (!match) continue; // blank line
|
18
|
-
var line_number = parseInt(match[1]);
|
19
|
-
if (line_number > current)
|
20
|
-
for (; current < line_number; current++)
|
21
|
-
injected.push(strToInject());
|
22
|
-
if (line_number == current) {
|
23
|
-
injected.push(strToInject());
|
24
|
-
injected.push(":: ERROR : "+match[2]); /* error message */
|
25
|
-
}
|
26
|
-
current = line_number+1;
|
27
|
-
}
|
28
|
-
|
29
|
-
/* prepend a summary so user can debug simple errors at a glance */
|
30
|
-
injected.unshift("");
|
31
|
-
for (li = log.length-1; li >= 0; li--)
|
32
|
-
injected.unshift(log[li]);
|
33
|
-
|
34
|
-
/* finally, add 3 more lines so the user has an easier time finding the problem in ambiguous code */
|
35
|
-
li = current;
|
36
|
-
for (current = li; current < li+3; current++)
|
37
|
-
injected.push(strToInject());
|
38
|
-
|
39
|
-
return injected.join("\n");
|
40
|
-
}
|
41
|
-
|
42
|
-
function compile(context, shader, source) {
|
43
|
-
context.glShaderSource(shader, source);
|
44
|
-
shader.source = source;
|
45
|
-
context.glCompileShader(shader);
|
46
|
-
if (!context.glGetShaderParameter(shader, GL_COMPILE_STATUS))
|
47
|
-
throw new Error(buildStackTrace(context, shader, source));
|
48
|
-
}
|
49
|
-
|
50
|
-
function sanitizeName(name) {
|
51
|
-
return name.replace(/-/, '_');
|
52
|
-
}
|
53
|
-
|
54
|
-
function getExportedVariableName(exportPrefix, name) {
|
55
|
-
return sanitizeName("_"+exportPrefix+"_"+name);
|
56
|
-
}
|
57
|
-
|
58
|
-
/*
|
59
|
-
preprocess shader source code to replace "import(varname, expression)" with the globalized varname if it's been
|
60
|
-
exported (as an attribute of material.exports || self.options.exports), or expression if it hasn't.
|
61
|
-
*/
|
62
|
-
function applyImports(self, options, source) {
|
63
|
-
var rx = /import\((.*?),\s*(.*?)\)/, result;
|
64
|
-
var exp;
|
65
|
-
while (result = rx.exec(source)) {
|
66
|
-
var name = result[1];
|
67
|
-
if (options && (exp = (options.exports && options.exports[name]) || (self.options.exports && self.options.exports[name]))) {
|
68
|
-
var exportedVariableName = getExportedVariableName(options.export_prefix || self.getName(), name);
|
69
|
-
source = source.replace(result[0], result[2].replace(new RegExp(name, "g"), exportedVariableName));
|
70
|
-
}
|
71
|
-
else source = source.replace(result[0], "");
|
72
|
-
}
|
73
|
-
return source;
|
74
|
-
}
|
75
|
-
|
76
|
-
function applyExports(self, options, source) {
|
77
|
-
var rx = /export\((.*?),\s*(.*?)(,\s*(.*?))?\)/, result;
|
78
|
-
// rx should match both 'export(vec4, ambient)' and 'export(vec4, ambient, ambient)'
|
79
|
-
var replacement, name, type, assignment;
|
80
|
-
while (result = rx.exec(source)) {
|
81
|
-
type = result[1];
|
82
|
-
name = result[2];
|
83
|
-
assignment = result[4] || null;
|
84
|
-
replacement = getExportedVariableName(options && options.export_prefix || self.getName(), name)+" = ";
|
85
|
-
if (assignment) replacement += assignment;
|
86
|
-
else replacement += name;
|
87
|
-
source = source.replace(result[0], replacement);
|
88
|
-
}
|
89
|
-
return source;
|
90
|
-
}
|
91
|
-
|
92
|
-
function mangleUniformsAndAttributes(self, material, source) {
|
93
|
-
var map = self.getInputMap(material);
|
94
|
-
for (var name in map)
|
95
|
-
source = source.replace(new RegExp("(^|[^a-zA-Z0-9])"+name+"([^a-zA-Z0-9]|$)", "g"), "$1"+map[name].full_name+"$2");
|
96
|
-
|
97
|
-
// remove the "shared" directive
|
98
|
-
return source.replace(/(^|[^\w])shared\s+/g, "$1");
|
99
|
-
}
|
100
|
-
|
101
|
-
function stripSharedDefinitions(self, options, source) {
|
102
|
-
var map = self.getInputMap(options);
|
103
|
-
for (var i in map) {
|
104
|
-
if (map[i].shared) {
|
105
|
-
if (options.skip_global_definitions && options.skip_global_definitions.indexOf(map[i].full_name) != -1) {
|
106
|
-
var rx = new RegExp("(shared\\s+)"+map[i].scope+"\\s*"+map[i].type+"[^;]*?"+map[i].full_name+"[^;]*?;\n?", "g");
|
107
|
-
source = source.replace(rx, "");
|
108
|
-
}
|
109
|
-
// else source = source.replace(rx, map[i].scope+" "+map[i].type+" "+map[i].full_name+";\n");
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
return source.replace(/shared\s+/, '');
|
114
|
-
}
|
115
|
-
|
116
|
-
/* TODO separate preprocessing from shader and friends; perhaps a Jax.Shader.Preprocessor class? */
|
117
|
-
function preprocess(self, options, source, isVertex) {
|
118
|
-
source = stripSharedDefinitions(self, options, source);
|
119
|
-
// source = source.replace(/^\s*(shared\s+|)(uniform|attribute|varying)([^;]*)?;\n?/, '');
|
120
|
-
// if (!options || !options.skip_global_definitions)
|
121
|
-
// source = self.getGlobalDefinitions(options, isVertex) + source;
|
122
|
-
source = applyExports(self, options, source);
|
123
|
-
source = applyImports(self, options, source);
|
124
|
-
source = mangleUniformsAndAttributes(self, options, source);
|
125
|
-
|
126
|
-
return source;
|
127
|
-
}
|
128
|
-
|
129
|
-
function sourceWithoutComments(source) {
|
130
|
-
return source.replace(/\/\*.*\*\//g, "");
|
131
|
-
}
|
132
|
-
|
133
|
-
function numArgumentsInMain(source) {
|
134
|
-
// if a comment contains 'void main' in it, we'll get false positives
|
135
|
-
var result = /void\s*main\((.*?)\)\s*\{/.exec(sourceWithoutComments(source));
|
136
|
-
if (result) {
|
137
|
-
result = result[1].replace(/\s*/g, '');
|
138
|
-
if (result == "" || result == "void") return 0;
|
139
|
-
else return result[1].split(/,/).length;
|
140
|
-
}
|
141
|
-
else throw new Error("Could not find main() function in source!\n\n"+source);
|
142
|
-
}
|
143
|
-
|
144
|
-
return Jax.Class.create({
|
145
|
-
initialize: function(obj) {
|
146
|
-
this.options = obj;
|
147
|
-
|
148
|
-
if (obj.vertex) this.setRawSource(obj.vertex, 'vertex');
|
149
|
-
if (obj.fragment) this.setRawSource(obj.fragment, 'fragment');
|
150
|
-
if (obj.common) this.setRawSource(obj.common, 'common');
|
151
|
-
|
152
|
-
this.shaders = { vertex: {}, fragment: {} };
|
153
|
-
},
|
154
|
-
|
155
|
-
getName: function() { return this.options.name; },
|
156
|
-
|
157
|
-
getVertexShader: function(context) {
|
158
|
-
if (!this.options.vertex) return null;
|
159
|
-
this.shaders.vertex[context.id] = this.shaders.vertex[context.id] || context.glCreateShader(GL_VERTEX_SHADER);
|
160
|
-
return this.shaders.vertex[context.id];
|
161
|
-
},
|
162
|
-
|
163
|
-
getFragmentShader: function(context) {
|
164
|
-
if (!this.options.fragment) return null;
|
165
|
-
this.shaders.fragment[context.id] = this.shaders.fragment[context.id] || context.glCreateShader(GL_FRAGMENT_SHADER);
|
166
|
-
return this.shaders.fragment[context.id];
|
167
|
-
},
|
168
|
-
|
169
|
-
getCommonSource: function(material) {
|
170
|
-
return this.options.common ? this.options.common.render(material) : "";
|
171
|
-
},
|
172
|
-
|
173
|
-
getVertexSource: function(material) {
|
174
|
-
var source = this.getRawSource(material, 'vertex');
|
175
|
-
return source && preprocess(this, material, source, true);
|
176
|
-
},
|
177
|
-
|
178
|
-
getPreamble: function(options) {
|
179
|
-
return options && options.ignore_es_precision ? "" : "#ifdef GL_ES\nprecision highp float;\n#endif\n";
|
180
|
-
},
|
181
|
-
|
182
|
-
getFragmentSource: function(material) {
|
183
|
-
var source = this.getRawSource(material, 'fragment');
|
184
|
-
return source && preprocess(this, material, source, false);
|
185
|
-
},
|
186
|
-
|
187
|
-
getVertexArgumentCount: function(options) {
|
188
|
-
var source = this.getVertexSource(options);
|
189
|
-
return numArgumentsInMain(source);
|
190
|
-
},
|
191
|
-
|
192
|
-
getFragmentArgumentCount: function(options) {
|
193
|
-
var source = this.getFragmentSource(options);
|
194
|
-
return numArgumentsInMain(source);
|
195
|
-
},
|
196
|
-
|
197
|
-
getRawSource: function(options, which) {
|
198
|
-
var source = this.options[which];
|
199
|
-
options = Jax.Util.normalizeOptions(options, {shader_type:which});
|
200
|
-
if (source && (source = source.render(options))) {
|
201
|
-
var result = this.getPreamble(options);
|
202
|
-
if (!options || !options.skip_export_definitions)
|
203
|
-
result += this.getExportDefinitions(options && options.export_prefix || this.getName());
|
204
|
-
if (!options || !options.skip_common_source)
|
205
|
-
result += this.getCommonSource(options) + "\n";
|
206
|
-
result += source;
|
207
|
-
return result;
|
208
|
-
}
|
209
|
-
return null;
|
210
|
-
},
|
211
|
-
|
212
|
-
getGlobalDefinitions: function(options, isVertex) {
|
213
|
-
var map = this.getInputMap(options);
|
214
|
-
var source = "";
|
215
|
-
for (var i in map) {
|
216
|
-
if (map[i].scope == "attribute" && !isVertex) continue;
|
217
|
-
source += map[i].scope+" "+map[i].type+" "+map[i].full_name+";\n";
|
218
|
-
}
|
219
|
-
return source;
|
220
|
-
},
|
221
|
-
|
222
|
-
setRawSource: function(source, which) { this.options[which] = source && new EJS({text:source}); },
|
223
|
-
|
224
|
-
setVertexSource: function(source) { this.setRawSource(source, 'vertex'); },
|
225
|
-
|
226
|
-
setFragmentSource: function(source) { this.setRawSource(source, 'fragment'); },
|
227
|
-
|
228
|
-
getInputMap: function(options) {
|
229
|
-
var map = {};
|
230
|
-
var prefix = "";
|
231
|
-
|
232
|
-
if (options && options.local_prefix) prefix = options.local_prefix+"_";
|
233
|
-
else if (options && options.export_prefix) prefix = options.export_prefix+"_";
|
234
|
-
|
235
|
-
var source = (this.getRawSource(options, 'common') || "") + "\n\n" +
|
236
|
-
(this.getRawSource(options, 'vertex') || "") + "\n\n" +
|
237
|
-
(this.getRawSource(options, 'fragment') || "");
|
238
|
-
|
239
|
-
// if it's not a "shared" uniform, mangle its name.
|
240
|
-
var rx = new RegExp("(^|\\n|\\s+)((shared\\s+)?)(uniform|attribute|varying)\\s+(\\w+)\\s+((?!"+prefix+")[^;]*);"), result;
|
241
|
-
while (result = rx.exec(source)) {
|
242
|
-
var shared = /shared/.test(result[2]);
|
243
|
-
var scope = result[4];
|
244
|
-
var type = result[5];
|
245
|
-
var names = result[6].split(/,/);
|
246
|
-
|
247
|
-
for (var i = 0; i < names.length; i++) {
|
248
|
-
names[i] = names[i].replace(/^\s+/, '').replace(/\s+$/, '');
|
249
|
-
if (shared) map[names[i]] = names[i];
|
250
|
-
else map[names[i]] = sanitizeName(prefix+names[i]);
|
251
|
-
map[names[i]] = { full_name: map[names[i]], type: type, scope: scope, shared: shared };
|
252
|
-
source = source.replace(new RegExp("(^|[^a-zA-Z0-9_])"+names[i]+"([^a-zA-Z0-9_]|$)", "g"),
|
253
|
-
"$1"+prefix+names[i]+"$2");
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
return map;
|
258
|
-
},
|
259
|
-
|
260
|
-
getExportDefinitions: function(exportPrefix, skip) {
|
261
|
-
var exports = "";
|
262
|
-
if (this.options.exports) {
|
263
|
-
for (var name in this.options.exports) {
|
264
|
-
if (!skip || skip.indexOf(name) == -1)
|
265
|
-
exports += this.options.exports[name]+" "+getExportedVariableName(exportPrefix, name)+";\n";
|
266
|
-
}
|
267
|
-
}
|
268
|
-
return exports + "\n";
|
269
|
-
},
|
270
|
-
|
271
|
-
build: function(context, material) {
|
272
|
-
var count = 0;
|
273
|
-
if (this.getVertexShader(context)) {
|
274
|
-
count++;
|
275
|
-
compile(context, this.getVertexShader(context), this.getVertexSource(material));
|
276
|
-
}
|
277
|
-
if (this.getFragmentShader(context)) {
|
278
|
-
count++;
|
279
|
-
compile(context, this.getFragmentShader(context), this.getFragmentSource(material));
|
280
|
-
}
|
281
|
-
if (count == 0) throw new Error("No sources specified for shader '"+this.getName()+"'!");
|
282
|
-
}
|
283
|
-
});
|
284
|
-
})();
|
285
|
-
|
286
|
-
|
287
|
-
Jax.Shader.max_varyings = gl.getParameter(GL_MAX_VARYING_VECTORS);
|
288
|
-
Jax.Shader.max_vertex_uniforms = gl.getParameter(GL_MAX_VERTEX_UNIFORM_VECTORS);
|
289
|
-
Jax.Shader.max_fragment_uniforms = gl.getParameter(GL_MAX_FRAGMENT_UNIFORM_VECTORS);
|
290
|
-
Jax.Shader.max_attributes = gl.getParameter(GL_MAX_VERTEX_ATTRIBS);
|
291
|
-
Jax.Shader.max_vertex_textures = gl.getParameter(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
292
|
-
|
293
|
-
// FIXME differentiate between vertex & fragment uniforms
|
294
|
-
Jax.Shader.max_uniforms = Math.min(Jax.Shader.max_fragment_uniforms, Jax.Shader.max_vertex_uniforms);
|
295
|
-
|
296
|
-
//= require "shader/program"
|