aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLGeomObj.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-07 13:30:08 -0800
committerNivesh Rajbhandari2012-02-07 13:30:08 -0800
commit3a8875c288049b466bfeb8b7f0510fd8cbfb970d (patch)
treeebe632aa3960a5f93f89fbed22b8ef0ecd9f82e7 /js/helper-classes/RDGE/GLGeomObj.js
parent8ad767b61460984a4031ba630f76ac8247a61857 (diff)
downloadninja-3a8875c288049b466bfeb8b7f0510fd8cbfb970d.tar.gz
Supporting switching materials in the PI. Also, moved makeFillMaterial and makeStrokeMaterial functions into GLGeomObj so shapes other than GLRectangle can use these routines.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/GLGeomObj.js')
-rw-r--r--js/helper-classes/RDGE/GLGeomObj.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLGeomObj.js b/js/helper-classes/RDGE/GLGeomObj.js
index 72019703..62fbf562 100644
--- a/js/helper-classes/RDGE/GLGeomObj.js
+++ b/js/helper-classes/RDGE/GLGeomObj.js
@@ -37,6 +37,10 @@ function GLGeomObj()
37 37
38 this.m_world = null; 38 this.m_world = null;
39 39
40 // stroke and fill colors
41 this._strokeColor;
42 this._fillColor;
43
40 // stroke and fill materials 44 // stroke and fill materials
41 this._fillMaterial; 45 this._fillMaterial;
42 this._strokeMaterial; 46 this._strokeMaterial;
@@ -104,6 +108,53 @@ function GLGeomObj()
104 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); } 108 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); }
105 this.setStrokeColor = function(c) { this.setMaterialColor(c, "stroke"); } 109 this.setStrokeColor = function(c) { this.setMaterialColor(c, "stroke"); }
106 110
111 this.makeStrokeMaterial = function()
112 {
113 var strokeMaterial;
114 if (this.getStrokeMaterial())
115 strokeMaterial = this.getStrokeMaterial().dup();
116 else
117 strokeMaterial = new FlatMaterial();
118
119 if (strokeMaterial)
120 {
121 strokeMaterial.init( this.getWorld() );
122 if(this._strokeColor)
123 {
124 strokeMaterial.setProperty("color", this._strokeColor);
125 }
126 }
127
128 this._materialArray.push( strokeMaterial );
129 this._materialTypeArray.push( "stroke" );
130
131 return strokeMaterial;
132 }
133
134 this.makeFillMaterial = function()
135 {
136 var fillMaterial;
137 if (this.getFillMaterial())
138 fillMaterial = this.getFillMaterial().dup();
139 else
140 fillMaterial = new FlatMaterial();
141
142 if (fillMaterial)
143 {
144 fillMaterial.init( this.getWorld() );
145 //if(!this.getFillMaterial() && this._fillColor)
146 if (this._fillColor)
147 {
148 fillMaterial.setProperty("color", this._fillColor);
149 }
150 }
151
152 this._materialArray.push( fillMaterial );
153 this._materialTypeArray.push( "fill" );
154
155 return fillMaterial;
156 }
157
107 158
108 this.translate = function(v) 159 this.translate = function(v)
109 { 160 {