diff options
Diffstat (limited to 'js/lib/rdge/materials/radial-blur-material.js')
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js index 46cdda74..e76b302f 100644 --- a/js/lib/rdge/materials/radial-blur-material.js +++ b/js/lib/rdge/materials/radial-blur-material.js | |||
@@ -157,6 +157,42 @@ var RadialBlurMaterial = function RadialBlurMaterial() { | |||
157 | } | 157 | } |
158 | }; | 158 | }; |
159 | 159 | ||
160 | this.exportJSON = function() | ||
161 | { | ||
162 | var world = this.getWorld(); | ||
163 | if (!world) | ||
164 | throw new Error( "no world in material.export, " + this.getName() ); | ||
165 | |||
166 | var jObj = | ||
167 | { | ||
168 | 'material' : this.getShaderName(), | ||
169 | 'name' : this.getName(), | ||
170 | 'color' : this._propValues["color"], | ||
171 | 'texture' : this._propValues[this._propNames[0]] | ||
172 | }; | ||
173 | |||
174 | return jObj; | ||
175 | }; | ||
176 | |||
177 | this.importJSON = function( importStr ) | ||
178 | { | ||
179 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
180 | this.setName( jObj.name ); | ||
181 | |||
182 | var rtnStr; | ||
183 | try | ||
184 | { | ||
185 | this._propValues[this._propNames[0]] = jObj.texture; | ||
186 | this.updateTexture(); | ||
187 | } | ||
188 | catch (e) | ||
189 | { | ||
190 | throw new Error( "could not import material: " + importStr ); | ||
191 | } | ||
192 | |||
193 | return rtnStr; | ||
194 | } | ||
195 | |||
160 | this.export = function() { | 196 | this.export = function() { |
161 | // every material needs the base type and instance name | 197 | // every material needs the base type and instance name |
162 | var exportStr = "material: " + this.getShaderName() + "\n"; | 198 | var exportStr = "material: " + this.getShaderName() + "\n"; |