aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/RDGE/GLCircle.js3
-rwxr-xr-xjs/helper-classes/RDGE/GLLine.js70
-rwxr-xr-xjs/helper-classes/RDGE/GLMaterial.js11
-rwxr-xr-xjs/helper-classes/RDGE/GLRectangle.js162
-rwxr-xr-xjs/helper-classes/RDGE/GLWorld.js75
-rwxr-xr-xjs/helper-classes/RDGE/Materials/BrickMaterial.js231
-rwxr-xr-xjs/helper-classes/RDGE/Materials/BumpMetalMaterial.js48
-rwxr-xr-xjs/helper-classes/RDGE/Materials/FlatMaterial.js60
-rwxr-xr-xjs/helper-classes/RDGE/Materials/IridescentScalesMaterial.js215
-rwxr-xr-xjs/helper-classes/RDGE/Materials/JuliaMaterial.js150
-rwxr-xr-xjs/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js149
-rwxr-xr-xjs/helper-classes/RDGE/Materials/LinearGradientMaterial.js148
-rwxr-xr-xjs/helper-classes/RDGE/Materials/MandelMaterial.js151
-rwxr-xr-xjs/helper-classes/RDGE/Materials/PlasmaMaterial.js134
-rwxr-xr-xjs/helper-classes/RDGE/Materials/PulseMaterial.js237
-rwxr-xr-xjs/helper-classes/RDGE/Materials/QuiltMaterial.js168
-rwxr-xr-xjs/helper-classes/RDGE/Materials/RadialBlurMaterial.js244
-rwxr-xr-xjs/helper-classes/RDGE/Materials/RadialGradientMaterial.js87
-rwxr-xr-xjs/helper-classes/RDGE/Materials/StitchMaterial.js119
-rwxr-xr-xjs/helper-classes/RDGE/Materials/TunnelMaterial.js133
-rwxr-xr-xjs/helper-classes/RDGE/Materials/TwistMaterial.js149
-rwxr-xr-xjs/helper-classes/RDGE/Materials/UberMaterial.js56
-rwxr-xr-xjs/helper-classes/RDGE/MaterialsLibrary.js38
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js57
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js22
25 files changed, 548 insertions, 2369 deletions
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 942eb528..08057778 100755
--- 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..5ec51230 100755
--- a/js/helper-classes/RDGE/GLLine.js
+++ b/js/helper-classes/RDGE/GLLine.js
@@ -28,6 +28,8 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
28 this._strokeWidth = 0.25; 28 this._strokeWidth = 0.25;
29 29
30 this._strokeStyle = "Solid"; 30 this._strokeStyle = "Solid";
31 this._scaleX = 1.0;
32 this._scaleY = 1.0;
31 33
32 if (arguments.length > 0) 34 if (arguments.length > 0)
33 { 35 {
@@ -44,13 +46,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
44 this._strokeColor = strokeColor; 46 this._strokeColor = strokeColor;
45 47
46 this._strokeStyle = strokeStyle; 48 this._strokeStyle = strokeStyle;
49 this._scaleX = (world.getViewportWidth())/(world.getViewportHeight());
47 } 50 }
48 51
49 this._scaleX = 1.0;
50 this._scaleY = 1.0;
51
52 this._scaleX = (world._viewportWidth)/(world._viewportHeight);
53
54 this._strokeVerticesLen = 0; 52 this._strokeVerticesLen = 0;
55 53
56 this.m_world = world; 54 this.m_world = world;
@@ -104,7 +102,64 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
104 this.setSlope = function(m) { this._slope = m; } 102 this.setSlope = function(m) { this._slope = m; }
105 103
106 this.geomType = function() { return this.GEOM_TYPE_LINE; } 104 this.geomType = function() { return this.GEOM_TYPE_LINE; }
107 105
106 ///////////////////////////////////////////////////////////////////////
107 // Methods
108 ///////////////////////////////////////////////////////////////////////
109 this.export = function()
110 {
111 var rtnStr = "type: " + this.geomType() + "\n";
112
113 rtnStr += "xoff: " + this._xOffset + "\n";
114 rtnStr += "yoff: " + this._yOffset + "\n";
115 rtnStr += "width: " + this._width + "\n";
116 rtnStr += "height: " + this._height + "\n";
117 rtnStr += "xAdj: " + this._xAdj + "\n";
118 rtnStr += "yAdj: " + this._yAdj + "\n";
119 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
120 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
121 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
122 rtnStr += "slope: " + String(this._slope) + "\n";
123
124 rtnStr += "strokeMat: ";
125 if (this._strokeMaterial)
126 rtnStr += this._strokeMaterial.getName();
127 else
128 rtnStr += "flatMaterial";
129 rtnStr += "\n";
130
131 return rtnStr;
132 }
133
134 this.import = function( importStr )
135 {
136 this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) );
137 this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) );
138 this._width = Number( this.getPropertyFromString( "width: ", importStr ) );
139 this._height = Number( this.getPropertyFromString( "height: ", importStr ) );
140 this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) );
141 this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) );
142 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) );
143 var slope = this.getPropertyFromString( "slope: ", importStr );
144 if(isNaN(Number(slope)))
145 this._slope = slope;
146 else
147 this._slope = Number(slope);
148
149 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
150 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
151 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
152
153 var strokeMat = MaterialsLibrary.getMaterial( strokeMaterialName );
154 if (!strokeMat)
155 {
156 console.log( "object material not found in library: " + strokeMaterialName );
157 strokeMat = new FlatMaterial();
158 }
159 this._strokeMaterial = strokeMat;
160
161 }
162
108 /////////////////////////////////////////////////////////////////////// 163 ///////////////////////////////////////////////////////////////////////
109 // Methods 164 // Methods
110 /////////////////////////////////////////////////////////////////////// 165 ///////////////////////////////////////////////////////////////////////
@@ -114,6 +169,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
114 var world = this.getWorld(); 169 var world = this.getWorld();
115 if (!world) throw( "null world in buildBuffers" ); 170 if (!world) throw( "null world in buildBuffers" );
116 if (!world._useWebGL) return; 171 if (!world._useWebGL) return;
172
173 // make sure RDGE has the correct context
174 g_Engine.setContext( world.getCanvas().uuid );
117 175
118 // create the gl buffer 176 // create the gl buffer
119 var gl = world.getGLContext(); 177 var gl = world.getGLContext();
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js
index e72b7908..642fab05 100755
--- 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..4216fe53 100755
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -180,7 +180,7 @@ function GLRectangle()
180 this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); 180 this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) );
181 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); 181 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
182 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); 182 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr );
183 this._strokeStyle = Number( this.getPropertyFromString( "strokeColor: ", importStr ) ); 183 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", 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 ) + "]" );
186 this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) ); 186 this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) );
@@ -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