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/GLCircle.js3
-rw-r--r--js/helper-classes/RDGE/GLLine.js3
-rw-r--r--js/helper-classes/RDGE/GLMaterial.js11
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js295
-rw-r--r--js/helper-classes/RDGE/GLWorld.js59
-rw-r--r--js/helper-classes/RDGE/Materials/BrickMaterial.js231
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js33
-rw-r--r--js/helper-classes/RDGE/Materials/IridescentScalesMaterial.js215
-rw-r--r--js/helper-classes/RDGE/Materials/JuliaMaterial.js150
-rw-r--r--js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js149
-rw-r--r--js/helper-classes/RDGE/Materials/LinearGradientMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/MandelMaterial.js151
-rw-r--r--js/helper-classes/RDGE/Materials/PlasmaMaterial.js134
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js237
-rw-r--r--js/helper-classes/RDGE/Materials/QuiltMaterial.js168
-rw-r--r--js/helper-classes/RDGE/Materials/RadialBlurMaterial.js244
-rw-r--r--js/helper-classes/RDGE/Materials/RadialGradientMaterial.js1
-rw-r--r--js/helper-classes/RDGE/Materials/StitchMaterial.js119
-rw-r--r--js/helper-classes/RDGE/Materials/TunnelMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/TwistMaterial.js149
-rw-r--r--js/helper-classes/RDGE/Materials/UberMaterial.js12
-rw-r--r--js/helper-classes/RDGE/MaterialsLibrary.js38
-rw-r--r--js/helper-classes/RDGE/rdge-compiled.js57
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderer.js22
24 files changed, 353 insertions, 2265 deletions
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 942eb528..08057778 100644
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -133,6 +133,9 @@ function GLCircle()
133 if (!world) throw( "null world in buildBuffers" ); 133 if (!world) throw( "null world in buildBuffers" );
134 134
135 if (!world._useWebGL) return; 135 if (!world._useWebGL) return;
136
137 // make sure RDGE has the correct context
138 g_Engine.setContext( world.getCanvas().uuid );
136 139
137 // create the gl buffer 140 // create the gl buffer
138 var gl = world.getGLContext(); 141 var gl = world.getGLContext();
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js
index 67379b52..1cd70575 100644
--- a/js/helper-classes/RDGE/GLLine.js
+++ b/js/helper-classes/RDGE/GLLine.js
@@ -114,6 +114,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
114 var world = this.getWorld(); 114 var world = this.getWorld();
115 if (!world) throw( "null world in buildBuffers" ); 115 if (!world) throw( "null world in buildBuffers" );
116 if (!world._useWebGL) return; 116 if (!world._useWebGL) return;
117
118 // make sure RDGE has the correct context
119 g_Engine.setContext( world.getCanvas().uuid );
117 120
118 // create the gl buffer 121 // create the gl buffer
119 var gl = world.getGLContext(); 122 var gl = world.getGLContext();
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js
index e72b7908..642fab05 100644
--- a/js/helper-classes/RDGE/GLMaterial.js
+++ b/js/helper-classes/RDGE/GLMaterial.js
@@ -31,6 +31,11 @@ function GLMaterial( world )
31 31
32 this._texture; 32 this._texture;
33 33
34 // vertex deformation variables
35 this._hasVertexDeformation = false;
36 this._vertexDeformationRange = [0, 0, 1, 1]; // (xMin, yMin, xMax, yMax)
37 this._vertexDeformationTolerance = 0.1;
38
34 // RDGE variables 39 // RDGE variables
35 this._shader; 40 this._shader;
36 this._materialNode; 41 this._materialNode;
@@ -66,6 +71,12 @@ function GLMaterial( world )
66 // Any material needing continuous rendering should override this method 71 // Any material needing continuous rendering should override this method
67 this.isAnimated = function() { return false; } 72 this.isAnimated = function() { return false; }
68 73
74 // the vertex shader can apply deformations requiring refinement in
75 // certain areas.
76 this.hasVertexDeformation = function() { return this._hasVertexDeformation; }
77 this.getVertexDeformationRange = function() { return this._vertexDeformationRange.slice(); }
78 this.getVertexDeformationTolerance = function() { return this._vertexDeformationTolerance; }
79
69 80
70 /////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////
71 // Common Material Methods 82 // Common Material Methods
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index 2899e476..e34532d2 100644
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -210,8 +210,11 @@ function GLRectangle()
210 // get the world 210 // get the world
211 var world = this.getWorld(); 211 var world = this.getWorld();
212 if (!world) throw( "null world in buildBuffers" ); 212 if (!world) throw( "null world in buildBuffers" );
213 213 //console.log( "GLRectangle.buildBuffers " + world._worldCount );
214 if (!world._useWebGL) return; 214 if (!world._useWebGL) return;
215
216 // make sure RDGE has the correct context
217 g_Engine.setContext( world.getCanvas().uuid );
215 218
216 // create the gl buffer 219 // create the gl buffer
217 var gl = world.getGLContext(); 220 var gl = world.getGLContext();
@@ -284,6 +287,7 @@ function GLRectangle()
284 xFill -= strokeSize; 287 xFill -= strokeSize;
285 yFill -= strokeSize; 288 yFill -= strokeSize;
286 var fillMaterial = this.makeFillMaterial(); 289 var fillMaterial = this.makeFillMaterial();
290 //console.log( "fillMaterial: " + fillMaterial.getName() );
287 var fillPrim = this.createFill([x,y], 2*xFill, 2*yFill, tlRadius, blRadius, brRadius, trRadius, fillMaterial); 291 var fillPrim = this.createFill([x,y], 2*xFill, 2*yFill, tlRadius, blRadius, brRadius, trRadius, fillMaterial);
288 this._primArray.push( fillPrim ); 292 this._primArray.push( fillPrim );
289 this._materialNodeArray.push( fillMaterial.getMaterialNode() ); 293 this._materialNodeArray.push( fillMaterial.getMaterialNode() );
@@ -313,71 +317,72 @@ function GLRectangle()
313 var width = Math.round(this.getWidth()), 317 var width = Math.round(this.getWidth()),
314 height = Math.round(this.getHeight()); 318 height = Math.round(this.getHeight());
315 319
320 // get the top left point
316 pt = [inset, inset]; // top left corner 321 pt = [inset, inset]; // top left corner
322 rad = this.getTLRadius() - inset;
323 if (rad < 0) rad = 0;
324 pt[1] += rad;
325 if (MathUtils.fpSign(rad) == 0) pt[1] = 0;
326 ctx.moveTo( pt[0], pt[1] );
327
328 // get the bottom left point
329 pt = [inset, height - inset];
330 rad = this.getBLRadius() - inset;
331 if (rad < 0) rad = 0;
332 pt[1] -= rad;
333 ctx.lineTo( pt[0], pt[1] );
334
335 // get the bottom left arc
336 if (MathUtils.fpSign(rad) > 0)
337 {
338 ctr = [ this.getBLRadius(), height - this.getBLRadius() ];
339 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
340 ctx.arc( ctr[0], ctr[1], rad, Math.PI, 0.5*Math.PI, true );
341 }
317 342
318 var tlRad = this._tlRadius; //top-left radius 343 // do the bottom of the rectangle
319 var trRad = this._trRadius; 344 pt = [width - inset, height - inset];
320 var blRad = this._blRadius; 345 rad = this.getBRRadius() - inset;
321 var brRad = this._brRadius; 346 if (rad < 0) rad = 0;
347 pt[0] -= rad;
348 ctx.lineTo( pt[0], pt[1] );
322 349
323 if ((tlRad <= 0) && (blRad <= 0) && (brRad <= 0) && (trRad <= 0)) 350 // get the bottom right arc
351 if (MathUtils.fpSign(rad) > 0)
324 { 352 {
325 ctx.rect(pt[0], pt[1], width - 2*inset, height - 2*inset); 353 ctr = [width - this.getBRRadius(), height - this.getBRRadius()];
354 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
355 ctx.arc( ctr[0], ctr[1], rad, 0.5*Math.PI, 0.0, true );
326 } 356 }
327 else 357
358 // get the right of the rectangle
359 pt = [width - inset, inset];
360 rad = this.getTRRadius() - inset;
361 if (rad < 0) rad = 0;
362 pt[1] += rad;
363 ctx.lineTo( pt[0], pt[1] );
364
365 // do the top right corner
366 if (MathUtils.fpSign(rad) > 0)
367 {
368 ctr = [width - this.getTRRadius(), this.getTRRadius()];
369 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
370 ctx.arc( ctr[0], ctr[1], rad, 0.0, -0.5*Math.PI, true );
371 }
372
373 // do the top of the rectangle
374 pt = [inset, inset]
375 rad = this.getTLRadius() - inset;
376 if (rad < 0) rad = 0;
377 pt[0] += rad;
378 ctx.lineTo( pt[0], pt[1] );
379
380 // do the top left corner
381 if (MathUtils.fpSign(rad) > 0)
328 { 382 {
329 // get the top left point 383 ctr = [this.getTLRadius(), this.getTLRadius()];
330 rad = tlRad - inset; 384 //this.renderQuadraticBezier( MathUtils.circularArcToBezier( ctr, pt, -0.5*Math.PI ), ctx );
331 if (rad < 0) rad = 0; 385 ctx.arc( ctr[0], ctr[1], rad, -0.5*Math.PI, Math.PI, true );
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;