aboutsummaryrefslogtreecommitdiff
path: root/js/models
diff options
context:
space:
mode:
authorhwc4872012-03-16 12:26:30 -0700
committerhwc4872012-03-16 12:26:30 -0700
commita0d23354802ebc6b437698acb4b18d3395d47cd1 (patch)
treea0081c079c9fc557e10a828db9adeed5a91d5a72 /js/models
parent57d4a82977a1f0e809511fe894886f88581d9615 (diff)
downloadninja-a0d23354802ebc6b437698acb4b18d3395d47cd1.tar.gz
Conversion to JSON based file IO for canvas2D and WebGL rendering
Diffstat (limited to 'js/models')
-rwxr-xr-xjs/models/materials-model.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/js/models/materials-model.js b/js/models/materials-model.js
index d8fb4016..a45b0c72 100755
--- a/js/models/materials-model.js
+++ b/js/models/materials-model.js
@@ -115,7 +115,31 @@ exports.MaterialsModel = Montage.create(Component, {
115 return this._materials[index]; 115 return this._materials[index];
116 } 116 }
117 } 117 }
118 }, 118 },
119
120 getMaterialByShader:
121 {
122 value: function( shaderName )
123 {
124 var index = this.getIndexOfMaterialByShader( shaderName );
125 if (index >= 0)
126 return this._materials[index];
127 }
128 },
129
130 getIndexOfMaterialByShader: {
131 value: function (shaderName) {
132 var len = this._materials.length;
133 for(var i=0; i<len; i++) {
134 var material = this._materials[i];
135 if(material.getShaderName() === shaderName) {
136 return i;
137 }
138 }
139
140 return -1;
141 }
142 },
119 143
120 getIndexOfMaterial: { 144 getIndexOfMaterial: {
121 value: function (materialName) { 145 value: function (materialName) {
@@ -143,6 +167,12 @@ exports.MaterialsModel = Montage.create(Component, {
143 } 167 }
144 }, 168 },
145 169
170 getDefaultMaterialName: {
171 value: function() {
172 return "FlatMaterial";
173 }
174 },
175
146 exportMaterials: { 176 exportMaterials: {
147 value: function() { 177 value: function() {
148 178