diff options
Diffstat (limited to 'js/models/materials-model.js')
-rwxr-xr-x | js/models/materials-model.js | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/js/models/materials-model.js b/js/models/materials-model.js index 244db3c5..1fd52721 100755 --- a/js/models/materials-model.js +++ b/js/models/materials-model.js | |||
@@ -69,37 +69,37 @@ exports.MaterialsModel = Montage.create(Component, { | |||
69 | value: false | 69 | value: false |
70 | }, | 70 | }, |
71 | 71 | ||
72 | deserializedFromTemplate: { | 72 | deserializedFromTemplate: { |
73 | value: function() { | 73 | value: function() { |
74 | // Load all the materials | 74 | // Load all the materials |
75 | this.addMaterial(new FlatMaterial()); | 75 | this.addMaterial(new FlatMaterial()); |
76 | this.addMaterial(new BumpMetalMaterial()); | 76 | this.addMaterial(new BumpMetalMaterial()); |
77 | //this.addMaterial(new CloudMaterial()); | 77 | //this.addMaterial(new CloudMaterial()); |
78 | this.addMaterial(new DeformMaterial()); | 78 | this.addMaterial(new DeformMaterial()); |
79 | this.addMaterial(new FlagMaterial()); | 79 | this.addMaterial(new FlagMaterial()); |
80 | this.addMaterial(new FlyMaterial()); | 80 | this.addMaterial(new FlyMaterial()); |
81 | this.addMaterial(new JuliaMaterial()); | 81 | this.addMaterial(new JuliaMaterial()); |
82 | this.addMaterial(new KeleidoscopeMaterial()); | 82 | this.addMaterial(new KeleidoscopeMaterial()); |
83 | this.addMaterial(new LinearGradientMaterial()); | 83 | this.addMaterial(new LinearGradientMaterial()); |
84 | this.addMaterial(new MandelMaterial()); | 84 | this.addMaterial(new MandelMaterial()); |
85 | this.addMaterial(new ParisMaterial()); | 85 | this.addMaterial(new ParisMaterial()); |
86 | this.addMaterial(new PlasmaMaterial()); | 86 | this.addMaterial(new PlasmaMaterial()); |
87 | this.addMaterial(new PulseMaterial()); | 87 | this.addMaterial(new PulseMaterial()); |
88 | this.addMaterial(new RadialBlurMaterial()); | 88 | this.addMaterial(new RadialBlurMaterial()); |
89 | this.addMaterial(new RadialGradientMaterial()); | 89 | this.addMaterial(new RadialGradientMaterial()); |
90 | this.addMaterial(new RaidersMaterial()); | 90 | this.addMaterial(new RaidersMaterial()); |
91 | this.addMaterial(new ReliefTunnelMaterial()); | 91 | this.addMaterial(new ReliefTunnelMaterial()); |
92 | this.addMaterial(new SquareTunnelMaterial()); | 92 | this.addMaterial(new SquareTunnelMaterial()); |
93 | this.addMaterial(new StarMaterial()); | 93 | this.addMaterial(new StarMaterial()); |
94 | this.addMaterial(new TaperMaterial()); | 94 | this.addMaterial(new TaperMaterial()); |
95 | this.addMaterial(new TunnelMaterial()); | 95 | this.addMaterial(new TunnelMaterial()); |
96 | this.addMaterial(new TwistMaterial()); | 96 | this.addMaterial(new TwistMaterial()); |
97 | this.addMaterial(new TwistVertMaterial()); | 97 | this.addMaterial(new TwistVertMaterial()); |
98 | this.addMaterial(new UberMaterial()); | 98 | this.addMaterial(new UberMaterial()); |
99 | this.addMaterial(new WaterMaterial()); | 99 | this.addMaterial(new WaterMaterial()); |
100 | this.addMaterial(new ZInvertMaterial()); | 100 | this.addMaterial(new ZInvertMaterial()); |
101 | } | 101 | } |
102 | }, | 102 | }, |
103 | 103 | ||
104 | _materials : { | 104 | _materials : { |
105 | value: AppModel.materials | 105 | value: AppModel.materials |
@@ -152,16 +152,16 @@ exports.MaterialsModel = Montage.create(Component, { | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | }, | 154 | }, |
155 | 155 | ||
156 | getMaterialByShader: | 156 | getMaterialByShader: |
157 | { | 157 | { |
158 | value: function( shaderName ) | 158 | value: function( shaderName ) |
159 | { | 159 | { |
160 | var index = this.getIndexOfMaterialByShader( shaderName ); | 160 | var index = this.getIndexOfMaterialByShader( shaderName ); |
161 | if (index >= 0) | 161 | if (index >= 0) |
162 | return this._materials[index]; | 162 | return this._materials[index]; |
163 | } | 163 | } |
164 | }, | 164 | }, |
165 | 165 | ||
166 | getIndexOfMaterialByShader: { | 166 | getIndexOfMaterialByShader: { |
167 | value: function (shaderName) { | 167 | value: function (shaderName) { |
@@ -191,11 +191,11 @@ exports.MaterialsModel = Montage.create(Component, { | |||
191 | } | 191 | } |
192 | }, | 192 | }, |
193 | 193 | ||
194 | clearAllMaterials: { | 194 | clearAllMaterials: { |
195 | value: function() { | 195 | value: function() { |
196 | this._materials = []; | 196 | this._materials = []; |
197 | } | 197 | } |
198 | }, | 198 | }, |
199 | 199 | ||
200 | exportFlatMaterial: { | 200 | exportFlatMaterial: { |
201 | value: function() { | 201 | value: function() { |
@@ -203,25 +203,25 @@ exports.MaterialsModel = Montage.create(Component, { | |||
203 | } | 203 | } |
204 | }, | 204 | }, |
205 | 205 | ||
206 | getDefaultMaterialName: { | 206 | getDefaultMaterialName: { |
207 | value: function() { | 207 | value: function() { |
208 | return "Flat"; | 208 | return "Flat"; |
209 | } | 209 | } |
210 | }, | 210 | }, |
211 | 211 | ||
212 | exportMaterials: { | 212 | exportMaterials: { |
213 | value: function() | 213 | value: function() |
214 | { | 214 | { |
215 | var matArray = []; | 215 | var matArray = []; |
216 | var nMats = this._materials.length; | 216 | var nMats = this._materials.length; |
217 | for (var i=0; i<nMats; i++) { | 217 | for (var i=0; i<nMats; i++) { |
218 | var material = this._materials[i]; | 218 | var material = this._materials[i]; |
219 | var matObj = material.exportJSON(); | 219 | var matObj = material.exportJSON(); |
220 | matArray.push( matObj ); | 220 | matArray.push( matObj ); |
221 | } | 221 | } |
222 | 222 | ||
223 | var jObj = | 223 | var jObj = |
224 | { | 224 | { |
225 | 'materialLibrary': 1.0, | 225 | 'materialLibrary': 1.0, |
226 | 'materials': matArray | 226 | 'materials': matArray |
227 | }; | 227 | }; |
@@ -230,81 +230,81 @@ exports.MaterialsModel = Montage.create(Component, { | |||
230 | // material model is loaded. | 230 | // material model is loaded. |
231 | var jStr = "materialLibrary;" + JSON.stringify( jObj ); | 231 | var jStr = "materialLibrary;" + JSON.stringify( jObj ); |
232 | 232 | ||
233 | return jStr; | 233 | return jStr; |
234 | } | 234 | } |
235 | }, | 235 | }, |
236 | 236 | ||
237 | createMaterialByShaderName: | 237 | createMaterialByShaderName: |
238 | { | 238 | { |
239 | value: function(shaderName) | 239 | value: function(shaderName) |
240 | { | 240 | { |
241 | var mat; | 241 | var mat; |
242 | switch (shaderName) | 242 | switch (shaderName) |
243 | { | 243 | { |
244 | case "flat": mat = new FlatMaterial(); break; | 244 | case "flat": mat = new FlatMaterial(); break; |
245 | case "linearGradient": mat = new LinearGradientMaterial(); break; | 245 | case "linearGradient": mat = new LinearGradientMaterial(); break; |
246 | case "radialGradient": mat = new RadialGradientMaterial(); break; | 246 | case "radialGradient": mat = new RadialGradientMaterial(); break; |
247 | case "bumpMetal": mat = new BumpMetalMaterial(); break; | 247 | case "bumpMetal": mat = new BumpMetalMaterial(); break; |
248 | case "uber": mat = new UberMaterial(); break; | 248 | case "uber": mat = new UberMaterial(); break; |
249 | //case "cloud": mat = new CloudMaterial(); break; | 249 | //case "cloud": mat = new CloudMaterial(); break; |
250 | 250 | ||
251 | case "taper": mat = new TaperMaterial(); break; | 251 | case "taper": mat = new TaperMaterial(); break; |
252 | case "twistVert": mat = new TwistVertMaterial(); break; | 252 | case "twistVert": mat = new TwistVertMaterial(); break; |
253 | case "radialBlur": mat = new RadialBlurMaterial(); break; | 253 | case "radialBlur": mat = new RadialBlurMaterial(); break; |
254 | case "plasma": mat = new PlasmaMaterial(); break; | 254 | case "plasma": mat = new PlasmaMaterial(); break; |
255 | case "pulse": mat = new PulseMaterial(); break; | 255 | case "pulse": mat = new PulseMaterial(); break; |
256 | case "tunnel": mat = new TunnelMaterial(); break; | 256 | case "tunnel": mat = new TunnelMaterial(); break; |
257 | case "reliefTunnel": mat = new ReliefTunnelMaterial(); break; | 257 | case "reliefTunnel": mat = new ReliefTunnelMaterial(); break; |
258 | case "squareTunnel": mat = new SquareTunnelMaterial(); break; | 258 | case "squareTunnel": mat = new SquareTunnelMaterial(); break; |
259 | case "flag": mat = new FlagMaterial(); break; | 259 | case "flag": mat = new FlagMaterial(); break; |
260 | case "fly": mat = new FlyMaterial(); break; | 260 | case "fly": mat = new FlyMaterial(); break; |
261 | case "water": mat = new WaterMaterial(); break; | 261 | case "water": mat = new WaterMaterial(); break; |
262 | case "paris": mat = new ParisMaterial(); break; | 262 | case "paris": mat = new ParisMaterial(); break; |
263 | case "raiders": mat = new RaidersMaterial(); break; | 263 | case "raiders": mat = new RaidersMaterial(); break; |
264 | case "zinvert": mat = new ZInvertMaterial(); break; | 264 | case "zinvert": mat = new ZInvertMaterial(); break; |
265 | case "deform": mat = new DeformMaterial(); break; | 265 | case "deform": mat = new DeformMaterial(); break; |
266 | case "star": mat = new StarMaterial(); break; | 266 | case "star": mat = new StarMaterial(); break; |
267 | case "twist": mat = new TwistMaterial(); break; | 267 | case "twist": mat = new TwistMaterial(); break; |
268 | case "julia": mat = new JuliaMaterial(); break; | 268 | case "julia": mat = new JuliaMaterial(); break; |
269 | case "keleidoscope": mat = new KeleidoscopeMaterial(); break; | 269 | case "keleidoscope": mat = new KeleidoscopeMaterial(); break; |
270 | case "mandel": mat = new MandelMaterial(); break; | 270 | case "mandel": mat = new MandelMaterial(); break; |
271 | 271 | ||
272 | 272 | ||
273 | default: | 273 | default: |
274 | console.log( "Unrecognized shader name: " + shaderName ); | 274 | console.log( "Unrecognized shader name: " + shaderName ); |
275 | break; | 275 | break; |
276 |