diff options
Diffstat (limited to 'js/lib/drawing/world.js')
-rwxr-xr-x | js/lib/drawing/world.js | 72 |
1 files changed, 9 insertions, 63 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index f077a5e2..a489110f 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -364,6 +364,15 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { | |||
364 | return str; | 364 | return str; |
365 | }; | 365 | }; |
366 | 366 | ||
367 | this.addListener = function( obj, callbackFunc, calleeData ) | ||
368 | { | ||
369 | this._notifier.addListener( obj, callbackFunc, calleeData ); | ||
370 | } | ||
371 | |||
372 | this.removeListener = function( obj ) | ||
373 | { | ||
374 | this._notifier.removeListener( obj ); | ||
375 | } | ||
367 | 376 | ||
368 | // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state | 377 | // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state |
369 | // in the case of a procedurally built scene an init state is not needed for loading data | 378 | // in the case of a procedurally built scene an init state is not needed for loading data |
@@ -818,70 +827,7 @@ World.prototype.exportObjectsJSON = function( obj, parentObj ) | |||
818 | this.exportObjectsJSON( obj.getNext(), parentObj ); | 827 | this.exportObjectsJSON( obj.getNext(), parentObj ); |
819 | } | 828 | } |
820 | 829 | ||
821 | /* | ||
822 | World.prototype.export = function() | ||
823 | { | ||
824 | var exportStr = "GLWorld 1.0\n"; | ||
825 | var id = this.getCanvas().getAttribute( "data-RDGE-id" ); | ||
826 | exportStr += "id: " + id + "\n"; | ||
827 | //exportStr += "id: " + this._canvas.rdgeid + "\n"; | ||
828 | exportStr += "fov: " + this._fov + "\n"; | ||
829 | exportStr += "zNear: " + this._zNear + "\n"; | ||
830 | exportStr += "zFar: " + this._zFar + "\n"; | ||
831 | exportStr += "viewDist: " + this._viewDist + "\n"; | ||
832 | if (this._useWebGL) | ||
833 | exportStr += "webGL: true\n"; | ||
834 | |||
835 | // we need 2 export modes: One for save/restore, one for publish. | ||
836 | // hardcoding for now | ||
837 | //var exportForPublish = false; | ||
838 | //if (!exportForPublish) exportForPublish = false; | ||
839 | var exportForPublish = true; | ||
840 | exportStr += "publish: " + exportForPublish + "\n"; | ||
841 | |||
842 | if (exportForPublish && this._useWebGL) | ||
843 | { | ||
844 | exportStr += "scenedata: " + this.myScene.exportJSON() + "endscene\n"; | ||
845 | |||
846 | // write out all of the objects | ||
847 | exportStr += "tree\n"; | ||
848 | exportStr += this.exportObjects( this._geomRoot ); | ||
849 | exportStr += "endtree\n"; | ||
850 | } | ||
851 | else | ||
852 | { | ||
853 | // output the material library | ||
854 | //exportStr += MaterialsLibrary.export(); // THIS NEEDS TO BE DONE AT THE DOC LEVEL | ||
855 | |||
856 | // write out all of the objects | ||
857 | exportStr += "tree\n"; | ||
858 | exportStr += this.exportObjects( this._geomRoot ); | ||
859 | exportStr += "endtree\n"; | ||
860 | } | ||
861 | |||
862 | return exportStr; | ||
863 | }; | ||
864 | |||
865 | World.prototype.exportObjects = function( obj ) { | ||
866 | if (!obj) return; | ||
867 | |||
868 | var rtnStr = "OBJECT\n"; | ||
869 | rtnStr += obj.export(); | ||
870 | 830 | ||
871 | if (obj.getChild()) { | ||
872 | rtnStr += this.exportObjects( obj.getChild () ); | ||
873 | } | ||
874 | |||
875 | // the end object goes outside the children | ||
876 | rtnStr += "ENDOBJECT\n"; | ||
877 | |||
878 | if (obj.getNext()) { | ||
879 | rtnStr += this.exportObjects( obj.getNext() ); | ||
880 | } | ||
881 | |||
882 | return rtnStr; | ||
883 | }; | ||
884 | */ | ||
885 | 831 | ||
886 | World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { | 832 | World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { |
887 | //if (trNode == null) trNode = this._ctrNode; | 833 | //if (trNode == null) trNode = this._ctrNode; |