00001 00012 #ifndef ISVRENGINE_H 00013 #define ISVRENGINE_H 00014 00015 #include "ISApp.H" 00016 #include "StatusBar.H" 00017 #include "WallClockInt.H" 00018 00019 #define OUTSIDE_GLUE_CORE 00020 #include <mlib/points.H> 00021 00022 namespace InSpace { 00023 00044 class ISVREngine 00045 { 00046 public: 00047 00048 // put the following function in all subclasses, not sure how to 00049 // make it virtual, since it's static? 00050 // static ISVREngine* createInstance(int argc, char **argv); 00051 00052 static ISVREngine* instance() { return _instance; } 00053 00056 virtual void readDisplaySettings(); 00057 00061 virtual void run(ISApp *app) = 0; 00062 00065 virtual int maxScreenWidth() = 0; 00066 virtual int maxScreenHeight() = 0; 00067 00068 00071 virtual int numGlContexts() { return 1; } 00074 virtual int currentGlContext() { return 0; } 00075 00077 void setHeadXform(Wtransf m) { _head = m; } 00078 Wtransf headXform(int usernum=0) { return _head; } 00079 00081 virtual void setIOD(double iod) { _iod = iod; } 00082 virtual double iod() { return _iod; } 00083 virtual void toggleStereo() { 00084 if (_iod==0) _iod=2.5/12.0; 00085 else _iod=0; 00086 } 00087 00088 00090 Wpt displayTopLeft(int tile=0) { return _topl[tile]; } 00091 Wpt displayTopRight(int tile=0) { return _topr[tile]; } 00092 Wpt displayBottomLeft(int tile=0) { return _botl[tile]; } 00093 Wpt displayBottomRight(int tile=0) { return _botr[tile]; } 00094 00096 int displayHeightPixels(int tile=0) { return _h[tile]; } 00097 int displayWidthPixels(int tile=0) { return _w[tile]; } 00098 00099 StatusBar* statusBar() { return _statusBar; } 00100 00103 void quit() { _quit = 1; } 00104 00107 double synchronizedTime() { 00108 if (_wallClockInt) 00109 return _wallClockInt->time(); 00110 else { 00111 cerr << "ISVREngine:: No wallclock, can't get synchronized time." << endl; 00112 return 0.0; 00113 } 00114 } 00115 00116 protected: 00117 00118 ISVREngine(int argc, char **argv); 00119 virtual ~ISVREngine() {} 00120 00123 void processInput(); 00124 00127 void isInit(); 00128 00132 void isGLContextInit(); 00133 00134 static ISVREngine *_instance; 00135 00136 ISApp *_app; 00137 Wtransf _head; 00138 double _iod; 00139 int _quit; 00140 00141 Wpt_list _topl, _topr, _botl, _botr; 00142 ARRAY<int> _h, _w; 00143 ARRAY<int> _xpos, _ypos; 00144 ARRAY<int> _stereo; 00145 00146 StatusBar *_statusBar; 00147 WallClockInt *_wallClockInt; 00148 00149 }; 00150 00151 } 00152 00153 00154 #endif