diff options
author | Nivesh Rajbhandari | 2012-02-07 13:30:08 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-07 13:30:08 -0800 |
commit | 3a8875c288049b466bfeb8b7f0510fd8cbfb970d (patch) | |
tree | ebe632aa3960a5f93f89fbed22b8ef0ecd9f82e7 /js/helper-classes/RDGE/GLRectangle.js | |
parent | 8ad767b61460984a4031ba630f76ac8247a61857 (diff) | |
download | ninja-3a8875c288049b466bfeb8b7f0510fd8cbfb970d.tar.gz |
Supporting switching materials in the PI. Also, moved makeFillMaterial and makeStrokeMaterial functions into GLGeomObj so shapes other than GLRectangle can use these routines.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/GLRectangle.js')
-rw-r--r-- | js/helper-classes/RDGE/GLRectangle.js | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 1334d7e6..151b15a3 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) |
@@ -298,53 +290,6 @@ function GLRectangle() | |||
298 | world.updateObject(this); | 290 | world.updateObject(this); |
299 | } | 291 | } |
300 | 292 | ||
301 | this.makeStrokeMaterial = function() | ||
302 | { | ||
303 | var strokeMaterial; | ||
304 | if (this.getStrokeMaterial()) | ||
305 | strokeMaterial = this.getStrokeMaterial().dup(); | ||
306 | else | ||
307 | strokeMaterial = new FlatMaterial(); | ||
308 | |||
309 | if (strokeMaterial) | ||
310 | { | ||
311 | strokeMaterial.init( this.getWorld() ); | ||
312 | if(this._strokeColor) | ||
313 | { | ||
314 | strokeMaterial.setProperty("color", this._strokeColor); | ||
315 | } | ||
316 | } | ||
317 | |||
318 | this._materialArray.push( strokeMaterial ); | ||
319 | this._materialTypeArray.push( "stroke" ); | ||
320 | |||
321 | return strokeMaterial; | ||
322 | } | ||
323 | |||
324 | this.makeFillMaterial = function() | ||
325 | { | ||
326 | var fillMaterial; | ||
327 | if (this.getFillMaterial()) | ||
328 | fillMaterial = this.getFillMaterial().dup(); | ||
329 | else | ||
330 | fillMaterial = new FlatMaterial(); | ||
331 | |||
332 | if (fillMaterial) | ||
333 | { | ||
334 | fillMaterial.init( this.getWorld() ); | ||
335 | //if(!this.getFillMaterial() && this._fillColor) | ||
336 | if (this._fillColor) | ||
337 | { | ||
338 | fillMaterial.setProperty("color", this._fillColor); | ||
339 | } | ||
340 | } | ||
341 | |||
342 | this._materialArray.push( fillMaterial ); | ||
343 | this._materialTypeArray.push( "fill" ); | ||
344 | |||
345 | return fillMaterial; | ||
346 | } | ||
347 | |||
348 | this.renderQuadraticBezier = function( bPts, ctx ) | 293 | this.renderQuadraticBezier = function( bPts, ctx ) |
349 | { | 294 | { |
350 | if (!bPts) return; | 295 | if (!bPts) return; |
@@ -1217,7 +1162,7 @@ ShapePrimitive.create = function(coords, normals, uvs, indices, primType, ver | |||
1217 | "a_normal":{'type':renderer.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': renderer.BUFFER_STATIC}, | 1162 | "a_normal":{'type':renderer.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': renderer.BUFFER_STATIC}, |
1218 | 1163 | ||
1219 | "texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, | 1164 | "texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, |
1220 | "a_texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC}, | 1165 | "a_texcoord":{'type':renderer.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': renderer.BUFFER_STATIC} |
1221 | }; | 1166 | }; |
1222 | 1167 | ||
1223 | 1168 | ||