aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLCircle.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/GLCircle.js')
-rw-r--r--js/helper-classes/RDGE/GLCircle.js79
1 files changed, 13 insertions, 66 deletions
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 8f7a5d30..942eb528 100644
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -33,14 +33,6 @@ function GLCircle()
33 33
34 this._ovalHeight = this._ovalHeight = 2.0*this.radius; 34 this._ovalHeight = this._ovalHeight = 2.0*this.radius;
35 35
36 // stroke and fill colors
37 this._strokeColor = [0.4, 0.4, 0.4, 1.0];
38 this._fillColor = [0.0, 0.6, 0.0, 1.0];
39
40 // stroke and fill materials
41 this._fillMaterial;
42 this._strokeMaterial;
43
44 this._strokeStyle = "Solid"; 36 this._strokeStyle = "Solid";
45 37
46 this._aspectRatio = 1.0; 38 this._aspectRatio = 1.0;
@@ -191,19 +183,19 @@ function GLCircle()
191 var reverseRotMat = Matrix.RotationZ( -angle ); 183 var reverseRotMat = Matrix.RotationZ( -angle );
192 184
193 // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse 185 // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse
194 strokeScaleMat = Matrix.I(4); 186 var strokeScaleMat = Matrix.I(4);
195 strokeScaleMat[0] = xRad; 187 strokeScaleMat[0] = xRad;
196 strokeScaleMat[5] = yRad; 188 strokeScaleMat[5] = yRad;
197 189
198 fillScaleMat = Matrix.I(4); 190 var fillScaleMat = Matrix.I(4);
199 fillScaleMat[0] = xRad - xStroke; 191 fillScaleMat[0] = xRad - xStroke;
200 fillScaleMat[5] = yRad - yStroke; 192 fillScaleMat[5] = yRad - yStroke;
201 193
202 innerRadiusScaleMat = Matrix.I(4); 194 var innerRadiusScaleMat = Matrix.I(4);
203 innerRadiusScaleMat[0] = xInnRad; 195 innerRadiusScaleMat[0] = xInnRad;
204 innerRadiusScaleMat[5] = yInnRad; 196 innerRadiusScaleMat[5] = yInnRad;
205 197
206 innerStrokeScaleMat = Matrix.I(4); 198 var innerStrokeScaleMat = Matrix.I(4);
207 innerStrokeScaleMat[0] = xInnRad - xStroke; 199 innerStrokeScaleMat[0] = xInnRad - xStroke;
208 innerStrokeScaleMat[5] = yInnRad - yStroke; 200 innerStrokeScaleMat[5] = yInnRad - yStroke;
209 201
@@ -235,69 +227,24 @@ function GLCircle()
235 227
236 if (fillPrim) 228 if (fillPrim)
237 { 229 {
238 this._primArray.push( fillPrim ); 230 fillMaterial = this.makeFillMaterial();
239
240 if (this.getFillMaterial())
241 fillMaterial = this.getFillMaterial().dup();
242 else
243 fillMaterial = new FlatMaterial();
244 231
245 if (fillMaterial) 232 this._primArray.push( fillPrim );
246 { 233 this._materialNodeArray.push( fillMaterial.getMaterialNode() );
247 fillMaterial.init( this.getWorld() );
248 if(!this.getFillMaterial() && this._fillColor)
249 {
250 fillMaterial.setProperty("color", this._fillColor);
251 }
252 this._materialArray.push( fillMaterial );
253 this._materialTypeArray.push( "fill" );
254 var matNode = fillMaterial.getMaterialNode();
255 this._materialNodeArray.push( matNode );
256 }
257 } 234 }
258 if (strokePrim0) 235 if (strokePrim0)
259 { 236 {
260 if (this.getStrokeMaterial()) 237 strokeMaterial0 = this.makeStrokeMaterial();
261 strokeMaterial = this.getStrokeMaterial().dup();
262 else
263 strokeMaterial = new FlatMaterial();
264 238
265 if (strokeMaterial) 239 this._primArray.push( strokePrim0 );
266 { 240 this._materialNodeArray.push( strokeMaterial0.getMaterialNode() );
267 strokeMaterial.init( this.getWorld() );
268 if(!this.getStrokeMaterial() && this._strokeColor)
269 {
270 strokeMaterial.setProperty("color", this._strokeColor);
271 }
272 this._primArray.push( strokePrim0 );
273
274 var materialNode = createMaterialNode("ovalFillMaterial");
275 this._materialArray.push( strokeMaterial );
276 this._materialTypeArray.push( "stroke" );
277 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
278 }
279 } 241 }
280 if (strokePrim1) 242 if (strokePrim1)
281 { 243 {
282 if (this.getStrokeMaterial()) 244 strokeMaterial2 = this.makeStrokeMaterial();
283 strokeMaterial = this.getStrokeMaterial().dup();
284 else
285 strokeMaterial = new FlatMaterial();
286 245
287 if (strokeMaterial) 246 this._primArray.push( strokePrim1 );
288 { 247 this._materialNodeArray.push( strokeMaterial2.getMaterialNode() );
289 strokeMaterial.init( this.getWorld() );
290 if(!this.getStrokeMaterial() && this._strokeColor)
291 {
292 strokeMaterial.setProperty("color", this._strokeColor);
293 }
294 this._primArray.push( strokePrim1 );
295
296 var materialNode = createMaterialNode("ovalFillMaterial");
297 this._materialArray.push( strokeMaterial );
298 this._materialTypeArray.push( "stroke" );
299 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
300 }
301 } 248 }
302 249
303 world.updateObject(this); 250 world.updateObject(this);