aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE')
-rw-r--r--js/helper-classes/RDGE/GLLine.js29
-rw-r--r--js/helper-classes/RDGE/GLMaterial.js2
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js141
-rw-r--r--js/helper-classes/RDGE/Materials/BumpMetalMaterial.js10
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js31
-rw-r--r--js/helper-classes/RDGE/Materials/UberMaterial.js6
-rw-r--r--js/helper-classes/RDGE/MaterialsLibrary.js2
7 files changed, 115 insertions, 106 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 c633f679..e72b7908 100644
--- a/js/helper-classes/RDGE/GLMaterial.js
+++ b/js/helper-classes/RDGE/GLMaterial.js
@@ -215,7 +215,7 @@ function GLMaterial( world )
215 var endKey = "endMaterial\n"; 215 var endKey = "endMaterial\n";
216 var index = importStr.indexOf( endKey ); 216 var index = importStr.indexOf( endKey );
217 index += endKey.length; 217 index += endKey.length;
218 rtnStr = importStr.substr( index ); 218 var rtnStr = importStr.substr( index );
219 219
220 return rtnStr; 220 return rtnStr;
221 } 221 }
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index 871e9ae4..2899e476 100644
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -178,8 +178,8 @@ function GLRectangle()
178 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); 178 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) );
179 this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) ); 179 this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) );
180 this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); 180 this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) );
181 var strokeMaterialName = Number( this.getPropertyFromString( "strokeMat: ", importStr ) ); 181 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
182 var fillMaterialName = Number( this.getPropertyFromString( "fillMat: ", importStr ) ); 182 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr );
183 this._strokeStyle = Number( this.getPropertyFromString( "strokeColor: ", importStr ) ); 183 this._strokeStyle = Number( this.getPropertyFromString( "strokeColor: ", importStr ) );
184 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); 184 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" );
185 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); 185 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
@@ -313,72 +313,71 @@ function GLRectangle()
313 var width = Math.round(this.getWidth()), 313 var width = Math.round(this.getWidth()),
314 height = Math.round(this.getHeight()); 314 height = Math.round(this.getHeight());
315 315
316 // get the top left point
317 pt = [inset, inset]; // top left corner 316 pt = [inset, inset]; // top left corner
318 rad = this.getTLRadius() - inset;
319 if (rad < 0) rad = 0;
320 pt[1] += rad;
321 if (MathUtils.fpSign(rad) == 0) pt[1] = 0;
322 ctx.moveTo( pt[0], pt[1] );
323
324 // get the bottom left point
325 pt = [inset, height - inset];
326 rad = this.getBLRadius() - inset;
327 if (rad < 0) rad = 0;
328 pt[1] -= rad;
329 ctx.lineTo( pt[0], pt[1] );
330
331 // get the bottom left arc
332 if (MathUtils.fpSign(rad) > 0)
333 {
334 ctr = [ this.getBLRadius(), height - this.getBLRadius() ];
335 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
336 ctx.arc( ctr[0], ctr[1], rad, Math.PI, 0.5*Math.PI, true );
337 }
338
339 // do the bottom of the rectangle
340 pt = [width - inset, height - inset];
341 rad = this.getBRRadius() - inset;
342 if (rad < 0) rad = 0;
343 pt[0] -= rad;
344 ctx.lineTo( pt[0], pt[1] );
345
346 // get the bottom right arc
347 if (MathUtils.fpSign(rad) > 0)
348 {
349 ctr = [width - this.getBRRadius(), height - this.getBRRadius()];
350 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
351 ctx.arc( ctr[0], ctr[1], rad, 0.5*Math.PI, 0.0, true );
352 }
353 317
354 // get the right of the rectangle 318 var tlRad = this._tlRadius; //top-left radius
355 pt = [width - inset, inset]; 319 var trRad = this._trRadius;
356 rad = this.getTRRadius() - inset; 320 var blRad = this._blRadius;
357 if (rad < 0) rad = 0; 321 var brRad = this._brRadius;
358 pt[1] += rad;
359 ctx.lineTo( pt[0], pt[1] );
360 322
361 // do the top right corner 323 if ((tlRad <= 0) && (blRad <= 0) && (brRad <= 0) && (trRad <= 0))
362 if (MathUtils.fpSign(rad) > 0)
363 { 324 {
364 ctr = [width - this.getTRRadius(), this.getTRRadius()]; 325 ctx.rect(pt[0], pt[1], width - 2*inset, height - 2*inset);
365 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
366 ctx.arc( ctr[0], ctr[1], rad, 0.0, -0.5*Math.PI, true );
367 } 326 }
368 327 else
369 // do the top of the rectangle
370 pt = [inset, inset]
371 rad = this.getTLRadius() - inset;
372 if (rad < 0) rad = 0;
373 pt[0] += rad;
374 ctx.lineTo( pt[0], pt[1] );
375
376 // do the top left corner
377 if (MathUtils.fpSign(rad) > 0)
378 { 328 {
379 ctr = [this.getTLRadius(), this.getTLRadius()]; 329 // get the top left point
380 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx ); 330 rad = tlRad - inset;
381 ctx.arc( ctr[0], ctr[1], rad, -0.5*Math.PI, Math.PI, true ); 331 if (rad < 0) rad = 0;
332 pt[1] += rad;
333 if (MathUtils.fpSign(rad) == 0) pt[1] = inset;
334 ctx.moveTo( pt[0], pt[1] );
335
336 // get the bottom left point
337 pt = [inset, height - inset];
338 rad = blRad - inset;
339 if (rad < 0) rad = 0;
340 pt[1] -= rad;
341 ctx.lineTo( pt[0], pt[1] );
342
343 // get the bottom left curve
344 if (MathUtils.fpSign(rad) > 0)