diff options
Diffstat (limited to 'js/helper-classes/RDGE/GLRectangle.js')
-rw-r--r-- | js/helper-classes/RDGE/GLRectangle.js | 65 |
1 files changed, 5 insertions, 60 deletions
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 7fe03022..f6f5a899 100644 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -33,14 +33,6 @@ function GLRectangle() | |||
33 | 33 | ||
34 | this._strokeWidth = 0.25; | 34 | this._strokeWidth = 0.25; |
35 | 35 | ||
36 | // stroke and fill colors | ||
37 | this._strokeColor; | ||
38 | this._fillColor; | ||
39 | |||
40 | // stroke and fill materials | ||
41 | this._fillMaterial; | ||
42 | this._strokeMaterial; | ||
43 | |||
44 | this._strokeStyle = "Solid"; | 36 | this._strokeStyle = "Solid"; |
45 | this.init = function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, | 37 | this.init = function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, |
46 | tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle) | 38 | tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle) |
@@ -280,8 +272,8 @@ function GLRectangle() | |||
280 | 272 | ||
281 | // stroke | 273 | // stroke |
282 | var strokeMaterial = this.makeStrokeMaterial(); | 274 | var strokeMaterial = this.makeStrokeMaterial(); |
283 | prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius); | 275 | var strokePrim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial); |
284 | this._primArray.push( prim ); | 276 | this._primArray.push( strokePrim ); |
285 | this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); | 277 | this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); |
286 | 278 | ||
287 | // fill | 279 | // fill |
@@ -292,60 +284,13 @@ function GLRectangle() | |||
292 | xFill -= strokeSize; | 284 | xFill -= strokeSize; |
293 | yFill -= strokeSize; | 285 | yFill -= strokeSize; |
294 | var fillMaterial = this.makeFillMaterial(); | 286 | var fillMaterial = this.makeFillMaterial(); |
295 | prim = this.createFill([x,y], 2*xFill, 2*yFill, tlRadius, blRadius, brRadius, trRadius, fillMaterial) | 287 | var fillPrim = this.createFill([x,y], 2*xFill, 2*yFill, tlRadius, blRadius, brRadius, trRadius, fillMaterial); |
296 | this._primArray.push( prim ); | 288 | this._primArray.push( fillPrim ); |
297 | this._materialNodeArray.push( fillMaterial.getMaterialNode() ); | 289 | this._materialNodeArray.push( fillMaterial.getMaterialNode() ); |
298 | 290 | ||
299 | world.updateObject(this); | 291 | world.updateObject(this); |
300 | } | 292 | } |
301 | 293 | ||
302 | this.makeStrokeMaterial = function() | ||
303 | { | ||
304 | var strokeMaterial; | ||
305 | if (this.getStrokeMaterial()) | ||
306 | strokeMaterial = this.getStrokeMaterial().dup(); | ||
307 | else | ||
308 | strokeMaterial = new FlatMaterial(); | ||
309 | |||
310 | if (strokeMaterial) | ||
311 | { | ||
312 | strokeMaterial.init( this.getWorld() ); | ||
313 | if(this._strokeColor) | ||
314 | { | ||
315 | strokeMaterial.setProperty("color", this._strokeColor); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | this._materialArray.push( strokeMaterial ); | ||
320 | this._materialTypeArray.push( "stroke" ); | ||
321 | |||
322 | return strokeMaterial; | ||
323 | } | ||
324 | |||
325 | this.makeFillMaterial = function() | ||
326 | { | ||
327 | var fillMaterial; | ||
328 | if (this.getFillMaterial()) | ||
329 | fillMaterial = this.getFillMaterial().dup(); | ||
330 | else | ||
331 | fillMaterial = new FlatMaterial(); | ||
332 | |||
333 | if (fillMaterial) | ||
334 | { | ||
335 | fillMaterial.init( this.getWorld() ); | ||
336 | //if(!this.getFillMaterial() && this._fillColor) | ||
337 | if (this._fillColor) | ||
338 | { | ||
339 | fillMaterial.setProperty("color", this._fillColor); | ||
340 | } | ||
341 | } | ||
342 | |||
343 | this._materialArray.push( fillMaterial ); | ||
344 | this._materialTypeArray.push( "fill" ); | ||
345 | |||
346 | return fillMaterial; | ||
347 | } | ||
348 | |||
349 | this.renderQuadraticBezier = function( bPts, ctx ) | 294 | this.renderQuadraticBezier = function( bPts, ctx ) |
350 | { | 295 | { |
351 | if (!bPts) return; | 296 | if (!bPts) return; |
@@ -1253,7 +1198,7 @@ ShapePrimitive.create = function(coords, normals, uvs, indices, primType, ver | |||
1253 | "a_normal":{'type':renderer.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': renderer.BUFFER_STATIC}, | 1198 | "a_normal":{'type':renderer.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': renderer.BUFFER_STATIC}, |
1254 | 1199 | ||
1255 | "texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, | 1200 | "texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, |
1256 | "a_texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, | 1201 | "a_texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC} |
1257 | }; | 1202 | }; |
1258 | 1203 | ||
1259 | 1204 | ||