From 679a0746bedab9c5871a83a5fea6a06ac6a4f41c Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 2 Apr 2012 10:17:48 -0700 Subject: texture abstraction --- js/lib/geom/geom-obj.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index a87bdbf5..11b9303a 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -220,6 +220,8 @@ var GeomObj = function GLGeomObj() { this.setStrokeColor(this._strokeColor); } + this._strokeMaterial = strokeMaterial; + return strokeMaterial; }; @@ -242,6 +244,8 @@ var GeomObj = function GLGeomObj() { this.setFillColor(this._fillColor); } + this._fillMaterial = fillMaterial; + return fillMaterial; }; -- cgit v1.2.3 From 4b199cf04af83f59895d4d1e9a2d8443c1ec8e06 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 3 Apr 2012 09:36:14 -0700 Subject: started the flag material --- js/lib/geom/geom-obj.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 11b9303a..0c0d7c01 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -309,6 +309,7 @@ var GeomObj = function GLGeomObj() { case "tunnel": case "reliefTunnel": case "squareTunnel": + case "flag": case "twist": case "fly": case "julia": @@ -382,6 +383,7 @@ var GeomObj = function GLGeomObj() { case "tunnel": case "reliefTunnel": case "squareTunnel": + case "flag": case "twist": case "fly": case "julia": -- cgit v1.2.3 From 5fcb96cae89007c684df3ce948831e2fcf9fd8b7 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 10:00:52 -0700 Subject: Fixing merge issues --- js/lib/geom/geom-obj.js | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 803dbb53..6f37ad1c 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -11,7 +11,6 @@ var MaterialsModel = require("js/models/materials-model").MaterialsModel; // Super class for all geometry classes /////////////////////////////////////////////////////////////////////// exports.GeomObj = Object.create(Object.prototype, { -{ /////////////////////////////////////////////////////////////////////// // Constants /////////////////////////////////////////////////////////////////////// @@ -181,14 +180,12 @@ exports.GeomObj = Object.create(Object.prototype, { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - setMaterialColor: { + setMaterialColor: { value: function(c, type) { var i = 0, nMats = 0; if (c) { if (c.gradientMode) { - if (c.gradientMode) - { // Gradient support if (this._materialArray && this._materialTypeArray) { nMats = this._materialArray.length; @@ -204,7 +201,6 @@ exports.GeomObj = Object.create(Object.prototype, { } for (var n = 0; n < len; n++) { - { var position = colors[n].position / 100; var cs = colors[n].value; var stop = [cs.r / 255, cs.g / 255, cs.b / 255, cs.a]; @@ -213,9 +209,6 @@ exports.GeomObj = Object.create(Object.prototype, { if (nMats === this._materialTypeArray.length) { for (i = 0; i < nMats; i++) { if (this._materialTypeArray[i] == type) { - { - if (this._materialTypeArray[i] == type) - { this._materialArray[i].setProperty("color" + (n + 1), stop.slice(0)); this._materialArray[i].setProperty("colorStop" + (n + 1), position); } @@ -225,15 +218,12 @@ exports.GeomObj = Object.create(Object.prototype, { if (type === "fill") { this._fillColor = c; } else { - else { this._strokeColor = c; } } else { - else { if (type === "fill") { this._fillColor = c.slice(0); } else { - else { this._strokeColor = c.slice(0); } @@ -241,7 +231,6 @@ exports.GeomObj = Object.create(Object.prototype, { nMats = this._materialArray.length; if (nMats === this._materialTypeArray.length) { for (i = 0; i < nMats; i++) { - { if (this._materialTypeArray[i] == type) { this._materialArray[i].setProperty("color", c.slice(0)); } @@ -250,24 +239,17 @@ exports.GeomObj = Object.create(Object.prototype, { } } } else { - else - { if (type === "fill") { this._fillColor = null; } else { - else { this._strokeColor = null; } if (this._materialArray && this._materialTypeArray) { - { nMats = this._materialArray.length; if (nMats === this._materialTypeArray.length) { for (i = 0; i < nMats; i++) { if (this._materialTypeArray[i] == type) { - { - if (this._materialTypeArray[i] == type) - { // TODO - Not sure how to set color to null values in shaders this._materialArray[i].setProperty("color", [0, 0, 0, 0]); } @@ -289,7 +271,6 @@ exports.GeomObj = Object.create(Object.prototype, { if (this.getStrokeMaterial()) { strokeMaterial = this.getStrokeMaterial().dup(); } else { - else { strokeMaterial = MaterialsModel.exportFlatMaterial(); } @@ -304,7 +285,7 @@ exports.GeomObj = Object.create(Object.prototype, { this.setStrokeColor(this._strokeColor); } - this._strokeMaterial = strokeMaterial; + this._strokeMaterial = strokeMaterial; return strokeMaterial; } @@ -316,7 +297,6 @@ exports.GeomObj = Object.create(Object.prototype, { if (this.getFillMaterial()) { fillMaterial = this.getFillMaterial().dup(); } else { - else { fillMaterial = MaterialsModel.exportFlatMaterial(); } @@ -339,17 +319,17 @@ exports.GeomObj = Object.create(Object.prototype, { exportMaterialsJSON: { value: function() { - MaterialsModel = require("js/models/materials-model").MaterialsModel; + MaterialsModel = require("js/models/materials-model").MaterialsModel; var jObj; if (this._materialArray && this._materialNodeArray && this.getWorld().isWebGL()) { var nMats = this._materialArray.length; if (nMats > 0) { - { + { var arr = []; for (var i = 0; i < nMats; i++) { - { + { var matObj = { 'materialNodeName':this._materialNodeArray[i].name, @@ -373,7 +353,7 @@ exports.GeomObj = Object.create(Object.prototype, { importMaterialsJSON: { value: function(jObj) { - MaterialsModel = require("js/models/materials-model").MaterialsModel; + MaterialsModel = require("js/models/materials-model").MaterialsModel; this._materialArray = []; this._materialTypeArray = []; @@ -383,12 +363,10 @@ exports.GeomObj = Object.create(Object.prototype, { var nMaterials = jObj.nMaterials; var matArray = jObj.materials; for (var i = 0; i < nMaterials; i++) { - { var mat; var matObj = matArray[i].material; var shaderName = matObj.material; switch (shaderName) { - { case "flat": case "radialGradient": case "linearGradient": @@ -402,7 +380,7 @@ exports.GeomObj = Object.create(Object.prototype, { case "tunnel": case "reliefTunnel": case "squareTunnel": - case "flag": + case "flag": case "twist": case "fly": case "julia": -- cgit v1.2.3 From 25a2e1c5eb21a18caccc7a9435d835a3f5e7f3a0 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 10:37:03 -0700 Subject: More merge problems --- js/lib/geom/geom-obj.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 6f37ad1c..6b73463f 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -325,11 +325,9 @@ exports.GeomObj = Object.create(Object.prototype, { if (this._materialArray && this._materialNodeArray && this.getWorld().isWebGL()) { var nMats = this._materialArray.length; if (nMats > 0) { - { var arr = []; for (var i = 0; i < nMats; i++) { - { var matObj = { 'materialNodeName':this._materialNodeArray[i].name, -- cgit v1.2.3 From 129b5282ef35f320ea39d1878d2b5f77ae73a3e2 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 29 May 2012 14:36:59 -0700 Subject: Fixed authortime & runtime for twist vertex shader. --- js/lib/geom/geom-obj.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 6b73463f..417c8731 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -388,6 +388,7 @@ exports.GeomObj = Object.create(Object.prototype, { case "keleidoscope": case "radialBlur": case "pulse": + case "twistVert": mat = MaterialsModel.getMaterialByShader(shaderName); if (mat) mat = mat.dup(); break; -- cgit v1.2.3 From 6c994c4b90023cecf4fd0caafb404b859fe28f54 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 6 Jun 2012 16:34:41 -0700 Subject: material cleanup and rearchitecture --- js/lib/geom/geom-obj.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 417c8731..3a7a5619 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -281,9 +281,11 @@ exports.GeomObj = Object.create(Object.prototype, { this._materialArray.push(strokeMaterial); this._materialTypeArray.push("stroke"); - if (this._strokeColor) { - this.setStrokeColor(this._strokeColor); - } + // don't set the value here. The material editor may set a color directly + // to the material without setting this value in the obj. The following + // lines of code will clobber the value in the material + //if (this._strokeColor) + // this.setStrokeColor(this._strokeColor); this._strokeMaterial = strokeMaterial; @@ -306,12 +308,14 @@ exports.GeomObj = Object.create(Object.prototype, { this._materialArray.push(fillMaterial); this._materialTypeArray.push("fill"); + + // don't set the value here. The material editor may set a color directly + // to the material without setting this value in the obj. The following + // lines of code will clobber the value in the material + //if (this._fillColor) + // this.setFillColor(this._fillColor); - if (this._fillColor) { - this.setFillColor(this._fillColor); - } - - this._fillMaterial = fillMaterial; + this._fillMaterial = fillMaterial; return fillMaterial; } @@ -389,6 +393,7 @@ exports.GeomObj = Object.create(Object.prototype, { case "radialBlur": case "pulse": case "twistVert": + case "taper": mat = MaterialsModel.getMaterialByShader(shaderName); if (mat) mat = mat.dup(); break; -- cgit v1.2.3