aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes')
-rw-r--r--js/helper-classes/RDGE/GLCircle.js10
-rw-r--r--js/helper-classes/RDGE/GLGeomObj.js3
-rw-r--r--js/helper-classes/RDGE/GLMaterial.js40
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js157
-rw-r--r--js/helper-classes/RDGE/GLWorld.js221
-rw-r--r--js/helper-classes/RDGE/Materials/BumpMetalMaterial.js66
-rw-r--r--js/helper-classes/RDGE/Materials/DeformMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js44
-rw-r--r--js/helper-classes/RDGE/Materials/FlyMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/IridescentScalesMaterial.js5
-rw-r--r--js/helper-classes/RDGE/Materials/JuliaMaterial.js3
-rw-r--r--js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js3
-rw-r--r--js/helper-classes/RDGE/Materials/LinearGradientMaterial.js8
-rw-r--r--js/helper-classes/RDGE/Materials/MandelMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/PlasmaMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js15
-rw-r--r--js/helper-classes/RDGE/Materials/RadialBlurMaterial.js5
-rw-r--r--js/helper-classes/RDGE/Materials/RadialGradientMaterial.js188
-rw-r--r--js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/StarMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/TunnelMaterial.js3
-rw-r--r--js/helper-classes/RDGE/Materials/TwistMaterial.js3
-rw-r--r--js/helper-classes/RDGE/Materials/UberMaterial.js25
-rw-r--r--js/helper-classes/RDGE/Materials/WaterMaterial.js133
-rw-r--r--js/helper-classes/RDGE/Materials/ZInvertMaterial.js133
-rw-r--r--js/helper-classes/RDGE/MaterialsLibrary.js61
-rw-r--r--js/helper-classes/RDGE/rdge-compiled.js102
-rw-r--r--js/helper-classes/RDGE/src/core/script/engine.js18
-rw-r--r--js/helper-classes/RDGE/src/core/script/init_state.js7
-rw-r--r--js/helper-classes/RDGE/src/core/script/jshader.js6
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderer.js27
-rw-r--r--js/helper-classes/RDGE/src/core/script/run_state.js10
-rw-r--r--js/helper-classes/RDGE/src/core/script/runtime.js2
34 files changed, 1717 insertions, 252 deletions
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index fc2e6460..8f7a5d30 100644
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -63,14 +63,16 @@ function GLCircle()
63 63
64 this.m_world = world; 64 this.m_world = world;
65 65
66
66 if(strokeMaterial) 67 if(strokeMaterial)
67 {
68 this._strokeMaterial = strokeMaterial; 68 this._strokeMaterial = strokeMaterial;
69 } 69 else
70 this._strokeMaterial = new FlatMaterial();
71
70 if(fillMaterial) 72 if(fillMaterial)
71 {
72 this._fillMaterial = fillMaterial; 73 this._fillMaterial = fillMaterial;
73 } 74 else
75 this._fillMaterial = new FlatMaterial();
74 } 76 }
75 77
76 /////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////
diff --git a/js/helper-classes/RDGE/GLGeomObj.js b/js/helper-classes/RDGE/GLGeomObj.js
index 72019703..e04b3283 100644
--- a/js/helper-classes/RDGE/GLGeomObj.js
+++ b/js/helper-classes/RDGE/GLGeomObj.js
@@ -99,6 +99,9 @@ function GLGeomObj()
99 } 99 }
100 } 100 }
101 } 101 }
102
103 var world = this.getWorld();
104 if (world) world.restartRenderLoop();
102 } 105 }
103 106
104 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); } 107 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); }
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js
index 51c27ace..07a98ab5 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.05;
38
34 // RDGE variables 39 // RDGE variables
35 this._shader; 40 this._shader;
36 this._materialNode; 41 this._materialNode;
@@ -62,6 +67,16 @@ function GLMaterial( world )
62 this.getShader = function() { return this._shader; } 67 this.getShader = function() { return this._shader; }
63 this.getMaterialNode = function() { return this._materialNode; } 68 this.getMaterialNode = function() { return this._materialNode; }
64 69
70 // a material can be animated or not. default is not.
71 // Any material needing continuous rendering should override this method
72 this.isAnimated = function() { return false; }
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
65 80
66 /////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////
67 // Common Material Methods 82 // Common Material Methods
@@ -174,6 +189,31 @@ function GLMaterial( world )
174 // animated materials should implement the update method 189 // animated materials should implement the update method
175 } 190 }
176 191
192 this.registerTexture = function( texture )
193 {
194 // the world needs to know about the texture map
195 var world = this.getWorld();
196 if (!world)
197 console.log( "**** world not defined for registering texture map: " + texture.lookUpName );
198 else
199 world.textureToLoad( texture );
200 }
201
202 this.loadTexture = function( texMapName, wrap, mips )
203 {
204 var tex;
205 var world = this.getWorld();
206 if (!world)
207 console.log( "world not defined for material with texture map" );
208 else
209 {
210 var renderer = world.getRenderer();
211 tex = renderer.getTextureByName(texMapName, wrap, mips );
212 this.registerTexture( tex );
213 }
214 return tex;
215 }
216
177 this.export = function() 217 this.export = function()
178 { 218 {
179 // this function should be overridden by subclasses 219 // this function should be overridden by subclasses
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index 1334d7e6..e72b4488 100644
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -80,13 +80,14 @@ function GLRectangle()
80 this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; 80 this._materialSpecular = [0.4, 0.4, 0.4, 1.0];
81 81
82 if(strokeMaterial) 82 if(strokeMaterial)
83 {
84 this._strokeMaterial = strokeMaterial; 83 this._strokeMaterial = strokeMaterial;
85 } 84 else
85 this._strokeMaterial = new FlatMaterial();
86
86 if(fillMaterial) 87 if(fillMaterial)
87 {
88 this._fillMaterial = fillMaterial; 88 this._fillMaterial = fillMaterial;
89 } 89 else
90 this._fillMaterial = new FlatMaterial();
90 } 91 }
91 92
92 /////////////////////////////////////////////////////////////////////// 93 ///////////////////////////////////////////////////////////////////////
@@ -279,7 +280,7 @@ function GLRectangle()
279 280
280 // stroke 281 // stroke
281 var strokeMaterial = this.makeStrokeMaterial(); 282 var strokeMaterial = this.makeStrokeMaterial();
282 prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial) 283 prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius);
283 this._primArray.push( prim ); 284 this._primArray.push( prim );
284 this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 285 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
285 286
@@ -485,7 +486,7 @@ function GLRectangle()
485 this.createStroke = function(ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad, material) 486 this.createStroke = function(ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad, material)
486 { 487 {
487 // create the geometry 488 // create the geometry
488 var prim = RectangleStroke.create( ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad) 489 var prim = RectangleStroke.create( ctr, width, height, strokeWidth, tlRad, blRad, brRad, trRad, material)
489 return prim; 490 return prim;
490 } 491 }
491 492
@@ -495,9 +496,9 @@ function GLRectangle()
495 // special the (common) case of no rounded corners 496 // special the (common) case of no rounded corners
496 var prim 497