aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
authorhwc4872012-03-06 12:37:17 -0800
committerhwc4872012-03-06 12:37:17 -0800
commite87069b43027b6b1707bb065a1f331b600b5db58 (patch)
treea897c648029016e2066292255fcb1da2f7e045bb /js/helper-classes/RDGE
parent5e640e24c3b4658b8060cde837ae98dabd3ba5bf (diff)
downloadninja-e87069b43027b6b1707bb065a1f331b600b5db58.tar.gz
Authortime import of 2d & 3d canvases
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-xjs/helper-classes/RDGE/GLWorld.js31
1 files changed, 14 insertions, 17 deletions
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js
index ce5f0516..c8bc4c1c 100755
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -905,27 +905,24 @@ GLWorld.prototype.import = function( importStr )
905 905
906 // determine if the data was written for export (no Ninja objects) 906 // determine if the data was written for export (no Ninja objects)
907 // or for save/restore 907 // or for save/restore
908 var index = importStr.indexOf( "scenedata: " ); 908 //var index = importStr.indexOf( "scenedata: " );
909 if (index >= 0) 909 var index = importStr.indexOf( "webGL: " );
910 this._useWebGL = (index >= 0)
911 if (this._useWebGL)
910 { 912 {
911 var rdgeStr = importStr.substr( index+11 ); 913 // start RDGE
912 var endIndex = rdgeStr.indexOf( "endscene\n" ); 914 rdgeStarted = true;
913 if (endIndex < 0) throw new Error( "ill-formed WebGL data" ); 915 var id = this._canvas.getAttribute( "data-RDGE-id" );
914 var len = endIndex - index + 11; 916 this._canvas.rdgeid = id;
915 rdgeStr = rdgeStr.substr( 0, endIndex ); 917 g_Engine.registerCanvas(this._canvas, this);
916 918 RDGEStart( this._canvas );
917 this.myScene.importJSON( rdgeStr ); 919 this._canvas.task.stop()
918
919 this.importObjects( importStr, this._rootNode );
920 } 920 }
921 else
922 {
923 // load the material library
924 //importStr = MaterialsLibrary.import( importStr );
925 921
926 // import the objects 922 this.importObjects( importStr, this._rootNode );
927 this.importObjects( importStr, this._rootNode );
928 923
924 if (!this._useWebGL)
925 {
929 // render using canvas 2D 926 // render using canvas 2D
930 this.render(); 927 this.render();
931 } 928 }