aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLRectangle.js
diff options
context:
space:
mode:
authorhwc4872012-02-23 16:57:55 -0800
committerhwc4872012-02-23 16:57:55 -0800
commitd0661d6c587aced68a68e36a5ec4e81f8a2096e8 (patch)
tree3fd0caf1c4286d0e8f0774b7a230b4dfb09f6167 /js/helper-classes/RDGE/GLRectangle.js
parent26bb2894c29d4608e843de01829d352dd3d00823 (diff)
downloadninja-d0661d6c587aced68a68e36a5ec4e81f8a2096e8.tar.gz
bug fixes for canvas 2d shape drawing.
Diffstat (limited to 'js/helper-classes/RDGE/GLRectangle.js')
-rwxr-xr-xjs/helper-classes/RDGE/GLRectangle.js61
1 files changed, 29 insertions, 32 deletions
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index 3c1cb7dc..cf9c123e 100755
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -402,7 +402,6 @@ function GLRectangle()
402 402
403 // set the fill 403 // set the fill
404 ctx.beginPath(); 404 ctx.beginPath();
405 ctx.fillStyle = "#990000";
406 if (this._fillColor) 405 if (this._fillColor)
407 { 406 {
408 var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")"; 407 var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")";
@@ -410,7 +409,6 @@ function GLRectangle()
410 } 409 }
411 410
412 // set the stroke 411 // set the stroke
413 ctx.strokeStyle = "#0000ff";
414 if (this._strokeColor) 412 if (this._strokeColor)
415 { 413 {
416 var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; 414 var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")";
@@ -420,8 +418,8 @@ function GLRectangle()
420 ctx.lineWidth = lw; 418 ctx.lineWidth = lw;
421 var inset = Math.ceil( 0.5*lw ) + 0.5; 419 var inset = Math.ceil( 0.5*lw ) + 0.5;
422 this.renderPath( inset, ctx ); 420 this.renderPath( inset, ctx );
423 ctx.fill(); 421 if (this._fillColor) ctx.fill();
424 ctx.stroke(); 422 if (this._strokeColor) ctx.stroke();
425 ctx.closePath(); 423 ctx.closePath();
426 } 424 }
427 425
@@ -777,15 +775,15 @@ RectangleFill.create = function( rectCtr, width, height, tlRad, blRad, brRad,
777 } 775 }
778 776
779 //refine the mesh for vertex deformations 777 //refine the mesh for vertex deformations
780 if (material) 778// if (material)
781 { 779// {
782 if (material.hasVertexDeformation()) 780// if (material.hasVertexDeformation())
783 { 781// {
784 var paramRange = material.getVertexDeformationRange(); 782// var paramRange = material.getVertexDeformationRange();
785 var tolerance = material.getVertexDeformationTolerance(); 783// var tolerance = material.getVertexDeformationTolerance();
786 nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); 784// nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance );
787 } 785// }
788 } 786// }
789 787
790 // create the RDGE primitive 788 // create the RDGE primitive
791 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); 789 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices);
@@ -1051,15 +1049,15 @@ RectangleStroke.create = function( rectCtr, width, height, strokeWidth, tlRad,
1051 } 1049 }
1052 1050
1053 //refine the mesh for vertex deformations 1051 //refine the mesh for vertex deformations
1054 if (material) 1052// if (material)
1055 { 1053// {
1056 if (material.hasVertexDeformation()) 1054// if (material.hasVertexDeformation())
1057 { 1055// {
1058 var paramRange = material.getVertexDeformationRange(); 1056// var paramRange = material.getVertexDeformationRange();
1059 var tolerance = material.getVertexDeformationTolerance(); 1057// var tolerance = material.getVertexDeformationTolerance();
1060 //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); 1058// nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance );
1061 } 1059// }
1062 } 1060// }
1063 1061
1064 // create the RDGE primitive 1062 // create the RDGE primitive
1065 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); 1063 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices);
@@ -1144,19 +1142,18 @@ RectangleGeometry.create = function( ctr, width, height, material )
1144 RectangleGeometry.pushIndices( 0, 3, 2 ); 1142 RectangleGeometry.pushIndices( 0, 3, 2 );
1145 1143
1146 //refine the mesh for vertex deformations 1144 //refine the mesh for vertex deformations
1147 if (material) 1145// if (material)
1148 { 1146// {
1149 if (material.hasVertexDeformation()) 1147// if (material.hasVertexDeformation())
1150 { 1148// {
1151 var paramRange = material.getVertexDeformationRange(); 1149// var paramRange = material.getVertexDeformationRange();
1152 var tolerance = material.getVertexDeformationTolerance(); 1150// var tolerance = material.getVertexDeformationTolerance();
1153 //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); 1151// nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance );
1154 } 1152// }
1155 } 1153// }
1156 1154
1157 // create the RDGE primitive 1155 // create the RDGE primitive
1158 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); 1156 var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices);
1159 //var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.LINES, nVertices);
1160 return prim; 1157 return prim;
1161} 1158}
1162 1159