aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/material.js')
-rwxr-xr-xjs/lib/rdge/materials/material.js69
1 files changed, 42 insertions, 27 deletions
diff --git a/js/lib/rdge/materials/material.js b/js/lib/rdge/materials/material.js
index 34d3aa1f..e1d17aa8 100755
--- a/js/lib/rdge/materials/material.js
+++ b/js/lib/rdge/materials/material.js
@@ -201,6 +201,8 @@ var Material = function GLMaterial( world ) {
201 }; 201 };
202 202
203 this.validateProperty = function( prop, value ) { 203 this.validateProperty = function( prop, value ) {
204 if(prop === "gradient") return true;
205
204 var rtnVal = false; 206 var rtnVal = false;
205 try 207 try
206 { 208 {
@@ -264,33 +266,37 @@ var Material = function GLMaterial( world ) {
264 var material = this._materialNode; 266 var material = this._materialNode;
265 if (material) technique = material.shaderProgram[this.getTechniqueName()]; 267 if (material) technique = material.shaderProgram[this.getTechniqueName()];
266 268
267 switch (this.getPropertyType(prop)) 269 if(prop === "gradient") {
268 { 270 this.setGradientData(value);
269 case "angle": 271 } else {
270 case "float": 272 switch (this.getPropertyType(prop))
271 this._propValues[prop] = value; 273 {
272 if (technique) technique[prop].set( [value] ); 274 case "angle":
273 break; 275 case "float":
274 276 this._propValues[prop] = value;
275 case "file": 277 if (technique) technique[prop].set( [value] );
276 this._propValues[prop] = value.slice(); 278 break;
277 if (technique) 279
278 { 280 case "file":
279 var glTex = new Texture( this.getWorld(), value ); 281 this._propValues[prop] = value.slice();
280 this._glTextures[prop] = glTex; 282 if (technique)
281 glTex.render(); 283 {
282 var tex = glTex.getTexture(); 284 var glTex = new Texture( this.getWorld(), value );
283 if (tex) technique[prop].set( tex ); 285 this._glTextures[prop] = glTex;
284 } 286 glTex.render();
285 break; 287 var tex = glTex.getTexture();
286 288 if (tex) technique[prop].set( tex );
287 case "color": 289 }
288 case "vector2d": 290 break;
289 case "vector3d": 291
290 this._propValues[prop] = value.slice(); 292 case "color":
291 if (technique) technique[prop].set( value ); 293 case "vector2d":
292 break; 294 case "vector3d":
293 } 295 this._propValues[prop] = value.slice();
296 if (technique) technique[prop].set( value );
297 break;
298 }
299 }
294 }; 300 };
295 301
296 this.setShaderValues = function() 302 this.setShaderValues = function()
@@ -422,6 +428,15 @@ var Material = function GLMaterial( world ) {
422 return tex; 428 return tex;
423 }; 429 };
424 430
431 this.gradientType = null;
432
433 this.getGradientData = function() {
434 return null;
435 };
436
437 this.setGradientData = function() {
438 // override in linear-gradient-material and radial-gradient-material
439 };
425}; 440};
426 441
427if (typeof exports === "object") { 442if (typeof exports === "object") {