aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLLine.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/GLLine.js')
-rw-r--r--js/helper-classes/RDGE/GLLine.js56
1 files changed, 20 insertions, 36 deletions
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js
index 9eaa69d1..67379b52 100644
--- a/js/helper-classes/RDGE/GLLine.js
+++ b/js/helper-classes/RDGE/GLLine.js
@@ -27,12 +27,6 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
27 27
28 this._strokeWidth = 0.25; 28 this._strokeWidth = 0.25;
29 29
30 // stroke colors
31 this._strokeColor = [0.4, 0.4, 0.4, 1.0];
32
33 // stroke materials
34 this._strokeMaterial;
35
36 this._strokeStyle = "Solid"; 30 this._strokeStyle = "Solid";
37 31
38 if (arguments.length > 0) 32 if (arguments.length > 0)
@@ -83,11 +77,16 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
83 this.getStrokeMaterial = function() { return this._strokeMaterial; } 77 this.getStrokeMaterial = function() { return this._strokeMaterial; }
84 this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } 78 this.setStrokeMaterial = function(m) { this._strokeMaterial = m; }
85 79
86 this.getStrokeColor = function() { return this._strokeColor; } 80 this.getStrokeColor = function() { return this._strokeColor; }
87 //this.setStrokeColor = function(c) { this._strokeColor = c; } 81 //this.setStrokeColor = function(c) { this._strokeColor = c; }
88 82
89 this.getStrokeStyle = function() { return this._strokeStyle; } 83 this.getStrokeStyle = function() { return this._strokeStyle; }
90 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; }
91 90
92 this.getWidth = function() { return this._width; } 91 this.getWidth = function() { return this._width; }
93 this.setWidth = function(w) { this._width = w; } 92 this.setWidth = function(w) { this._width = w; }
@@ -190,9 +189,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
190 xFill+x, yFill+y, 0.0, 189 xFill+x, yFill+y, 0.0,
191 -xFill+x, -yFill+y, 0.0, 190 -xFill+x, -yFill+y, 0.0,
192 191
193 xFill+x, yFill+y, 0.0, 192 xFill+x, -yFill+y, 0.0,
194 -xFill+x, -yFill+y, 0.0, 193 -xFill+x, -yFill+y, 0.0,
195 xFill+x, -yFill+y, 0.0 194 xFill+x, yFill+y, 0.0
196 ]; 195 ];
197 } 196 }
198 else if(this._slope === "horizontal") 197 else if(this._slope === "horizontal")
@@ -205,10 +204,10 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
205 xFill+x, yFill+y, 0.0, 204 xFill+x, yFill+y, 0.0,
206 -xFill+x, -yFill+y, 0.0, 205 -xFill+x, -yFill+y, 0.0,
207 206
208 xFill+x, yFill+y, 0.0, 207 xFill+x, -yFill+y, 0.0,
209 -xFill+x, -yFill+y, 0.0, 208 -xFill+x, -yFill+y, 0.0,
210 xFill+x, -yFill+y, 0.0 209 xFill+x, yFill+y, 0.0
211 ]; 210 ];
212 } 211 }
213 else if(this._slope > 0) 212 else if(this._slope > 0)
214 { 213 {
@@ -218,9 +217,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
218 -xFill+2*xAdj+x, yFill+y, 0.0, 217 -xFill+2*xAdj+x, yFill+y, 0.0,
219 xFill-2*xAdj+x, -yFill+y, 0.0, 218 xFill-2*xAdj+x, -yFill+y, 0.0,
220 219
221 -xFill+2*xAdj+x, yFill+y, 0.0, 220 xFill+x, -yFill+2*yAdj+y, 0.0,
222 xFill-2*xAdj+x, -yFill+y, 0.0, 221 xFill-2*xAdj+x, -yFill+y, 0.0,
223 xFill+x, -yFill+2*yAdj+y, 0.0 222 -xFill+2*xAdj+x, yFill+y, 0.0
224 ]; 223 ];
225 } 224 }
226 else 225 else
@@ -231,9 +230,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
231 -xFill+2*xAdj+x, -yFill+y, 0.0, 230 -xFill+2*xAdj+x, -yFill+y, 0.0,
232 xFill-2*xAdj+x, yFill+y, 0.0, 231 xFill-2*xAdj+x, yFill+y, 0.0,
233 232
234 -xFill+2*xAdj+x, -yFill+y, 0.0, 233 xFill+x, yFill-2*yAdj+y, 0.0,
235 xFill-2*xAdj+x, yFill+y, 0.0, 234 xFill-2*xAdj+x, yFill+y, 0.0,
236 xFill+x, yFill-2*yAdj+y, 0.0 235 -xFill+2*xAdj+x, -yFill+y, 0.0
237 ]; 236 ];
238 } 237 }
239 } 238 }
@@ -267,26 +266,11 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
267 } 266 }
268 267
269 var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, g_Engine.getContext().renderer.TRIANGLES, indices.length); 268 var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, g_Engine.getContext().renderer.TRIANGLES, indices.length);
270 this._primArray.push( prim );
271 269
272 var strokeMaterial; 270 var strokeMaterial = this.makeStrokeMaterial();
273 if (this.getStrokeMaterial())
274 strokeMaterial = this.getStrokeMaterial().dup();
275 else
276 strokeMaterial = new FlatMaterial();
277 271
278 if (strokeMaterial) 272 this._primArray.push( prim );
279 { 273 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
280 strokeMaterial.init( this.getWorld() );
281 if(!this.getStrokeMaterial() && this._strokeColor)
282 {
283 strokeMaterial.setProperty("color", this._strokeColor);
284 }
285 }
286
287 this._materialArray.push( strokeMaterial );
288 this._materialTypeArray.push( "stroke" );
289 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
290 274
291 world.updateObject(this); 275 world.updateObject(this);
292 } 276 }