diff options
Diffstat (limited to 'js/lib/geom/rectangle.js')
-rwxr-xr-x | js/lib/geom/rectangle.js | 118 |
1 files changed, 4 insertions, 114 deletions
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index b01aea53..91b1d426 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js | |||
@@ -187,65 +187,6 @@ var Rectangle = function GLRectangle() { | |||
187 | /////////////////////////////////////////////////////////////////////// | 187 | /////////////////////////////////////////////////////////////////////// |
188 | // Methods | 188 | // Methods |
189 | /////////////////////////////////////////////////////////////////////// | 189 | /////////////////////////////////////////////////////////////////////// |
190 | /* | ||
191 | this.export = function() { | ||
192 | var rtnStr = "type: " + this.geomType() + "\n"; | ||
193 | |||
194 | ///////////////////////////////////////////////////////////////////////// | ||
195 | // | ||
196 | // world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, | ||
197 | // tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle | ||
198 | // | ||
199 | ///////////////////////////////////////////////////////////////////////////// | ||
200 | |||
201 | rtnStr += "xoff: " + this._xOffset + "\n"; | ||
202 | rtnStr += "yoff: " + this._yOffset + "\n"; | ||
203 | rtnStr += "width: " + this._width + "\n"; | ||
204 | rtnStr += "height: " + this._height + "\n"; | ||
205 | rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; | ||
206 | |||
207 | if(this._strokeColor.gradientMode) { | ||
208 | rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n"; | ||
209 | rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n"; | ||
210 | } else { | ||
211 | rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; | ||
212 | } | ||
213 | |||
214 | if(this._fillColor.gradientMode) { | ||
215 | rtnStr += "fillGradientMode: " + this._fillColor.gradientMode + "\n"; | ||
216 | rtnStr += "fillColor: " + this.gradientToString(this._fillColor.color) + "\n"; | ||
217 | } else { | ||
218 | rtnStr += "fillColor: " + String(this._fillColor) + "\n"; | ||
219 | } | ||
220 | rtnStr += "tlRadius: " + this._tlRadius + "\n"; | ||
221 | rtnStr += "trRadius: " + this._trRadius + "\n"; | ||
222 | rtnStr += "blRadius: " + this._blRadius + "\n"; | ||
223 | rtnStr += "brRadius: " + this._brRadius + "\n"; | ||
224 | rtnStr += "innerRadius: " + this._innerRadius + "\n"; | ||
225 | rtnStr += "strokeStyle: " + this._strokeStyle + "\n"; | ||
226 | |||
227 | rtnStr += "strokeMat: "; | ||
228 | if (this._strokeMaterial) { | ||
229 | rtnStr += this._strokeMaterial.getName(); | ||
230 | } else { | ||
231 | rtnStr += MaterialsModel.getDefaultMaterialName(); | ||
232 | } | ||
233 | rtnStr += "\n"; | ||
234 | |||
235 | rtnStr += "fillMat: "; | ||
236 | if (this._fillMaterial) { | ||
237 | rtnStr += this._fillMaterial.getName(); | ||
238 | } else { | ||
239 | rtnStr += MaterialsModel.getDefaultMaterialName(); | ||
240 | } | ||
241 | rtnStr += "\n"; | ||
242 | |||
243 | rtnStr += this.exportMaterials(); | ||
244 | |||
245 | return rtnStr; | ||
246 | }; | ||
247 | */ | ||
248 | |||
249 | // JSON export | 190 | // JSON export |
250 | this.exportJSON = function() | 191 | this.exportJSON = function() |
251 | { | 192 | { |
@@ -308,57 +249,6 @@ var Rectangle = function GLRectangle() { | |||
308 | this.importMaterialsJSON( jObj.materials ); | 249 | this.importMaterialsJSON( jObj.materials ); |
309 | }; | 250 | }; |
310 | 251 | ||
311 | this.import = function( importStr ) { | ||
312 | this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) ); | ||
313 | this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) ); | ||
314 | this._width = Number( this.getPropertyFromString( "width: ", importStr ) ); | ||
315 | this._height = Number( this.getPropertyFromString( "height: ", importStr ) ); | ||
316 | this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); | ||
317 | this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) ); | ||
318 | this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); | ||
319 | var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); | ||
320 | var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); | ||
321 | this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); | ||
322 | |||
323 | if(importStr.indexOf("fillGradientMode: ") < 0) { | ||
324 | this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); | ||
325 | } else { | ||
326 | this._fillColor = {}; | ||
327 | this._fillColor.gradientMode = this.getPropertyFromString( "fillGradientMode: ", importStr ); | ||
328 | this._fillColor.color = this.stringToGradient(this.getPropertyFromString( "fillColor: ", importStr )); | ||
329 | } | ||
330 | |||
331 | if(importStr.indexOf("strokeGradientMode: ") < 0) | ||
332 | { | ||
333 | this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); | ||
334 | } else { | ||
335 | this._strokeColor = {}; | ||
336 | this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr ); | ||
337 | this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr )); | ||
338 | } | ||
339 | |||
340 | this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) ); | ||
341 | this._trRadius = Number( this.getPropertyFromString( "trRadius: ", importStr ) ); | ||
342 | this._blRadius = Number( this.getPropertyFromString( "blRadius: ", importStr ) ); | ||
343 | this._brRadius = Number( this.getPropertyFromString( "brRadius: ", importStr ) ); | ||
344 | |||
345 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); | ||
346 | if (!strokeMat) { | ||
347 | console.log( "object material not found in library: " + strokeMaterialName ); | ||
348 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | ||
349 | } | ||
350 | this._strokeMaterial = strokeMat; | ||
351 | |||
352 | var fillMat = MaterialsModel.getMaterial( fillMaterialName ); | ||
353 | if (!fillMat) { | ||
354 | console.log( "object material not found in library: " + fillMaterialName ); | ||
355 | fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | ||
356 | } | ||
357 | this._fillMaterial = fillMat; | ||
358 | |||
359 | this.importMaterials( importStr ); | ||
360 | }; | ||
361 | |||
362 | this.buildBuffers = function() { | 252 | this.buildBuffers = function() { |
363 | // get the world | 253 | // get the world |
364 | var world = this.getWorld(); | 254 | var world = this.getWorld(); |
@@ -367,7 +257,7 @@ var Rectangle = function GLRectangle() { | |||
367 | if (!world._useWebGL) return; | 257 | if (!world._useWebGL) return; |
368 | 258 | ||
369 | // make sure RDGE has the correct context | 259 | // make sure RDGE has the correct context |
370 | g_Engine.setContext( world.getCanvas().rdgeid ); | 260 | RDGE.globals.engine.setContext( world.getCanvas().rdgeid ); |
371 | 261 | ||
372 | // create the gl buffer | 262 | // create the gl buffer |
373 | var gl = world.getGLContext(); | 263 | var gl = world.getGLContext(); |
@@ -967,7 +857,7 @@ RectangleFill.create = function( rectCtr, width, height, tlRad, blRad, brRad, | |||
967 | // } | 857 | // } |
968 | 858 | ||
969 | // create the RDGE primitive | 859 | // create the RDGE primitive |
970 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 860 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); |
971 | }; | 861 | }; |
972 | 862 | ||
973 | RectangleFill.pushVertex = function( x, y, z ) { | 863 | RectangleFill.pushVertex = function( x, y, z ) { |
@@ -1199,7 +1089,7 @@ RectangleStroke.create = function( rectCtr, width, height, strokeWidth, tlRad, | |||
1199 | // } | 1089 | // } |
1200 | 1090 | ||
1201 | // create the RDGE primitive | 1091 | // create the RDGE primitive |
1202 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 1092 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); |
1203 | }; | 1093 | }; |
1204 | 1094 | ||
1205 | RectangleStroke.getRoundedCorner = function( ctr, insidePt, outsidePt ) { | 1095 | RectangleStroke.getRoundedCorner = function( ctr, insidePt, outsidePt ) { |
@@ -1285,7 +1175,7 @@ RectangleGeometry.create = function( ctr, width, height, material ) { | |||
1285 | // } | 1175 | // } |
1286 | 1176 | ||
1287 | // create the RDGE primitive | 1177 | // create the RDGE primitive |
1288 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); | 1178 | return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); |
1289 | }; | 1179 | }; |
1290 | 1180 | ||
1291 | RectangleGeometry.pushVertex = RectangleFill.pushVertex; | 1181 | RectangleGeometry.pushVertex = RectangleFill.pushVertex; |