aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/geom-obj.js
diff options
context:
space:
mode:
authorEric Guzman2012-06-20 19:42:03 -0700
committerEric Guzman2012-06-20 19:42:03 -0700
commit3270aac4980c908f305fb53abadda5121ff6b9cb (patch)
tree6255aaab239fde71b1f4862dd70de7be62f48b85 /js/lib/geom/geom-obj.js
parenta5d93daf6fdccbfee160d6a8ba08f6b6d4b9d7cc (diff)
parent87377c81da06abf6d656017859830a3ab2902f0e (diff)
downloadninja-3270aac4980c908f305fb53abadda5121ff6b9cb.tar.gz
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js/lib/geom/geom-obj.js')
-rwxr-xr-xjs/lib/geom/geom-obj.js29
1 files changed, 22 insertions, 7 deletions
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index 4cb21a25..3a7a5619 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -180,7 +180,7 @@ exports.GeomObj = Object.create(Object.prototype, {
180 /////////////////////////////////////////////////////////////////////// 180 ///////////////////////////////////////////////////////////////////////
181 // Methods 181 // Methods
182 /////////////////////////////////////////////////////////////////////// 182 ///////////////////////////////////////////////////////////////////////
183 setMaterialColor: { 183 setMaterialColor: {
184 value: function(c, type) { 184 value: function(c, type) {
185 var i = 0, 185 var i = 0,
186 nMats = 0; 186 nMats = 0;
@@ -281,9 +281,13 @@ exports.GeomObj = Object.create(Object.prototype, {
281 this._materialArray.push(strokeMaterial); 281 this._materialArray.push(strokeMaterial);
282 this._materialTypeArray.push("stroke"); 282 this._materialTypeArray.push("stroke");
283 283
284 if (this._strokeColor) { 284 // don't set the value here. The material editor may set a color directly
285 this.setStrokeColor(this._strokeColor); 285 // to the material without setting this value in the obj. The following
286 } 286 // lines of code will clobber the value in the material
287 //if (this._strokeColor)
288 // this.setStrokeColor(this._strokeColor);
289
290 this._strokeMaterial = strokeMaterial;
287 291
288 return strokeMaterial; 292 return strokeMaterial;
289 } 293 }
@@ -304,10 +308,14 @@ exports.GeomObj = Object.create(Object.prototype, {
304 308
305 this._materialArray.push(fillMaterial); 309 this._materialArray.push(fillMaterial);
306 this._materialTypeArray.push("fill"); 310 this._materialTypeArray.push("fill");
311
312 // don't set the value here. The material editor may set a color directly
313 // to the material without setting this value in the obj. The following
314 // lines of code will clobber the value in the material
315 //if (this._fillColor)
316 // this.setFillColor(this._fillColor);
307 317
308 if (this._fillColor) { 318 this._fillMaterial = fillMaterial;
309 this.setFillColor(this._fillColor);
310 }
311 319
312 return fillMaterial; 320 return fillMaterial;
313 } 321 }
@@ -315,6 +323,8 @@ exports.GeomObj = Object.create(Object.prototype, {
315 323
316 exportMaterialsJSON: { 324 exportMaterialsJSON: {
317 value: function() { 325 value: function() {
326 MaterialsModel = require("js/models/materials-model").MaterialsModel;
327
318 var jObj; 328 var jObj;
319 if (this._materialArray && this._materialNodeArray && this.getWorld().isWebGL()) { 329 if (this._materialArray && this._materialNodeArray && this.getWorld().isWebGL()) {
320 var nMats = this._materialArray.length; 330 var nMats = this._materialArray.length;
@@ -345,6 +355,8 @@ exports.GeomObj = Object.create(Object.prototype, {
345 355
346 importMaterialsJSON: { 356 importMaterialsJSON: {
347 value: function(jObj) { 357 value: function(jObj) {
358 MaterialsModel = require("js/models/materials-model").MaterialsModel;
359
348 this._materialArray = []; 360 this._materialArray = [];
349 this._materialTypeArray = []; 361 this._materialTypeArray = [];
350 362
@@ -370,6 +382,7 @@ exports.GeomObj = Object.create(Object.prototype, {
370 case "tunnel": 382 case "tunnel":
371 case "reliefTunnel": 383 case "reliefTunnel":
372 case "squareTunnel": 384 case "squareTunnel":
385 case "flag":
373 case "twist": 386 case "twist":
374 case "fly": 387 case "fly":
375 case "julia": 388 case "julia":
@@ -379,6 +392,8 @@ exports.GeomObj = Object.create(Object.prototype, {
379 case "keleidoscope": 392 case "keleidoscope":
380 case "radialBlur": 393 case "radialBlur":
381 case "pulse": 394 case "pulse":
395 case "twistVert":
396 case "taper":
382 mat = MaterialsModel.getMaterialByShader(shaderName); 397 mat = MaterialsModel.getMaterialByShader(shaderName);
383 if (mat) mat = mat.dup(); 398 if (mat) mat = mat.dup();
384 break; 399 break;