jax 0.0.0.8 → 0.0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +22 -0
- data/Rakefile +2 -1
- data/builtin/shaders/functions/noise.ejs +0 -3
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +31 -3
- data/guides/jax_guides/common.rb +1 -1
- data/guides/source/index.html.erb +4 -4
- data/guides/source/shaders.textile +496 -2
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +130 -94
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +33 -0
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb +1 -13
- data/lib/jax/generators/shader/templates/fragment.ejs.tt +2 -3
- data/lib/jax/generators/shader/templates/spec.js.tt +4 -11
- data/lib/jax/routes.rb +0 -3
- data/lib/jax/tasks/rake.rb +4 -0
- data/lib/jax/version.rb +1 -1
- data/spec/example_app/app/shaders/blob/vertex.ejs +2 -0
- data/spec/example_app/spec/javascripts/shaders/blob_spec.js +5 -8
- data/spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +33 -0
- data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +1 -13
- data/spec/generators/app_generator_spec.rb +1 -0
- data/spec/javascripts/helpers/jax_spec_environment_helper.js +33 -0
- data/spec/javascripts/helpers/{SpecHelper.js → jax_spec_helper.js} +0 -0
- data/spec/javascripts/jax/core/utils_spec.js +21 -2
- data/spec/lib/jax/tasks/jax_rake_spec.rb +13 -0
- data/src/jax/context.js +1 -1
- data/src/jax/core/util.js +12 -5
- data/src/jax/mvc/model.js +1 -0
- data/src/jax/webgl/scene/light_manager.js +58 -45
- data/src/jax/webgl/scene/light_source.js +49 -4
- data/src/jax/webgl/world.js +12 -46
- metadata +11 -6
data/src/jax/webgl/world.js
CHANGED
@@ -41,7 +41,12 @@ Jax.World = (function() {
|
|
41
41
|
* Adds the model to the world and then returns the model itself unchanged.
|
42
42
|
*
|
43
43
|
**/
|
44
|
-
addObject: function(object) {
|
44
|
+
addObject: function(object) {
|
45
|
+
this.objects.push(object);
|
46
|
+
if (object.isLit() || object.isShadowCaster())
|
47
|
+
this.lighting.addObject(object);
|
48
|
+
return object;
|
49
|
+
},
|
45
50
|
|
46
51
|
/**
|
47
52
|
* Jax.World#getObject(index) -> Jax.Model
|
@@ -62,7 +67,7 @@ Jax.World = (function() {
|
|
62
67
|
if (this.objects[object_or_index]) {
|
63
68
|
var obj = this.objects[object_or_index];
|
64
69
|
this.objects.splice(object_or_index, 1);
|
65
|
-
this.
|
70
|
+
this.lighting.removeObject(obj);
|
66
71
|
return obj;
|
67
72
|
}
|
68
73
|
else
|
@@ -70,7 +75,7 @@ Jax.World = (function() {
|
|
70
75
|
if (this.objects[i] == object_or_index)
|
71
76
|
{
|
72
77
|
this.objects.splice(i, 1);
|
73
|
-
this.
|
78
|
+
this.lighting.removeObject(this.objects[i]);
|
74
79
|
return this.objects[i];
|
75
80
|
}
|
76
81
|
},
|
@@ -183,32 +188,7 @@ Jax.World = (function() {
|
|
183
188
|
return this.objects.length;
|
184
189
|
},
|
185
190
|
|
186
|
-
|
187
|
-
while (this.shadow_casters.length > 0) {
|
188
|
-
/* TODO we still need to unregister the camera event listener */
|
189
|
-
this.shadow_casters.pop();
|
190
|
-
}
|
191
|
-
|
192
|
-
var updated = function() { self.shadowmaps_valid = false; };
|
193
|
-
|
194
|
-
var i;
|
195
|
-
for (i = 0; i < this.objects.length; i++) {
|
196
|
-
var self = this;
|
197
|
-
if (this.objects[i].isShadowCaster()) {
|
198
|
-
this.objects[i].camera.addEventListener('matrixUpdated', updated);
|
199
|
-
this.shadow_casters.push(this.objects[i]);
|
200
|
-
}
|
201
|
-
}
|
202
|
-
|
203
|
-
for (i = 0; i < this.lighting.count(); i++) {
|
204
|
-
var light = this.lighting.getLight(i);
|
205
|
-
if (light.isShadowcaster())
|
206
|
-
light.camera.addEventListener('matrixUpdated', updated);
|
207
|
-
}
|
208
|
-
this.shadowmaps_valid = false;
|
209
|
-
},
|
210
|
-
|
211
|
-
getShadowCasters: function() { return this.shadow_casters; },
|
191
|
+
getShadowCasters: function() { return this.lighting.getShadowCasters(); },//return this.shadow_casters; },
|
212
192
|
|
213
193
|
render: function(options) {
|
214
194
|
var i;
|
@@ -220,30 +200,16 @@ Jax.World = (function() {
|
|
220
200
|
var unlit = Jax.Util.normalizeOptions(options, {unlit:true});
|
221
201
|
|
222
202
|
if (this.lighting.isEnabled() && (!unlit.material || unlit.material.supportsLighting())) {
|
223
|
-
/* ambient pass */
|
224
|
-
/*
|
225
|
-
So.... I see a legit need for an ambient pass for A) unlit objects and B)
|
226
|
-
scene lighting. But jax doesn't yet support scene lighting so really only
|
227
|
-
unlit objects need an ambient pass. For lit objects, why not let
|
228
|
-
lighting take care of (ambient + diffuse + specular) all at once?
|
229
|
-
*/
|
203
|
+
/* ambient pass - unlit objects only because lit objects get ambient+diffuse+specular in one pass */
|
230
204
|
for (i = 0; i < this.objects.length; i++)
|
231
|
-
if (!this.objects[i].
|
205
|
+
if (!this.objects[i].isLit()) {
|
232
206
|
unlit.model_index = i;
|
233
207
|
this.objects[i].render(this.context, unlit);
|
234
208
|
}
|
235
|
-
// this.lighting.ambient(this.context, this.objects);
|
236
209
|
|
237
|
-
/* shadowgen pass */
|
238
|
-
this.context.current_pass = Jax.Scene.SHADOWMAP_PASS;
|
239
|
-
if (!this.shadowmaps_valid) {
|
240
|
-
this.lighting.updateShadowMaps(this.context, this.shadow_casters);
|
241
|
-
this.shadowmaps_valid = true;
|
242
|
-
}
|
243
|
-
|
244
210
|
/* illumination pass */
|
245
211
|
this.context.current_pass = Jax.Scene.ILLUMINATION_PASS;
|
246
|
-
this.lighting.illuminate(this.context,
|
212
|
+
this.lighting.illuminate(this.context, options);
|
247
213
|
} else {
|
248
214
|
for (i = 0; i < this.objects.length; i++) {
|
249
215
|
unlit.model_index = i;
|
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.9
|
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-
|
13
|
+
date: 2011-06-02 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -381,6 +381,7 @@ files:
|
|
381
381
|
- lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml
|
382
382
|
- lib/jax/generators/app/templates/spec/javascripts/support/jasmine_config.rb
|
383
383
|
- lib/jax/generators/app/templates/spec/javascripts/support/jasmine_runner.rb
|
384
|
+
- lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js
|
384
385
|
- lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
385
386
|
- lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb
|
386
387
|
- lib/jax/generators/commands.rb
|
@@ -491,6 +492,7 @@ files:
|
|
491
492
|
- spec/example_app/spec/javascripts/shaders/blob_spec.js
|
492
493
|
- spec/example_app/spec/javascripts/support/jasmine.yml
|
493
494
|
- spec/example_app/spec/javascripts/support/jasmine_runner.rb
|
495
|
+
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js
|
494
496
|
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
495
497
|
- spec/example_app/spec/javascripts/support/spec_layout.html.erb
|
496
498
|
- spec/generators/app_generator_spec.rb
|
@@ -498,7 +500,8 @@ files:
|
|
498
500
|
- spec/generators/light_generator_spec.rb
|
499
501
|
- spec/generators/material_generator_spec.rb
|
500
502
|
- spec/generators/model_generator_spec.rb
|
501
|
-
- spec/javascripts/helpers/
|
503
|
+
- spec/javascripts/helpers/jax_spec_environment_helper.js
|
504
|
+
- spec/javascripts/helpers/jax_spec_helper.js
|
502
505
|
- spec/javascripts/jax/builtin/meshes/cube_spec.js
|
503
506
|
- spec/javascripts/jax/builtin/meshes/plane_spec.js
|
504
507
|
- spec/javascripts/jax/builtin/meshes/quad_spec.js
|
@@ -741,7 +744,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
741
744
|
requirements:
|
742
745
|
- - ">="
|
743
746
|
- !ruby/object:Gem::Version
|
744
|
-
hash:
|
747
|
+
hash: -4302524360687155854
|
745
748
|
segments:
|
746
749
|
- 0
|
747
750
|
version: "0"
|
@@ -750,7 +753,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
750
753
|
requirements:
|
751
754
|
- - ">="
|
752
755
|
- !ruby/object:Gem::Version
|
753
|
-
hash:
|
756
|
+
hash: -4302524360687155854
|
754
757
|
segments:
|
755
758
|
- 0
|
756
759
|
version: "0"
|
@@ -825,6 +828,7 @@ test_files:
|
|
825
828
|
- spec/example_app/spec/javascripts/shaders/blob_spec.js
|
826
829
|
- spec/example_app/spec/javascripts/support/jasmine.yml
|
827
830
|
- spec/example_app/spec/javascripts/support/jasmine_runner.rb
|
831
|
+
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js
|
828
832
|
- spec/example_app/spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
829
833
|
- spec/example_app/spec/javascripts/support/spec_layout.html.erb
|
830
834
|
- spec/generators/app_generator_spec.rb
|
@@ -832,7 +836,8 @@ test_files:
|
|
832
836
|
- spec/generators/light_generator_spec.rb
|
833
837
|
- spec/generators/material_generator_spec.rb
|
834
838
|
- spec/generators/model_generator_spec.rb
|
835
|
-
- spec/javascripts/helpers/
|
839
|
+
- spec/javascripts/helpers/jax_spec_environment_helper.js
|
840
|
+
- spec/javascripts/helpers/jax_spec_helper.js
|
836
841
|
- spec/javascripts/jax/builtin/meshes/cube_spec.js
|
837
842
|
- spec/javascripts/jax/builtin/meshes/plane_spec.js
|
838
843
|
- spec/javascripts/jax/builtin/meshes/quad_spec.js
|