Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpViewer.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Simulator based on Coin3d.
32 */
33
45
46#ifndef VP_VIEWER_H
47#define VP_VIEWER_H
48
49#include <visp3/core/vpConfig.h>
50
51#ifdef VISP_HAVE_COIN3D_AND_GUI
52
53#if defined(VISP_HAVE_SOWIN)
54
55#include <Inventor/Win/SoWin.h>
56#include <Inventor/Win/viewers/SoWinExaminerViewer.h>
57
58#elif defined(VISP_HAVE_SOQT)
59
60#include <Inventor/Qt/SoQt.h>
61#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
62
63#elif defined(VISP_HAVE_SOXT)
64
65#include <Inventor/Xt/SoXt.h>
66#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
67
68#endif
69
70// Coin stuff
71
72#include <Inventor/nodes/SoBaseColor.h>
73#include <Inventor/nodes/SoCone.h>
74#include <Inventor/nodes/SoCube.h>
75#include <Inventor/nodes/SoImage.h>
76#include <Inventor/nodes/SoLightModel.h>
77#include <Inventor/nodes/SoPerspectiveCamera.h>
78#include <Inventor/nodes/SoRotationXYZ.h>
79#include <Inventor/nodes/SoSeparator.h>
80#include <Inventor/nodes/SoTranslation.h>
81#include <Inventor/sensors/SoTimerSensor.h>
82
83#if defined(VISP_HAVE_SOWIN)
84#include <GL/gl.h>
85#elif defined(VISP_HAVE_SOQT)
86#include <qgl.h>
87#elif defined(VISP_HAVE_SOXT)
88#include <GL/gl.h>
89#endif
90
91// visp
92#include <visp3/core/vpCameraParameters.h>
93#include <visp3/core/vpDebug.h>
94#include <visp3/core/vpHomogeneousMatrix.h>
95
110
111class vpSimulator;
112
113#if defined(VISP_HAVE_SOWIN)
114class VISP_EXPORT vpViewer : public SoWinExaminerViewer
115#elif defined(VISP_HAVE_SOQT)
116class VISP_EXPORT vpViewer : public SoQtExaminerViewer
117#elif defined(VISP_HAVE_SOXT)
118class VISP_EXPORT vpViewer : public SoXtExaminerViewer
119#endif
120{
121
122 friend class vpSimulator;
123
124public:
125 typedef enum { internalView, externalView } vpViewerType;
126#if defined(VISP_HAVE_SOWIN)
127 vpViewer(HWND parent, vpSimulator *simu, vpViewerType type);
128#elif defined(VISP_HAVE_SOQT)
129 vpViewer(QWidget *parent, vpSimulator *simu, vpViewerType type);
130#elif defined(VISP_HAVE_SOXT)
131 vpViewer(Widget parent, vpSimulator *simu, vpViewerType type);
132#endif
133
134 virtual ~vpViewer();
135 void resize(int x, int y, bool fixed = false);
136 virtual void actualRedraw(void);
137
138private:
139 vpViewerType viewerType;
140 vpSimulator *simu;
141 SbBool processSoEvent(const SoEvent *const event);
142#if defined(VISP_HAVE_SOWIN)
143 static HWND init(const char *appname) { return SoWin::init(appname); }
144 static void mainLoop() { SoWin::mainLoop(); }
145 static void exitMainLoop() { SoWin::exitMainLoop(); }
146#elif defined(VISP_HAVE_SOQT)
147 static QWidget *init(const char *appname) { return SoQt::init(appname); }
148 static void mainLoop() { SoQt::mainLoop(); }
149 static void exitMainLoop() { SoQt::exitMainLoop(); }
150#elif defined(VISP_HAVE_SOXT)
151 static Widget init(const char *appname) { return SoXt::init(appname); }
152 static void mainLoop() { SoXt::mainLoop(); }
153 static void exitMainLoop() { SoXt::exitMainLoop(); }
154#endif
155};
156END_VISP_NAMESPACE
157#endif // VISP_HAVE_COIN3D_AND_GUI
158
159#endif
Implementation of a simulator based on Coin3d (www.coin3d.org).
Definition vpSimulator.h:95
void resize(int x, int y, bool fixed=false)
Definition vpViewer.cpp:126
@ externalView
Definition vpViewer.h:125
@ internalView
Definition vpViewer.h:125
friend class vpSimulator
Definition vpViewer.h:122
vpViewer(HWND parent, vpSimulator *simu, vpViewerType type)
Definition vpViewer.cpp:51
virtual ~vpViewer()
Definition vpViewer.cpp:69
virtual void actualRedraw(void)
Definition vpViewer.cpp:71