diff options
Diffstat (limited to 'js/helper-classes/RDGE')
-rw-r--r-- | js/helper-classes/RDGE/GLLine.js | 29 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLMaterial.js | 2 | ||||
-rw-r--r-- | js/helper-classes/RDGE/GLRectangle.js | 141 | ||||
-rw-r--r-- | js/helper-classes/RDGE/Materials/BumpMetalMaterial.js | 10 | ||||
-rw-r--r-- | js/helper-classes/RDGE/Materials/FlatMaterial.js | 48 | ||||
-rw-r--r-- | js/helper-classes/RDGE/Materials/UberMaterial.js | 6 | ||||
-rw-r--r-- | js/helper-classes/RDGE/MaterialsLibrary.js | 2 |
7 files changed, 122 insertions, 116 deletions
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index bd3cbc26..67379b52 100644 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js | |||
@@ -77,11 +77,16 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
77 | this.getStrokeMaterial = function() { return this._strokeMaterial; } | 77 | this.getStrokeMaterial = function() { return this._strokeMaterial; } |
78 | this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } | 78 | this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } |
79 | 79 | ||
80 | this.getStrokeColor = function() { return this._strokeColor; } | 80 | this.getStrokeColor = function() { return this._strokeColor; } |
81 | //this.setStrokeColor = function(c) { this._strokeColor = c; } | 81 | //this.setStrokeColor = function(c) { this._strokeColor = c; } |
82 | 82 | ||
83 | this.getStrokeStyle = function() { return this._strokeStyle; } | 83 | this.getStrokeStyle = function() { return this._strokeStyle; } |
84 | this.setStrokeStyle = function(s) { this._strokeStyle = s; } | 84 | this.setStrokeStyle = function(s) { this._strokeStyle = s; } |
85 | |||
86 | this.getFillMaterial = function() { return null; } | ||
87 | |||
88 | this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } | ||
89 | this.getStrokeMaterial = function() { return this._strokeMaterial; } | ||
85 | 90 | ||
86 | this.getWidth = function() { return this._width; } | 91 | this.getWidth = function() { return this._width; } |
87 | this.setWidth = function(w) { this._width = w; } | 92 | this.setWidth = function(w) { this._width = w; } |
@@ -184,9 +189,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
184 | xFill+x, yFill+y, 0.0, | 189 | xFill+x, yFill+y, 0.0, |
185 | -xFill+x, -yFill+y, 0.0, | 190 | -xFill+x, -yFill+y, 0.0, |
186 | 191 | ||
187 | xFill+x, yFill+y, 0.0, | 192 | xFill+x, -yFill+y, 0.0, |
188 | -xFill+x, -yFill+y, 0.0, | 193 | -xFill+x, -yFill+y, 0.0, |
189 | xFill+x, -yFill+y, 0.0 | 194 | xFill+x, yFill+y, 0.0 |
190 | ]; | 195 | ]; |
191 | } | 196 | } |
192 | else if(this._slope === "horizontal") | 197 | else if(this._slope === "horizontal") |
@@ -199,10 +204,10 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
199 | xFill+x, yFill+y, 0.0, | 204 | xFill+x, yFill+y, 0.0, |
200 | -xFill+x, -yFill+y, 0.0, | 205 | -xFill+x, -yFill+y, 0.0, |
201 | 206 | ||
202 | xFill+x, yFill+y, 0.0, | 207 | xFill+x, -yFill+y, 0.0, |
203 | -xFill+x, -yFill+y, 0.0, | 208 | -xFill+x, -yFill+y, 0.0, |
204 | xFill+x, -yFill+y, 0.0 | 209 | xFill+x, yFill+y, 0.0 |
205 | ]; | 210 | ]; |
206 | } | 211 | } |
207 | else if(this._slope > 0) | 212 | else if(this._slope > 0) |
208 | { | 213 | { |
@@ -212,9 +217,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
212 | -xFill+2*xAdj+x, yFill+y, 0.0, | 217 | -xFill+2*xAdj+x, yFill+y, 0.0, |
213 | xFill-2*xAdj+x, -yFill+y, 0.0, | 218 | xFill-2*xAdj+x, -yFill+y, 0.0, |
214 | 219 | ||
215 | -xFill+2*xAdj+x, yFill+y, 0.0, | 220 | xFill+x, -yFill+2*yAdj+y, 0.0, |
216 | xFill-2*xAdj+x, -yFill+y, 0.0, | 221 | xFill-2*xAdj+x, -yFill+y, 0.0, |
217 | xFill+x, -yFill+2*yAdj+y, 0.0 | 222 | -xFill+2*xAdj+x, yFill+y, 0.0 |
218 | ]; | 223 | ]; |
219 | } | 224 | } |
220 | else | 225 | else |
@@ -225,9 +230,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
225 | -xFill+2*xAdj+x, -yFill+y, 0.0, | 230 | -xFill+2*xAdj+x, -yFill+y, 0.0, |
226 | xFill-2*xAdj+x, yFill+y, 0.0, | 231 | xFill-2*xAdj+x, yFill+y, 0.0, |
227 | 232 | ||
228 | -xFill+2*xAdj+x, -yFill+y, 0.0, | 233 | xFill+x, yFill-2*yAdj+y, 0.0, |
229 | xFill-2*xAdj+x, yFill+y, 0.0, | 234 | xFill-2*xAdj+x, yFill+y, 0.0, |
230 | xFill+x, yFill-2*yAdj+y, 0.0 | 235 | -xFill+2*xAdj+x, -yFill+y, 0.0 |
231 | ]; | 236 | ]; |
232 | } | 237 | } |
233 | } | 238 | } |
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js index 51c27ace..e1a68abd 100644 --- a/js/helper-classes/RDGE/GLMaterial.js +++ b/js/helper-classes/RDGE/GLMaterial.js | |||
@@ -186,7 +186,7 @@ function GLMaterial( world ) | |||
186 | var endKey = "endMaterial\n"; | 186 | var endKey = "endMaterial\n"; |
187 | var index = importStr.indexOf( endKey ); | 187 | var index = importStr.indexOf( endKey ); |
188 | index += endKey.length; | 188 | index += endKey.length; |
189 | rtnStr = importStr.substr( index ); | 189 | var rtnStr = importStr.substr( index ); |
190 | 190 | ||
191 | return rtnStr; | 191 | return rtnStr; |
192 | } | 192 | } |
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 8535a683..2f242414 100644 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -177,8 +177,8 @@ function GLRectangle() | |||
177 | this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); | 177 | this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); |
178 | this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) ); | 178 | this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) ); |
179 | this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); | 179 | this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); |
180 | var strokeMaterialName = Number( this.getPropertyFromString( "strokeMat: ", importStr ) ); | 180 | var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); |
181 | var fillMaterialName = Number( this.getPropertyFromString( "fillMat: ", importStr ) ); | 181 | var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); |
182 | this._strokeStyle = Number( this.getPropertyFromString( "strokeColor: ", importStr ) ); | 182 | this._strokeStyle = Number( this.getPropertyFromString( "strokeColor: ", importStr ) ); |
183 | this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); | 183 | this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); |
184 | this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); | 184 | this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); |
@@ -312,72 +312,71 @@ function GLRectangle() | |||
312 | var width = Math.round(this.getWidth()), | 312 | var width = Math.round(this.getWidth()), |
313 | height = Math.round(this.getHeight()); | 313 | height = Math.round(this.getHeight()); |
314 | 314 | ||
315 | // get the top left point | ||
316 | pt = [inset, inset]; // top left corner | 315 | pt = [inset, inset]; // top left corner |
317 | rad = this.getTLRadius() - inset; | ||
318 | if (rad < 0) rad = 0; | ||
319 | pt[1] += rad; | ||
320 | if (MathUtils.fpSign(rad) == 0) pt[1] = 0; | ||
321 | ctx.moveTo( pt[0], pt[1] ); | ||
322 | |||
323 | // get the bottom left point | ||
324 | pt = [inset, height - inset]; | ||
325 | rad = this.getBLRadius() - inset; | ||
326 | if (rad < 0) rad = 0; | ||
327 | pt[1] -= rad; | ||
328 | ctx.lineTo( pt[0], pt[1] ); | ||
329 | |||
330 | // get the bottom left arc | ||
331 | if (MathUtils.fpSign(rad) > 0) | ||
332 | { | ||
333 | ctr = [ this.getBLRadius(), height - this.getBLRadius() ]; | ||
334 | //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx ); | ||
335 | ctx.arc( ctr[0], ctr[1], rad, Math.PI, 0.5*Math.PI, true ); | ||
336 | } | ||
337 | |||
338 | // do the bottom of the rectangle | ||
339 | pt = [width - inset, height - inset]; | ||
340 | rad = this.getBRRadius() - inset; | ||
341 | if (rad < 0) rad = 0; | ||
342 | pt[0] -= rad; | ||
343 | ctx.lineTo( pt[0], pt[1] ); | ||
344 | |||
345 | // get the bottom right arc | ||
346 | if (MathUtils.fpSign(rad) > 0) | ||
347 | { | ||
348 | ctr = [width - this.getBRRadius(), height - this.getBRRadius()]; | ||
349 | //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx ); | ||
350 | ctx.arc( ctr[0], ctr[1], rad, 0.5*Math.PI, 0.0, true ); | ||
351 | } | ||
352 | 316 | ||
353 | // get the right of the rectangle | 317 | var tlRad = this._tlRadius; //top-left radius |
354 | pt = [width - inset, inset]; | 318 | var trRad = this._trRadius; |
355 | rad = this.getTRRadius() - inset; | 319 | var blRad = this._blRadius; |
356 | if (rad < 0) rad = 0; | 320 | var brRad = this._brRadius; |
357 | pt[1] += rad; | ||
358 | ctx.lineTo( pt[0], pt[1] ); | ||
359 | 321 | ||
360 | // do the top right corner | 322 | if ((tlRad <= 0) && (blRad <= 0) && (brRad <= 0) && (trRad <= 0)) |
361 | if (MathUtils.fpSign(rad) > 0) | ||
362 | { | 323 | { |
363 | ctr = [width - this.getTRRadius(), this.getTRRadius()]; | 324 | ctx.rect(pt[0], pt[1], width - 2*inset, height - 2*inset); |
364 | //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx ); | ||
365 | ctx.arc( ctr[0], ctr[1], rad, 0.0, -0.5*Math.PI, true ); | ||
366 | } | 325 | } |
367 | 326 | else | |
368 | // do the top of the rectangle | ||
369 | pt = [inset, inset] | ||
370 | rad = this.getTLRadius() - inset; | ||
371 | if (rad < 0) rad = 0; | ||
372 | pt[0] += rad; | ||
373 | ctx.lineTo( pt[0], pt[1] ); | ||
374 | |||
375 | // do the top left corner | ||
376 | if (MathUtils.fpSign(rad) > 0) | ||
377 | { | 327 | { |
378 | ctr = [this.getTLRadius(), this.getTLRadius()]; | 328 | // get the top left point |
379 | //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx ); | 329 | rad = tlRad - inset; |
380 | ctx.arc( ctr[0], ctr[1], rad, -0.5*Math.PI, Math.PI, true ); | 330 | if (rad < 0) rad = 0; |
331 | pt[1] += rad; | ||
332 | if (MathUtils.fpSign(rad) == 0) pt[1] = inset; | ||
333 | ctx.moveTo( pt[0], pt[1] ); | ||
334 | |||
335 | // get the bottom left point | ||
336 | pt = [inset, height - inset]; | ||
337 | rad = blRad - inset; | ||
338 | if (rad < 0) rad = 0; | ||
339 | pt[1] -= rad; | ||
340 | ctx.lineTo( pt[0], pt[1] ); | ||
341 | |||
342 |