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.js10
-rw-r--r--js/helper-classes/RDGE/GLGeomObj.js3
-rw-r--r--js/helper-classes/RDGE/GLMaterial.js29
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js17
-rw-r--r--js/helper-classes/RDGE/GLWorld.js211
-rw-r--r--js/helper-classes/RDGE/Materials/BumpMetalMaterial.js66
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js2
-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.js4
-rw-r--r--js/helper-classes/RDGE/Materials/MandelMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js15
-rw-r--r--js/helper-classes/RDGE/Materials/RadialBlurMaterial.js3
-rw-r--r--js/helper-classes/RDGE/Materials/RadialGradientMaterial.js188
-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/MaterialsLibrary.js40
-rw-r--r--js/helper-classes/RDGE/rdge-compiled.js102
-rw-r--r--js/helper-classes/RDGE/src/core/script/init_state.js7
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderer.js14
-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
24 files changed, 554 insertions, 215 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..c633f679 100644
--- a/js/helper-classes/RDGE/GLMaterial.js
+++ b/js/helper-classes/RDGE/GLMaterial.js
@@ -62,6 +62,10 @@ function GLMaterial( world )
62 this.getShader = function() { return this._shader; } 62 this.getShader = function() { return this._shader; }
63 this.getMaterialNode = function() { return this._materialNode; } 63 this.getMaterialNode = function() { return this._materialNode; }
64 64
65 // a material can be animated or not. default is not.
66 // Any material needing continuous rendering should override this method
67 this.isAnimated = function() { return false; }
68
65 69
66 /////////////////////////////////////////////////////////////////////// 70 ///////////////////////////////////////////////////////////////////////
67 // Common Material Methods 71 // Common Material Methods
@@ -174,6 +178,31 @@ function GLMaterial( world )
174 // animated materials should implement the update method 178 // animated materials should implement the update method
175 } 179 }
176 180
181 this.registerTexture = function( texture )
182 {
183 // the world needs to know about the texture map
184 var world = this.getWorld();
185 if (!world)
186 console.log( "**** world not defined for registering texture map: " + texture.lookUpName );
187 else
188 world.textureToLoad( texture );
189 }
190
191 this.loadTexture = function( texMapName, wrap, mips )
192 {
193 var tex;
194 var world = this.getWorld();
195 if (!world)
196 console.log( "world not defined for material with texture map" );
197 else
198 {
199 var renderer = world.getRenderer();
200 tex = renderer.getTextureByName(texMapName, wrap, mips );
201 this.registerTexture( tex );
202 }
203 return tex;
204 }
205
177 this.export = function() 206 this.export = function()
178 { 207 {
179 // this function should be overridden by subclasses 208 // 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..bc3b1478 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 ///////////////////////////////////////////////////////////////////////
@@ -278,10 +279,10 @@ function GLRectangle()
278 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC; 279 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC;
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, strokeMaterial)
283 this._primArray.push( prim ); 284// this._primArray.push( prim );
284 this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 285// this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
285 286
286 // fill 287 // fill
287 tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0; 288 tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0;
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js
index cc44da50..dd9b6977 100644
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -65,6 +65,11 @@ function GLWorld( canvas, use3D )
65 65
66 this._camera; 66 this._camera;
67 67
68 // keep a flag indicating whether a render has been completed.
69 // this allows us to turn off automatic updating if there are
70 // no animated materials
71 this._firstRender = true;
72
68 /////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////
69 // Property accessors 74 // Property accessors
70 /////////////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////
@@ -103,6 +108,8 @@ function GLWorld( canvas, use3D )
103 108
104 this.isWebGL = function() { return this._useWebGL; } 109 this.isWebGL = function() { return this._useWebGL; }
105 110
111 this.getRenderer = function() { return this.renderer; }
112
106 //////////////////////////////////////////////////////////////////////////////////// 113 ////////////////////////////////////////////////////////////////////////////////////
107 // RDGE 114 // RDGE
108 // local variables 115 // local variables
@@ -114,6 +121,10 @@ function GLWorld( canvas, use3D )
114 this.strokeShader = null; 121 this.strokeShader = null;
115 this.renderer = null; 122 this.renderer = null;
116 123
124 // keep an array of texture maps that need to be loaded
125 this._texMapsToLoad = [];
126 this._allMapsLoaded = true;
127
117 // this is the node to which objects get hung 128 // this is the node to which objects get hung
118 this._rootNode; 129 this._rootNode;
119 130
@@ -214,18 +225,149 @@ function GLWorld( canvas, use3D )
214 { 225 {
215 if (this._useWebGL) 226 if (this._useWebGL)
216 { 227 {
217 var ctx = g_Engine.getContext(); 228 if (this._allMapsLoaded)
218 //console.log( "RDGE state: " + ctx.ctxStateManager.currentState().name); 229 {
219 230 var ctx = g_Engine.getContext();
220 var renderer = ctx.renderer; 231 //console.log( "RDGE state: " + ctx.ctxStateManager.currentState().name);
221 renderer.disableCulling(); 232
222 this.myScene.render(); 233 /////////////////////////////
234