diff options
author | Nivesh Rajbhandari | 2012-03-24 13:53:34 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-24 13:53:34 -0700 |
commit | 5e8faa47e1b2507a09d04fea4325006e5eab2f25 (patch) | |
tree | 56683c1be0485f560ff49e8125f0b19dd42199f3 /js/controllers/elements/shapes-controller.js | |
parent | 2946d01666ff81f913bd06d1ac1381ed42b4a010 (diff) | |
parent | 7ee75fef18c21275cf29740a6fdd81ea90e41f45 (diff) | |
download | ninja-5e8faa47e1b2507a09d04fea4325006e5eab2f25.tar.gz |
Merge branch 'refs/heads/montage-integration' into WebGL-Animation-CheckBox
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index b060b751..5b9e4672 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -504,13 +504,14 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
504 | var sm, | 504 | var sm, |
505 | fm, | 505 | fm, |
506 | world, | 506 | world, |
507 | worldData = el.elementModel.shapeModel.GLWorld.export(); | 507 | worldData = el.elementModel.shapeModel.GLWorld.exportJSON(); |
508 | if(worldData) | 508 | if(worldData) |
509 | { | 509 | { |
510 | worldData = this.flip3DSense (worldData ); | ||
510 | world = new World(el, true); | 511 | world = new World(el, true); |
511 | el.elementModel.shapeModel.GLWorld = world; | 512 | el.elementModel.shapeModel.GLWorld = world; |
512 | el.elementModel.shapeModel.useWebGl = true; | 513 | el.elementModel.shapeModel.useWebGl = true; |
513 | world.import(worldData); | 514 | world.importJSON(worldData); |
514 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); | 515 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); |
515 | 516 | ||
516 | sm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); | 517 | sm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); |
@@ -540,13 +541,14 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
540 | return; | 541 | return; |
541 | } | 542 | } |
542 | var world, | 543 | var world, |
543 | worldData = el.elementModel.shapeModel.GLWorld.export(); | 544 | worldData = el.elementModel.shapeModel.GLWorld.exportJSON(); |
544 | if(worldData) | 545 | if(worldData) |
545 | { | 546 | { |
547 | worldData = this.flip3DSense (worldData ); | ||
546 | world = new World(el, false); | 548 | world = new World(el, false); |
547 | el.elementModel.shapeModel.GLWorld = world; | 549 | el.elementModel.shapeModel.GLWorld = world; |
548 | el.elementModel.shapeModel.useWebGl = false; | 550 | el.elementModel.shapeModel.useWebGl = false; |
549 | world.import(worldData); | 551 | world.importJSON(worldData); |
550 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); | 552 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); |
551 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); | 553 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); |
552 | el.elementModel.shapeModel.strokeMaterial = null; | 554 | el.elementModel.shapeModel.strokeMaterial = null; |
@@ -558,6 +560,24 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
558 | } | 560 | } |
559 | } | 561 | } |
560 | } | 562 | } |
563 | }, | ||
564 | |||
565 | flip3DSense: { | ||
566 | value: function( importStr ) | ||
567 | { | ||
568 | var jObj; | ||
569 | var index = importStr.indexOf( ';' ); | ||
570 | if ((importStr[0] === 'v') && (index < 24)) | ||
571 | { | ||
572 | // JSON format. separate the version info from the JSON info | ||
573 | //var vStr = importStr.substr( 0, index+1 ); | ||
574 | var jStr = importStr.substr( index+1 ); | ||
575 | jObj = JSON.parse( jStr ); | ||
576 | jObj.webGL = !jObj.webGL; | ||
577 | } | ||
578 | |||
579 | return jObj; | ||
580 | } | ||
561 | } | 581 | } |
562 | 582 | ||
563 | }); | 583 | }); |