jax 0.0.0.4 → 0.0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +14 -0
- data/Rakefile +4 -0
- data/builtin/shaders/depthmap/fragment.ejs +4 -2
- data/builtin/shaders/depthmap/material.js +5 -0
- data/builtin/shaders/depthmap/vertex.ejs +4 -1
- data/builtin/shaders/functions/noise.ejs +523 -0
- data/builtin/shaders/lighting/common.ejs +1 -1
- data/builtin/shaders/normal_map/common.ejs +1 -1
- data/builtin/shaders/{paraboloid-depthmap → paraboloid}/common.ejs +2 -2
- data/builtin/shaders/{paraboloid-depthmap → paraboloid}/fragment.ejs +3 -3
- data/builtin/shaders/paraboloid/manifest.yml +5 -0
- data/builtin/shaders/{paraboloid-depthmap → paraboloid}/material.js +4 -4
- data/builtin/shaders/{paraboloid-depthmap → paraboloid}/vertex.ejs +1 -0
- data/builtin/shaders/shadow_map/common.ejs +1 -1
- data/builtin/shaders/shadow_map/fragment.ejs +1 -1
- data/lib/jax.rb +4 -0
- data/lib/jax/application.rb +4 -5
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +190 -6
- data/lib/jax/generators/material/USAGE +1 -1
- data/lib/jax/generators/shader/templates/common.ejs.tt +1 -1
- data/lib/jax/generators/shader/templates/spec.js.tt +4 -0
- data/lib/jax/packager/sprockets_template.rb +4 -0
- data/lib/jax/resource_compiler.rb +1 -1
- data/lib/jax/shader.rb +19 -7
- data/lib/jax/version.rb +1 -1
- data/spec/example_app/app/controllers/noise_controller.js +18 -0
- data/spec/example_app/app/helpers/noise_helper.js +3 -0
- data/spec/example_app/app/resources/materials/blob.yml +28 -0
- data/spec/example_app/app/shaders/blob/common.ejs +18 -0
- data/spec/example_app/app/shaders/blob/fragment.ejs +8 -0
- data/spec/example_app/app/shaders/blob/manifest.yml +15 -0
- data/spec/example_app/app/shaders/blob/material.js +48 -0
- data/spec/example_app/app/shaders/blob/vertex.ejs +13 -0
- data/spec/example_app/app/views/noise/index.js +4 -0
- data/spec/example_app/config/routes.rb +1 -0
- data/spec/example_app/spec/javascripts/controllers/noise_controller_spec.js +11 -0
- data/spec/example_app/spec/javascripts/helpers/noise_helper_spec.js +12 -0
- data/spec/example_app/spec/javascripts/shaders/blob_spec.js +30 -0
- data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +2 -1
- data/spec/javascripts/shaders/core_materials_spec.js +1 -0
- data/spec/javascripts/shaders/{dual_paraboloid_spec.js → paraboloid_spec.js} +2 -2
- data/src/constants.yml +1 -0
- data/src/constants.yml.erb +1 -0
- data/src/jax.js +14 -1
- data/src/jax/noise.js +193 -0
- data/src/jax/webgl/material.js +3 -2
- data/src/jax/webgl/scene/light_source.js +3 -2
- metadata +41 -12
- data/spec/javascripts/Player.js +0 -58
data/src/jax/webgl/material.js
CHANGED
@@ -366,10 +366,11 @@ Jax.Material.addResources = function(resources) {
|
|
366
366
|
//= require "../../../builtin/shaders/texture/material"
|
367
367
|
//= require "../../../builtin/shaders/normal_map/material"
|
368
368
|
//= require "../../../builtin/shaders/shadow_map/material"
|
369
|
-
//= require "../../../builtin/shaders/
|
369
|
+
//= require "../../../builtin/shaders/depthmap/material"
|
370
|
+
//= require "../../../builtin/shaders/paraboloid/material"
|
370
371
|
//= require "../../../builtin/shaders/fog/material"
|
371
372
|
|
372
373
|
Jax.Material.create("basic");
|
373
374
|
Jax.Material.create("default", {default_shader:'basic'});
|
374
375
|
Jax.Material.create("depthmap", {default_shader:"depthmap"});
|
375
|
-
Jax.Material.create("paraboloid-depthmap", {type:"
|
376
|
+
Jax.Material.create("paraboloid-depthmap", {type:"Paraboloid",default_shader:"paraboloid",layers:[{type:"Depthmap"}]});
|
@@ -154,6 +154,7 @@ Jax.Scene.LightSource = (function() {
|
|
154
154
|
fieldOfView = 60;
|
155
155
|
this.camera.perspective({near:nearPlane,far:nearPlane+(2.0*sceneBoundingRadius),fov:fieldOfView,width:2048,height:2048});
|
156
156
|
} else if (this.type == Jax.POINT_LIGHT) {
|
157
|
+
var paraboloid_depthmap = Jax.Material.find("paraboloid-depthmap");
|
157
158
|
|
158
159
|
context.glDisable(GL_BLEND);
|
159
160
|
context.glEnable(GL_CULL_FACE);
|
@@ -170,7 +171,7 @@ Jax.Scene.LightSource = (function() {
|
|
170
171
|
mat4.set(context.getInverseViewMatrix(), sm);
|
171
172
|
|
172
173
|
for (var i = 0; i < objects.length; i++) {
|
173
|
-
objects[i].render(context, {material:
|
174
|
+
objects[i].render(context, {material:paraboloid_depthmap, direction:1});
|
174
175
|
}
|
175
176
|
});
|
176
177
|
|
@@ -180,7 +181,7 @@ Jax.Scene.LightSource = (function() {
|
|
180
181
|
context.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
181
182
|
context.loadViewMatrix(self.camera.getModelViewMatrix());
|
182
183
|
for (var i = 0; i < objects.length; i++) {
|
183
|
-
objects[i].render(context, {material:
|
184
|
+
objects[i].render(context, {material:paraboloid_depthmap,direction:-1});
|
184
185
|
}
|
185
186
|
});
|
186
187
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.0.
|
5
|
+
version: 0.0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Colin MacKenzie IV
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-21 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- .gitignore
|
181
181
|
- .gitmodules
|
182
182
|
- .rvmrc
|
183
|
+
- CHANGELOG
|
183
184
|
- Gemfile
|
184
185
|
- LICENSE
|
185
186
|
- README.rdoc
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- builtin/shaders/basic/vertex.ejs
|
191
192
|
- builtin/shaders/depthmap/common.ejs
|
192
193
|
- builtin/shaders/depthmap/fragment.ejs
|
194
|
+
- builtin/shaders/depthmap/material.js
|
193
195
|
- builtin/shaders/depthmap/vertex.ejs
|
194
196
|
- builtin/shaders/fog/common.ejs
|
195
197
|
- builtin/shaders/fog/fragment.ejs
|
@@ -198,6 +200,7 @@ files:
|
|
198
200
|
- builtin/shaders/fog/vertex.ejs
|
199
201
|
- builtin/shaders/functions/depth_map.ejs
|
200
202
|
- builtin/shaders/functions/lights.ejs
|
203
|
+
- builtin/shaders/functions/noise.ejs
|
201
204
|
- builtin/shaders/lighting/common.ejs
|
202
205
|
- builtin/shaders/lighting/fragment.ejs
|
203
206
|
- builtin/shaders/lighting/manifest.yml
|
@@ -208,10 +211,11 @@ files:
|
|
208
211
|
- builtin/shaders/normal_map/manifest.yml
|
209
212
|
- builtin/shaders/normal_map/material.js
|
210
213
|
- builtin/shaders/normal_map/vertex.ejs
|
211
|
-
- builtin/shaders/paraboloid
|
212
|
-
- builtin/shaders/paraboloid
|
213
|
-
- builtin/shaders/paraboloid
|
214
|
-
- builtin/shaders/paraboloid
|
214
|
+
- builtin/shaders/paraboloid/common.ejs
|
215
|
+
- builtin/shaders/paraboloid/fragment.ejs
|
216
|
+
- builtin/shaders/paraboloid/manifest.yml
|
217
|
+
- builtin/shaders/paraboloid/material.js
|
218
|
+
- builtin/shaders/paraboloid/vertex.ejs
|
215
219
|
- builtin/shaders/shadow_map/common.ejs
|
216
220
|
- builtin/shaders/shadow_map/fragment.ejs
|
217
221
|
- builtin/shaders/shadow_map/manifest.yml
|
@@ -424,9 +428,11 @@ files:
|
|
424
428
|
- spec/example_app/app/controllers/application_controller.js
|
425
429
|
- spec/example_app/app/controllers/courthouse_controller.js
|
426
430
|
- spec/example_app/app/controllers/lighting_controller.js
|
431
|
+
- spec/example_app/app/controllers/noise_controller.js
|
427
432
|
- spec/example_app/app/controllers/shadows_controller.js
|
428
433
|
- spec/example_app/app/controllers/textures_controller.js
|
429
434
|
- spec/example_app/app/helpers/application_helper.js
|
435
|
+
- spec/example_app/app/helpers/noise_helper.js
|
430
436
|
- spec/example_app/app/helpers/textures_helper.js
|
431
437
|
- spec/example_app/app/models/character.js
|
432
438
|
- spec/example_app/app/models/door.js
|
@@ -438,11 +444,18 @@ files:
|
|
438
444
|
- spec/example_app/app/resources/light_sources/spot_light.yml
|
439
445
|
- spec/example_app/app/resources/light_sources/sun.yml
|
440
446
|
- spec/example_app/app/resources/light_sources/textures_point.yml
|
447
|
+
- spec/example_app/app/resources/materials/blob.yml
|
441
448
|
- spec/example_app/app/resources/materials/bricks.yml
|
442
449
|
- spec/example_app/app/resources/materials/lighting_with_shadows.yml
|
443
450
|
- spec/example_app/app/resources/scenes/courthouse.yml
|
451
|
+
- spec/example_app/app/shaders/blob/common.ejs
|
452
|
+
- spec/example_app/app/shaders/blob/fragment.ejs
|
453
|
+
- spec/example_app/app/shaders/blob/manifest.yml
|
454
|
+
- spec/example_app/app/shaders/blob/material.js
|
455
|
+
- spec/example_app/app/shaders/blob/vertex.ejs
|
444
456
|
- spec/example_app/app/views/courthouse/index.js
|
445
457
|
- spec/example_app/app/views/lighting/index.js
|
458
|
+
- spec/example_app/app/views/noise/index.js
|
446
459
|
- spec/example_app/app/views/shadows/index.js
|
447
460
|
- spec/example_app/app/views/textures/index.js
|
448
461
|
- spec/example_app/config/application.rb
|
@@ -455,11 +468,14 @@ files:
|
|
455
468
|
- spec/example_app/public/images/rss.png
|
456
469
|
- spec/example_app/public/webgl_not_supported.html
|
457
470
|
- spec/example_app/script/jax
|
471
|
+
- spec/example_app/spec/javascripts/controllers/noise_controller_spec.js
|
458
472
|
- spec/example_app/spec/javascripts/controllers/textures_controller_spec.js
|
459
473
|
- spec/example_app/spec/javascripts/helpers/application_helper_spec.js
|
474
|
+
- spec/example_app/spec/javascripts/helpers/noise_helper_spec.js
|
460
475
|
- spec/example_app/spec/javascripts/resources/directional_light_spec.js
|
461
476
|
- spec/example_app/spec/javascripts/resources/point_light_spec.js
|
462
477
|
- spec/example_app/spec/javascripts/resources/spot_light_spec.js
|
478
|
+
- spec/example_app/spec/javascripts/shaders/blob_spec.js
|
463
479
|
- spec/example_app/spec/javascripts/support/jasmine.yml
|
464
480
|
- spec/example_app/spec/javascripts/support/jasmine_runner.rb
|
465
481
|
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
@@ -469,7 +485,6 @@ files:
|
|
469
485
|
- spec/generators/light_generator_spec.rb
|
470
486
|
- spec/generators/material_generator_spec.rb
|
471
487
|
- spec/generators/model_generator_spec.rb
|
472
|
-
- spec/javascripts/Player.js
|
473
488
|
- spec/javascripts/helpers/SpecHelper.js
|
474
489
|
- spec/javascripts/jax/builtin/meshes/cube_spec.js
|
475
490
|
- spec/javascripts/jax/builtin/meshes/plane_spec.js
|
@@ -505,10 +520,10 @@ files:
|
|
505
520
|
- spec/javascripts/jax/world_spec.js
|
506
521
|
- spec/javascripts/jax_spec.js
|
507
522
|
- spec/javascripts/shaders/core_materials_spec.js
|
508
|
-
- spec/javascripts/shaders/dual_paraboloid_spec.js
|
509
523
|
- spec/javascripts/shaders/fog_spec.js
|
510
524
|
- spec/javascripts/shaders/lighting_spec.js
|
511
525
|
- spec/javascripts/shaders/normal_map_spec.js
|
526
|
+
- spec/javascripts/shaders/paraboloid_spec.js
|
512
527
|
- spec/javascripts/shaders/shadow_map_spec.js
|
513
528
|
- spec/javascripts/shaders/texture_spec.js
|
514
529
|
- spec/javascripts/support/jasmine.yml
|
@@ -519,6 +534,8 @@ files:
|
|
519
534
|
- spec/spec_helper.rb
|
520
535
|
- spec/support/file_exist_matcher.rb
|
521
536
|
- spec/support/spec_shell.rb
|
537
|
+
- src/constants.yml
|
538
|
+
- src/constants.yml.erb
|
522
539
|
- src/jax.js
|
523
540
|
- src/jax/anim_frame.js
|
524
541
|
- src/jax/builtin/all.js
|
@@ -540,6 +557,7 @@ files:
|
|
540
557
|
- src/jax/geometry/plane.js
|
541
558
|
- src/jax/helper.js
|
542
559
|
- src/jax/model.js
|
560
|
+
- src/jax/noise.js
|
543
561
|
- src/jax/prototype/class.js
|
544
562
|
- src/jax/prototype/core.js
|
545
563
|
- src/jax/prototype/extensions.js
|
@@ -658,7 +676,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
658
676
|
requirements:
|
659
677
|
- - ">="
|
660
678
|
- !ruby/object:Gem::Version
|
661
|
-
hash:
|
679
|
+
hash: -852676475953651161
|
662
680
|
segments:
|
663
681
|
- 0
|
664
682
|
version: "0"
|
@@ -667,7 +685,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
667
685
|
requirements:
|
668
686
|
- - ">="
|
669
687
|
- !ruby/object:Gem::Version
|
670
|
-
hash:
|
688
|
+
hash: -852676475953651161
|
671
689
|
segments:
|
672
690
|
- 0
|
673
691
|
version: "0"
|
@@ -684,9 +702,11 @@ test_files:
|
|
684
702
|
- spec/example_app/app/controllers/application_controller.js
|
685
703
|
- spec/example_app/app/controllers/courthouse_controller.js
|
686
704
|
- spec/example_app/app/controllers/lighting_controller.js
|
705
|
+
- spec/example_app/app/controllers/noise_controller.js
|
687
706
|
- spec/example_app/app/controllers/shadows_controller.js
|
688
707
|
- spec/example_app/app/controllers/textures_controller.js
|
689
708
|
- spec/example_app/app/helpers/application_helper.js
|
709
|
+
- spec/example_app/app/helpers/noise_helper.js
|
690
710
|
- spec/example_app/app/helpers/textures_helper.js
|
691
711
|
- spec/example_app/app/models/character.js
|
692
712
|
- spec/example_app/app/models/door.js
|
@@ -698,11 +718,18 @@ test_files:
|
|
698
718
|
- spec/example_app/app/resources/light_sources/spot_light.yml
|
699
719
|
- spec/example_app/app/resources/light_sources/sun.yml
|
700
720
|
- spec/example_app/app/resources/light_sources/textures_point.yml
|
721
|
+
- spec/example_app/app/resources/materials/blob.yml
|
701
722
|
- spec/example_app/app/resources/materials/bricks.yml
|
702
723
|
- spec/example_app/app/resources/materials/lighting_with_shadows.yml
|
703
724
|
- spec/example_app/app/resources/scenes/courthouse.yml
|
725
|
+
- spec/example_app/app/shaders/blob/common.ejs
|
726
|
+
- spec/example_app/app/shaders/blob/fragment.ejs
|
727
|
+
- spec/example_app/app/shaders/blob/manifest.yml
|
728
|
+
- spec/example_app/app/shaders/blob/material.js
|
729
|
+
- spec/example_app/app/shaders/blob/vertex.ejs
|
704
730
|
- spec/example_app/app/views/courthouse/index.js
|
705
731
|
- spec/example_app/app/views/lighting/index.js
|
732
|
+
- spec/example_app/app/views/noise/index.js
|
706
733
|
- spec/example_app/app/views/shadows/index.js
|
707
734
|
- spec/example_app/app/views/textures/index.js
|
708
735
|
- spec/example_app/config/application.rb
|
@@ -715,11 +742,14 @@ test_files:
|
|
715
742
|
- spec/example_app/public/images/rss.png
|
716
743
|
- spec/example_app/public/webgl_not_supported.html
|
717
744
|
- spec/example_app/script/jax
|
745
|
+
- spec/example_app/spec/javascripts/controllers/noise_controller_spec.js
|
718
746
|
- spec/example_app/spec/javascripts/controllers/textures_controller_spec.js
|
719
747
|
- spec/example_app/spec/javascripts/helpers/application_helper_spec.js
|
748
|
+
- spec/example_app/spec/javascripts/helpers/noise_helper_spec.js
|
720
749
|
- spec/example_app/spec/javascripts/resources/directional_light_spec.js
|
721
750
|
- spec/example_app/spec/javascripts/resources/point_light_spec.js
|
722
751
|
- spec/example_app/spec/javascripts/resources/spot_light_spec.js
|
752
|
+
- spec/example_app/spec/javascripts/shaders/blob_spec.js
|
723
753
|
- spec/example_app/spec/javascripts/support/jasmine.yml
|
724
754
|
- spec/example_app/spec/javascripts/support/jasmine_runner.rb
|
725
755
|
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
@@ -729,7 +759,6 @@ test_files:
|
|
729
759
|
- spec/generators/light_generator_spec.rb
|
730
760
|
- spec/generators/material_generator_spec.rb
|
731
761
|
- spec/generators/model_generator_spec.rb
|
732
|
-
- spec/javascripts/Player.js
|
733
762
|
- spec/javascripts/helpers/SpecHelper.js
|
734
763
|
- spec/javascripts/jax/builtin/meshes/cube_spec.js
|
735
764
|
- spec/javascripts/jax/builtin/meshes/plane_spec.js
|
@@ -765,10 +794,10 @@ test_files:
|
|
765
794
|
- spec/javascripts/jax/world_spec.js
|
766
795
|
- spec/javascripts/jax_spec.js
|
767
796
|
- spec/javascripts/shaders/core_materials_spec.js
|
768
|
-
- spec/javascripts/shaders/dual_paraboloid_spec.js
|
769
797
|
- spec/javascripts/shaders/fog_spec.js
|
770
798
|
- spec/javascripts/shaders/lighting_spec.js
|
771
799
|
- spec/javascripts/shaders/normal_map_spec.js
|
800
|
+
- spec/javascripts/shaders/paraboloid_spec.js
|
772
801
|
- spec/javascripts/shaders/shadow_map_spec.js
|
773
802
|
- spec/javascripts/shaders/texture_spec.js
|
774
803
|
- spec/javascripts/support/jasmine.yml
|
data/spec/javascripts/Player.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
describe("Player", function() {
|
2
|
-
var player;
|
3
|
-
var song;
|
4
|
-
|
5
|
-
beforeEach(function() {
|
6
|
-
player = new Player();
|
7
|
-
song = new Song();
|
8
|
-
});
|
9
|
-
|
10
|
-
it("should be able to play a Song", function() {
|
11
|
-
player.play(song);
|
12
|
-
expect(player.currentlyPlayingSong).toEqual(song);
|
13
|
-
|
14
|
-
//demonstrates use of custom matcher
|
15
|
-
expect(player).toBePlaying(song);
|
16
|
-
});
|
17
|
-
|
18
|
-
describe("when song has been paused", function() {
|
19
|
-
beforeEach(function() {
|
20
|
-
player.play(song);
|
21
|
-
player.pause();
|
22
|
-
});
|
23
|
-
|
24
|
-
it("should indicate that the song is currently paused", function() {
|
25
|
-
expect(player.isPlaying).toBeFalsy();
|
26
|
-
|
27
|
-
// demonstrates use of 'not' with a custom matcher
|
28
|
-
expect(player).not.toBePlaying(song);
|
29
|
-
});
|
30
|
-
|
31
|
-
it("should be possible to resume", function() {
|
32
|
-
player.resume();
|
33
|
-
expect(player.isPlaying).toBeTruthy();
|
34
|
-
expect(player.currentlyPlayingSong).toEqual(song);
|
35
|
-
});
|
36
|
-
});
|
37
|
-
|
38
|
-
// demonstrates use of spies to intercept and test method calls
|
39
|
-
it("tells the current song if the user has made it a favorite", function() {
|
40
|
-
spyOn(song, 'persistFavoriteStatus');
|
41
|
-
|
42
|
-
player.play(song);
|
43
|
-
player.makeFavorite();
|
44
|
-
|
45
|
-
expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
|
46
|
-
});
|
47
|
-
|
48
|
-
//demonstrates use of expected exceptions
|
49
|
-
describe("#resume", function() {
|
50
|
-
it("should throw an exception if song is already playing", function() {
|
51
|
-
player.play(song);
|
52
|
-
|
53
|
-
expect(function() {
|
54
|
-
player.resume();
|
55
|
-
}).toThrow("song is already playing");
|
56
|
-
});
|
57
|
-
});
|
58
|
-
});
|