diff options
author | hwc487 | 2012-03-22 15:47:11 -0700 |
---|---|---|
committer | hwc487 | 2012-03-22 15:47:11 -0700 |
commit | e927e4702d7dbd4a878f6979b3f56b46758f93de (patch) | |
tree | e6bb8951374a6504bd6c745ce7233da5cd4869dc /js/lib/rdge/materials/bump-metal-material.js | |
parent | 00cd98e49c959906d7c44bb6adcdef1f3d5148ae (diff) | |
parent | 31e924e1b8b8da8342b3ff2341c8284915486c0b (diff) | |
download | ninja-e927e4702d7dbd4a878f6979b3f56b46758f93de.tar.gz |
Merge branch 'integration' of github.com:ericmueller/ninja-internal into Textures
Diffstat (limited to 'js/lib/rdge/materials/bump-metal-material.js')
-rwxr-xr-x | js/lib/rdge/materials/bump-metal-material.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index fe8a9dd5..ccd8e3ca 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js | |||
@@ -190,6 +190,46 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
190 | } | 190 | } |
191 | }; | 191 | }; |
192 | 192 | ||
193 | this.exportJSON = function() | ||
194 | { | ||
195 | var jObj = | ||
196 | { | ||
197 | 'material' : this.getShaderName(), | ||
198 | 'name' : this.getName(), | ||
199 | 'lightDiff' : this.getLightDiff(), | ||
200 | 'diffuseTexture' : this.getDiffuseTexture(), | ||
201 | 'specularTexture' : this.getSpecularTexture(), | ||
202 | 'normalMap' : this.getNormalTexture() | ||
203 | }; | ||
204 | |||
205 | return jObj; | ||
206 | }; | ||
207 | |||
208 | this.importJSON = function( jObj ) | ||
209 | { | ||
210 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
211 | this.setName( jObj.name ); | ||
212 | |||
213 | try | ||
214 | { | ||
215 | var lightDiff = jObj.lightDiff, | ||
216 | dt = jObj.diffuseTexture, | ||
217 | st = jObj.specularTexture, | ||
218 | nt = jObj.normalMap; | ||
219 | |||
220 | this.setProperty( "lightDiff", lightDiff); | ||
221 | this.setProperty( "diffuseTexture", dt ); | ||
222 | this.setProperty( "specularTexture", st ); | ||
223 | this.setProperty( "normalMap", nt ); | ||
224 | } | ||
225 | catch (e) | ||
226 | { | ||
227 | throw new Error( "could not import BumpMetal material: " + jObj ); | ||
228 | } | ||
229 | |||
230 | return; | ||
231 | }; | ||
232 | |||
193 | this.export = function() | 233 | this.export = function() |
194 | { | 234 | { |
195 | // every material needs the base type and instance name | 235 | // every material needs the base type and instance name |