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 00042 class ISVREngine 00043 { 00044 public: 00045 00046 // put the following function in all subclasses, not sure how to 00047 // make it virtual, since it's static? 00048 // static ISVREngine* createInstance(int argc, char **argv); 00049 00050 static ISVREngine* instance() { return _instance; } 00051 00054 virtual void readDisplaySettings(); 00055 00059 virtual void run(ISApp *app) = 0; 00060 00063 virtual int maxScreenWidth() = 0; 00064 virtual int maxScreenHeight() = 0; 00065 00066 00069 virtual int numGlContexts() { return 1; } 00072 virtual int currentGlContext() { return 0; } 00073 00075 void setHeadXform(Wtransf m) { _head = m; } 00076 Wtransf headXform(int usernum=0) { return _head; } 00077 00079 virtual void setIOD(double iod) { _iod = iod; } 00080 virtual double iod() { return _iod; } 00081 virtual void toggleStereo() {} 00082 00083 00085 Wpt displayTopLeft(int tile=0) { return _topl[tile]; } 00086 Wpt displayTopRight(int tile=0) { return _topr[tile]; } 00087 Wpt displayBottomLeft(int tile=0) { return _botl[tile]; } 00088 Wpt displayBottomRight(int tile=0) { return _botr[tile]; } 00089 00091 int displayHeightPixels(int tile=0) { return _h[tile]; } 00092 int displayWidthPixels(int tile=0) { return _w[tile]; } 00093 00094 StatusBar* statusBar() { return _statusBar; } 00095 00098 void quit() { _quit = 1; } 00099 00102 double synchronizedTime() { 00103 if (_wallClockInt) 00104 return _wallClockInt->time(); 00105 else { 00106 cerr << "ISVREngine:: No wallclock, can't get synchronized time." << endl; 00107 return 0.0; 00108 } 00109 } 00110 00111 protected: 00112 00113 ISVREngine(int argc, char **argv); 00114 virtual ~ISVREngine() {} 00115 00118 void processInput(); 00119 00122 void isInit(); 00123 00127 void isGLContextInit(); 00128 00129 static ISVREngine *_instance; 00130 00131 ISApp *_app; 00132 Wtransf _head; 00133 double _iod; 00134 int _quit; 00135 00136 Wpt_list _topl, _topr, _botl, _botr; 00137 ARRAY<int> _h, _w; 00138 ARRAY<int> _stereo; 00139 00140 StatusBar *_statusBar; 00141 WallClockInt *_wallClockInt; 00142 00143 }; 00144 00145 00146 00147 00148 #endif