diff options
author | Ananya Sen | 2012-06-19 11:00:49 -0700 |
---|---|---|
committer | Ananya Sen | 2012-06-19 11:00:49 -0700 |
commit | f1d8401aeb84e0eb0680caf72878dae26fd78a37 (patch) | |
tree | 31771ccaf3d1e2ddf01fa9605438d20be0d155d7 /js/models | |
parent | 9ea2610cec6569e7b7d5268b6c65bbf94c4753e5 (diff) | |
parent | 483ad57efcd6475776f580c3af5b60e6deeaf781 (diff) | |
download | ninja-f1d8401aeb84e0eb0680caf72878dae26fd78a37.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Diffstat (limited to 'js/models')
-rwxr-xr-x | js/models/color-model.js | 14 | ||||
-rwxr-xr-x | js/models/materials-model.js | 151 |
2 files changed, 92 insertions, 73 deletions
diff --git a/js/models/color-model.js b/js/models/color-model.js index 764feeb5..a2eab2e1 100755 --- a/js/models/color-model.js +++ b/js/models/color-model.js | |||
@@ -231,10 +231,10 @@ exports.ColorModel = Montage.create(Component, { | |||
231 | // | 231 | // |
232 | applyNoColor: { | 232 | applyNoColor: { |
233 | enumerable: true, | 233 | enumerable: true, |
234 | value: function () { | 234 | value: function (code) { |
235 | // | 235 | // |
236 | var nocolor = {}; | 236 | var nocolor = {}; |
237 | nocolor.wasSetByCode = true; | 237 | nocolor.wasSetByCode = code; |
238 | nocolor.type = 'change'; | 238 | nocolor.type = 'change'; |
239 | this.updateColorSelected('nocolor', nocolor); | 239 | this.updateColorSelected('nocolor', nocolor); |
240 | } | 240 | } |
@@ -310,29 +310,29 @@ exports.ColorModel = Montage.create(Component, { | |||
310 | case 'hex': | 310 | case 'hex': |
311 | switch (color.length) { | 311 | switch (color.length) { |
312 | case 1: | 312 | case 1: |
313 | this.applyNoColor(); | 313 | this.applyNoColor(false); |
314 | return; | 314 | return; |
315 | break; | 315 | break; |
316 | case 2: | 316 | case 2: |
317 | this.applyNoColor(); | 317 | this.applyNoColor(false); |
318 | return; | 318 | return; |
319 | break; | 319 | break; |
320 | case 3: | 320 | case 3: |
321 | color = color[0]+color[0]+color[1]+color[1]+color[2]+color[2]; | 321 | color = color[0]+color[0]+color[1]+color[1]+color[2]+color[2]; |
322 | break; | 322 | break; |
323 | case 4: | 323 | case 4: |
324 | this.applyNoColor(); | 324 | this.applyNoColor(false); |
325 | return; | 325 | return; |
326 | break; | 326 | break; |
327 | case 5: | 327 | case 5: |
328 | this.applyNoColor(); | 328 | this.applyNoColor(false); |
329 | return; | 329 | return; |
330 | break; | 330 | break; |
331 | case 6: | 331 | case 6: |
332 | //Nothing | 332 | //Nothing |
333 | break; | 333 | break; |
334 | default: | 334 | default: |
335 | this.applyNoColor(); | 335 | this.applyNoColor(false); |
336 | return; | 336 | return; |
337 | break; | 337 | break; |
338 | } | 338 | } |
diff --git a/js/models/materials-model.js b/js/models/materials-model.js index 44364aa2..7d9f33b4 100755 --- a/js/models/materials-model.js +++ b/js/models/materials-model.js | |||
@@ -16,12 +16,14 @@ var LinearGradientMaterial = require("js/lib/rdge/materials/linear-gradient-mate | |||
16 | var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-material").RadialGradientMaterial; | 16 | var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-material").RadialGradientMaterial; |
17 | var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial; | 17 | var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial; |
18 | var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial; | 18 | var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial; |
19 | //var CloudMaterial = require("js/lib/rdge/materials/cloud-material").CloudMaterial; | ||
19 | var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial; | 20 | var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial; |
20 | var RaidersMaterial = require("js/lib/rdge/materials/radial-blur-material").RaidersMaterial; | 21 | var RaidersMaterial = require("js/lib/rdge/materials/radial-blur-material").RaidersMaterial; |
21 | var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial; | 22 | var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial; |
22 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; | 23 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; |
23 | var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial; | 24 | var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial; |
24 | var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial; | 25 | var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial; |
26 | var FlagMaterial = require("js/lib/rdge/materials/flag-material").FlagMaterial; | ||
25 | var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial; | 27 | var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial; |
26 | var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial; | 28 | var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial; |
27 | var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial; | 29 | var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial; |
@@ -30,6 +32,8 @@ var ZInvertMaterial = require("js/lib/rdge/materials/z-invert-material").ZInvert | |||
30 | var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial; | 32 | var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial; |
31 | var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial; | 33 | var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial; |
32 | var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial; | 34 | var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial; |
35 | var TwistVertMaterial = require("js/lib/rdge/materials/twist-vert-material").TwistVertMaterial; | ||
36 | var TaperMaterial = require("js/lib/rdge/materials/taper-material").TaperMaterial; | ||
33 | var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial; | 37 | var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial; |
34 | var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial; | 38 | var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial; |
35 | var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial; | 39 | var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial; |
@@ -41,33 +45,37 @@ exports.MaterialsModel = Montage.create(Component, { | |||
41 | value: false | 45 | value: false |
42 | }, | 46 | }, |
43 | 47 | ||
44 | deserializedFromTemplate: { | 48 | deserializedFromTemplate: { |
45 | value: function() { | 49 | value: function() { |
46 | // Load all the materials | 50 | // Load all the materials |
47 | this.addMaterial(new FlatMaterial()); | 51 | this.addMaterial(new FlatMaterial()); |
48 | this.addMaterial(new LinearGradientMaterial()); | 52 | this.addMaterial(new BumpMetalMaterial()); |
49 | this.addMaterial(new RadialGradientMaterial()); | 53 | //this.addMaterial(new CloudMaterial()); |
50 | this.addMaterial(new BumpMetalMaterial()); | 54 | this.addMaterial(new DeformMaterial()); |
51 | this.addMaterial(new UberMaterial()); | 55 | this.addMaterial(new FlagMaterial()); |
52 | this.addMaterial(new RadialBlurMaterial()); | 56 | this.addMaterial(new FlyMaterial()); |
53 | this.addMaterial(new RaidersMaterial()); | 57 | this.addMaterial(new JuliaMaterial()); |
54 | this.addMaterial(new PlasmaMaterial()); | 58 | this.addMaterial(new KeleidoscopeMaterial()); |
55 | this.addMaterial(new PulseMaterial()); | 59 | this.addMaterial(new LinearGradientMaterial()); |
56 | this.addMaterial(new TunnelMaterial()); | 60 | this.addMaterial(new MandelMaterial()); |
57 | this.addMaterial(new ReliefTunnelMaterial()); | 61 | this.addMaterial(new ParisMaterial()); |
58 | this.addMaterial(new SquareTunnelMaterial()); | 62 | this.addMaterial(new PlasmaMaterial()); |
59 | this.addMaterial(new FlyMaterial()); | 63 | this.addMaterial(new PulseMaterial()); |
60 | this.addMaterial(new WaterMaterial()); | 64 | this.addMaterial(new RadialBlurMaterial()); |
61 | this.addMaterial(new ParisMaterial()); | 65 | this.addMaterial(new RadialGradientMaterial()); |
62 | this.addMaterial(new ZInvertMaterial()); | 66 | this.addMaterial(new RaidersMaterial()); |
63 | this.addMaterial(new DeformMaterial()); | 67 | this.addMaterial(new ReliefTunnelMaterial()); |
64 | this.addMaterial(new StarMaterial()); | 68 | this.addMaterial(new SquareTunnelMaterial()); |
65 | this.addMaterial(new TwistMaterial()); | 69 | this.addMaterial(new StarMaterial()); |
66 | this.addMaterial(new JuliaMaterial()); | 70 | this.addMaterial(new TaperMaterial()); |
67 | this.addMaterial(new KeleidoscopeMaterial()); | 71 | this.addMaterial(new TunnelMaterial()); |
68 | this.addMaterial(new MandelMaterial()); | 72 | this.addMaterial(new TwistMaterial()); |
69 | } | 73 | this.addMaterial(new TwistVertMaterial()); |
70 | }, | 74 | this.addMaterial(new UberMaterial()); |
75 | this.addMaterial(new WaterMaterial()); | ||
76 | this.addMaterial(new ZInvertMaterial()); | ||
77 | } | ||
78 | }, | ||
71 | 79 | ||
72 | _materials : { | 80 | _materials : { |
73 | value: AppModel.materials | 81 | value: AppModel.materials |
@@ -116,7 +124,7 @@ exports.MaterialsModel = Montage.create(Component, { | |||
116 | value: function (materialName) { | 124 | value: function (materialName) { |
117 | var index = this.getIndexOfMaterial(materialName); | 125 | var index = this.getIndexOfMaterial(materialName); |
118 | if(index !== -1) { | 126 | if(index !== -1) { |
119 | return this._materials[index].dup(); | 127 | return this._materials[index]; |
120 | } | 128 | } |
121 | } | 129 | } |
122 | }, | 130 | }, |
@@ -127,7 +135,7 @@ exports.MaterialsModel = Montage.create(Component, { | |||
127 | { | 135 | { |
128 | var index = this.getIndexOfMaterialByShader( shaderName ); | 136 | var index = this.getIndexOfMaterialByShader( shaderName ); |
129 | if (index >= 0) | 137 | if (index >= 0) |
130 | return this._materials[index].dup(); | 138 | return this._materials[index]; |
131 | } | 139 | } |
132 | }, | 140 | }, |
133 | 141 | ||
@@ -173,7 +181,7 @@ exports.MaterialsModel = Montage.create(Component, { | |||
173 | 181 | ||
174 | getDefaultMaterialName: { | 182 | getDefaultMaterialName: { |
175 | value: function() { | 183 | value: function() { |
176 | return "FlatMaterial"; | 184 | return "Flat"; |
177 | } | 185 | } |
178 | }, | 186 | }, |
179 | 187 | ||
@@ -202,6 +210,51 @@ exports.MaterialsModel = Montage.create(Component, { | |||
202 | } | 210 | } |
203 | }, | 211 | }, |
204 | 212 | ||
213 | createMaterialByShaderName: | ||
214 | { | ||
215 | value: function(shaderName) | ||
216 | { | ||
217 | var mat; | ||
218 | switch (shaderName) | ||
219 | { | ||
220 | case "flat": mat = new FlatMaterial(); break; | ||
221 | case "linearGradient": mat = new LinearGradientMaterial(); break; | ||
222 | case "radialGradient": mat = new RadialGradientMaterial(); break; | ||
223 | case "bumpMetal": mat = new BumpMetalMaterial(); break; | ||
224 | case "uber": mat = new UberMaterial(); break; | ||
225 | //case "cloud": mat = new CloudMaterial(); break; | ||
226 | |||
227 | case "taper": mat = new TaperMaterial(); break; | ||
228 | case "twistVert": mat = new TwistVertMaterial(); break; | ||
229 | case "radialBlur": mat = new RadialBlurMaterial(); break; | ||
230 | case "plasma": mat = new PlasmaMaterial(); break; | ||
231 | case "pulse": mat = new PulseMaterial(); break; | ||
232 | case "tunnel": mat = new TunnelMaterial(); break; | ||
233 | case "reliefTunnel": mat = new ReliefTunnelMaterial(); break; | ||
234 | case "squareTunnel": mat = new SquareTunnelMaterial( |