Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

renderiv.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //               The Motion Strategy Library (MSL)
00003 //----------------------------------------------------------------------
00004 //
00005 // Copyright (c) University of Illinois and Steven M. LaValle.     
00006 // All Rights Reserved.
00007 // 
00008 // Permission to use, copy, and distribute this software and its 
00009 // documentation is hereby granted free of charge, provided that 
00010 // (1) it is not a component of a commercial product, and 
00011 // (2) this notice appears in all copies of the software and
00012 //     related documentation. 
00013 // 
00014 // The University of Illinois and the author make no representations
00015 // about the suitability or fitness of this software for any purpose.  
00016 // It is provided "as is" without express or implied warranty.
00017 //----------------------------------------------------------------------
00018 
00019 #ifndef MSL_RENDERIV_H
00020 #define MSL_RENDERIV_H
00021 
00022 
00023 // MSL includes
00024 #include "triangle.h"
00025 #include "render.h"
00026 #include "point.h"
00027 #include "vector.h"
00028 #include "renderglobj.h"
00029 #include <Xm/Xm.h>
00030 #include <Inventor/Xt/SoXt.h>
00031 
00032 // Inventor classes
00033 class SoSeparator;
00034 class SoXtExaminerViewer;
00035 class SoSensor;
00036 class SoTransform;
00037 class SoSwitch;
00038 class SoVertexProperty;
00039 class SoCamera;
00040 class SoPerspectiveCamera;
00041 class SoOrthographicCamera;
00042 class SoPointLight;
00043 class SoRotation;
00044 //-----------------------------------------------------------------
00045 //                       Class RenderIv
00046 //
00048 //
00049 //-----------------------------------------------------------------
00050 class RenderIv: public Render
00051 {
00052 public: 
00053   
00054   // Constructors & Destructor
00055   RenderIv();
00056   RenderIv(string filepath);
00057   RenderIv(Scene *s, string filepath);
00058   virtual ~RenderIv();
00059   
00060   // method to reset the scene
00061   virtual void Reset();
00062  
00063   // initialization
00064   virtual void Init();
00065   virtual void MainLoop(Gui *g);
00066   
00067   
00068 protected:
00069 
00070  // event callbacks
00071   static void  _TimerCB(void* userData, SoSensor*);
00072   inline void  _IdleFunction();
00073 
00074  // initialization
00075   SoSeparator* _ReadIvFile(const char *filename);
00076   SoSeparator* _InitObject(const string &fname);
00077   bool         _InitBoundsDisplay();
00078   bool         _InitPathDisplay();
00079   SoSeparator* _InitTriangleGeom(list<MSLTriangle> &triangles);
00080   bool         _InitData();
00081 
00082  // helper methods
00083   inline void  _SetSwitch(SoSwitch *pSwitch, bool bFlag);
00084   inline void  _UpdatePathDisplay();
00085   inline void  _SetTransform(SoTransform* pTrans,
00086                              double tx, double ty, double tz,
00087                              double rx, double ry, double rz);
00088   inline void  _UpdateBodies(const MSLVector &qConfig);
00089  
00090 
00091  // Data
00092 
00093   SoXtExaminerViewer*  _viewer;         // the viewer window
00094   Gui*                 _pGui;           // gui pointer
00095 
00096   SoSeparator*         _ivRoot;         // scene graph root
00097   SoSeparator*         _ivData;         // root of all scene data
00098 
00099   SoSwitch*            _ivBoundsSwitch; // workspace boundary display
00100   bool                 _bDisplayBounds;
00101 
00102   SoSwitch*            _ivPathSwitch;   // path display
00103   SoVertexProperty*    _pPathVertexProp;
00104   int                  _pathFrames;
00105   bool                 _bDisplayPath;
00106 
00107   list<SoTransform*>   _bodyTrans;      // list of body transforms
00108 
00109   //for AttachedCamera
00110   int                  camToggle;
00111   bool                 _bAttachedCamera;
00112   SoSwitch*            CamSwitch;
00113   SoPerspectiveCamera* defCam;
00114   SoPerspectiveCamera* attachedCam;
00115   SoPointLight*        lightSource;
00116   float                _ivPosition[3];
00117   float                _ivOrientation[3];
00118   float                _ivBoundingBoxMin[3];
00119   float                _ivBoundingBoxMax[3];
00120   float                _ivSceneCenter[3];
00121   float                CamPosX;
00122   float                CamPosY;
00123   float                CamPosZ;
00124   float                CamViewX;
00125   float                CamViewY;
00126   float                CamViewZ;
00127   float                _ivViewLength;
00128   float                _ivFocalDist;
00129   float                _ivNearDist;
00130   float                _ivFarDist;
00131   float                LightPosX;
00132   float                LightPosY;
00133   float                LightPosZ;
00134   float                CamUpX;
00135   float                CamUpY;
00136   float                CamUpZ;
00137   
00138   //for multiple views
00139   bool                 _bMultipleViews;
00140   SoSeparator*         _ivTopLeftObject;
00141   SoSeparator*         _ivTopRightObject;
00142   SoSeparator*         _ivBottomLeftObject;
00143   SoSeparator*         _ivBottomRightObject;
00144   int                  MultipleViewsToggle;
00145   SoXtExaminerViewer*  TopLeftViewer;
00146   SoXtExaminerViewer*  TopRightViewer;
00147   SoXtExaminerViewer*  BottomLeftViewer;
00148   SoXtExaminerViewer*  BottomRightViewer;
00149   Widget               mainWindow;  
00150   SoOrthographicCamera*            TopLeftCamera;
00151   SoOrthographicCamera*            TopRightCamera;
00152   SoOrthographicCamera*            BottomLeftCamera;
00153   SoPerspectiveCamera*             BottomRightCamera;
00154 
00155 };
00156 
00157 #endif
00158 
00159 
00160 
Motion Strategy Library


Web page maintained by Steve LaValle