diff options
Diffstat (limited to 'js/helper-classes/RDGE/GLRectangle.js')
-rwxr-xr-x | js/helper-classes/RDGE/GLRectangle.js | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 5b6ff94f..a801d3c4 100755 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -214,7 +214,7 @@ function GLRectangle() | |||
214 | if (!world._useWebGL) return; | 214 | if (!world._useWebGL) return; |
215 | 215 | ||
216 | // make sure RDGE has the correct context | 216 | // make sure RDGE has the correct context |
217 | g_Engine.setContext( world.getCanvas().uuid ); | 217 | g_Engine.setContext( world.getCanvas().rdgeid ); |
218 | 218 | ||
219 | // create the gl buffer | 219 | // create the gl buffer |
220 | var gl = world.getGLContext(); | 220 | var gl = world.getGLContext(); |
@@ -400,29 +400,33 @@ function GLRectangle() | |||
400 | var w = world.getViewportWidth(), | 400 | var w = world.getViewportWidth(), |
401 | h = world.getViewportHeight(); | 401 | h = world.getViewportHeight(); |
402 | 402 | ||
403 | // set the fill | 403 | // render 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] + ")"; |
409 | ctx.fillStyle = c; | 408 | ctx.fillStyle = c; |
409 | |||
410 | ctx.lineWidth = lw; | ||
411 | var inset = Math.ceil( lw ) + 0.5; | ||
412 | this.renderPath( inset, ctx ); | ||
413 | ctx.fill(); | ||
414 | ctx.closePath(); | ||
410 | } | 415 | } |
411 | 416 | ||
412 | // set the stroke | 417 | // render the stroke |
413 | ctx.strokeStyle = "#0000ff"; | 418 | ctx.beginPath(); |
414 | if (this._strokeColor) | 419 | if (this._strokeColor) |
415 | { | 420 | { |
416 | var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; | 421 | var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; |
417 | ctx.strokeStyle = c; | 422 | ctx.strokeStyle = c; |
418 | } | ||
419 | 423 | ||
420 | ctx.lineWidth = lw; | 424 | ctx.lineWidth = lw; |
421 | var inset = Math.ceil( 0.5*lw ) + 0.5; | 425 | var inset = Math.ceil( 0.5*lw ) + 0.5; |
422 | this.renderPath( inset, ctx ); | 426 | this.renderPath( inset, ctx ); |
423 | ctx.fill(); | 427 | ctx.stroke(); |
424 | ctx.stroke(); | 428 | ctx.closePath(); |
425 | ctx.closePath(); | 429 | } |
426 | } | 430 | } |
427 | 431 | ||
428 | this.createStroke = function(ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad, material) | 432 | this.createStroke = function(ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad, material) |
@@ -777,15 +781,15 @@ RectangleFill.create = function( rectCtr, width, height, tlRad, blRad, brRad, | |||
777 | } | 781 | } |
778 | 782 | ||
779 | //refine the mesh for vertex deformations | 783 | //refine the mesh for vertex deformations |
780 | if (material) | 784 | // if (material) |
781 | { | 785 | // { |
782 | if (material.hasVertexDeformation()) | 786 | // if (material.hasVertexDeformation()) |
783 | { | 787 | // { |
784 | var paramRange = material.getVertexDeformationRange(); | 788 | // var paramRange = material.getVertexDeformationRange(); |
785 | var tolerance = material.getVertexDeformationTolerance(); | 789 | // var tolerance = material.getVertexDeformationTolerance(); |
786 | nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); | 790 | // nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); |
787 | } | 791 | // } |
788 | } | 792 | // } |
789 | 793 | ||
790 | // create the RDGE primitive | 794 | // create the RDGE primitive |
791 | var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 795 | var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); |
@@ -1051,15 +1055,15 @@ RectangleStroke.create = function( rectCtr, width, height, strokeWidth, tlRad, | |||
1051 | } | 1055 | } |
1052 | 1056 | ||
1053 | //refine the mesh for vertex deformations | 1057 | //refine the mesh for vertex deformations |
1054 | if (material) | 1058 | // if (material) |
1055 | { | 1059 | // { |
1056 | if (material.hasVertexDeformation()) | 1060 | // if (material.hasVertexDeformation()) |
1057 | { | 1061 | // { |
1058 | var paramRange = material.getVertexDeformationRange(); | 1062 | // var paramRange = material.getVertexDeformationRange(); |
1059 | var tolerance = material.getVertexDeformationTolerance(); | 1063 | // var tolerance = material.getVertexDeformationTolerance(); |
1060 | //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); | 1064 | // nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); |
1061 | } | 1065 | // } |
1062 | } | 1066 | // } |
1063 | 1067 | ||
1064 | // create the RDGE primitive | 1068 | // create the RDGE primitive |
1065 | var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 1069 | var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); |
@@ -1144,19 +1148,18 @@ RectangleGeometry.create = function( ctr, width, height, material ) | |||
1144 | RectangleGeometry.pushIndices( 0, 3, 2 ); | 1148 | RectangleGeometry.pushIndices( 0, 3, 2 ); |
1145 | 1149 | ||
1146 | //refine the mesh for vertex deformations | 1150 | //refine the mesh for vertex deformations |
1147 | if (material) | 1151 | // if (material) |
1148 | { | 1152 | // { |
1149 | if (material.hasVertexDeformation()) | 1153 | // if (material.hasVertexDeformation()) |
1150 | { | 1154 | // { |
1151 | var paramRange = material.getVertexDeformationRange(); | 1155 | // var paramRange = material.getVertexDeformationRange(); |
1152 | var tolerance = material.getVertexDeformationTolerance(); | 1156 | // var tolerance = material.getVertexDeformationTolerance(); |
1153 | //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); | 1157 | // nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); |
1154 | } | 1158 | // } |
1155 | } | 1159 | // } |
1156 | 1160 | ||
1157 | // create the RDGE primitive | 1161 | // create the RDGE primitive |
1158 | var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 1162 | 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; | 1163 | return prim; |
1161 | } | 1164 | } |
1162 | 1165 | ||