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 00028 // Inventor classes 00029 class SoSeparator; 00030 class SoXtExaminerViewer; 00031 class SoSensor; 00032 class SoTransform; 00033 class SoSwitch; 00034 class SoVertexProperty; 00035 00036 //----------------------------------------------------------------- 00037 // Class RenderIv 00038 // 00040 // 00041 //----------------------------------------------------------------- 00042 class RenderIv: public Render 00043 { 00044 public: 00045 00046 // Constructors & Destructor 00047 RenderIv(); 00048 RenderIv(string filepath); 00049 RenderIv(Scene *s, string filepath); 00050 virtual ~RenderIv(); 00051 00052 // method to reset the scene 00053 virtual void Reset(); 00054 00055 // initialization 00056 virtual void Init(); 00057 virtual void MainLoop(Gui *g); 00058 00059 00060 protected: 00061 00062 // event callbacks 00063 static void _TimerCB(void* userData, SoSensor*); 00064 inline void _IdleFunction(); 00065 00066 // initialization 00067 SoSeparator* _ReadIvFile(const char *filename); 00068 SoSeparator* _InitObject(const string &fname); 00069 bool _InitBoundsDisplay(); 00070 bool _InitPathDisplay(); 00071 SoSeparator* _InitTriangleGeom(list<MSLTriangle> &triangles); 00072 bool _InitData(); 00073 00074 // helper methods 00075 inline void _SetSwitch(SoSwitch *pSwitch, bool bFlag); 00076 inline void _UpdatePathDisplay(); 00077 inline void _SetTransform(SoTransform* pTrans, 00078 double tx, double ty, double tz, 00079 double rx, double ry, double rz); 00080 inline void _UpdateBodies(const MSLVector &qConfig); 00081 00082 00083 // Data 00084 00085 SoXtExaminerViewer* _viewer; // the viewer window 00086 Gui* _pGui; // gui pointer 00087 00088 SoSeparator* _ivRoot; // scene graph root 00089 SoSeparator* _ivData; // root of all scene data 00090 00091 SoSwitch* _ivBoundsSwitch; // workspace boundary display 00092 bool _bDisplayBounds; 00093 00094 SoSwitch* _ivPathSwitch; // path display 00095 SoVertexProperty* _pPathVertexProp; 00096 int _pathFrames; 00097 bool _bDisplayPath; 00098 00099 list<SoTransform*> _bodyTrans; // list of body transforms 00100 }; 00101 00102 00103 00104 #endif