aboutsummaryrefslogtreecommitdiff
path: root/js/models/materials-model.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/models/materials-model.js')
-rwxr-xr-xjs/models/materials-model.js305
1 files changed, 153 insertions, 152 deletions
diff --git a/js/models/materials-model.js b/js/models/materials-model.js
index 244db3c5..cc3c3fa1 100755
--- a/js/models/materials-model.js
+++ b/js/models/materials-model.js
@@ -1,24 +1,25 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License.
5 4
6Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 6modification, are permitted provided that the following conditions are met:
8 7
9 - Redistributions of source code must retain the above copyright notice, 8* Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 9 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 10
12 notice, this list of conditions and the following disclaimer in the 11* Redistributions in binary form must reproduce the above copyright notice,
13 documentation and/or other materials provided with the distribution. 12 this list of conditions and the following disclaimer in the documentation
14 - Neither the name of Motorola Mobility nor the names of its contributors 13 and/or other materials provided with the distribution.
15 may be used to endorse or promote products derived from this software 14
16 without specific prior written permission. 15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
17 18
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -41,26 +42,26 @@ var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-mate
41var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial; 42var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial;
42var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial; 43var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial;
43//var CloudMaterial = require("js/lib/rdge/materials/cloud-material").CloudMaterial; 44//var CloudMaterial = require("js/lib/rdge/materials/cloud-material").CloudMaterial;
44var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial; 45//var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial;
45var RaidersMaterial = require("js/lib/rdge/materials/radial-blur-material").RaidersMaterial; 46//var RaidersMaterial = require("js/lib/rdge/materials/radial-blur-material").RaidersMaterial;
46var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial; 47var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial;
47var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; 48var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
48var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial; 49//var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial;
49var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial; 50//var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial;
50var FlagMaterial = require("js/lib/rdge/materials/flag-material").FlagMaterial; 51var FlagMaterial = require("js/lib/rdge/materials/flag-material").FlagMaterial;
51var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial; 52//var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial;
52var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial; 53//var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial;
53var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial; 54var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial;
54var ParisMaterial = require("js/lib/rdge/materials/water-material").ParisMaterial; 55var ParisMaterial = require("js/lib/rdge/materials/water-material").ParisMaterial;
55var ZInvertMaterial = require("js/lib/rdge/materials/z-invert-material").ZInvertMaterial; 56//var ZInvertMaterial = require("js/lib/rdge/materials/z-invert-material").ZInvertMaterial;
56var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial; 57//var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial;
57var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial; 58//var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial;
58var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial; 59//var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial;
59var TwistVertMaterial = require("js/lib/rdge/materials/twist-vert-material").TwistVertMaterial; 60var TwistVertMaterial = require("js/lib/rdge/materials/twist-vert-material").TwistVertMaterial;
60var TaperMaterial = require("js/lib/rdge/materials/taper-material").TaperMaterial; 61var TaperMaterial = require("js/lib/rdge/materials/taper-material").TaperMaterial;
61var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial; 62//var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial;
62var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial; 63//var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial;
63var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial; 64//var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial;
64 65
65 66
66exports.MaterialsModel = Montage.create(Component, { 67exports.MaterialsModel = Montage.create(Component, {
@@ -69,37 +70,37 @@ exports.MaterialsModel = Montage.create(Component, {
69 value: false 70 value: false
70 }, 71 },
71 72
72 deserializedFromTemplate: { 73 deserializedFromTemplate: {
73 value: function() { 74 value: function() {
74 // Load all the materials 75 // Load all the materials
75 this.addMaterial(new FlatMaterial()); 76 this.addMaterial(new FlatMaterial());
76 this.addMaterial(new BumpMetalMaterial()); 77 this.addMaterial(new BumpMetalMaterial());
77 //this.addMaterial(new CloudMaterial()); 78 //this.addMaterial(new CloudMaterial());
78 this.addMaterial(new DeformMaterial()); 79 //this.addMaterial(new DeformMaterial());
79 this.addMaterial(new FlagMaterial()); 80 this.addMaterial(new FlagMaterial());
80 this.addMaterial(new FlyMaterial()); 81 //this.addMaterial(new FlyMaterial());
81 this.addMaterial(new JuliaMaterial()); 82 //this.addMaterial(new JuliaMaterial());
82 this.addMaterial(new KeleidoscopeMaterial()); 83 //this.addMaterial(new KeleidoscopeMaterial());
83 this.addMaterial(new LinearGradientMaterial()); 84 this.addMaterial(new LinearGradientMaterial());
84 this.addMaterial(new MandelMaterial()); 85 //this.addMaterial(new MandelMaterial());
85 this.addMaterial(new ParisMaterial()); 86 this.addMaterial(new ParisMaterial());
86 this.addMaterial(new PlasmaMaterial()); 87 this.addMaterial(new PlasmaMaterial());
87 this.addMaterial(new PulseMaterial()); 88 this.addMaterial(new PulseMaterial());
88 this.addMaterial(new RadialBlurMaterial()); 89 //this.addMaterial(new RadialBlurMaterial());
89 this.addMaterial(new RadialGradientMaterial()); 90 this.addMaterial(new RadialGradientMaterial());
90 this.addMaterial(new RaidersMaterial()); 91 //this.addMaterial(new RaidersMaterial());
91 this.addMaterial(new ReliefTunnelMaterial()); 92 //this.addMaterial(new ReliefTunnelMaterial());
92 this.addMaterial(new SquareTunnelMaterial()); 93 //this.addMaterial(new SquareTunnelMaterial());
93 this.addMaterial(new StarMaterial()); 94 //this.addMaterial(new StarMaterial());
94 this.addMaterial(new TaperMaterial()); 95 this.addMaterial(new TaperMaterial());
95 this.addMaterial(new TunnelMaterial()); 96 //this.addMaterial(new TunnelMaterial());
96 this.addMaterial(new TwistMaterial()); 97 //this.addMaterial(new TwistMaterial());
97 this.addMaterial(new TwistVertMaterial()); 98 this.addMaterial(new TwistVertMaterial());
98 this.addMaterial(new UberMaterial()); 99 this.addMaterial(new UberMaterial());
99 this.addMaterial(new WaterMaterial()); 100 this.addMaterial(new WaterMaterial());
100 this.addMaterial(new ZInvertMaterial()); 101 //this.addMaterial(new ZInvertMaterial());
101 } 102 }
102 }, 103 },
103 104
104 _materials : { 105 _materials : {
105 value: AppModel.materials 106 value: AppModel.materials
@@ -110,7 +111,7 @@ exports.MaterialsModel = Montage.create(Component, {
110 return this._materials; 111 return this._materials;
111 } 112 }
112 }, 113 },
113 114
114 addMaterial: { 115 addMaterial: {
115 value: function (material) { 116 value: function (material) {
116 this._materials.push(material); 117 this._materials.push(material);
@@ -152,16 +153,16 @@ exports.MaterialsModel = Montage.create(Component, {
152 } 153 }
153 } 154 }
154 }, 155 },
155 156
156 getMaterialByShader: 157 getMaterialByShader:
157 { 158 {
158 value: function( shaderName ) 159 value: function( shaderName )
159 { 160 {
160 var index = this.getIndexOfMaterialByShader( shaderName ); 161 var index = this.getIndexOfMaterialByShader( shaderName );
161 if (index >= 0) 162 if (index >= 0)
162 return this._materials[index]; 163 return this._materials[index];
163 } 164 }
164 }, 165 },
165 166
166 getIndexOfMaterialByShader: { 167 getIndexOfMaterialByShader: {
167 value: function (shaderName) { 168 value: function (shaderName) {
@@ -191,11 +192,11 @@ exports.MaterialsModel = Montage.create(Component, {
191 } 192 }
192 }, 193 },
193 194
194 clearAllMaterials: { 195 clearAllMaterials: {
195 value: function() { 196 value: function() {
196 this._materials = []; 197 this._materials = [];
197 } 198 }
198 }, 199 },
199 200
200 exportFlatMaterial: { 201 exportFlatMaterial: {
201 value: function() { 202 value: function() {
@@ -203,108 +204,108 @@ exports.MaterialsModel = Montage.create(Component, {
203 } 204 }
204 }, 205 },
205 206
206 getDefaultMaterialName: { 207 getDefaultMaterialName: {
207 value: function() { 208 value: function() {
208 return "Flat"; 209 return "Flat";
209 } 210 }
210 }, 211 },
211 212
212 exportMaterials: { 213 exportMaterials: {
213 value: function() 214 value: function()
214 { 215 {
215 var matArray = []; 216 var matArray = [];
216 var nMats = this._materials.length; 217 var nMats = this._materials.length;
217 for (var i=0; i<nMats; i++) { 218 for (var i=0; i<nMats; i++) {
218 var material = this._materials[i]; 219 var material = this._materials[i];
219 var matObj = material.exportJSON(); 220 var matObj = material.exportJSON();