diff options
author | Jose Antonio Marquez | 2012-03-26 15:36:49 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-03-26 15:36:49 -0700 |
commit | 7bf738bc08f6a24edce30dbc2b101a8cab2d27aa (patch) | |
tree | af3b114d6a83ae62dfcead8bd61bc62efe0c9516 /js/lib/rdge/materials/bump-metal-material.js | |
parent | d87cded11dcc0faf41a4a3e6b587e5549c0da6df (diff) | |
parent | 309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff) | |
download | ninja-7bf738bc08f6a24edce30dbc2b101a8cab2d27aa.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
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 fa6f5300..2ef83227 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js | |||
@@ -152,6 +152,46 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
152 | } | 152 | } |
153 | }; | 153 | }; |
154 | 154 | ||
155 | this.exportJSON = function() | ||
156 | { | ||
157 | var jObj = | ||
158 | { | ||
159 | 'material' : this.getShaderName(), | ||
160 | 'name' : this.getName(), | ||
161 | 'lightDiff' : this.getLightDiff(), | ||
162 | 'diffuseTexture' : this.getDiffuseTexture(), | ||
163 | 'specularTexture' : this.getSpecularTexture(), | ||
164 | 'normalMap' : this.getNormalTexture() | ||
165 | }; | ||
166 | |||
167 | return jObj; | ||
168 | }; | ||
169 | |||
170 | this.importJSON = function( jObj ) | ||
171 | { | ||
172 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
173 | this.setName( jObj.name ); | ||
174 | |||
175 | try | ||
176 | { | ||
177 | var lightDiff = jObj.lightDiff, | ||
178 | dt = jObj.diffuseTexture, | ||
179 | st = jObj.specularTexture, | ||
180 | nt = jObj.normalMap; | ||
181 | |||
182 | this.setProperty( "lightDiff", lightDiff); | ||
183 | this.setProperty( "diffuseTexture", dt ); | ||
184 | this.setProperty( "specularTexture", st ); | ||
185 | this.setProperty( "normalMap", nt ); | ||
186 | } | ||
187 | catch (e) | ||
188 | { | ||
189 | throw new Error( "could not import BumpMetal material: " + jObj ); | ||
190 | } | ||
191 | |||
192 | return; | ||
193 | }; | ||
194 | |||
155 | this.export = function() | 195 | this.export = function() |
156 | { | 196 | { |
157 | // every material needs the base type and instance name | 197 | // every material needs the base type and instance name |