00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Olivier Fedkiw (MMM yyyy) 00022 **=======================================================================*/ 00023 #ifndef _SB_CONFIG_H 00024 #define _SB_CONFIG_H 00025 00026 #include <Inventor/MP/Xt/SbPipe.h> 00027 #include <Inventor/SbLinear.h> 00028 #include <Inventor/nodes/SoSeparator.h> 00029 #include <Inventor/SbBox.h> 00030 00031 #include <Inventor/MP/SoTrackdAPI.h> 00032 00033 #if !defined(_WIN32) 00034 # include <X11/Xlib.h> 00035 #endif 00036 00037 #ifndef HIDDEN_FROM_DOC 00038 // structure used to get information from configuration file 00039 // It is used as a chained list. Each time a pipe specification 00040 // is found, a new structure pipe is added to the list. 00041 // Once finished, this structure is used to initialize SbPipe **. 00042 00043 typedef struct pipe_tmp { 00044 int id; 00045 char * display_name; 00046 char * view; 00047 char * size; 00048 char * position; 00049 char * viewport; 00050 float edgeBlending_R; 00051 float edgeBlending_L; 00052 float edgeBlending_T; 00053 float edgeBlending_B; 00054 struct pipe_tmp * next; 00055 } pipe_t; 00056 00057 { 00058 int nbPipe; 00059 pipe_t * first; 00060 } cfg_t; 00061 00062 #endif // HIDDEN_FROM_DOC 00063 00064 //@tbr 00115 class SbConfig { 00116 00117 public : 00121 SbConfig(); 00122 00126 ~SbConfig(); 00127 00131 char * getConfigFile(void); 00132 00136 void setConfigFile(char * fileName); 00137 00141 int readConfigFile(void); 00142 00146 SoSeparator * getConfigTree(void); 00147 00151 int getNbPipes(void); 00152 00156 SbPipe * getPipe(int pipeID); 00157 00161 SbPipe * getPipe(SbPipe::mpView view); 00162 00163 #if defined(_WIN32) 00164 00167 SbPipe * getPipe(HWND); 00168 #else 00169 00172 SbPipe * getPipe(Window win); 00173 00177 SbPipe * getPipe(SoWidget glw); 00178 00182 SbPipe * getPipe(Display * dpy); 00183 #endif 00184 00188 int getIndex(SbPipe * pipe); 00189 00193 void printInfo(void); 00194 00199 void setAppName(char * appName); 00200 00204 void xtRealize(void); 00205 00209 void computeVirtualSize(void); 00210 00214 SbVec2s getVirtualSize(void); 00215 00219 SbVec2s getVirtualCoordinates(SbVec2s mouseCoord, SbPipe * pipe); 00220 00226 void setEventPipe(SbPipe * pipe); 00227 00232 int isEventFromPipe(void); 00233 00237 SbBox3f computeSubViewVolume(int pipeID); 00238 00239 #if defined(_WIN32) 00240 00244 HGLRC getSharedContext(void); 00245 00249 void setSharedContext(HGLRC ctx); 00250 00251 #if 1 SoDEPRECATED 00256 HGLRC getOverlaySharedContext(void); 00257 SoDEPRECATED 00262 void setOverlaySharedContext(HGLRC); 00263 #endif 00265 #else 00266 00269 GLXContext getSharedContext(void); 00270 00274 void setSharedContext(GLXContext ctx); 00275 00276 #if 1 SoDEPRECATED 00281 GLXContext getOverlaySharedContext(void); 00282 SoDEPRECATED 00287 void setOverlaySharedContext(GLXContext ctx); 00288 SoDEPRECATED 00293 void setOverlayColormap(int startIndex,int num,XColor* xcol); 00294 #endif 00296 #endif 00297 00301 SbBool isPerPipeStereo(void); 00302 00306 void setPerPipeStereo(SbBool trueOrFalse); 00307 00311 SbBool isSequentialRendering(void); 00312 00316 void setSequentialRendering(SbBool trueOrFalse); 00317 00321 SbBool isInsideOut(void); 00322 00326 void setInsideOut(SbBool trueOrFalse); 00327 00328 00332 SoTrackerReader * getTrackerReader(void); 00336 SoControllerReader * getControllerReader(void); 00337 00342 SbVec3f getDefaultCameraPosition(void) {return _cameraDefaultPosition;} ; 00343 00348 SbVec3f getDefaultObjectPosition(void) {return _objectDefaultPosition;}; 00349 00355 float getObjectMaxDim(void) {return _objectMaxDimension;}; 00356 00362 float getInterEyeDistance(void) {return _interEyeDistance;}; 00363 00369 void setInterEyeDistance(float value) {_interEyeDistance = value;}; 00370 00375 int getWandTrackerId(void) {return _wandTrackerID;}; 00376 00381 int getHeadTrackerId(void) {return _headTrackerID;}; 00382 00387 void setWandTrackerId(int value) {_wandTrackerID = value;}; 00388 00393 void setHeadTrackerId(int value) {_headTrackerID = value;}; 00394 00398 SbBool isHeadTracking(void); 00403 void setHeadTracking(int value); 00404 00405 void getWandFile(SbString &str); 00406 void setWandFile(SbString wandiv); 00407 00408 private: 00409 00410 // Callback from SoXt::show 00411 static int mpRealize(SbConfig *config); 00412 00413 private : 00414 00415 00416 // add a function to check the consistency of the configuration 00417 void checkConfig(void); 00418 00419 // check the configuration file format 00420 int newReadConfigFile(void); 00421 00422 void getTrackdKeys(char *,int &, int&); 00423 00424 SbPipe ** pipe; 00425 int nbPipes; 00426 int nbFlatScreens; 00427 int nbWallScreens; 00428 char * configFilename; 00429 SoSeparator * cfgTree; 00430 00431 // when an event is recieved, we need to know if it comes from one 00432 // of the pipe window or from the viewer window; 00433 // evtPipe is used to compute virtualCoordinates. 00434 SbPipe * evtPipe; 00435 00436 SbVec2s virtualSize; 00437 00438 #if !defined(_WIN32) 00439 GLXContext mpSharedContext; 00440 GLXContext mpOverlaySharedContext; 00441 #else 00442 HGLRC mpSharedContext; 00443 HGLRC mpOverlaySharedContext; 00444 #endif 00445 00446 SbBool perPipeStereo; 00447 00448 SbBool sequentialRendering; 00449 SbBool insideOut; 00450 00451 SoTrackerReader * _tracker; 00452 SoControllerReader * _controller; 00453 SbVec3f _cameraDefaultPosition; 00454 SbVec3f _objectDefaultPosition; 00455 float _objectMaxDimension; 00456 float _interEyeDistance; 00457 int _wandTrackerID; 00458 int _headTrackerID; 00459 SbString _wandFile; 00460 00461 }; 00462 00463 #endif /* _SB_CONFIG_H */ 00464 00465