aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/bump-metal-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/bump-metal-material.js')
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js44
1 files changed, 44 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..4a6e9ab8 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -152,6 +152,50 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
152 } 152 }
153 }; 153 };
154 154
155 this.exportJSON = function()
156 {
157 var world = this.getWorld();
158 if (!world)
159 throw new Error( "no world in material.export, " + this.getName() );
160
161 var jObj =
162 {
163 'material' : this.getShaderName(),
164 'name' : this.getName(),
165 'lightDiff' : this.getLightDiff(),
166 'diffuseTexture' : this.getDiffuseTexture(),
167 'specularTexture' : this.getSpecularTexture(),
168 'normalMap' : this.getNormalTexture()
169 };
170
171 return jObj;
172 };
173
174 this.importJSON = function( jObj )
175 {
176 if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" );
177 this.setName( jObj.name );
178
179 try
180 {
181 var lightDiff = jObj.lightDiff,
182 dt = jObj.diffuseTexture,
183 st = jObj.specularTexture,
184 nt = jObj.normalMap;
185
186 this.setProperty( "lightDiff", lightDiff);
187 this.setProperty( "diffuseTexture", dt );
188 this.setProperty( "specularTexture", st );
189 this.setProperty( "normalMap", nt );
190 }
191 catch (e)
192 {
193 throw new Error( "could not import BumpMetal material: " + jObj );
194 }
195
196 return;
197 };
198
155 this.export = function() 199 this.export = function()
156 { 200 {
157 // every material needs the base type and instance name 201 // every material needs the base type and instance name