00001 #ifndef IG_SOCKET_DRIVER_IG_OIV_BROWSER_H
00002 # define IG_SOCKET_DRIVER_IG_OIV_BROWSER_H
00003
00004
00005
00006 # include "Iguana/GLModels/interface/config.h"
00007 # include "Iguana/Framework/interface/IgBrowser.h"
00008 # include <qcstring.h>
00009 # include <Inventor/SbViewportRegion.h>
00010 # include <Inventor/SbLinear.h>
00011 # include <Inventor/SbTime.h>
00012 # include <Inventor/SoType.h>
00013
00014
00015
00016
00017
00018 class IgSite;
00019 class IgState;
00020 class Ig3DBaseModel;
00021 class SoCamera;
00022 class SoGroup;
00023 class SoOffscreenRenderer;
00024 class SbSphereSheetProjector;
00025 class SoPerspectiveCamera;
00026 class SoOrthographicCamera;
00027
00028
00029
00030
00031
00032
00033 class IGUANA_GL_MODELS_API IgOIVBrowser : public IgBrowser
00034 {
00035 public:
00036 static const char * catalogLabel (void);
00037 static const int MOUSEPOSLOGSIZE = 16;
00038
00039 IgOIVBrowser (IgState *state,
00040 IgSite *site,
00041 Ig3DBaseModel *model = 0);
00042 ~IgOIVBrowser (void);
00043
00044 virtual void viewAll (void);
00045 virtual SoCamera * getCamera (void);
00046 virtual void setCamera (void);
00047 QByteArray getBuffer (void);
00048 QByteArray getJPGBuffer (void);
00049 QByteArray getIV (void);
00050 virtual void browse (IgRepresentable *rep);
00051
00052 virtual void moveCameraScreen (const SbVec2f &screenpos);
00053 virtual void spin (const SbVec2f & pointerpos);
00054 virtual void zoom (const float diffValue);
00055 void clearLog (void);
00056 void addToLog (const SbVec2f pos, const SbTime time);
00057 void reorientCamera (const SbRotation &r);
00058 const SbViewportRegion & viewRegion (void);
00059 const SbViewportRegion & renderRegion (void);
00060 void setCameraType (SoType t);
00061 void toggleCameraType (void);
00062 void saveHomePosition (void);
00063 void replaceCamera (SoCamera *cam);
00064
00065
00066 static void convertOrtho2Perspective (const SoOrthographicCamera * in,
00067 SoPerspectiveCamera *out);
00068 static void convertPerspective2Ortho (const SoPerspectiveCamera * in,
00069 SoOrthographicCamera * out);
00070
00071
00072
00073
00074
00075 SbVec2f m_lastMousePosition;
00076 SbPlane m_panningPlane;
00077 SbBool m_spinAnimatingAllowed;
00078 SbVec2f m_lastSpinPosition;
00079 int m_spinSampleCounter;
00080 SbRotation m_spinIncrement;
00081 SbSphereSheetProjector * m_spinProjector;
00082
00083 SbRotation m_spinRotation;
00084
00085 struct {
00086 short size;
00087 short historysize;
00088 SbVec2f * position;
00089 SbTime * time;
00090 } m_log;
00091
00092
00093
00094
00095
00096 struct Pointer {
00097 SbVec2s now, then;
00098 } m_pointer;
00099
00100 SbBool m_button1down;
00101 SbBool m_button3down;
00102 SbBool m_ctrldown, m_shiftdown;
00103 SbTime m_prevRedrawTime;
00104 protected:
00105 static IgState * initialise (IgState *state);
00106 private:
00107 IgSite * m_site;
00108 IgState * m_state;
00109 Ig3DBaseModel * m_model;
00110 SoGroup * m_topLevelGroup;
00111 SoCamera * m_camera;
00112 SoType m_cameraType;
00113 SbViewportRegion m_renderRegion;
00114 SbViewportRegion m_viewRegion;
00115
00116
00117 SoOffscreenRenderer * m_renderer;
00118 bool m_deleteCamera;
00119 SoCamera * m_storedCamera;
00120 };
00121
00122
00123
00124
00125 #endif // IG_SOCKET_DRIVER_IG_OIV_BROWSER_H