aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/uber-material.js
diff options
context:
space:
mode:
authorhwc4872012-04-26 16:40:05 -0700
committerhwc4872012-04-26 16:40:05 -0700
commit5a1965bf2ed9a54601ca16fd67555335c510ce08 (patch)
tree7fa2419c8a194e7b0265b58f0f4d10d02a0d66f4 /js/lib/rdge/materials/uber-material.js
parentee07f71e9e6c9219e02738c77fb038bece2e03b6 (diff)
downloadninja-5a1965bf2ed9a54601ca16fd67555335c510ce08.tar.gz
Update materials to the new texture model.
Create local world for deleted source canvases
Diffstat (limited to 'js/lib/rdge/materials/uber-material.js')
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js
index a2c782d8..bc2ba340 100755
--- a/js/lib/rdge/materials/uber-material.js
+++ b/js/lib/rdge/materials/uber-material.js
@@ -24,8 +24,8 @@ var UberMaterial = function UberMaterial() {
24 this._environmentAmount = 0.2; // 0 .. 1 24 this._environmentAmount = 0.2; // 0 .. 1
25 25
26 // set the default maps 26 // set the default maps
27 //this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' }; 27 this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' };
28 this._diffuseMapOb = { 'texture' : 'texture', 'wrap' : 'REPEAT' }; 28 //this._diffuseMapOb = { 'texture' : 'texture', 'wrap' : 'REPEAT' };
29 this._normalMapOb = { 'texture': 'assets/images/rocky-normal.jpg', 'wrap': 'REPEAT' }; 29 this._normalMapOb = { 'texture': 'assets/images/rocky-normal.jpg', 'wrap': 'REPEAT' };
30 this._specularMapOb = { 'texture': 'assets/images/rocky-spec.jpg', 'wrap': 'REPEAT' }; 30 this._specularMapOb = { 'texture': 'assets/images/rocky-spec.jpg', 'wrap': 'REPEAT' };
31 this._environmentMapOb = { 'texture': 'assets/images/silver.png', 'wrap': 'CLAMP', 'envReflection': this._environmentAmount }; 31 this._environmentMapOb = { 'texture': 'assets/images/silver.png', 'wrap': 'CLAMP', 'envReflection': this._environmentAmount };
@@ -366,9 +366,13 @@ var UberMaterial = function UberMaterial() {
366 366
367 // duplcate method requirde 367 // duplcate method requirde
368 this.dup = function () { 368 this.dup = function () {
369 // allocate a new uber material
370 var newMat = new UberMaterial();
371 369
370 // get the current values;
371 var propNames = [], propValues = [], propTypes = [], propLabels = [];
372 this.getAllProperties(propNames, propValues, propTypes, propLabels);
373
374 // allocate a new material
375 var newMat = new UberMaterial();
372 newMat._useDiffuseMap = this._useDiffuseMap; 376 newMat._useDiffuseMap = this._useDiffuseMap;
373 newMat._useEnvironmentMap = this._useEnvironmentMap; 377 newMat._useEnvironmentMap = this._useEnvironmentMap;
374 newMat._useLights = this._useLights; 378 newMat._useLights = this._useLights;
@@ -376,9 +380,7 @@ var UberMaterial = function UberMaterial() {
376 newMat._useSpecularMap = this._useSpecularMap; 380 newMat._useSpecularMap = this._useSpecularMap;
377 newMat.rebuildShader(); 381 newMat.rebuildShader();
378 382
379 // copy over the current values; 383 // copy over the current values;
380 var propNames = [], propValues = [], propTypes = [], propLabels = [];
381 this.getAllProperties(propNames, propValues, propTypes, propLabels);
382 var n = propNames.length; 384 var n = propNames.length;
383 for (var i = 0; i < n; i++) 385 for (var i = 0; i < n; i++)
384 newMat.setProperty(propNames[i], propValues[i]); 386 newMat.setProperty(propNames[i], propValues[i]);